commit 74684234cf389986cac45b72862f95d7c0648084 Author: Greg Gauthier Date: Wed Mar 12 20:50:48 2025 +0000 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c18dd8d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..1e19d18 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# rexx-things + +A repository with all my rexx noodlings + +The `samples` directory is other peoples' code. The `projects` directory is my code. diff --git a/modules/CMakeCache.txt b/modules/CMakeCache.txt new file mode 100644 index 0000000..2493aa6 --- /dev/null +++ b/modules/CMakeCache.txt @@ -0,0 +1,469 @@ +# This is the CMakeCache file. +# For build in directory: /home/gmgauthier/Projects/code/rexx +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-13 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-13 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-13 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-13 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/CMakeFiles/pkgRedirects + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=samples-api + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//Path to a program. +CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +call.example_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/c++/call.example + +//Value Computed by CMake +call.example_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +call.example_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/c++/call.example + +//Value Computed by CMake +callrexx_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx + +//Value Computed by CMake +callrexx_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +callrexx_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx + +//Value Computed by CMake +external-sample_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/c++/external + +//Value Computed by CMake +external-sample_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +external-sample_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/c++/external + +//Dependencies for the target +external_methods_LIB_DEPENDS:STATIC=general;rexxapi; + +//Dependencies for the target +external_methods_routines_LIB_DEPENDS:STATIC=general;rexxapi; + +//Dependencies for the target +external_routines_LIB_DEPENDS:STATIC=general;rexxapi; + +//Value Computed by CMake +rexxapi1_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 + +//Value Computed by CMake +rexxapi1_IS_TOP_LEVEL:STATIC=OFF + +//Dependencies for the target +rexxapi1_LIB_DEPENDS:STATIC=general;rexx;general;rexxapi; + +//Value Computed by CMake +rexxapi1_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + +//Value Computed by CMake +rexxapi2_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 + +//Value Computed by CMake +rexxapi2_IS_TOP_LEVEL:STATIC=OFF + +//Dependencies for the target +rexxapi2_LIB_DEPENDS:STATIC=general;rexx;general;rexxapi; + +//Value Computed by CMake +rexxapi2_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2 + +//Value Computed by CMake +rexxapi3_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 + +//Value Computed by CMake +rexxapi3_IS_TOP_LEVEL:STATIC=OFF + +//Dependencies for the target +rexxapi3_LIB_DEPENDS:STATIC=general;rexx;general;rexxapi; + +//Value Computed by CMake +rexxapi3_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3 + +//Value Computed by CMake +samples-api-classic-unix_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/classic/unix + +//Value Computed by CMake +samples-api-classic-unix_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +samples-api-classic-unix_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix + +//Value Computed by CMake +samples-api_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/classic + +//Value Computed by CMake +samples-api_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +samples-api_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic + +//Value Computed by CMake +samples-native-api_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/c++ + +//Value Computed by CMake +samples-native-api_IS_TOP_LEVEL:STATIC=OFF + +//Value Computed by CMake +samples-native-api_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/c++ + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/gmgauthier/Projects/code/rexx +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=28 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/gmgauthier/Projects/code/rexx/api +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=10 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.28 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_TAPI +CMAKE_TAPI-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//linker supports push/pop state +_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE + diff --git a/modules/CMakeFiles/3.28.3/CMakeCCompiler.cmake b/modules/CMakeFiles/3.28.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..3766fe1 --- /dev/null +++ b/modules/CMakeFiles/3.28.3/CMakeCCompiler.cmake @@ -0,0 +1,74 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "13.3.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-13") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-13") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/modules/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake b/modules/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..8dbc9d3 --- /dev/null +++ b/modules/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake @@ -0,0 +1,85 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "13.3.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-13") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-13") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/13;/usr/include/x86_64-linux-gnu/c++/13;/usr/include/c++/13/backward;/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/modules/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin b/modules/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000..87f2871 Binary files /dev/null and b/modules/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin differ diff --git a/modules/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin b/modules/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000..81abc26 Binary files /dev/null and b/modules/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/modules/CMakeFiles/3.28.3/CMakeSystem.cmake b/modules/CMakeFiles/3.28.3/CMakeSystem.cmake new file mode 100644 index 0000000..e01f3fe --- /dev/null +++ b/modules/CMakeFiles/3.28.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-6.11.0-19-generic") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "6.11.0-19-generic") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-6.11.0-19-generic") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "6.11.0-19-generic") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/modules/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c b/modules/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..0a0ec9b --- /dev/null +++ b/modules/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,880 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/modules/CMakeFiles/3.28.3/CompilerIdC/a.out b/modules/CMakeFiles/3.28.3/CompilerIdC/a.out new file mode 100755 index 0000000..ecc315e Binary files /dev/null and b/modules/CMakeFiles/3.28.3/CompilerIdC/a.out differ diff --git a/modules/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/modules/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..9c9c90e --- /dev/null +++ b/modules/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,869 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/modules/CMakeFiles/3.28.3/CompilerIdCXX/a.out b/modules/CMakeFiles/3.28.3/CompilerIdCXX/a.out new file mode 100755 index 0000000..c8ced32 Binary files /dev/null and b/modules/CMakeFiles/3.28.3/CompilerIdCXX/a.out differ diff --git a/modules/CMakeFiles/CMakeConfigureLog.yaml b/modules/CMakeFiles/CMakeConfigureLog.yaml new file mode 100644 index 0000000..37d3c3e --- /dev/null +++ b/modules/CMakeFiles/CMakeConfigureLog.yaml @@ -0,0 +1,531 @@ + +--- +events: + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake:233 (message)" + - "CMakeLists.txt:53 (project)" + message: | + The system is: Linux - 6.11.0-19-generic - x86_64 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:53 (project)" + message: | + Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. + Compiler: /usr/bin/cc + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + + The C compiler identification is GNU, found in: + /home/gmgauthier/Projects/code/rexx/CMakeFiles/3.28.3/CompilerIdC/a.out + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:53 (project)" + message: | + Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. + Compiler: /usr/bin/c++ + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + + The CXX compiler identification is GNU, found in: + /home/gmgauthier/Projects/code/rexx/CMakeFiles/3.28.3/CompilerIdCXX/a.out + + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA" + binary: "/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA" + cmakeVariables: + CMAKE_C_FLAGS: "" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA' + + Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_aaf9c/fast + /usr/bin/gmake -f CMakeFiles/cmTC_aaf9c.dir/build.make CMakeFiles/cmTC_aaf9c.dir/build + gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA' + Building C object CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o + /usr/bin/cc -v -o CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c + Using built-in specs. + COLLECT_GCC=/usr/bin/cc + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_aaf9c.dir/' + /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_aaf9c.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccr6vMbf.s + GNU C17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu) + compiled by GNU C version 13.3.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/13/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include + End of search list. + Compiler executable checksum: 38987c28e967c64056a6454abdef726e + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_aaf9c.dir/' + as -v --64 -o CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o /tmp/ccr6vMbf.s + GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42 + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.' + Linking C executable cmTC_aaf9c + /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_aaf9c.dir/link.txt --verbose=1 + /usr/bin/cc -v -rdynamic CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o -o cmTC_aaf9c + Using built-in specs. + COLLECT_GCC=/usr/bin/cc + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_aaf9c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_aaf9c.' + /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccEUJSae.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_aaf9c /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_aaf9c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_aaf9c.' + gmake[1]: Leaving directory '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:127 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed C implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/13/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/13/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/13/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:159 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed C implicit link information: + link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + ignore line: [Change Dir: '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_aaf9c/fast] + ignore line: [/usr/bin/gmake -f CMakeFiles/cmTC_aaf9c.dir/build.make CMakeFiles/cmTC_aaf9c.dir/build] + ignore line: [gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-hxjnCA'] + ignore line: [Building C object CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_aaf9c.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_aaf9c.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccr6vMbf.s] + ignore line: [GNU C17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 13.3.0 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version isl-0.26-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/13/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: 38987c28e967c64056a6454abdef726e] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_aaf9c.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o /tmp/ccr6vMbf.s] + ignore line: [GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.'] + ignore line: [Linking C executable cmTC_aaf9c] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_aaf9c.dir/link.txt --verbose=1] + ignore line: [/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o -o cmTC_aaf9c ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_aaf9c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_aaf9c.'] + link line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccEUJSae.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_aaf9c /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccEUJSae.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_aaf9c] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] + arg [CMakeFiles/cmTC_aaf9c.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13] ==> [/usr/lib/gcc/x86_64-linux-gnu/13] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4" + binary: "/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4" + cmakeVariables: + CMAKE_CXX_FLAGS: "" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4' + + Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_7c7ac/fast + /usr/bin/gmake -f CMakeFiles/cmTC_7c7ac.dir/build.make CMakeFiles/cmTC_7c7ac.dir/build + gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4' + Building CXX object CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o + /usr/bin/c++ -v -o CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_7c7ac.dir/' + /usr/libexec/gcc/x86_64-linux-gnu/13/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_7c7ac.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc6lexkl.s + GNU C++17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu) + compiled by GNU C version 13.3.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/13" + ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/include/c++/13 + /usr/include/x86_64-linux-gnu/c++/13 + /usr/include/c++/13/backward + /usr/lib/gcc/x86_64-linux-gnu/13/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include + End of search list. + Compiler executable checksum: c81c05345ce537099dafd5580045814a + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_7c7ac.dir/' + as -v --64 -o CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc6lexkl.s + GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42 + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.' + Linking CXX executable cmTC_7c7ac + /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7c7ac.dir/link.txt --verbose=1 + /usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_7c7ac + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_7c7ac' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_7c7ac.' + /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/cctX5X4H.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_7c7ac /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_7c7ac' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_7c7ac.' + gmake[1]: Leaving directory '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:127 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed CXX implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/13] + add: [/usr/include/x86_64-linux-gnu/c++/13] + add: [/usr/include/c++/13/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/13/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/13] ==> [/usr/include/c++/13] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/13] ==> [/usr/include/x86_64-linux-gnu/c++/13] + collapse include dir [/usr/include/c++/13/backward] ==> [/usr/include/c++/13/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/13/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/13/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/13;/usr/include/x86_64-linux-gnu/c++/13;/usr/include/c++/13/backward;/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:159 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed CXX implicit link information: + link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + ignore line: [Change Dir: '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_7c7ac/fast] + ignore line: [/usr/bin/gmake -f CMakeFiles/cmTC_7c7ac.dir/build.make CMakeFiles/cmTC_7c7ac.dir/build] + ignore line: [gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/CMakeFiles/CMakeScratch/TryCompile-6uhSR4'] + ignore line: [Building CXX object CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_7c7ac.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_7c7ac.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/cc6lexkl.s] + ignore line: [GNU C++17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 13.3.0 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version isl-0.26-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/13"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/13] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/13] + ignore line: [ /usr/include/c++/13/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/13/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: c81c05345ce537099dafd5580045814a] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_7c7ac.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o /tmp/cc6lexkl.s] + ignore line: [GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.'] + ignore line: [Linking CXX executable cmTC_7c7ac] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_7c7ac.dir/link.txt --verbose=1] + ignore line: [/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_7c7ac ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_7c7ac' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_7c7ac.'] + link line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/cctX5X4H.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_7c7ac /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/cctX5X4H.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_7c7ac] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] + arg [CMakeFiles/cmTC_7c7ac.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13] ==> [/usr/lib/gcc/x86_64-linux-gnu/13] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +... diff --git a/modules/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/CMakeFiles/Makefile.cmake b/modules/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000..ebec120 --- /dev/null +++ b/modules/CMakeFiles/Makefile.cmake @@ -0,0 +1,157 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "CMakeFiles/3.28.3/CMakeCCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.28.3/CMakeSystem.cmake" + "/home/gmgauthier/Projects/code/rexx/api/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/c++/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/c++/external/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/CMakeLists.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/CMakeLists.txt" + "/usr/share/cmake-3.28/Modules/CMakeCCompiler.cmake.in" + "/usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c" + "/usr/share/cmake-3.28/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeCXXCompiler.cmake.in" + "/usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp" + "/usr/share/cmake-3.28/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompileFeatures.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake" + "/usr/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake" + "/usr/share/cmake-3.28/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake" + "/usr/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeParseImplicitIncludeInfo.cmake" + "/usr/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake" + "/usr/share/cmake-3.28/Modules/CMakeParseLibraryArchitecture.cmake" + "/usr/share/cmake-3.28/Modules/CMakeSystem.cmake.in" + "/usr/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake" + "/usr/share/cmake-3.28/Modules/CMakeUnixFindMake.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Bruce-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Compaq-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/HP-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/HP-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/LCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SDCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SunPro-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XL-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XL-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XLClang-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/zOS-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Internal/FeatureTesting.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-Determine-CXX.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-Initialize.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux.cmake" + "/usr/share/cmake-3.28/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/3.28.3/CMakeSystem.cmake" + "CMakeFiles/3.28.3/CMakeCCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCXXCompiler.cmake" + "CMakeFiles/CMakeDirectoryInformation.cmake" + "c++/CMakeFiles/CMakeDirectoryInformation.cmake" + "c++/call.example/CMakeFiles/CMakeDirectoryInformation.cmake" + "c++/external/CMakeFiles/CMakeDirectoryInformation.cmake" + "classic/CMakeFiles/CMakeDirectoryInformation.cmake" + "classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake" + "classic/unix/callrexx/CMakeFiles/CMakeDirectoryInformation.cmake" + "classic/unix/rexxapi1/CMakeFiles/CMakeDirectoryInformation.cmake" + "classic/unix/rexxapi2/CMakeFiles/CMakeDirectoryInformation.cmake" + "classic/unix/rexxapi3/CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + "c++/call.example/CMakeFiles/stackOverflow.dir/DependInfo.cmake" + "c++/call.example/CMakeFiles/runRexxProgram.dir/DependInfo.cmake" + "c++/external/CMakeFiles/external_routines.dir/DependInfo.cmake" + "c++/external/CMakeFiles/external_methods.dir/DependInfo.cmake" + "c++/external/CMakeFiles/external_methods_routines.dir/DependInfo.cmake" + "classic/unix/callrexx/CMakeFiles/callrexx1.dir/DependInfo.cmake" + "classic/unix/callrexx/CMakeFiles/callrexx2.dir/DependInfo.cmake" + "classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/DependInfo.cmake" + "classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/DependInfo.cmake" + "classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/DependInfo.cmake" + ) diff --git a/modules/CMakeFiles/Makefile2 b/modules/CMakeFiles/Makefile2 new file mode 100644 index 0000000..7e272e3 --- /dev/null +++ b/modules/CMakeFiles/Makefile2 @@ -0,0 +1,504 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: c++/all +all: classic/all +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: c++/preinstall +preinstall: classic/preinstall +.PHONY : preinstall + +# The main recursive "clean" target. +clean: c++/clean +clean: classic/clean +.PHONY : clean + +#============================================================================= +# Directory level rules for directory c++ + +# Recursive "all" directory target. +c++/all: c++/call.example/all +c++/all: c++/external/all +.PHONY : c++/all + +# Recursive "preinstall" directory target. +c++/preinstall: c++/call.example/preinstall +c++/preinstall: c++/external/preinstall +.PHONY : c++/preinstall + +# Recursive "clean" directory target. +c++/clean: c++/call.example/clean +c++/clean: c++/external/clean +.PHONY : c++/clean + +#============================================================================= +# Directory level rules for directory c++/call.example + +# Recursive "all" directory target. +c++/call.example/all: c++/call.example/CMakeFiles/stackOverflow.dir/all +c++/call.example/all: c++/call.example/CMakeFiles/runRexxProgram.dir/all +.PHONY : c++/call.example/all + +# Recursive "preinstall" directory target. +c++/call.example/preinstall: +.PHONY : c++/call.example/preinstall + +# Recursive "clean" directory target. +c++/call.example/clean: c++/call.example/CMakeFiles/stackOverflow.dir/clean +c++/call.example/clean: c++/call.example/CMakeFiles/runRexxProgram.dir/clean +.PHONY : c++/call.example/clean + +#============================================================================= +# Directory level rules for directory c++/external + +# Recursive "all" directory target. +c++/external/all: c++/external/CMakeFiles/external_routines.dir/all +c++/external/all: c++/external/CMakeFiles/external_methods.dir/all +c++/external/all: c++/external/CMakeFiles/external_methods_routines.dir/all +.PHONY : c++/external/all + +# Recursive "preinstall" directory target. +c++/external/preinstall: +.PHONY : c++/external/preinstall + +# Recursive "clean" directory target. +c++/external/clean: c++/external/CMakeFiles/external_routines.dir/clean +c++/external/clean: c++/external/CMakeFiles/external_methods.dir/clean +c++/external/clean: c++/external/CMakeFiles/external_methods_routines.dir/clean +.PHONY : c++/external/clean + +#============================================================================= +# Directory level rules for directory classic + +# Recursive "all" directory target. +classic/all: classic/unix/all +.PHONY : classic/all + +# Recursive "preinstall" directory target. +classic/preinstall: classic/unix/preinstall +.PHONY : classic/preinstall + +# Recursive "clean" directory target. +classic/clean: classic/unix/clean +.PHONY : classic/clean + +#============================================================================= +# Directory level rules for directory classic/unix + +# Recursive "all" directory target. +classic/unix/all: classic/unix/callrexx/all +classic/unix/all: classic/unix/rexxapi1/all +classic/unix/all: classic/unix/rexxapi2/all +classic/unix/all: classic/unix/rexxapi3/all +.PHONY : classic/unix/all + +# Recursive "preinstall" directory target. +classic/unix/preinstall: classic/unix/callrexx/preinstall +classic/unix/preinstall: classic/unix/rexxapi1/preinstall +classic/unix/preinstall: classic/unix/rexxapi2/preinstall +classic/unix/preinstall: classic/unix/rexxapi3/preinstall +.PHONY : classic/unix/preinstall + +# Recursive "clean" directory target. +classic/unix/clean: classic/unix/callrexx/clean +classic/unix/clean: classic/unix/rexxapi1/clean +classic/unix/clean: classic/unix/rexxapi2/clean +classic/unix/clean: classic/unix/rexxapi3/clean +.PHONY : classic/unix/clean + +#============================================================================= +# Directory level rules for directory classic/unix/callrexx + +# Recursive "all" directory target. +classic/unix/callrexx/all: classic/unix/callrexx/CMakeFiles/callrexx1.dir/all +classic/unix/callrexx/all: classic/unix/callrexx/CMakeFiles/callrexx2.dir/all +.PHONY : classic/unix/callrexx/all + +# Recursive "preinstall" directory target. +classic/unix/callrexx/preinstall: +.PHONY : classic/unix/callrexx/preinstall + +# Recursive "clean" directory target. +classic/unix/callrexx/clean: classic/unix/callrexx/CMakeFiles/callrexx1.dir/clean +classic/unix/callrexx/clean: classic/unix/callrexx/CMakeFiles/callrexx2.dir/clean +.PHONY : classic/unix/callrexx/clean + +#============================================================================= +# Directory level rules for directory classic/unix/rexxapi1 + +# Recursive "all" directory target. +classic/unix/rexxapi1/all: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/all +.PHONY : classic/unix/rexxapi1/all + +# Recursive "preinstall" directory target. +classic/unix/rexxapi1/preinstall: +.PHONY : classic/unix/rexxapi1/preinstall + +# Recursive "clean" directory target. +classic/unix/rexxapi1/clean: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/clean +.PHONY : classic/unix/rexxapi1/clean + +#============================================================================= +# Directory level rules for directory classic/unix/rexxapi2 + +# Recursive "all" directory target. +classic/unix/rexxapi2/all: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/all +.PHONY : classic/unix/rexxapi2/all + +# Recursive "preinstall" directory target. +classic/unix/rexxapi2/preinstall: +.PHONY : classic/unix/rexxapi2/preinstall + +# Recursive "clean" directory target. +classic/unix/rexxapi2/clean: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/clean +.PHONY : classic/unix/rexxapi2/clean + +#============================================================================= +# Directory level rules for directory classic/unix/rexxapi3 + +# Recursive "all" directory target. +classic/unix/rexxapi3/all: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/all +.PHONY : classic/unix/rexxapi3/all + +# Recursive "preinstall" directory target. +classic/unix/rexxapi3/preinstall: +.PHONY : classic/unix/rexxapi3/preinstall + +# Recursive "clean" directory target. +classic/unix/rexxapi3/clean: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/clean +.PHONY : classic/unix/rexxapi3/clean + +#============================================================================= +# Target rules for target c++/call.example/CMakeFiles/stackOverflow.dir + +# All Build rule for target. +c++/call.example/CMakeFiles/stackOverflow.dir/all: + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/depend + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=19,20 "Built target stackOverflow" +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/all + +# Build rule for subdir invocation for target. +c++/call.example/CMakeFiles/stackOverflow.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/CMakeFiles/stackOverflow.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/rule + +# Convenience name for target. +stackOverflow: c++/call.example/CMakeFiles/stackOverflow.dir/rule +.PHONY : stackOverflow + +# clean rule for target. +c++/call.example/CMakeFiles/stackOverflow.dir/clean: + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/clean +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/clean + +#============================================================================= +# Target rules for target c++/call.example/CMakeFiles/runRexxProgram.dir + +# All Build rule for target. +c++/call.example/CMakeFiles/runRexxProgram.dir/all: + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/depend + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=17,18 "Built target runRexxProgram" +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/all + +# Build rule for subdir invocation for target. +c++/call.example/CMakeFiles/runRexxProgram.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/CMakeFiles/runRexxProgram.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/rule + +# Convenience name for target. +runRexxProgram: c++/call.example/CMakeFiles/runRexxProgram.dir/rule +.PHONY : runRexxProgram + +# clean rule for target. +c++/call.example/CMakeFiles/runRexxProgram.dir/clean: + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/clean +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/clean + +#============================================================================= +# Target rules for target c++/external/CMakeFiles/external_routines.dir + +# All Build rule for target. +c++/external/CMakeFiles/external_routines.dir/all: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/depend + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=9,10 "Built target external_routines" +.PHONY : c++/external/CMakeFiles/external_routines.dir/all + +# Build rule for subdir invocation for target. +c++/external/CMakeFiles/external_routines.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/CMakeFiles/external_routines.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : c++/external/CMakeFiles/external_routines.dir/rule + +# Convenience name for target. +external_routines: c++/external/CMakeFiles/external_routines.dir/rule +.PHONY : external_routines + +# clean rule for target. +c++/external/CMakeFiles/external_routines.dir/clean: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/clean +.PHONY : c++/external/CMakeFiles/external_routines.dir/clean + +#============================================================================= +# Target rules for target c++/external/CMakeFiles/external_methods.dir + +# All Build rule for target. +c++/external/CMakeFiles/external_methods.dir/all: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/depend + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=5,6 "Built target external_methods" +.PHONY : c++/external/CMakeFiles/external_methods.dir/all + +# Build rule for subdir invocation for target. +c++/external/CMakeFiles/external_methods.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/CMakeFiles/external_methods.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : c++/external/CMakeFiles/external_methods.dir/rule + +# Convenience name for target. +external_methods: c++/external/CMakeFiles/external_methods.dir/rule +.PHONY : external_methods + +# clean rule for target. +c++/external/CMakeFiles/external_methods.dir/clean: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/clean +.PHONY : c++/external/CMakeFiles/external_methods.dir/clean + +#============================================================================= +# Target rules for target c++/external/CMakeFiles/external_methods_routines.dir + +# All Build rule for target. +c++/external/CMakeFiles/external_methods_routines.dir/all: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/depend + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=7,8 "Built target external_methods_routines" +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/all + +# Build rule for subdir invocation for target. +c++/external/CMakeFiles/external_methods_routines.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/CMakeFiles/external_methods_routines.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/rule + +# Convenience name for target. +external_methods_routines: c++/external/CMakeFiles/external_methods_routines.dir/rule +.PHONY : external_methods_routines + +# clean rule for target. +c++/external/CMakeFiles/external_methods_routines.dir/clean: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/clean +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/clean + +#============================================================================= +# Target rules for target classic/unix/callrexx/CMakeFiles/callrexx1.dir + +# All Build rule for target. +classic/unix/callrexx/CMakeFiles/callrexx1.dir/all: + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=1,2 "Built target callrexx1" +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/all + +# Build rule for subdir invocation for target. +classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/CMakeFiles/callrexx1.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule + +# Convenience name for target. +callrexx1: classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule +.PHONY : callrexx1 + +# clean rule for target. +classic/unix/callrexx/CMakeFiles/callrexx1.dir/clean: + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/clean +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/clean + +#============================================================================= +# Target rules for target classic/unix/callrexx/CMakeFiles/callrexx2.dir + +# All Build rule for target. +classic/unix/callrexx/CMakeFiles/callrexx2.dir/all: + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=3,4 "Built target callrexx2" +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/all + +# Build rule for subdir invocation for target. +classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/CMakeFiles/callrexx2.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule + +# Convenience name for target. +callrexx2: classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule +.PHONY : callrexx2 + +# clean rule for target. +classic/unix/callrexx/CMakeFiles/callrexx2.dir/clean: + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/clean +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/clean + +#============================================================================= +# Target rules for target classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir + +# All Build rule for target. +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/all: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=11,12 "Built target rexxapi1" +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/all + +# Build rule for subdir invocation for target. +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule + +# Convenience name for target. +rexxapi1: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule +.PHONY : rexxapi1 + +# clean rule for target. +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/clean: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/clean +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/clean + +#============================================================================= +# Target rules for target classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir + +# All Build rule for target. +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/all: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=13,14 "Built target rexxapi2" +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/all + +# Build rule for subdir invocation for target. +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule + +# Convenience name for target. +rexxapi2: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule +.PHONY : rexxapi2 + +# clean rule for target. +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/clean: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/clean +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/clean + +#============================================================================= +# Target rules for target classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir + +# All Build rule for target. +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/all: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=15,16 "Built target rexxapi3" +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/all + +# Build rule for subdir invocation for target. +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule + +# Convenience name for target. +rexxapi3: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule +.PHONY : rexxapi3 + +# clean rule for target. +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/clean: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/clean +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/CMakeFiles/TargetDirectories.txt b/modules/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..a815704 --- /dev/null +++ b/modules/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,70 @@ +/home/gmgauthier/Projects/code/rexx/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/c++/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/c++/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/c++/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/c++/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/c++/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/c++/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/stackOverflow.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/runRexxProgram.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/external_routines.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/external_methods.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/external_methods_routines.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/classic/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/classic/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/classic/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/classic/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/callrexx1.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/callrexx2.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/install/strip.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/install/strip.dir diff --git a/modules/CMakeFiles/cmake.check_cache b/modules/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/modules/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/modules/CMakeFiles/progress.marks b/modules/CMakeFiles/progress.marks new file mode 100644 index 0000000..209e3ef --- /dev/null +++ b/modules/CMakeFiles/progress.marks @@ -0,0 +1 @@ +20 diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000..d670b4c --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,61 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples) + +add_subdirectory(api) + +if (WIN32) + add_subdirectory (windows) + # else () + # add_subdirectory (unix) +endif () diff --git a/modules/Makefile b/modules/Makefile new file mode 100644 index 0000000..19063c9 --- /dev/null +++ b/modules/Makefile @@ -0,0 +1,329 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx//CMakeFiles/progress.marks + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named stackOverflow + +# Build rule for target. +stackOverflow: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 stackOverflow +.PHONY : stackOverflow + +# fast build rule for target. +stackOverflow/fast: + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/build +.PHONY : stackOverflow/fast + +#============================================================================= +# Target rules for targets named runRexxProgram + +# Build rule for target. +runRexxProgram: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 runRexxProgram +.PHONY : runRexxProgram + +# fast build rule for target. +runRexxProgram/fast: + $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/build +.PHONY : runRexxProgram/fast + +#============================================================================= +# Target rules for targets named external_routines + +# Build rule for target. +external_routines: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 external_routines +.PHONY : external_routines + +# fast build rule for target. +external_routines/fast: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/build +.PHONY : external_routines/fast + +#============================================================================= +# Target rules for targets named external_methods + +# Build rule for target. +external_methods: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 external_methods +.PHONY : external_methods + +# fast build rule for target. +external_methods/fast: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/build +.PHONY : external_methods/fast + +#============================================================================= +# Target rules for targets named external_methods_routines + +# Build rule for target. +external_methods_routines: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 external_methods_routines +.PHONY : external_methods_routines + +# fast build rule for target. +external_methods_routines/fast: + $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/build +.PHONY : external_methods_routines/fast + +#============================================================================= +# Target rules for targets named callrexx1 + +# Build rule for target. +callrexx1: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 callrexx1 +.PHONY : callrexx1 + +# fast build rule for target. +callrexx1/fast: + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/build +.PHONY : callrexx1/fast + +#============================================================================= +# Target rules for targets named callrexx2 + +# Build rule for target. +callrexx2: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 callrexx2 +.PHONY : callrexx2 + +# fast build rule for target. +callrexx2/fast: + $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/build +.PHONY : callrexx2/fast + +#============================================================================= +# Target rules for targets named rexxapi1 + +# Build rule for target. +rexxapi1: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 rexxapi1 +.PHONY : rexxapi1 + +# fast build rule for target. +rexxapi1/fast: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build +.PHONY : rexxapi1/fast + +#============================================================================= +# Target rules for targets named rexxapi2 + +# Build rule for target. +rexxapi2: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 rexxapi2 +.PHONY : rexxapi2 + +# fast build rule for target. +rexxapi2/fast: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build +.PHONY : rexxapi2/fast + +#============================================================================= +# Target rules for targets named rexxapi3 + +# Build rule for target. +rexxapi3: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 rexxapi3 +.PHONY : rexxapi3 + +# fast build rule for target. +rexxapi3/fast: + $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build +.PHONY : rexxapi3/fast + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... callrexx1" + @echo "... callrexx2" + @echo "... external_methods" + @echo "... external_methods_routines" + @echo "... external_routines" + @echo "... rexxapi1" + @echo "... rexxapi2" + @echo "... rexxapi3" + @echo "... runRexxProgram" + @echo "... stackOverflow" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/api/CMakeLists.txt b/modules/api/CMakeLists.txt new file mode 100644 index 0000000..47a3d46 --- /dev/null +++ b/modules/api/CMakeLists.txt @@ -0,0 +1,58 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples-api) + +add_subdirectory(c++) +add_subdirectory(classic) + +install(FILES readme.txt COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api ) diff --git a/modules/api/c++/CMakeLists.txt b/modules/api/c++/CMakeLists.txt new file mode 100644 index 0000000..bdc36c8 --- /dev/null +++ b/modules/api/c++/CMakeLists.txt @@ -0,0 +1,58 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples-native-api) + +add_subdirectory (call.example) +add_subdirectory (external) + +install(FILES readme.txt COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++) diff --git a/modules/api/c++/call.example/CMakeLists.txt b/modules/api/c++/call.example/CMakeLists.txt new file mode 100644 index 0000000..abcae05 --- /dev/null +++ b/modules/api/c++/call.example/CMakeLists.txt @@ -0,0 +1,93 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (call.example) + +#################### callrxnt (executable) ######################### +# additional source files required by specific platforms +set (platform_libs ${ORX_SYSLIB_DL}) +# Sources for call.example +add_executable(stackOverflow ${PROJECT_SOURCE_DIR}/stackOverflow.cpp) +# Include file definition +target_include_directories(stackOverflow PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +target_link_libraries(stackOverflow rexx rexxapi ${ORX_SYSLIB_DL}) + +add_executable(runRexxProgram ${PROJECT_SOURCE_DIR}/runRexxProgram.cpp) +# Include file definition +target_include_directories(runRexxProgram PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +target_link_libraries(runRexxProgram rexx rexxapi ${ORX_SYSLIB_DL}) + +target_link_libraries(runRexxProgram rexx rexxapi ${platform_callrxnt_libs}) + +#install the directory files +install(TARGETS stackOverflow RUNTIME COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +install(FILES stackOverflow.cpp COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +install(TARGETS runRexxProgram RUNTIME COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) +install(FILES runRexxProgram.cpp COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +install(PROGRAMS HelloWorld.rex COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +install(PROGRAMS backward.fnc COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +install(PROGRAMS tooRecursiveTrapped.rex COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +install(PROGRAMS tooRecursiveUnhandled.rex COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + install(FILES readme.txt Makefile.windows Makefile.unix COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/c++/callsample ) diff --git a/modules/api/c++/call.example/HelloWorld.rex b/modules/api/c++/call.example/HelloWorld.rex new file mode 100644 index 0000000..60af434 --- /dev/null +++ b/modules/api/c++/call.example/HelloWorld.rex @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Very simple Rexx intended to be used with the runRexxProgram example program. + */ + + line = "Hello World" + say line + return line diff --git a/modules/api/c++/call.example/Makefile.unix b/modules/api/c++/call.example/Makefile.unix new file mode 100644 index 0000000..f44f428 --- /dev/null +++ b/modules/api/c++/call.example/Makefile.unix @@ -0,0 +1,54 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2008-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + + +# A pretty simple make file that should work on most Unix-like platforms that have gcc. + +OOREXX_LFLAGS = -lrexx -lrexxapi # needs to follow after file for which link resoultion is needed + +# What we want to build. +all: runRexxProgram stackOverflow + +runRexxProgram: runRexxProgram.cpp + gcc runRexxProgram.cpp ${OOREXX_LFLAGS} -o runRexxProgram + +stackOverflow: stackOverflow.cpp + gcc stackOverflow.cpp $(OOREXX_LFLAGS) -o stackOverflow + +clean: + rm -f stackOverflow runRexxProgram + diff --git a/modules/api/c++/call.example/Makefile.windows b/modules/api/c++/call.example/Makefile.windows new file mode 100644 index 0000000..8fe6eb7 --- /dev/null +++ b/modules/api/c++/call.example/Makefile.windows @@ -0,0 +1,100 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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 Visual C++, nMake compatible make file. +# +# The compiler needs to be able to find the ooRexx native API headers and +# libraries. If REXX_HOME is set on the system, the correct directory will be +# automatically added to the LIB and INCLUDE environment variables by this make +# file. +# +# Otherwise, either uncomment the next line and define the correct REXX_HOME, or +# be sure the LIB and INCLUDE environment variables allow the compiler to find +# the ooRexx native API headers and libraries. +# +# On a build system for ooRexx, you can set REXX_HOME to point to Win32Dbg or +# Win32Rel, as appropriate, in your build directory. For this to work, you +# will have to have built the interpreter. + +#REXX_HOME = C:\work.ooRexx\wc\main\Win32Dbg # For example + +# Define RELEASE on the command line, or here, to build a non-debug version. By +# default debug versions are built. I.e. nMake RELEASE=1 /F Makefile +#RELEASE = 1 + + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +REXX_LIBS = rexx.lib rexxapi.lib + +WARNINGFLAGS = /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE + +!IF DEFINED(RELEASE) + +OOREXX_CFLAGS = /nologo /EHsc /O2 /Gs /FAcs /MT $(WARNINGFLAGS) /c +EXE_LFLAGS = /nologo /SUBSYSTEM:Console $(REXX_LIBS) user32.lib comdlg32.lib gdi32.lib kernel32.lib +DLL_LFLAGS = /nologo /SUBSYSTEM:Windows $(REXX_LIBS) /DLL + +!ELSE + +OOREXX_CFLAGS = /nologo /EHsc /Zi /Od /MTd $(WARNINGFLAGS) /c +EXE_LFLAGS = /nologo /DEBUG -debugtype:cv /SUBSYSTEM:Console $(REXX_LIBS) user32.lib comdlg32.lib gdi32.lib kernel32.lib +DLL_LFLAGS = /nologo /DEBUG -debugtype:cv /SUBSYSTEM:Windows $(REXX_LIBS) /DLL + +!ENDIF + +# What we want to build. +all: stackOverflow.exe runRexxProgram.exe + +stackOverflow.obj: stackOverflow.cpp + cl $(OOREXX_CFLAGS) stackOverflow.cpp + +stackOverflow.exe: stackOverflow.obj + link $(EXE_LFLAGS) stackOverflow.obj -out:$(@B).exe + +runRexxProgram.obj: runRexxProgram.cpp + cl $(OOREXX_CFLAGS) runRexxProgram.cpp + +runRexxProgram.exe: runRexxProgram.obj + link $(EXE_LFLAGS) runRexxProgram.obj -out:$(@B).exe + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 + diff --git a/modules/api/c++/call.example/backward.fnc b/modules/api/c++/call.example/backward.fnc new file mode 100644 index 0000000..c10302f --- /dev/null +++ b/modules/api/c++/call.example/backward.fnc @@ -0,0 +1,70 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* backward.fnc - Reverse the words in a string */ +/* */ +/* This program is from the traditional, classic API example, */ +/* callrxnt. Here it can be used by the runRexxProgram to */ +/* demonstrate calling a program using the C++ native APIs. */ +/* */ +/* Input: A string of words */ +/* */ +/* Output: A string containing the same words but in opposite order */ +/* */ +/*********************************************************************/ + +say; say "backward.fnc --> start @" .DateTime~new~string +Parse Arg Data /* get argument string */ +say 'The string:' +say ' ' Data +OutString = '' /* initialize output to empty */ +Count = Words(Data) /* find number of words */ +Do i = Count To 1 By -1 /* for each word in string */ + OutString = OutString Word(Data,i) /* add word to output string */ + End /* end do */ + +OutString = Strip(OutString) /* remove any blanks on the */ + /* front or back. */ +say 'when reversed is:' +say ' ' OutString +say "backward.fnc --> finished @" .DateTime~new~string; say + +Return OutString /* return reversed string, */ + + diff --git a/modules/api/c++/call.example/readme.txt b/modules/api/c++/call.example/readme.txt new file mode 100644 index 0000000..a646a47 --- /dev/null +++ b/modules/api/c++/call.example/readme.txt @@ -0,0 +1,85 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + readme.txt + ========== + + This subdirectory provides two examples: runRexxProgram and + stackOverflow. Both programs will compile and run on any platform + supported by ooRexx. Also included are 2 make files. + + Makefile.windows + ---------------- + This is a nMake compatible make file for building the examples on + Windows. Provided your build environment is set up correctly for a + MicroSoft's Visual C++ compile, you should be able to compile the + examples without problem. Read the comments in Makefile.windows if + your have problems and / or to see how to build a debug version (the + default) or a non-debug version of the samples. + + Makefile.unix + -------------- + This make file should build the examples on any Unix-like system that + has gcc installed. + + + runRexxProgram + ============== + This example creates an instance of the interpreter and uses it to call + a Rexx program. The Rexx program name is supplied on the command line. + For instance: + + runRexxProgram HelloWorld.rex + + Read the comments in the program code for additional details. A few + sample Rexx programs are provided, including backward.fnc + + + stackOverflow + ============= + This example creates an instance of the interpreter and then + dynamically creates and calls a Rexx routine. Two routines are + provided. Execute stackOverflow without any arguments to use the first + routine and with one (any) argument to use the second routine. I.e.: + + stackOverflow + + or + + stackOverflow 1 + + More details are provided in comments within the C++ code. diff --git a/modules/api/c++/call.example/runRexxProgram.cpp b/modules/api/c++/call.example/runRexxProgram.cpp new file mode 100644 index 0000000..d8af8b3 --- /dev/null +++ b/modules/api/c++/call.example/runRexxProgram.cpp @@ -0,0 +1,233 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2017 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple example that creates an instance of the interpreter and uses that + * instance to execute a Rexx program. The program name must be passed in the + * command line. For example: + * + * runRexxProgram HelloWorld.rex + * runRexxProgram backward.fnc + * runRexxProgram tooRecursiveTrapped.rex + * runRexxProgram tooRecursiveUnhandled.rex + * + * backward.fnc demonstrates how to pass arguments into the called program. + */ + +#include "oorexxapi.h" +#include +#include + +#if defined(_WIN32) +#define _CDECL __cdecl +#else +#define _CDECL +#endif + +/* Prototypes for several simple helper functions that demonstrate usage of some + * of the native C++ APIs. The functions themselves are at the bottom of the + * file. + */ +bool checkForCondition(RexxThreadContext *c, bool clear); +void printInterpreterVersion(RexxInstance *); + +int _CDECL main(int argc, char **argv) +{ + char *programName = NULL; + if ( argc == 2 ) + { + programName = argv[1]; + } + + if ( programName == NULL || *programName == '\0' ) + { + printf("You must pass in the name of a Rexx program on the command line.\n"); + printf(" For example: %s crash.rex.\n", argv[0]); + return 9; + } + + // These are the arguments to RexxCreateInterpreter(). An array of any + // number of Rexx options can be passed in, but for this example we do not + // need any options. So, we use NULL. + RexxInstance *interpreter; + RexxThreadContext *threadContext; + RexxOption *options = NULL; + + if ( RexxCreateInterpreter(&interpreter, &threadContext, options) == 0 ) + { + printf("Failed to create interpreter, aborting.\n"); + exit(1); + } + printInterpreterVersion(interpreter); + + // If we want to pass arguments to the program we need to put them into an + // array of Rexx objects. We can pass null if there are no arguments. + RexxArrayObject args = NULL; + + if ( strcmp("backward.fnc", programName) == 0 ) + { + RexxStringObject str = threadContext->String("These words will be swapped"); + args = threadContext->ArrayOfOne(str); + } + + // Execute the program and get the result returned to us. + printf("Using interpreter to execute %s\n\n", programName); + RexxObjectPtr result = threadContext->CallProgram(programName, args); + + // During the program execution, a condition can be raised if there is an + // unexpected error. If an exception occurred and is pending, + // CheckCondtion() will return true. In this case we print out some + // information on the condition, otherwise we print out the return, if any, + // from the program. + if (threadContext->CheckCondition()) + { + checkForCondition(threadContext, true); + } + else if (result != NULLOBJECT) + { + // Note that we use ObjectToStringValue(). That is guarenteed to return + // the ASCII-Z string representation of the object. If we passed in, say + // an .array object to the CString() function, we would get a crash. + printf("\nProgram result=%s\n\n", threadContext->ObjectToStringValue(result)); + } + + // Now wait for the interpreter to terminate and we are done. + interpreter->Terminate(); + + return 0; +} + +/** + * Below are several helper functions that demonstrate how to use some of the + * different C++ native APIs. + */ + +/** + * Given an interpreter instance, prints out the interpreter version and + * language version. The documentation in the ooRexx programming guide explains + * the byte encoding of the version numbers. + */ +void printInterpreterVersion(RexxInstance *interpreter) +{ + wholenumber_t ver = interpreter->InterpreterVersion(); + wholenumber_t lang = interpreter->LanguageLevel(); + printf("Created interpreter instance version=%zd.%zd.%zd language level=%zd.%02zd\n\n", + (ver & 0xff0000) >> 16, (ver & 0x00ff00) >> 8, ver & 0x0000ff, (lang & 0xff00) >> 8, lang & 0x00ff); +} + + +/** + * Given a condition object, extracts and returns as a whole number the subcode + * of the condition. + */ +inline wholenumber_t conditionSubCode(RexxCondition *condition) +{ + return (condition->code - (condition->rc * 1000)); +} + + +/** + * Outputs the typical condition message. For example: + * + * 4 *-* say dt~number + * Error 97 running C:\work\qTest.rex line 4: Object method not found + * Error 97.1: Object "a DateTime" does not understand message "NUMBER" + * + * @param c The thread context we are operating in. + * @param condObj The condition information object. The object returned from + * the C++ API GetConditionInfo() + * @param condition The RexxCondition struct. The filled in struct from the + * C++ API DecodeConditionInfo(). + * + * @assumes There is a condition and that condObj and condition are valid. + */ +void standardConditionMsg(RexxThreadContext *c, RexxDirectoryObject condObj, RexxCondition *condition) +{ + RexxObjectPtr list = c->SendMessage0(condObj, "TRACEBACK"); + if ( list != NULLOBJECT ) + { + RexxArrayObject a = (RexxArrayObject)c->SendMessage0(list, "ALLITEMS"); + if ( a != NULLOBJECT ) + { + size_t count = c->ArrayItems(a); + for ( size_t i = 1; i <= count; i++ ) + { + RexxObjectPtr o = c->ArrayAt(a, i); + if ( o != NULLOBJECT ) + { + printf("%s\n", c->ObjectToStringValue(o)); + } + } + } + } + printf("Error %zd running %s line %zd: %s\n", condition->rc, c->CString(condition->program), + condition->position, c->CString(condition->errortext)); + + printf("Error %zd.%03zd: %s\n", condition->rc, conditionSubCode(condition), c->CString(condition->message)); +} + + +/** + * Given a thread context, checks for a raised condition, and prints out the + * standard condition message if there is a condition. + * + * @param c Thread context we are operating in. + * @param clear Whether to clear the condition or not. + * + * @return True if there was a condition, otherwise false. + */ +bool checkForCondition(RexxThreadContext *c, bool clear) +{ + if ( c->CheckCondition() ) + { + RexxCondition condition; + RexxDirectoryObject condObj = c->GetConditionInfo(); + + if ( condObj != NULLOBJECT ) + { + c->DecodeConditionInfo(condObj, &condition); + standardConditionMsg(c, condObj, &condition); + + if ( clear ) + { + c->ClearCondition(); + } + return true; + } + } + return false; +} diff --git a/modules/api/c++/call.example/stackOverflow.cpp b/modules/api/c++/call.example/stackOverflow.cpp new file mode 100644 index 0000000..acbe388 --- /dev/null +++ b/modules/api/c++/call.example/stackOverflow.cpp @@ -0,0 +1,242 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2017 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple example that creates an instance of the interpreter and uses that + * instance to execute a Rexx routine defined in this program. + * + * Both routines cause an infinite recursion. One version of the routine traps + * any error, the other does not. This shows how to handle conditions raised + * inside the interpreter execution, i.e., outside of your native code + * execution. + * + * To have the second routine execute, specify any argument on the command line. + * For example: + * + * stackOverflow 1 + * + * With no argument, the first routine is used: + * + * starckOverflow + */ + +#include "oorexxapi.h" +#include +#include + +#if defined(_WIN32) +#define _CDECL __cdecl +#else +#define _CDECL +#endif + +#define RECURSIVE_ROUTINE1 \ + "signal on any name error\n\n" \ + "say 'Starting infinite recursison'\n" \ + "line = 'interpret line'\n" \ + "interpret line\n" \ + "return 0\n\n" \ + "error:\n" \ + "obj = condition('O')\n" \ + "say 'Trapped error:' obj~code '('obj~errorText')'\n" \ + "return -9" + +#define RECURSIVE_ROUTINE2 \ + "say 'Starting infinite recursison'\n" \ + "line = 'interpret line'\n" \ + "interpret line\n" \ + "return 0\n\n" \ + +/* Prototypes for several simple helper functions that demonstrate usage of some + * of the native C++ APIs. The functions themselves are at the bottom of the + * file. + */ +bool checkForCondition(RexxThreadContext *c, bool clear); +void printInterpreterVersion(RexxInstance *); + +int _CDECL main(int argc, char **argv) +{ + // These are the arguments to RexxCreateInterpreter(). An array of any + // number of Rexx options can be passed in, but for this example we do not + // need any options. So, we use NULL. + RexxInstance *interpreter; + RexxThreadContext *threadContext; + RexxOption *options = NULL; + + if ( RexxCreateInterpreter(&interpreter, &threadContext, options) == 0 ) + { + printf("Failed to create interpreter, aborting.\n"); + exit(1); + } + printInterpreterVersion(interpreter); + + // Get the source code to use. We copy it into a buffer just to illustrate + // a point. How your program fills the code buffer could be by any means. + char buf[512]; + if ( argc == 1 ) + { + // No argument on the command line use the routine that traps any error. + strcpy(buf, RECURSIVE_ROUTINE1); + } + else + { + // An argument on the command line, use the routine that does not trap + // any error. + strcpy(buf, RECURSIVE_ROUTINE2); + } + + // Create a routine object from the source code. + RexxRoutineObject obj = threadContext->NewRoutine("stackOverflow", buf, strlen(buf)); + if ( obj == NULL ) + { + checkForCondition(threadContext, true); + printf("Error creating routine object, aborting\n"); + exit(1); + } + + // Execute the routine. + RexxObjectPtr result = threadContext->CallRoutine(obj, NULL); + + // Check for a condition raised during CallRoutine(). + checkForCondition(threadContext, true); + + // Now wait for the interpreter to terminate and we are done. + interpreter->Terminate(); + + return 0; +} + +/** + * Below are several helper functions that demonstrate how to use some of the + * different C++ native APIs. + */ + +/** + * Given an interpreter instance, prints out the interpreter version and + * language version. The documentation in the ooRexx programming guide explains + * the byte encoding of the version numbers. + */ +void printInterpreterVersion(RexxInstance *interpreter) +{ + wholenumber_t ver = interpreter->InterpreterVersion(); + wholenumber_t lang = interpreter->LanguageLevel(); + printf("Created interpreter instance version=%zd.%zd.%zd language level=%zd.%02zd\n\n", + (ver & 0xff0000) >> 16, (ver & 0x00ff00) >> 8, ver & 0x0000ff, (lang & 0xff00) >> 8, lang & 0x00ff); +} + + +/** + * Given a condition object, extracts and returns as a whole number the subcode + * of the condition. + */ +inline wholenumber_t conditionSubCode(RexxCondition *condition) +{ + return (condition->code - (condition->rc * 1000)); +} + + +/** + * Outputs the typical condition message. For example: + * + * 4 *-* say dt~number + * Error 97 running C:\work\qTest.rex line 4: Object method not found + * Error 97.1: Object "a DateTime" does not understand message "NUMBER" + * + * @param c The thread context we are operating in. + * @param condObj The condition information object. The object returned from + * the C++ API GetConditionInfo() + * @param condition The RexxCondition struct. The filled in struct from the + * C++ API DecodeConditionInfo(). + * + * @assumes There is a condition and that condObj and condition are valid. + */ +void standardConditionMsg(RexxThreadContext *c, RexxDirectoryObject condObj, RexxCondition *condition) +{ + RexxObjectPtr list = c->SendMessage0(condObj, "TRACEBACK"); + if ( list != NULLOBJECT ) + { + RexxArrayObject a = (RexxArrayObject)c->SendMessage0(list, "ALLITEMS"); + if ( a != NULLOBJECT ) + { + size_t count = c->ArrayItems(a); + for ( size_t i = 1; i <= count; i++ ) + { + RexxObjectPtr o = c->ArrayAt(a, i); + if ( o != NULLOBJECT ) + { + printf("%s\n", c->ObjectToStringValue(o)); + } + } + } + } + printf("Error %zd running %s line %zd: %s\n", condition->rc, c->CString(condition->program), + condition->position, c->CString(condition->errortext)); + + printf("Error %zd.%03zd: %s\n", condition->rc, conditionSubCode(condition), c->CString(condition->message)); +} + + +/** + * Given a thread context, checks for a raised condition, and prints out the + * standard condition message if there is a condition. + * + * @param c Thread context we are operating in. + * @param clear Whether to clear the condition or not. + * + * @return True if there was a condition, otherwise false. + */ +bool checkForCondition(RexxThreadContext *c, bool clear) +{ + if ( c->CheckCondition() ) + { + RexxCondition condition; + RexxDirectoryObject condObj = c->GetConditionInfo(); + + if ( condObj != NULLOBJECT ) + { + c->DecodeConditionInfo(condObj, &condition); + standardConditionMsg(c, condObj, &condition); + + if ( clear ) + { + c->ClearCondition(); + } + return true; + } + } + return false; +} diff --git a/modules/api/c++/call.example/tooRecursiveTrapped.rex b/modules/api/c++/call.example/tooRecursiveTrapped.rex new file mode 100644 index 0000000..fa699fa --- /dev/null +++ b/modules/api/c++/call.example/tooRecursiveTrapped.rex @@ -0,0 +1,55 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple Rexx program that is infinitely recursive. + * + * Meant to be used with the runRexxProgram example to demonstrate condition + * handling. (This is the same Rexx code as used in the stackOverflow example.) + */ +signal on any name error + + say 'Starting infinite recursison' + + line = 'interpret line' + interpret line + return 0 + +error: + obj = condition('O') + say 'Trapped error:' obj~code '('obj~errorText')' + return -9 diff --git a/modules/api/c++/call.example/tooRecursiveUnhandled.rex b/modules/api/c++/call.example/tooRecursiveUnhandled.rex new file mode 100644 index 0000000..44c1eaa --- /dev/null +++ b/modules/api/c++/call.example/tooRecursiveUnhandled.rex @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple Rexx program that is infinitely recursive. + * + * Meant to be used with the runRexxProgram example to demonstrate condition + * handling. (This is the same Rexx code as used in the stackOverflow example.) + */ + + say 'Starting infinite recursison' + + line = 'interpret line' + interpret line + return 0 diff --git a/modules/api/c++/external/CMakeLists.txt b/modules/api/c++/external/CMakeLists.txt new file mode 100644 index 0000000..1ea47bf --- /dev/null +++ b/modules/api/c++/external/CMakeLists.txt @@ -0,0 +1,122 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (external-sample) + +# installation target for all samples +set (DEST ${INSTALL_SAMPLES_DIR}/api/c++/external) + +# allow group write permissions as well +set (PERM PERMISSIONS OWNER_READ OWNER_WRITE + GROUP_READ GROUP_WRITE + WORLD_READ ) +# add execute bit +set (PERM_EXE ${PERM} OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) + +install(FILES readme.txt Makefile.unix Makefile.windows + COMPONENT Samples DESTINATION ${DEST} ${PERM}) + +#################### external_routines (library) ######################### +# Sources for external_routines sample +add_library(external_routines SHARED external_routines.cpp) +# Include file definition +target_include_directories(external_routines PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +target_link_libraries(external_routines rexxapi) + +if (WIN32) + install(TARGETS external_routines RUNTIME COMPONENT Samples DESTINATION ${DEST}) +else() + install(TARGETS external_routines LIBRARY COMPONENT Samples DESTINATION ${DEST} ${PERM_EXE} ) +endif() +install(FILES external_routines.cpp COMPONENT Samples DESTINATION ${DEST} ${PERM}) +install(PROGRAMS useExternalRoutines.rex useExternalRoutines2.rex + COMPONENT Samples DESTINATION ${DEST} ${PERM_EXE}) + + +#################### external_methods (library) ######################### +# Sources for external_methods sample +add_library(external_methods SHARED external_methods.cpp) +# Include file definition +target_include_directories(external_methods PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +target_link_libraries(external_methods rexxapi) + +if (WIN32) + install(TARGETS external_methods RUNTIME COMPONENT Samples DESTINATION ${DEST}) +else() + install(TARGETS external_methods LIBRARY COMPONENT Samples DESTINATION ${DEST} ${PERM_EXE}) +endif() +install(FILES external_methods.cpp COMPONENT Samples DESTINATION ${DEST} ${PERM}) +install(PROGRAMS useExternalMethods.rex COMPONENT Samples DESTINATION ${DEST} ${PERM_EXE}) + + +#################### external_methods_routines (library) ######################### +# Sources for external_methods_routines sample +add_library(external_methods_routines SHARED external_methods_routines.cpp) +# Include file definition +target_include_directories(external_methods_routines PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +target_link_libraries(external_methods_routines rexxapi) + +if (WIN32) + install(TARGETS external_methods_routines RUNTIME COMPONENT Samples DESTINATION ${DEST}) +else() + install(TARGETS external_methods_routines LIBRARY COMPONENT Samples DESTINATION ${DEST} ${PERM_EXE} ) +endif() +install(FILES external_methods_routines.cpp COMPONENT Samples DESTINATION ${DEST} ${PERM}) +install(PROGRAMS useExternalMethodsRoutines.rex COMPONENT Samples DESTINATION ${DEST} ${PERM_EXE}) + + diff --git a/modules/api/c++/external/Makefile.unix b/modules/api/c++/external/Makefile.unix new file mode 100644 index 0000000..4897b39 --- /dev/null +++ b/modules/api/c++/external/Makefile.unix @@ -0,0 +1,70 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -export-dynamic -shared -nostartfiles + +# determine extension, default to Linux style +EXT = so +UNAME := $(shell uname -s) +ifeq ($(UNAME),Darwin) # if Apple adjust accordingly + EXT = dylib +endif + +# What we want to build. +all: external_routines external_methods external_methods_routines + +external_routines: + @echo "building [$@] ..." + gcc -c $@.cpp $(OOREXX_CFLAGS) -o $@.o + gcc $@.o ${OOREXX_LFLAGS} -o lib$@.$(EXT) + +external_methods: + @echo "building [$@] ..." + gcc -c $@.cpp $(OOREXX_CFLAGS) -o $@.o + gcc $@.o ${OOREXX_LFLAGS} -o lib$@.$(EXT) + +external_methods_routines: + @echo "building [$@] ..." + gcc -c $@.cpp $(OOREXX_CFLAGS) -o $@.o + gcc $@.o ${OOREXX_LFLAGS} -o lib$@.$(EXT) + +clean: + rm -f *.so *.o lib*.$(EXT) + diff --git a/modules/api/c++/external/Makefile.windows b/modules/api/c++/external/Makefile.windows new file mode 100644 index 0000000..abc9cd8 --- /dev/null +++ b/modules/api/c++/external/Makefile.windows @@ -0,0 +1,66 @@ +# usage: nmake /f Makefile.windows [clean] +# /*----------------------------------------------------------------------------*/ +# /* */ +# /* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +# /* */ +# /* This program and the accompanying materials are made available under */ +# /* the terms of the Common Public License v1.0 which accompanies this */ +# /* distribution. A copy is also available at the following address: */ +# /* https://www.oorexx.org/license.html */ +# /* */ +# /* 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. */ +# /* */ +# /* Neither the name of Rexx Language Association nor the names */ +# /* of its contributors may be used to endorse or promote products */ +# /* derived from this software without specific prior written permission. */ +# /* */ +# /* 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 */ +# /* OWNER 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. */ +# /* */ +# /*----------------------------------------------------------------------------*/ + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +WARNINGFLAGS = /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE + +REXX_LIBS = rexxapi.lib +OOREXX_CFLAGS = /nologo /EHsc /O2 /Gs /FAcs /MT $(WARNINGFLAGS) /c +DLL_LFLAGS = /nologo /SUBSYSTEM:Windows $(REXX_LIBS) /DLL + +# default targets +all: external_routines external_methods external_methods_routines + +external_routines: + cl $(OOREXX_CFLAGS) /Fo$(@B).obj $(@B).cpp + link $(DLL_LFLAGS) $(@B).obj -out:$(@B).dll + +external_methods: + cl $(OOREXX_CFLAGS) /Fo$(@B).obj $(@B).cpp + link $(DLL_LFLAGS) $(@B).obj -out:$(@B).dll + +external_methods_routines: + cl $(OOREXX_CFLAGS) /Fo$(@B).obj $(@B).cpp + link $(DLL_LFLAGS) $(@B).obj -out:$(@B).dll + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 diff --git a/modules/api/c++/external/external_methods.cpp b/modules/api/c++/external/external_methods.cpp new file mode 100644 index 0000000..37edc80 --- /dev/null +++ b/modules/api/c++/external/external_methods.cpp @@ -0,0 +1,133 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include + +// ----------------------------------------------------- +RexxMethod0(int, // return type + NoArgMethodReturn123) // native method name +{ + return 123; // return value +} + +// ----------------------------------------------------- +RexxMethod0(RexxObjectPtr, // return type a Rexx Object Pointer + NoArgMethodVoid) // native method name +{ + fprintf(stdout, "(from native code) \"NoArgMethodVoid\"\n"); + return NULLOBJECT; // indicate no return value ! +} + +// ----------------------------------------------------- +RexxMethod1(int, // return type + OneArgMethodReturnArg, // native method name + OPTIONAL_int, arg1) // argument +{ + fprintf(stdout, "(from native code) \"OneArgMethodReturnArg\": arg1=[%d]", arg1); + fprintf(stdout, " argumentExists(1)=[%d], argumentOmitted(1)=[%d]\n", + argumentExists(1), argumentOmitted(1)); + return arg1; // return value +} + +// ----------------------------------------------------- +RexxMethod1(RexxObjectPtr, // return type a Rexx Object Pointer + OneArgMethodVoid, // native method name + int, arg1) // argument +{ + fprintf(stdout, "(from native code) \"OneArgMethodVoid\": arg1=[%d]\n", arg1); + return NULLOBJECT; // indicate no return value ! +} + +// ----------------------------------------------------- +RexxMethod2(int, // return type + TwoIntArgAdder, // native method name + int, arg1, // argument 1 + int, arg2) // argument 2 +{ + return arg1 + arg2; // return value +} + +// ----------------------------------------------------- +RexxMethod2(double, // return type + TwoDoubleArgAdder, // native method name + double, arg1, // argument 1 + double, arg2) // argument 2 +{ + return arg1 + arg2; // return value +} + +// ----------------------------------------------------- +RexxMethod2(RexxObjectPtr, // return type a Rexx Object Pointer + OneArgInvokeOrxMethod, // native method name + OSELF, self, // pseudo-argument: allow access to object instance + int, arg1) // argument from Rexx program! +{ + fprintf(stdout, "(from native code) \"OneArgInvokeOrxMethod\": arg1=[%d]\n", arg1); + fprintf(stdout, "(from native code) invoking method \"hello\" in this very same object:\n"); + context->SendMessage0(self,"HELLO"); + return NULLOBJECT; // indicate no return value ! +} + + +RexxMethodEntry orxtest_meths[] = { + + REXX_METHOD(NoArgMethodReturn123 , NoArgMethodReturn123 ), + REXX_METHOD(NoArgMethodVoid , NoArgMethodVoid ), + REXX_METHOD(OneArgMethodReturnArg, OneArgMethodReturnArg), + REXX_METHOD(OneArgMethodVoid , OneArgMethodVoid ), + REXX_METHOD(TwoIntArgAdder , TwoIntArgAdder ), + REXX_METHOD(TwoDoubleArgAdder , TwoDoubleArgAdder ), + REXX_METHOD(OneArgInvokeOrxMethod, OneArgInvokeOrxMethod), + REXX_LAST_METHOD() // end marker +}; + + +RexxPackageEntry DemoExternalMethods_package_entry = { + STANDARD_PACKAGE_HEADER + REXX_INTERPRETER_5_0_0, // ooRexx version 5.0.0 or higher required + "ExternalMethodsDemo", // name of the package + "1.0.0", // package information + NULL, // no load function + NULL, // no unload function + NULL, // the exported routines + orxtest_meths // the exported methods +}; + +// package loading stub. +OOREXX_GET_PACKAGE(DemoExternalMethods); + diff --git a/modules/api/c++/external/external_methods_routines.cpp b/modules/api/c++/external/external_methods_routines.cpp new file mode 100644 index 0000000..cd21edc --- /dev/null +++ b/modules/api/c++/external/external_methods_routines.cpp @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include + +// ----------------------------------------------------- +RexxRoutine0(int, // return type + NoArgRoutineReturn123) // native routine name +{ + return 123; // return value +} + +RexxRoutineEntry orxtest_funcs[] = { + REXX_TYPED_ROUTINE(NoArgRoutineReturn123 , NoArgRoutineReturn123 ), + REXX_LAST_ROUTINE() // end marker +}; + +// ----------------------------------------------------- +RexxMethod0(int, // return type + NoArgMethodReturn123) // native method name +{ + return 123; // return value +} + +RexxMethodEntry orxtest_meths[] = { + REXX_METHOD(NoArgMethodReturn123 , NoArgMethodReturn123 ), + REXX_LAST_METHOD() // end marker +}; + +RexxPackageEntry DemoExternalLibrary_package_entry = { + STANDARD_PACKAGE_HEADER + REXX_CURRENT_INTERPRETER_VERSION, // ooRexx version at compilation time or higher + "ExternalMethodsRoutinesDemo", // name of the package + "1.0.0", // package information + NULL, // no load function + NULL, // no unload function + orxtest_funcs, // the exported routines + orxtest_meths // the exported methods +}; + +// package loading stub. +OOREXX_GET_PACKAGE(DemoExternalLibrary); + diff --git a/modules/api/c++/external/external_routines.cpp b/modules/api/c++/external/external_routines.cpp new file mode 100644 index 0000000..73cc075 --- /dev/null +++ b/modules/api/c++/external/external_routines.cpp @@ -0,0 +1,120 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include + +// ----------------------------------------------------- +RexxRoutine0(int, // return type + NoArgRoutineReturn123) // native routine name +{ + return 123; // return value +} + +// ----------------------------------------------------- +RexxRoutine0(RexxObjectPtr, // return type a Rexx Object Pointer + NoArgRoutineVoid) // native routine name +{ + fprintf(stdout, "(from native code) \"NoArgRoutineVoid\"\n"); + return NULLOBJECT; // indicate no return value ! +} + +// ----------------------------------------------------- +RexxRoutine1(int, // return type + OneArgRoutineReturnArg,// native routine name + OPTIONAL_int, arg1) // optional argument +{ + fprintf(stdout, "(from native code) \"OneArgRoutineReturnArg\": arg1=[%d]", arg1); + fprintf(stdout, " argumentExists(1)=[%d], argumentOmitted(1)=[%d]\n", + argumentExists(1), argumentOmitted(1)); + return arg1; // return value +} + +// ----------------------------------------------------- +RexxRoutine1(RexxObjectPtr, // return type a Rexx Object Pointer + OneArgRoutineVoid, // native routine name + int, arg1) // argument +{ + fprintf(stdout, "(from native code) \"OneArgRoutineVoid\": arg1=[%d]\n", arg1); + return NULLOBJECT; // indicate no return value ! +} + +// ----------------------------------------------------- +RexxRoutine2(int, // return type + TwoIntArgAdder, // native routine name + int, arg1, // argument 1 + int, arg2) // argument 2 +{ + return arg1 + arg2; // return value +} + +// ----------------------------------------------------- +RexxRoutine2(double, // return type + TwoDoubleArgAdder, // native routine name + double, arg1, // argument 1 + double, arg2) // argument 2 +{ + return arg1 + arg2; // return value +} + + +RexxRoutineEntry orxtest_funcs[] = { + + REXX_TYPED_ROUTINE(NoArgRoutineReturn123 , NoArgRoutineReturn123 ), + REXX_TYPED_ROUTINE(NoArgRoutineVoid , NoArgRoutineVoid ), + REXX_TYPED_ROUTINE(OneArgRoutineReturnArg, OneArgRoutineReturnArg), + REXX_TYPED_ROUTINE(OneArgRoutineVoid , OneArgRoutineVoid ), + REXX_TYPED_ROUTINE(TwoIntArgAdder , TwoIntArgAdder ), + REXX_TYPED_ROUTINE(TwoDoubleArgAdder , TwoDoubleArgAdder ), + REXX_LAST_ROUTINE() // end marker +}; + + +RexxPackageEntry DemoExternalRoutines_package_entry = { + STANDARD_PACKAGE_HEADER + REXX_INTERPRETER_4_0_0, // ooRexx version 4.0.0 or higher required + "ExternalRoutinesDemo", // name of the package + "1.0.0", // package information + NULL, // no load function + NULL, // no unload function + orxtest_funcs, // the exported routines + NULL // the exported methods +}; + +// package loading stub. +OOREXX_GET_PACKAGE(DemoExternalRoutines); + diff --git a/modules/api/c++/external/readme.txt b/modules/api/c++/external/readme.txt new file mode 100644 index 0000000..43bddbf --- /dev/null +++ b/modules/api/c++/external/readme.txt @@ -0,0 +1,116 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 directory includes c++ source code files with Makefiles for the different +platforms and Rexx code which demonstrate how to create routines/functions and +methods in native code and using it directly from ooRexx code. + +Information on external native libraries, the declarations and the +available predefined argument and return types can be found in the ooRexx +API documentation in rexxapi.pdf: + + Chapter 1.12. Building an External Native Library + Chapter 1.13. Defining Library Routines + Chapter 1.14. Defining Library Methods + + +external_routines.cpp +===================== + +This example creates external functions/routines in a DLL which get used +from + + - useExternalRoutines.rex: uses the routine directive to individually + load each native routine (would allow to use a different name in the + ooRexx program) + + - useExternalRoutines2.rex: uses the "library" subkeyword of the requires + directive to load all external routines at once + +Note that external_routines.cpp defines the native routines to be usable +from ooRexx 4.0.0 on, cf. "REXX_INTERPRETER_4_0_0" constant in the +RexxPackageEntry structure at the end of the program. + + +external_methods.cpp +==================== + +This example creates external methods in a DLL which get used from + + - useExternalMethods.rex: uses the "external" subkeyword of the method + directive to load the native methods + +Note that external_methods.cpp defines the native methods to be usable +from ooRexx 5.0.0 on, cf. "REXX_INTERPRETER_5_0_0" constant in the +RexxPackageEntry structure at the end of the program. + + +external_methods_routines.cpp +============================= + +This example creates external routines and methods in a DLL which get used +from + + - useExternalMethodsRoutines.rex: uses the "external" subkeyword of the + routine and method directives + +Note that external_methods_routines.cpp defines the native methods and +routines to be usable from the ooRexx version on that got used to compile +the library, cf. "REXX_CURRRENT_INTERPRETER_VERSION" constant in the +RexxPackageEntry structure at the end of the program. + +------------------------------------------------------------------------------ + +Maybe some useful hints: + + On Linux you may want to run the ooRexx scripts with: + + LD_LIBRARY_PATH=`pwd` rexx useExternalRoutines.rex + LD_LIBRARY_PATH=`pwd` rexx useExternalRoutines2.rex + LD_LIBRARY_PATH=`pwd` rexx useExternalMethods.rex + LD_LIBRARY_PATH=`pwd` rexx useExternalMethodsRoutines.rex + + Unix: to recreate the shared libraries you would enter: + + make -f Makefile.unix clean + make -f Makefile.unix + + Windows: to recreate the DLLs you would enter: + + nmake /f Makefile.windows clean + nmake /f Makefile.windows + diff --git a/modules/api/c++/external/useExternalMethods.rex b/modules/api/c++/external/useExternalMethods.rex new file mode 100755 index 0000000..8ab4ce4 --- /dev/null +++ b/modules/api/c++/external/useExternalMethods.rex @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +o=.test~new -- create object +o~hello +say "---" +say "o~NoArgMethodReturn123() :" pp(o~NoArgMethodReturn123) +say +say "invoking a method that returns nothing:" +o~NoArgMethodVoid +say +say "o~OneArgMethodReturnArg(1) :" pp(o~OneArgMethodReturnArg(1)) +say "o~OneArgMethodReturnArg( ) :" pp(o~OneArgMethodReturnArg( )) +say +say "invoking another method that returns nothing:" +o~OneArgMethodVoid(2) +say +say "o~TwoIntArgAdder(4, 5) :" pp(o~TwoIntArgAdder(4, 5)) +say "o~TwoDoubleArgAdder(6 , 8 ):" pp(o~TwoDoubleArgAdder(6 , 8 )) +say "o~TwoDoubleArgAdder(6.7, 8.9):" pp(o~TwoDoubleArgAdder(6.7, 8.9)) +say "---" +say "invoking a method that natively will send 'hello' to its object:" +o~OneArgInvokeOrxMethod(-123) +say "---" + +say "Invoking an external method with wrong arguments:" +say "o~TwoIntArgAdder(9.8, 7.6) :" pp(o~TwoIntArgAdder(9.8, 7.6)) + + +::routine pp -- return string value enclosed in square brackets + return "["arg(1)"]" + +::class test -- define class and native methods for it +::method NoArgMethodReturn123 external "LIBRARY external_methods NoArgMethodReturn123 " +::method NoArgMethodVoid external "LIBRARY external_methods NoArgMethodVoid " +::method OneArgMethodReturnArg external "LIBRARY external_methods OneArgMethodReturnArg" +::method OneArgMethodVoid external "LIBRARY external_methods OneArgMethodVoid " +::method TwoIntArgAdder external "LIBRARY external_methods TwoIntArgAdder " +::method TwoDoubleArgAdder external "LIBRARY external_methods TwoDoubleArgAdder " +::method OneArgInvokeOrxMethod external "LIBRARY external_methods OneArgInvokeOrxMethod" + +::method hello + say "hello from" pp(self) "self~identityHash:" pp(self~identityHash) diff --git a/modules/api/c++/external/useExternalMethodsRoutines.rex b/modules/api/c++/external/useExternalMethodsRoutines.rex new file mode 100755 index 0000000..5dbe49f --- /dev/null +++ b/modules/api/c++/external/useExternalMethodsRoutines.rex @@ -0,0 +1,47 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +say "NoArgRoutineReturn123():" NoArgRoutineReturn123() + +o=.test~new -- create object +say "o~NoArgMethodReturn123 :" o~NoArgMethodReturn123 + +::routine NoArgRoutineReturn123 external "library external_methods_routines NoArgRoutineReturn123" + +::class test -- define class and native methods for it +::method NoArgMethodReturn123 external "LIBRARY external_methods_routines NoArgMethodReturn123 " + diff --git a/modules/api/c++/external/useExternalRoutines.rex b/modules/api/c++/external/useExternalRoutines.rex new file mode 100755 index 0000000..fc6b3a0 --- /dev/null +++ b/modules/api/c++/external/useExternalRoutines.rex @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +say "NoArgRoutineReturn123() :" pp(NoArgRoutineReturn123()) +say +say "calling a routine that returns nothing:" +call NoArgRoutineVoid +say +say "OneArgRoutineReturnArg(1) :" pp(OneArgRoutineReturnArg(1)) +say "OneArgRoutineReturnArg( ) :" pp(OneArgRoutineReturnArg()) +say +say "calling another routine that returns nothing:" +call OneArgRoutineVoid 2 +say +say "TwoIntArgAdder(4, 5) :" pp(TwoIntArgAdder(4, 5)) +say "TwoDoubleArgAdder(6 , 8 ):" pp(TwoDoubleArgAdder(6 , 8 )) +say "TwoDoubleArgAdder(6.7, 8.9):" pp(TwoDoubleArgAdder(6.7, 8.9)) +say "---" + +say "Invoking an external routine with wrong arguments:" +say "TwoIntArgAdder(9.8, 7.6) :" pp(TwoIntArgAdder(9.8, 7.6)) + +::routine pp -- return string value enclosed in square brackets + return "["arg(1)"]" + +::routine NoArgRoutineReturn123 external "library external_routines NoArgRoutineReturn123" +::routine NoArgRoutineVoid external "library external_routines NoArgRoutineVoid" +::routine OneArgRoutineReturnArg external "library external_routines OneArgRoutineReturnArg" +::routine OneArgRoutineVoid external "library external_routines OneArgRoutineVoid" +::routine TwoDoubleArgAdder external "library external_routines TwoDoubleArgAdder" diff --git a/modules/api/c++/external/useExternalRoutines2.rex b/modules/api/c++/external/useExternalRoutines2.rex new file mode 100755 index 0000000..79fcd43 --- /dev/null +++ b/modules/api/c++/external/useExternalRoutines2.rex @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +say "NoArgRoutineReturn123() :" pp(NoArgRoutineReturn123()) +say +say "calling a routine that returns nothing:" +call NoArgRoutineVoid +say +say "OneArgRoutineReturnArg(1) :" pp(OneArgRoutineReturnArg(1)) +say "OneArgRoutineReturnArg( ) :" pp(OneArgRoutineReturnArg()) +say +say "calling another routine that returns nothing:" +call OneArgRoutineVoid 2 +say +say "TwoIntArgAdder(4, 5) :" pp(TwoIntArgAdder(4, 5)) +say "TwoDoubleArgAdder(6 , 8 ):" pp(TwoDoubleArgAdder(6 , 8 )) +say "TwoDoubleArgAdder(6.7, 8.9):" pp(TwoDoubleArgAdder(6.7, 8.9)) +say "---" + +say "Invoking an external routine with wrong arguments:" +say "TwoIntArgAdder(9.8, 7.6) :" pp(TwoIntArgAdder(9.8, 7.6)) + +::requires "external_routines" library + +::routine pp -- return string value enclosed in square brackets + return "["arg(1)"]" diff --git a/modules/api/c++/readme.txt b/modules/api/c++/readme.txt new file mode 100644 index 0000000..01152f7 --- /dev/null +++ b/modules/api/c++/readme.txt @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + ====== + + ooRexx 4.0.0 introduced a new (at the time) C++ API for writing + extensions to the ooRexx interpreter. This API makes it possible for + the extension developer to make better, and more robust, use of the + interpreter. In particular the API makes it possible to use the + objects in ooRexx. + + The subdirectories of this directory contain examples showing how to + use the C++ API. + + Note that the extensions distributed with ooRexx make extensive use of + the C++ API and provide a lot of code showing usage of the API. + + The subdirectories: + + callsample + ---------- + This subdirectory has several examples of creating an interpreter + instance. One example uses the interpreter instance to call, + execute, and obtain the result from Rexx programs. The other + dynamically creates a Rexx routine and calls that routine. + + external + -------- + This subdirectory has three examples to create DLLs/shared libraries + with external routines and methods that can be directly used from + ooRexx programs. One example creates external routines only, the next + external methods only and one example creates external routines and + methods in the same DLL/shared library. + diff --git a/modules/api/classic/CMakeLists.txt b/modules/api/classic/CMakeLists.txt new file mode 100644 index 0000000..d3f4691 --- /dev/null +++ b/modules/api/classic/CMakeLists.txt @@ -0,0 +1,59 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples-api) + +if (WIN32) + add_subdirectory (windows) +else () + add_subdirectory (unix) +endif () diff --git a/modules/api/classic/unix/CMakeCache.txt b/modules/api/classic/unix/CMakeCache.txt new file mode 100644 index 0000000..567e923 --- /dev/null +++ b/modules/api/classic/unix/CMakeCache.txt @@ -0,0 +1,382 @@ +# This is the CMakeCache file. +# For build in directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix +# It was generated by CMake: /usr/bin/cmake +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line + +//Path to a program. +CMAKE_AR:FILEPATH=/usr/bin/ar + +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= + +//Enable/Disable color output during build. +CMAKE_COLOR_MAKEFILE:BOOL=ON + +//CXX compiler +CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/c++ + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-13 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_CXX_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-13 + +//Flags used by the CXX compiler during all build types. +CMAKE_CXX_FLAGS:STRING= + +//Flags used by the CXX compiler during DEBUG builds. +CMAKE_CXX_FLAGS_DEBUG:STRING=-g + +//Flags used by the CXX compiler during MINSIZEREL builds. +CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the CXX compiler during RELEASE builds. +CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the CXX compiler during RELWITHDEBINFO builds. +CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//C compiler +CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc + +//A wrapper around 'ar' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-13 + +//A wrapper around 'ranlib' adding the appropriate '--plugin' option +// for the GCC compiler +CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-13 + +//Flags used by the C compiler during all build types. +CMAKE_C_FLAGS:STRING= + +//Flags used by the C compiler during DEBUG builds. +CMAKE_C_FLAGS_DEBUG:STRING=-g + +//Flags used by the C compiler during MINSIZEREL builds. +CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG + +//Flags used by the C compiler during RELEASE builds. +CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG + +//Flags used by the C compiler during RELWITHDEBINFO builds. +CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG + +//Path to a program. +CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND + +//Flags used by the linker during all build types. +CMAKE_EXE_LINKER_FLAGS:STRING= + +//Flags used by the linker during DEBUG builds. +CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during MINSIZEREL builds. +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during RELEASE builds. +CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during RELWITHDEBINFO builds. +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL= + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/pkgRedirects + +//Install path prefix, prepended onto install directories. +CMAKE_INSTALL_PREFIX:PATH=/usr/local + +//Path to a program. +CMAKE_LINKER:FILEPATH=/usr/bin/ld + +//Path to a program. +CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake + +//Flags used by the linker during the creation of modules during +// all build types. +CMAKE_MODULE_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of modules during +// DEBUG builds. +CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of modules during +// MINSIZEREL builds. +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of modules during +// RELEASE builds. +CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of modules during +// RELWITHDEBINFO builds. +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_NM:FILEPATH=/usr/bin/nm + +//Path to a program. +CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy + +//Path to a program. +CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=rexxapi1 + +//Path to a program. +CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib + +//Path to a program. +CMAKE_READELF:FILEPATH=/usr/bin/readelf + +//Flags used by the linker during the creation of shared libraries +// during all build types. +CMAKE_SHARED_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of shared libraries +// during DEBUG builds. +CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of shared libraries +// during MINSIZEREL builds. +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELEASE builds. +CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of shared libraries +// during RELWITHDEBINFO builds. +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//If set, runtime paths are not added when installing shared libraries, +// but are added when building. +CMAKE_SKIP_INSTALL_RPATH:BOOL=NO + +//If set, runtime paths are not added when using shared libraries. +CMAKE_SKIP_RPATH:BOOL=NO + +//Flags used by the linker during the creation of static libraries +// during all build types. +CMAKE_STATIC_LINKER_FLAGS:STRING= + +//Flags used by the linker during the creation of static libraries +// during DEBUG builds. +CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING= + +//Flags used by the linker during the creation of static libraries +// during MINSIZEREL builds. +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELEASE builds. +CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING= + +//Flags used by the linker during the creation of static libraries +// during RELWITHDEBINFO builds. +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING= + +//Path to a program. +CMAKE_STRIP:FILEPATH=/usr/bin/strip + +//Path to a program. +CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND + +//If this value is on, makefiles will be generated without the +// .SILENT directive, and all commands will be echoed to the console +// during the make. This is useful for debugging only. With Visual +// Studio IDE projects all commands are done without /nologo. +CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE + +//Value Computed by CMake +rexxapi1_BINARY_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix + +//Value Computed by CMake +rexxapi1_IS_TOP_LEVEL:STATIC=ON + +//Dependencies for the target +rexxapi1_LIB_DEPENDS:STATIC=general;rexx;general;rexxapi; + +//Value Computed by CMake +rexxapi1_SOURCE_DIR:STATIC=/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + + +######################## +# INTERNAL cache entries +######################## + +//ADVANCED property for variable: CMAKE_ADDR2LINE +CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_AR +CMAKE_AR-ADVANCED:INTERNAL=1 +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=/home/gmgauthier/Projects/code/rexx/api/classic/unix +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=28 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=3 +//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE +CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=/usr/bin/cmake +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=/usr/bin/cpack +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=/usr/bin/ctest +//ADVANCED property for variable: CMAKE_CXX_COMPILER +CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_AR +CMAKE_CXX_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_COMPILER_RANLIB +CMAKE_CXX_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS +CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG +CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL +CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE +CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO +CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER +CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_AR +CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB +CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS +CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG +CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL +CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE +CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO +CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_DLLTOOL +CMAKE_DLLTOOL-ADVANCED:INTERNAL=1 +//Executable file format +CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS +CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG +CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL +CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE +CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS +CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Unix Makefiles +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 +//Install .so files without execute permission. +CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1 +//ADVANCED property for variable: CMAKE_LINKER +CMAKE_LINKER-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MAKE_PROGRAM +CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS +CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG +CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL +CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE +CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_NM +CMAKE_NM-ADVANCED:INTERNAL=1 +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJCOPY +CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_OBJDUMP +CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_RANLIB +CMAKE_RANLIB-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_READELF +CMAKE_READELF-ADVANCED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=/usr/share/cmake-3.28 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS +CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG +CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL +CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE +CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH +CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_SKIP_RPATH +CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS +CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG +CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL +CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE +CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO +CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_STRIP +CMAKE_STRIP-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: CMAKE_TAPI +CMAKE_TAPI-ADVANCED:INTERNAL=1 +//uname command +CMAKE_UNAME:INTERNAL=/usr/bin/uname +//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE +CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 +//linker supports push/pop state +_CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED:INTERNAL=TRUE + diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeCCompiler.cmake b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeCCompiler.cmake new file mode 100644 index 0000000..3766fe1 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeCCompiler.cmake @@ -0,0 +1,74 @@ +set(CMAKE_C_COMPILER "/usr/bin/cc") +set(CMAKE_C_COMPILER_ARG1 "") +set(CMAKE_C_COMPILER_ID "GNU") +set(CMAKE_C_COMPILER_VERSION "13.3.0") +set(CMAKE_C_COMPILER_VERSION_INTERNAL "") +set(CMAKE_C_COMPILER_WRAPPER "") +set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23") +set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes") +set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros") +set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert") +set(CMAKE_C17_COMPILE_FEATURES "c_std_17") +set(CMAKE_C23_COMPILE_FEATURES "c_std_23") + +set(CMAKE_C_PLATFORM_ID "Linux") +set(CMAKE_C_SIMULATE_ID "") +set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_C_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-13") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-13") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCC 1) +set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS TRUE) +set(CMAKE_C_ABI_COMPILED TRUE) + +set(CMAKE_C_COMPILER_ENV_VAR "CC") + +set(CMAKE_C_COMPILER_ID_RUN 1) +set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m) +set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC) +set(CMAKE_C_LINKER_PREFERENCE 10) +set(CMAKE_C_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_C_SIZEOF_DATA_PTR "8") +set(CMAKE_C_COMPILER_ABI "ELF") +set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_C_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_C_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}") +endif() + +if(CMAKE_C_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake new file mode 100644 index 0000000..8dbc9d3 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeCXXCompiler.cmake @@ -0,0 +1,85 @@ +set(CMAKE_CXX_COMPILER "/usr/bin/c++") +set(CMAKE_CXX_COMPILER_ARG1 "") +set(CMAKE_CXX_COMPILER_ID "GNU") +set(CMAKE_CXX_COMPILER_VERSION "13.3.0") +set(CMAKE_CXX_COMPILER_VERSION_INTERNAL "") +set(CMAKE_CXX_COMPILER_WRAPPER "") +set(CMAKE_CXX_STANDARD_COMPUTED_DEFAULT "17") +set(CMAKE_CXX_EXTENSIONS_COMPUTED_DEFAULT "ON") +set(CMAKE_CXX_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters;cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates;cxx_std_17;cxx_std_20;cxx_std_23") +set(CMAKE_CXX98_COMPILE_FEATURES "cxx_std_98;cxx_template_template_parameters") +set(CMAKE_CXX11_COMPILE_FEATURES "cxx_std_11;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates") +set(CMAKE_CXX14_COMPILE_FEATURES "cxx_std_14;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates") +set(CMAKE_CXX17_COMPILE_FEATURES "cxx_std_17") +set(CMAKE_CXX20_COMPILE_FEATURES "cxx_std_20") +set(CMAKE_CXX23_COMPILE_FEATURES "cxx_std_23") + +set(CMAKE_CXX_PLATFORM_ID "Linux") +set(CMAKE_CXX_SIMULATE_ID "") +set(CMAKE_CXX_COMPILER_FRONTEND_VARIANT "GNU") +set(CMAKE_CXX_SIMULATE_VERSION "") + + + + +set(CMAKE_AR "/usr/bin/ar") +set(CMAKE_CXX_COMPILER_AR "/usr/bin/gcc-ar-13") +set(CMAKE_RANLIB "/usr/bin/ranlib") +set(CMAKE_CXX_COMPILER_RANLIB "/usr/bin/gcc-ranlib-13") +set(CMAKE_LINKER "/usr/bin/ld") +set(CMAKE_MT "") +set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND") +set(CMAKE_COMPILER_IS_GNUCXX 1) +set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS TRUE) +set(CMAKE_CXX_ABI_COMPILED TRUE) + +set(CMAKE_CXX_COMPILER_ENV_VAR "CXX") + +set(CMAKE_CXX_COMPILER_ID_RUN 1) +set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;mpp;CPP;ixx;cppm;ccm;cxxm;c++m) +set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC) + +foreach (lang C OBJC OBJCXX) + if (CMAKE_${lang}_COMPILER_ID_RUN) + foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS) + list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension}) + endforeach() + endif() +endforeach() + +set(CMAKE_CXX_LINKER_PREFERENCE 30) +set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1) +set(CMAKE_CXX_LINKER_DEPFILE_SUPPORTED TRUE) + +# Save compiler ABI information. +set(CMAKE_CXX_SIZEOF_DATA_PTR "8") +set(CMAKE_CXX_COMPILER_ABI "ELF") +set(CMAKE_CXX_BYTE_ORDER "LITTLE_ENDIAN") +set(CMAKE_CXX_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") + +if(CMAKE_CXX_SIZEOF_DATA_PTR) + set(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}") +endif() + +if(CMAKE_CXX_COMPILER_ABI) + set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}") +endif() + +if(CMAKE_CXX_LIBRARY_ARCHITECTURE) + set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu") +endif() + +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + + + + + +set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES "/usr/include/c++/13;/usr/include/x86_64-linux-gnu/c++/13;/usr/include/c++/13/backward;/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include") +set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "stdc++;m;gcc_s;gcc;c;gcc_s;gcc") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib") +set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin new file mode 100755 index 0000000..87f2871 Binary files /dev/null and b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_C.bin differ diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin new file mode 100755 index 0000000..81abc26 Binary files /dev/null and b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeDetermineCompilerABI_CXX.bin differ diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeSystem.cmake b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeSystem.cmake new file mode 100644 index 0000000..e01f3fe --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/3.28.3/CMakeSystem.cmake @@ -0,0 +1,15 @@ +set(CMAKE_HOST_SYSTEM "Linux-6.11.0-19-generic") +set(CMAKE_HOST_SYSTEM_NAME "Linux") +set(CMAKE_HOST_SYSTEM_VERSION "6.11.0-19-generic") +set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64") + + + +set(CMAKE_SYSTEM "Linux-6.11.0-19-generic") +set(CMAKE_SYSTEM_NAME "Linux") +set(CMAKE_SYSTEM_VERSION "6.11.0-19-generic") +set(CMAKE_SYSTEM_PROCESSOR "x86_64") + +set(CMAKE_CROSSCOMPILING "FALSE") + +set(CMAKE_SYSTEM_LOADED 1) diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c new file mode 100644 index 0000000..0a0ec9b --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/CMakeCCompilerId.c @@ -0,0 +1,880 @@ +#ifdef __cplusplus +# error "A C++ compiler has been selected for C." +#endif + +#if defined(__18CXX) +# define ID_VOID_MAIN +#endif +#if defined(__CLASSIC_C__) +/* cv-qualifiers did not exist in K&R C */ +# define const +# define volatile +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_C) +# define COMPILER_ID "SunPro" +# if __SUNPRO_C >= 0x5100 + /* __SUNPRO_C = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF) +# endif + +#elif defined(__HP_cc) +# define COMPILER_ID "HP" + /* __HP_cc = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100) + +#elif defined(__DECC) +# define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) + +#elif defined(__IBMC__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800 +# define COMPILER_ID "XL" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMC__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__TINYC__) +# define COMPILER_ID "TinyCC" + +#elif defined(__BCC__) +# define COMPILER_ID "Bruce" + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) +# define COMPILER_ID "GNU" +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + +#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC) +# define COMPILER_ID "SDCC" +# if defined(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR) +# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR) +# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH) +# else + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if !defined(__STDC__) && !defined(__clang__) +# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__) +# define C_VERSION "90" +# else +# define C_VERSION +# endif +#elif __STDC_VERSION__ > 201710L +# define C_VERSION "23" +#elif __STDC_VERSION__ >= 201710L +# define C_VERSION "17" +#elif __STDC_VERSION__ >= 201000L +# define C_VERSION "11" +#elif __STDC_VERSION__ >= 199901L +# define C_VERSION "99" +#else +# define C_VERSION "90" +#endif +const char* info_language_standard_default = + "INFO" ":" "standard_default[" C_VERSION "]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +#ifdef ID_VOID_MAIN +void main() {} +#else +# if defined(__CLASSIC_C__) +int main(argc, argv) int argc; char *argv[]; +# else +int main(int argc, char* argv[]) +# endif +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} +#endif diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/a.out b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/a.out new file mode 100755 index 0000000..ecc315e Binary files /dev/null and b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/a.out differ diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp new file mode 100644 index 0000000..9c9c90e --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/CMakeCXXCompilerId.cpp @@ -0,0 +1,869 @@ +/* This source file must have a .cpp extension so that all C++ compilers + recognize the extension without flags. Borland does not know .cxx for + example. */ +#ifndef __cplusplus +# error "A C compiler has been selected for C++." +#endif + +#if !defined(__has_include) +/* If the compiler does not have __has_include, pretend the answer is + always no. */ +# define __has_include(x) 0 +#endif + + +/* Version number components: V=Version, R=Revision, P=Patch + Version date components: YYYY=Year, MM=Month, DD=Day */ + +#if defined(__COMO__) +# define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) + +#elif defined(__INTEL_COMPILER) || defined(__ICC) +# define COMPILER_ID "Intel" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# if defined(__GNUC__) +# define SIMULATE_ID "GNU" +# endif + /* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later, + except that a few beta releases use the old format with V=2021. */ +# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111 +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10) +# if defined(__INTEL_COMPILER_UPDATE) +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE) +# else +# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10) +# endif +# else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER) +# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE) + /* The third version component from --version is an update index, + but no macro is provided for it. */ +# define COMPILER_VERSION_PATCH DEC(0) +# endif +# if defined(__INTEL_COMPILER_BUILD_DATE) + /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */ +# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE) +# endif +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER) +# define COMPILER_ID "IntelLLVM" +#if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +#endif +#if defined(__GNUC__) +# define SIMULATE_ID "GNU" +#endif +/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and + * later. Look for 6 digit vs. 8 digit version number to decide encoding. + * VVVV is no smaller than the current year when a version is released. + */ +#if __INTEL_LLVM_COMPILER < 1000000L +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10) +#else +# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000) +# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100) +#endif +#if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +#endif +#if defined(__GNUC__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +#elif defined(__GNUG__) +# define SIMULATE_VERSION_MAJOR DEC(__GNUG__) +#endif +#if defined(__GNUC_MINOR__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +#endif +#if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +#endif + +#elif defined(__PATHCC__) +# define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif + +#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__) +# define COMPILER_ID "Embarcadero" +# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF) +# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF) +# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF) + +#elif defined(__BORLANDC__) +# define COMPILER_ID "Borland" + /* __BORLANDC__ = 0xVRR */ +# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8) +# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF) + +#elif defined(__WATCOMC__) && __WATCOMC__ < 1200 +# define COMPILER_ID "Watcom" + /* __WATCOMC__ = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__WATCOMC__) +# define COMPILER_ID "OpenWatcom" + /* __WATCOMC__ = VVRP + 1100 */ +# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100) +# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10) +# if (__WATCOMC__ % 10) > 0 +# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10) +# endif + +#elif defined(__SUNPRO_CC) +# define COMPILER_ID "SunPro" +# if __SUNPRO_CC >= 0x5100 + /* __SUNPRO_CC = 0xVRRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# else + /* __SUNPRO_CC = 0xVRP */ +# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8) +# define COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF) +# define COMPILER_VERSION_PATCH HEX(__SUNPRO_CC & 0xF) +# endif + +#elif defined(__HP_aCC) +# define COMPILER_ID "HP" + /* __HP_aCC = VVRRPP */ +# define COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000) +# define COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100) +# define COMPILER_VERSION_PATCH DEC(__HP_aCC % 100) + +#elif defined(__DECCXX) +# define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) + +#elif defined(__IBMCPP__) && defined(__COMPILER_VER__) +# define COMPILER_ID "zOS" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__open_xl__) && defined(__clang__) +# define COMPILER_ID "IBMClang" +# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__) +# define COMPILER_VERSION_MINOR DEC(__open_xl_release__) +# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__) + + +#elif defined(__ibmxl__) && defined(__clang__) +# define COMPILER_ID "XLClang" +# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__) +# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__) +# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__) +# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__) + + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ >= 800 +# define COMPILER_ID "XL" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__IBMCPP__) && !defined(__COMPILER_VER__) && __IBMCPP__ < 800 +# define COMPILER_ID "VisualAge" + /* __IBMCPP__ = VRP */ +# define COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100) +# define COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10) +# define COMPILER_VERSION_PATCH DEC(__IBMCPP__ % 10) + +#elif defined(__NVCOMPILER) +# define COMPILER_ID "NVHPC" +# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__) +# if defined(__NVCOMPILER_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__) +# endif + +#elif defined(__PGI) +# define COMPILER_ID "PGI" +# define COMPILER_VERSION_MAJOR DEC(__PGIC__) +# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__) +# if defined(__PGIC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) +# endif + +#elif defined(__clang__) && defined(__cray__) +# define COMPILER_ID "CrayClang" +# define COMPILER_VERSION_MAJOR DEC(__cray_major__) +# define COMPILER_VERSION_MINOR DEC(__cray_minor__) +# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(_CRAYC) +# define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) + +#elif defined(__TI_COMPILER_VERSION__) +# define COMPILER_ID "TI" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) + +#elif defined(__CLANG_FUJITSU) +# define COMPILER_ID "FujitsuClang" +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# define COMPILER_VERSION_INTERNAL_STR __clang_version__ + + +#elif defined(__FUJITSU) +# define COMPILER_ID "Fujitsu" +# if defined(__FCC_version__) +# define COMPILER_VERSION __FCC_version__ +# elif defined(__FCC_major__) +# define COMPILER_VERSION_MAJOR DEC(__FCC_major__) +# define COMPILER_VERSION_MINOR DEC(__FCC_minor__) +# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__) +# endif +# if defined(__fcc_version) +# define COMPILER_VERSION_INTERNAL DEC(__fcc_version) +# elif defined(__FCC_VERSION) +# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION) +# endif + + +#elif defined(__ghs__) +# define COMPILER_ID "GHS" +/* __GHS_VERSION_NUMBER = VVVVRP */ +# ifdef __GHS_VERSION_NUMBER +# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100) +# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10) +# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10) +# endif + +#elif defined(__TASKING__) +# define COMPILER_ID "Tasking" + # define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000) + # define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100) +# define COMPILER_VERSION_INTERNAL DEC(__VERSION__) + +#elif defined(__ORANGEC__) +# define COMPILER_ID "OrangeC" +# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__) +# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__) + +#elif defined(__SCO_VERSION__) +# define COMPILER_ID "SCO" + +#elif defined(__ARMCC_VERSION) && !defined(__clang__) +# define COMPILER_ID "ARMCC" +#if __ARMCC_VERSION >= 1000000 + /* __ARMCC_VERSION = VRRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#else + /* __ARMCC_VERSION = VRPPPP */ + # define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000) + # define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10) + # define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000) +#endif + + +#elif defined(__clang__) && defined(__apple_build_version__) +# define COMPILER_ID "AppleClang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif +# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__) + +#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION) +# define COMPILER_ID "ARMClang" + # define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000) + # define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100) + # define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100) +# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION) + +#elif defined(__clang__) +# define COMPILER_ID "Clang" +# if defined(_MSC_VER) +# define SIMULATE_ID "MSVC" +# endif +# define COMPILER_VERSION_MAJOR DEC(__clang_major__) +# define COMPILER_VERSION_MINOR DEC(__clang_minor__) +# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__) +# if defined(_MSC_VER) + /* _MSC_VER = VVRR */ +# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100) +# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100) +# endif + +#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__)) +# define COMPILER_ID "LCC" +# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100) +# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100) +# if defined(__LCC_MINOR__) +# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__) +# endif +# if defined(__GNUC__) && defined(__GNUC_MINOR__) +# define SIMULATE_ID "GNU" +# define SIMULATE_VERSION_MAJOR DEC(__GNUC__) +# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__) +# if defined(__GNUC_PATCHLEVEL__) +# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif +# endif + +#elif defined(__GNUC__) || defined(__GNUG__) +# define COMPILER_ID "GNU" +# if defined(__GNUC__) +# define COMPILER_VERSION_MAJOR DEC(__GNUC__) +# else +# define COMPILER_VERSION_MAJOR DEC(__GNUG__) +# endif +# if defined(__GNUC_MINOR__) +# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__) +# endif +# if defined(__GNUC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__) +# endif + +#elif defined(_MSC_VER) +# define COMPILER_ID "MSVC" + /* _MSC_VER = VVRR */ +# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100) +# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100) +# if defined(_MSC_FULL_VER) +# if _MSC_VER >= 1400 + /* _MSC_FULL_VER = VVRRPPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000) +# else + /* _MSC_FULL_VER = VVRRPPPP */ +# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000) +# endif +# endif +# if defined(_MSC_BUILD) +# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) +# endif + +#elif defined(_ADI_COMPILER) +# define COMPILER_ID "ADSP" +#if defined(__VERSIONNUM__) + /* __VERSIONNUM__ = 0xVVRRPPTT */ +# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF) +# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF) +# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF) +# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF) +#endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# define COMPILER_ID "IAR" +# if defined(__VER__) && defined(__ICCARM__) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000) +# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000) +# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__)) +# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100) +# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100)) +# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__) +# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__) +# endif + + +/* These compilers are either not known or too old to define an + identification macro. Try to identify the platform and guess that + it is the native compiler. */ +#elif defined(__hpux) || defined(__hpua) +# define COMPILER_ID "HP" + +#else /* unknown compiler */ +# define COMPILER_ID "" +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]"; +#ifdef SIMULATE_ID +char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]"; +#endif + +#ifdef __QNXNTO__ +char const* qnxnto = "INFO" ":" "qnxnto[]"; +#endif + +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) +char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]"; +#endif + +#define STRINGIFY_HELPER(X) #X +#define STRINGIFY(X) STRINGIFY_HELPER(X) + +/* Identify known platforms by name. */ +#if defined(__linux) || defined(__linux__) || defined(linux) +# define PLATFORM_ID "Linux" + +#elif defined(__MSYS__) +# define PLATFORM_ID "MSYS" + +#elif defined(__CYGWIN__) +# define PLATFORM_ID "Cygwin" + +#elif defined(__MINGW32__) +# define PLATFORM_ID "MinGW" + +#elif defined(__APPLE__) +# define PLATFORM_ID "Darwin" + +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define PLATFORM_ID "Windows" + +#elif defined(__FreeBSD__) || defined(__FreeBSD) +# define PLATFORM_ID "FreeBSD" + +#elif defined(__NetBSD__) || defined(__NetBSD) +# define PLATFORM_ID "NetBSD" + +#elif defined(__OpenBSD__) || defined(__OPENBSD) +# define PLATFORM_ID "OpenBSD" + +#elif defined(__sun) || defined(sun) +# define PLATFORM_ID "SunOS" + +#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__) +# define PLATFORM_ID "AIX" + +#elif defined(__hpux) || defined(__hpux__) +# define PLATFORM_ID "HP-UX" + +#elif defined(__HAIKU__) +# define PLATFORM_ID "Haiku" + +#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS) +# define PLATFORM_ID "BeOS" + +#elif defined(__QNX__) || defined(__QNXNTO__) +# define PLATFORM_ID "QNX" + +#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__) +# define PLATFORM_ID "Tru64" + +#elif defined(__riscos) || defined(__riscos__) +# define PLATFORM_ID "RISCos" + +#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__) +# define PLATFORM_ID "SINIX" + +#elif defined(__UNIX_SV__) +# define PLATFORM_ID "UNIX_SV" + +#elif defined(__bsdos__) +# define PLATFORM_ID "BSDOS" + +#elif defined(_MPRAS) || defined(MPRAS) +# define PLATFORM_ID "MP-RAS" + +#elif defined(__osf) || defined(__osf__) +# define PLATFORM_ID "OSF1" + +#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv) +# define PLATFORM_ID "SCO_SV" + +#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX) +# define PLATFORM_ID "ULTRIX" + +#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX) +# define PLATFORM_ID "Xenix" + +#elif defined(__WATCOMC__) +# if defined(__LINUX__) +# define PLATFORM_ID "Linux" + +# elif defined(__DOS__) +# define PLATFORM_ID "DOS" + +# elif defined(__OS2__) +# define PLATFORM_ID "OS2" + +# elif defined(__WINDOWS__) +# define PLATFORM_ID "Windows3x" + +# elif defined(__VXWORKS__) +# define PLATFORM_ID "VxWorks" + +# else /* unknown platform */ +# define PLATFORM_ID +# endif + +#elif defined(__INTEGRITY) +# if defined(INT_178B) +# define PLATFORM_ID "Integrity178" + +# else /* regular Integrity */ +# define PLATFORM_ID "Integrity" +# endif + +# elif defined(_ADI_COMPILER) +# define PLATFORM_ID "ADSP" + +#else /* unknown platform */ +# define PLATFORM_ID + +#endif + +/* For windows compilers MSVC and Intel we can determine + the architecture of the compiler being used. This is because + the compilers do not have flags that can change the architecture, + but rather depend on which compiler is being used +*/ +#if defined(_WIN32) && defined(_MSC_VER) +# if defined(_M_IA64) +# define ARCHITECTURE_ID "IA64" + +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + +# elif defined(_M_X64) || defined(_M_AMD64) +# define ARCHITECTURE_ID "x64" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + +# elif defined(_M_ARM) +# if _M_ARM == 4 +# define ARCHITECTURE_ID "ARMV4I" +# elif _M_ARM == 5 +# define ARCHITECTURE_ID "ARMV5I" +# else +# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM) +# endif + +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__WATCOMC__) +# if defined(_M_I86) +# define ARCHITECTURE_ID "I86" + +# elif defined(_M_IX86) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC) +# if defined(__ICCARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__ICCRX__) +# define ARCHITECTURE_ID "RX" + +# elif defined(__ICCRH850__) +# define ARCHITECTURE_ID "RH850" + +# elif defined(__ICCRL78__) +# define ARCHITECTURE_ID "RL78" + +# elif defined(__ICCRISCV__) +# define ARCHITECTURE_ID "RISCV" + +# elif defined(__ICCAVR__) +# define ARCHITECTURE_ID "AVR" + +# elif defined(__ICC430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__ICCV850__) +# define ARCHITECTURE_ID "V850" + +# elif defined(__ICC8051__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__ICCSTM8__) +# define ARCHITECTURE_ID "STM8" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__ghs__) +# if defined(__PPC64__) +# define ARCHITECTURE_ID "PPC64" + +# elif defined(__ppc__) +# define ARCHITECTURE_ID "PPC" + +# elif defined(__ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__x86_64__) +# define ARCHITECTURE_ID "x64" + +# elif defined(__i386__) +# define ARCHITECTURE_ID "X86" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +#elif defined(__TI_COMPILER_VERSION__) +# if defined(__TI_ARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__MSP430__) +# define ARCHITECTURE_ID "MSP430" + +# elif defined(__TMS320C28XX__) +# define ARCHITECTURE_ID "TMS320C28x" + +# elif defined(__TMS320C6X__) || defined(_TMS320C6X) +# define ARCHITECTURE_ID "TMS320C6x" + +# else /* unknown architecture */ +# define ARCHITECTURE_ID "" +# endif + +# elif defined(__ADSPSHARC__) +# define ARCHITECTURE_ID "SHARC" + +# elif defined(__ADSPBLACKFIN__) +# define ARCHITECTURE_ID "Blackfin" + +#elif defined(__TASKING__) + +# if defined(__CTC__) || defined(__CPTC__) +# define ARCHITECTURE_ID "TriCore" + +# elif defined(__CMCS__) +# define ARCHITECTURE_ID "MCS" + +# elif defined(__CARM__) +# define ARCHITECTURE_ID "ARM" + +# elif defined(__CARC__) +# define ARCHITECTURE_ID "ARC" + +# elif defined(__C51__) +# define ARCHITECTURE_ID "8051" + +# elif defined(__CPCP__) +# define ARCHITECTURE_ID "PCP" + +# else +# define ARCHITECTURE_ID "" +# endif + +#else +# define ARCHITECTURE_ID +#endif + +/* Convert integer to decimal digit literals. */ +#define DEC(n) \ + ('0' + (((n) / 10000000)%10)), \ + ('0' + (((n) / 1000000)%10)), \ + ('0' + (((n) / 100000)%10)), \ + ('0' + (((n) / 10000)%10)), \ + ('0' + (((n) / 1000)%10)), \ + ('0' + (((n) / 100)%10)), \ + ('0' + (((n) / 10)%10)), \ + ('0' + ((n) % 10)) + +/* Convert integer to hex digit literals. */ +#define HEX(n) \ + ('0' + ((n)>>28 & 0xF)), \ + ('0' + ((n)>>24 & 0xF)), \ + ('0' + ((n)>>20 & 0xF)), \ + ('0' + ((n)>>16 & 0xF)), \ + ('0' + ((n)>>12 & 0xF)), \ + ('0' + ((n)>>8 & 0xF)), \ + ('0' + ((n)>>4 & 0xF)), \ + ('0' + ((n) & 0xF)) + +/* Construct a string literal encoding the version number. */ +#ifdef COMPILER_VERSION +char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]"; + +/* Construct a string literal encoding the version number components. */ +#elif defined(COMPILER_VERSION_MAJOR) +char const info_version[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[', + COMPILER_VERSION_MAJOR, +# ifdef COMPILER_VERSION_MINOR + '.', COMPILER_VERSION_MINOR, +# ifdef COMPILER_VERSION_PATCH + '.', COMPILER_VERSION_PATCH, +# ifdef COMPILER_VERSION_TWEAK + '.', COMPILER_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct a string literal encoding the internal version number. */ +#ifdef COMPILER_VERSION_INTERNAL +char const info_version_internal[] = { + 'I', 'N', 'F', 'O', ':', + 'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_', + 'i','n','t','e','r','n','a','l','[', + COMPILER_VERSION_INTERNAL,']','\0'}; +#elif defined(COMPILER_VERSION_INTERNAL_STR) +char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]"; +#endif + +/* Construct a string literal encoding the version number components. */ +#ifdef SIMULATE_VERSION_MAJOR +char const info_simulate_version[] = { + 'I', 'N', 'F', 'O', ':', + 's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[', + SIMULATE_VERSION_MAJOR, +# ifdef SIMULATE_VERSION_MINOR + '.', SIMULATE_VERSION_MINOR, +# ifdef SIMULATE_VERSION_PATCH + '.', SIMULATE_VERSION_PATCH, +# ifdef SIMULATE_VERSION_TWEAK + '.', SIMULATE_VERSION_TWEAK, +# endif +# endif +# endif + ']','\0'}; +#endif + +/* Construct the string literal in pieces to prevent the source from + getting matched. Store it in a pointer rather than an array + because some compilers will just produce instructions to fill the + array rather than assigning a pointer to a static array. */ +char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]"; +char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]"; + + + +#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L +# if defined(__INTEL_CXX11_MODE__) +# if defined(__cpp_aggregate_nsdmi) +# define CXX_STD 201402L +# else +# define CXX_STD 201103L +# endif +# else +# define CXX_STD 199711L +# endif +#elif defined(_MSC_VER) && defined(_MSVC_LANG) +# define CXX_STD _MSVC_LANG +#else +# define CXX_STD __cplusplus +#endif + +const char* info_language_standard_default = "INFO" ":" "standard_default[" +#if CXX_STD > 202002L + "23" +#elif CXX_STD > 201703L + "20" +#elif CXX_STD >= 201703L + "17" +#elif CXX_STD >= 201402L + "14" +#elif CXX_STD >= 201103L + "11" +#else + "98" +#endif +"]"; + +const char* info_language_extensions_default = "INFO" ":" "extensions_default[" +#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \ + defined(__TI_COMPILER_VERSION__)) && \ + !defined(__STRICT_ANSI__) + "ON" +#else + "OFF" +#endif +"]"; + +/*--------------------------------------------------------------------------*/ + +int main(int argc, char* argv[]) +{ + int require = 0; + require += info_compiler[argc]; + require += info_platform[argc]; + require += info_arch[argc]; +#ifdef COMPILER_VERSION_MAJOR + require += info_version[argc]; +#endif +#ifdef COMPILER_VERSION_INTERNAL + require += info_version_internal[argc]; +#endif +#ifdef SIMULATE_ID + require += info_simulate[argc]; +#endif +#ifdef SIMULATE_VERSION_MAJOR + require += info_simulate_version[argc]; +#endif +#if defined(__CRAYXT_COMPUTE_LINUX_TARGET) + require += info_cray[argc]; +#endif + require += info_language_standard_default[argc]; + require += info_language_extensions_default[argc]; + (void)argv; + return require; +} diff --git a/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/a.out b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/a.out new file mode 100755 index 0000000..c8ced32 Binary files /dev/null and b/modules/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/a.out differ diff --git a/modules/api/classic/unix/CMakeFiles/CMakeConfigureLog.yaml b/modules/api/classic/unix/CMakeFiles/CMakeConfigureLog.yaml new file mode 100644 index 0000000..cd300e0 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/CMakeConfigureLog.yaml @@ -0,0 +1,531 @@ + +--- +events: + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake:233 (message)" + - "CMakeLists.txt:53 (project)" + message: | + The system is: Linux - 6.11.0-19-generic - x86_64 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake:123 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:53 (project)" + message: | + Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded. + Compiler: /usr/bin/cc + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out" + + The C compiler identification is GNU, found in: + /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/3.28.3/CompilerIdC/a.out + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:17 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:64 (__determine_compiler_id_test)" + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake:126 (CMAKE_DETERMINE_COMPILER_ID)" + - "CMakeLists.txt:53 (project)" + message: | + Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded. + Compiler: /usr/bin/c++ + Build flags: + Id flags: + + The output was: + 0 + + + Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "a.out" + + The CXX compiler identification is GNU, found in: + /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/3.28.3/CompilerIdCXX/a.out + + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + checks: + - "Detecting C compiler ABI info" + directories: + source: "/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5" + binary: "/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5" + cmakeVariables: + CMAKE_C_FLAGS: "" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_C_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5' + + Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_0f8fe/fast + /usr/bin/gmake -f CMakeFiles/cmTC_0f8fe.dir/build.make CMakeFiles/cmTC_0f8fe.dir/build + gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5' + Building C object CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o + /usr/bin/cc -v -o CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c + Using built-in specs. + COLLECT_GCC=/usr/bin/cc + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_0f8fe.dir/' + /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_0f8fe.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccq6SGES.s + GNU C17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu) + compiled by GNU C version 13.3.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/lib/gcc/x86_64-linux-gnu/13/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include + End of search list. + Compiler executable checksum: 38987c28e967c64056a6454abdef726e + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_0f8fe.dir/' + as -v --64 -o CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o /tmp/ccq6SGES.s + GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42 + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.' + Linking C executable cmTC_0f8fe + /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0f8fe.dir/link.txt --verbose=1 + /usr/bin/cc -v -rdynamic CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o -o cmTC_0f8fe + Using built-in specs. + COLLECT_GCC=/usr/bin/cc + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_0f8fe' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_0f8fe.' + /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccbjzs4x.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_0f8fe /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_0f8fe' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_0f8fe.' + gmake[1]: Leaving directory '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:127 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed C implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/lib/gcc/x86_64-linux-gnu/13/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/13/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/13/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:159 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed C implicit link information: + link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + ignore line: [Change Dir: '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_0f8fe/fast] + ignore line: [/usr/bin/gmake -f CMakeFiles/cmTC_0f8fe.dir/build.make CMakeFiles/cmTC_0f8fe.dir/build] + ignore line: [gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-DdXzc5'] + ignore line: [Building C object CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/cc -v -o CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_0f8fe.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/cc1 -quiet -v -imultiarch x86_64-linux-gnu /usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c -quiet -dumpdir CMakeFiles/cmTC_0f8fe.dir/ -dumpbase CMakeCCompilerABI.c.c -dumpbase-ext .c -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccq6SGES.s] + ignore line: [GNU C17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 13.3.0 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version isl-0.26-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/13/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: 38987c28e967c64056a6454abdef726e] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_0f8fe.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o /tmp/ccq6SGES.s] + ignore line: [GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o' '-c' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.'] + ignore line: [Linking C executable cmTC_0f8fe] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0f8fe.dir/link.txt --verbose=1] + ignore line: [/usr/bin/cc -v -rdynamic CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o -o cmTC_0f8fe ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/cc] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_0f8fe' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_0f8fe.'] + link line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccbjzs4x.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_0f8fe /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o -lgcc --push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed -lgcc_s --pop-state /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccbjzs4x.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_0f8fe] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] + arg [CMakeFiles/cmTC_0f8fe.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [-lc] ==> lib [c] + arg [-lgcc] ==> lib [gcc] + arg [--push-state] ==> ignore + arg [--as-needed] ==> ignore + arg [-lgcc_s] ==> lib [gcc_s] + arg [--pop-state] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13] ==> [/usr/lib/gcc/x86_64-linux-gnu/13] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> [/usr/lib] + implicit libs: [gcc;gcc_s;c;gcc;gcc_s] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + + - + kind: "try_compile-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:57 (try_compile)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + checks: + - "Detecting CXX compiler ABI info" + directories: + source: "/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu" + binary: "/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu" + cmakeVariables: + CMAKE_CXX_FLAGS: "" + CMAKE_EXE_LINKER_FLAGS: "" + buildResult: + variable: "CMAKE_CXX_ABI_COMPILED" + cached: true + stdout: | + Change Dir: '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu' + + Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_9f826/fast + /usr/bin/gmake -f CMakeFiles/cmTC_9f826.dir/build.make CMakeFiles/cmTC_9f826.dir/build + gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu' + Building CXX object CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o + /usr/bin/c++ -v -o CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_9f826.dir/' + /usr/libexec/gcc/x86_64-linux-gnu/13/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_9f826.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccc6b6MX.s + GNU C++17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu) + compiled by GNU C version 13.3.0, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.26-GMP + + GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 + ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/13" + ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed" + ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include" + #include "..." search starts here: + #include <...> search starts here: + /usr/include/c++/13 + /usr/include/x86_64-linux-gnu/c++/13 + /usr/include/c++/13/backward + /usr/lib/gcc/x86_64-linux-gnu/13/include + /usr/local/include + /usr/include/x86_64-linux-gnu + /usr/include + End of search list. + Compiler executable checksum: c81c05345ce537099dafd5580045814a + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_9f826.dir/' + as -v --64 -o CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccc6b6MX.s + GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42 + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.' + Linking CXX executable cmTC_9f826 + /usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9f826.dir/link.txt --verbose=1 + /usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_9f826 + Using built-in specs. + COLLECT_GCC=/usr/bin/c++ + COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper + OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa + OFFLOAD_TARGET_DEFAULT=1 + Target: x86_64-linux-gnu + Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2 + Thread model: posix + Supported LTO compression algorithms: zlib zstd + gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) + COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/ + LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/ + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_9f826' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_9f826.' + /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccjd28fu.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_9f826 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o + COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_9f826' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_9f826.' + gmake[1]: Leaving directory '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu' + + exitCode: 0 + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:127 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed CXX implicit include dir info: rv=done + found start of include info + found start of implicit include info + add: [/usr/include/c++/13] + add: [/usr/include/x86_64-linux-gnu/c++/13] + add: [/usr/include/c++/13/backward] + add: [/usr/lib/gcc/x86_64-linux-gnu/13/include] + add: [/usr/local/include] + add: [/usr/include/x86_64-linux-gnu] + add: [/usr/include] + end of search list found + collapse include dir [/usr/include/c++/13] ==> [/usr/include/c++/13] + collapse include dir [/usr/include/x86_64-linux-gnu/c++/13] ==> [/usr/include/x86_64-linux-gnu/c++/13] + collapse include dir [/usr/include/c++/13/backward] ==> [/usr/include/c++/13/backward] + collapse include dir [/usr/lib/gcc/x86_64-linux-gnu/13/include] ==> [/usr/lib/gcc/x86_64-linux-gnu/13/include] + collapse include dir [/usr/local/include] ==> [/usr/local/include] + collapse include dir [/usr/include/x86_64-linux-gnu] ==> [/usr/include/x86_64-linux-gnu] + collapse include dir [/usr/include] ==> [/usr/include] + implicit include dirs: [/usr/include/c++/13;/usr/include/x86_64-linux-gnu/c++/13;/usr/include/c++/13/backward;/usr/lib/gcc/x86_64-linux-gnu/13/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include] + + + - + kind: "message-v1" + backtrace: + - "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake:159 (message)" + - "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake:26 (CMAKE_DETERMINE_COMPILER_ABI)" + - "CMakeLists.txt:53 (project)" + message: | + Parsed CXX implicit link information: + link line regex: [^( *|.*[/\\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\\]+-)?ld|collect2)[^/\\]*( |$)] + ignore line: [Change Dir: '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu'] + ignore line: [] + ignore line: [Run Build Command(s): /usr/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_9f826/fast] + ignore line: [/usr/bin/gmake -f CMakeFiles/cmTC_9f826.dir/build.make CMakeFiles/cmTC_9f826.dir/build] + ignore line: [gmake[1]: Entering directory '/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/CMakeScratch/TryCompile-oSgVWu'] + ignore line: [Building CXX object CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/c++ -v -o CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_9f826.dir/'] + ignore line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/cc1plus -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE /usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp -quiet -dumpdir CMakeFiles/cmTC_9f826.dir/ -dumpbase CMakeCXXCompilerABI.cpp.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -version -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection -o /tmp/ccc6b6MX.s] + ignore line: [GNU C++17 (Ubuntu 13.3.0-6ubuntu2~24.04) version 13.3.0 (x86_64-linux-gnu)] + ignore line: [ compiled by GNU C version 13.3.0 GMP version 6.3.0 MPFR version 4.2.1 MPC version 1.3.1 isl version isl-0.26-GMP] + ignore line: [] + ignore line: [GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072] + ignore line: [ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/13"] + ignore line: [ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed/x86_64-linux-gnu"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/include-fixed"] + ignore line: [ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include"] + ignore line: [#include "..." search starts here:] + ignore line: [#include <...> search starts here:] + ignore line: [ /usr/include/c++/13] + ignore line: [ /usr/include/x86_64-linux-gnu/c++/13] + ignore line: [ /usr/include/c++/13/backward] + ignore line: [ /usr/lib/gcc/x86_64-linux-gnu/13/include] + ignore line: [ /usr/local/include] + ignore line: [ /usr/include/x86_64-linux-gnu] + ignore line: [ /usr/include] + ignore line: [End of search list.] + ignore line: [Compiler executable checksum: c81c05345ce537099dafd5580045814a] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_9f826.dir/'] + ignore line: [ as -v --64 -o CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o /tmp/ccc6b6MX.s] + ignore line: [GNU assembler version 2.42 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.42] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.'] + ignore line: [Linking CXX executable cmTC_9f826] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_9f826.dir/link.txt --verbose=1] + ignore line: [/usr/bin/c++ -v -rdynamic CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_9f826 ] + ignore line: [Using built-in specs.] + ignore line: [COLLECT_GCC=/usr/bin/c++] + ignore line: [COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] + ignore line: [OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa] + ignore line: [OFFLOAD_TARGET_DEFAULT=1] + ignore line: [Target: x86_64-linux-gnu] + ignore line: [Configured with: ../src/configure -v --with-pkgversion='Ubuntu 13.3.0-6ubuntu2~24.04' --with-bugurl=file:///usr/share/doc/gcc-13/README.Bugs --enable-languages=c ada c++ go d fortran objc obj-c++ m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-13 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32 m64 mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-nvptx/usr amdgcn-amdhsa=/build/gcc-13-fG75Ri/gcc-13-13.3.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2] + ignore line: [Thread model: posix] + ignore line: [Supported LTO compression algorithms: zlib zstd] + ignore line: [gcc version 13.3.0 (Ubuntu 13.3.0-6ubuntu2~24.04) ] + ignore line: [COMPILER_PATH=/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/13/:/usr/libexec/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/13/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/13/../../../:/lib/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-v' '-rdynamic' '-o' 'cmTC_9f826' '-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' 'cmTC_9f826.'] + link line: [ /usr/libexec/gcc/x86_64-linux-gnu/13/collect2 -plugin /usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper -plugin-opt=-fresolution=/tmp/ccjd28fu.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -z now -z relro -o cmTC_9f826 /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o -L/usr/lib/gcc/x86_64-linux-gnu/13 -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/13/../../.. CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/collect2] ==> ignore + arg [-plugin] ==> ignore + arg [/usr/libexec/gcc/x86_64-linux-gnu/13/liblto_plugin.so] ==> ignore + arg [-plugin-opt=/usr/libexec/gcc/x86_64-linux-gnu/13/lto-wrapper] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccjd28fu.res] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [-plugin-opt=-pass-through=-lc] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc_s] ==> ignore + arg [-plugin-opt=-pass-through=-lgcc] ==> ignore + arg [--build-id] ==> ignore + arg [--eh-frame-hdr] ==> ignore + arg [-m] ==> ignore + arg [elf_x86_64] ==> ignore + arg [--hash-style=gnu] ==> ignore + arg [--as-needed] ==> ignore + arg [-export-dynamic] ==> ignore + arg [-dynamic-linker] ==> ignore + arg [/lib64/ld-linux-x86-64.so.2] ==> ignore + arg [-pie] ==> ignore + arg [-znow] ==> ignore + arg [-zrelro] ==> ignore + arg [-o] ==> ignore + arg [cmTC_9f826] ==> ignore + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] + arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu] + arg [-L/lib/../lib] ==> dir [/lib/../lib] + arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu] + arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] + arg [CMakeFiles/cmTC_9f826.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [-lstdc++] ==> lib [stdc++] + arg [-lm] ==> lib [m] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [-lc] ==> lib [c] + arg [-lgcc_s] ==> lib [gcc_s] + arg [-lgcc] ==> lib [gcc] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o] + arg [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o] ==> [/usr/lib/x86_64-linux-gnu/Scrt1.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crti.o] ==> [/usr/lib/x86_64-linux-gnu/crti.o] + collapse obj [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/crtn.o] ==> [/usr/lib/x86_64-linux-gnu/crtn.o] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13] ==> [/usr/lib/gcc/x86_64-linux-gnu/13] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../../../lib] ==> [/usr/lib] + collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu] + collapse library dir [/lib/../lib] ==> [/lib] + collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu] + collapse library dir [/usr/lib/../lib] ==> [/usr/lib] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/13/../../..] ==> [/usr/lib] + implicit libs: [stdc++;m;gcc_s;gcc;c;gcc_s;gcc] + implicit objs: [/usr/lib/x86_64-linux-gnu/Scrt1.o;/usr/lib/x86_64-linux-gnu/crti.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtbeginS.o;/usr/lib/gcc/x86_64-linux-gnu/13/crtendS.o;/usr/lib/x86_64-linux-gnu/crtn.o] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/13;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib] + implicit fwks: [] + + +... diff --git a/modules/api/classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/api/classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..c38f8b7 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx/api/classic/unix") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/api/classic/unix/CMakeFiles/Makefile.cmake b/modules/api/classic/unix/CMakeFiles/Makefile.cmake new file mode 100644 index 0000000..6be0396 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/Makefile.cmake @@ -0,0 +1,130 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# The generator used is: +set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles") + +# The top level Makefile was generated from the following files: +set(CMAKE_MAKEFILE_DEPENDS + "CMakeCache.txt" + "CMakeFiles/3.28.3/CMakeCCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.28.3/CMakeSystem.cmake" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/CMakeLists.txt" + "/usr/share/cmake-3.28/Modules/CMakeCCompiler.cmake.in" + "/usr/share/cmake-3.28/Modules/CMakeCCompilerABI.c" + "/usr/share/cmake-3.28/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeCXXCompiler.cmake.in" + "/usr/share/cmake-3.28/Modules/CMakeCXXCompilerABI.cpp" + "/usr/share/cmake-3.28/Modules/CMakeCXXInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.28/Modules/CMakeCompilerIdDetection.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCXXCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompileFeatures.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerABI.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake" + "/usr/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake" + "/usr/share/cmake-3.28/Modules/CMakeFindBinUtils.cmake" + "/usr/share/cmake-3.28/Modules/CMakeGenericSystem.cmake" + "/usr/share/cmake-3.28/Modules/CMakeInitializeConfigs.cmake" + "/usr/share/cmake-3.28/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeParseImplicitIncludeInfo.cmake" + "/usr/share/cmake-3.28/Modules/CMakeParseImplicitLinkInfo.cmake" + "/usr/share/cmake-3.28/Modules/CMakeParseLibraryArchitecture.cmake" + "/usr/share/cmake-3.28/Modules/CMakeSystem.cmake.in" + "/usr/share/cmake-3.28/Modules/CMakeSystemSpecificInformation.cmake" + "/usr/share/cmake-3.28/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.28/Modules/CMakeTestCCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeTestCXXCompiler.cmake" + "/usr/share/cmake-3.28/Modules/CMakeTestCompilerCommon.cmake" + "/usr/share/cmake-3.28/Modules/CMakeUnixFindMake.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/ADSP-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/ARMCC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/ARMClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/AppleClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Borland-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Bruce-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Compaq-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Cray-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/CrayClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GHS-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU-FindBinUtils.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/HP-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/HP-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IAR-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IBMClang-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Intel-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/LCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/LCC-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/MSVC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/NVHPC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/OrangeC-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/PGI-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/PathScale-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SCO-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SDCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SunPro-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/TI-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Tasking-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/Watcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XL-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XL-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XLClang-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/XLClang-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/zOS-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.28/Modules/Internal/FeatureTesting.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-Determine-CXX.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-GNU-C.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-GNU-CXX.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-GNU.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux-Initialize.cmake" + "/usr/share/cmake-3.28/Modules/Platform/Linux.cmake" + "/usr/share/cmake-3.28/Modules/Platform/UnixPaths.cmake" + ) + +# The corresponding makefile is: +set(CMAKE_MAKEFILE_OUTPUTS + "Makefile" + "CMakeFiles/cmake.check_cache" + ) + +# Byproducts of CMake generate step: +set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/3.28.3/CMakeSystem.cmake" + "CMakeFiles/3.28.3/CMakeCCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCXXCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCCompiler.cmake" + "CMakeFiles/3.28.3/CMakeCXXCompiler.cmake" + "CMakeFiles/CMakeDirectoryInformation.cmake" + ) + +# Dependency information for all targets: +set(CMAKE_DEPEND_INFO_FILES + "CMakeFiles/rexxapi1.dir/DependInfo.cmake" + ) diff --git a/modules/api/classic/unix/CMakeFiles/Makefile2 b/modules/api/classic/unix/CMakeFiles/Makefile2 new file mode 100644 index 0000000..ab3425f --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/Makefile2 @@ -0,0 +1,112 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx/api/classic/unix + +#============================================================================= +# Directory level rules for the build root directory + +# The main recursive "all" target. +all: CMakeFiles/rexxapi1.dir/all +.PHONY : all + +# The main recursive "preinstall" target. +preinstall: +.PHONY : preinstall + +# The main recursive "clean" target. +clean: CMakeFiles/rexxapi1.dir/clean +.PHONY : clean + +#============================================================================= +# Target rules for target CMakeFiles/rexxapi1.dir + +# All Build rule for target. +CMakeFiles/rexxapi1.dir/all: + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/depend + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/build + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles --progress-num=1,2 "Built target rexxapi1" +.PHONY : CMakeFiles/rexxapi1.dir/all + +# Build rule for subdir invocation for target. +CMakeFiles/rexxapi1.dir/rule: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles 2 + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 CMakeFiles/rexxapi1.dir/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles 0 +.PHONY : CMakeFiles/rexxapi1.dir/rule + +# Convenience name for target. +rexxapi1: CMakeFiles/rexxapi1.dir/rule +.PHONY : rexxapi1 + +# clean rule for target. +CMakeFiles/rexxapi1.dir/clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/clean +.PHONY : CMakeFiles/rexxapi1.dir/clean + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/api/classic/unix/CMakeFiles/TargetDirectories.txt b/modules/api/classic/unix/CMakeFiles/TargetDirectories.txt new file mode 100644 index 0000000..3a0808d --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/TargetDirectories.txt @@ -0,0 +1,7 @@ +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/rexxapi1.dir +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/edit_cache.dir +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/rebuild_cache.dir +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/list_install_components.dir +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/install.dir +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/install/local.dir +/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/install/strip.dir diff --git a/modules/api/classic/unix/CMakeFiles/cmake.check_cache b/modules/api/classic/unix/CMakeFiles/cmake.check_cache new file mode 100644 index 0000000..3dccd73 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/modules/api/classic/unix/CMakeFiles/progress.marks b/modules/api/classic/unix/CMakeFiles/progress.marks new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/progress.marks @@ -0,0 +1 @@ +2 diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/DependInfo.cmake b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/DependInfo.cmake new file mode 100644 index 0000000..002b201 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c" "CMakeFiles/rexxapi1.dir/rexxapi1.c.o" "gcc" "CMakeFiles/rexxapi1.dir/rexxapi1.c.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/build.make b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/build.make new file mode 100644 index 0000000..e2eaa03 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx/api/classic/unix + +# Include any dependencies generated for this target. +include CMakeFiles/rexxapi1.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include CMakeFiles/rexxapi1.dir/compiler_depend.make + +# Include the progress variables for this target. +include CMakeFiles/rexxapi1.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/rexxapi1.dir/flags.make + +CMakeFiles/rexxapi1.dir/rexxapi1.c.o: CMakeFiles/rexxapi1.dir/flags.make +CMakeFiles/rexxapi1.dir/rexxapi1.c.o: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c +CMakeFiles/rexxapi1.dir/rexxapi1.c.o: CMakeFiles/rexxapi1.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/rexxapi1.dir/rexxapi1.c.o" + /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/rexxapi1.dir/rexxapi1.c.o -MF CMakeFiles/rexxapi1.dir/rexxapi1.c.o.d -o CMakeFiles/rexxapi1.dir/rexxapi1.c.o -c /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c + +CMakeFiles/rexxapi1.dir/rexxapi1.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/rexxapi1.dir/rexxapi1.c.i" + /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c > CMakeFiles/rexxapi1.dir/rexxapi1.c.i + +CMakeFiles/rexxapi1.dir/rexxapi1.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/rexxapi1.dir/rexxapi1.c.s" + /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c -o CMakeFiles/rexxapi1.dir/rexxapi1.c.s + +# Object files for target rexxapi1 +rexxapi1_OBJECTS = \ +"CMakeFiles/rexxapi1.dir/rexxapi1.c.o" + +# External object files for target rexxapi1 +rexxapi1_EXTERNAL_OBJECTS = + +librexxapi1.so: CMakeFiles/rexxapi1.dir/rexxapi1.c.o +librexxapi1.so: CMakeFiles/rexxapi1.dir/build.make +librexxapi1.so: CMakeFiles/rexxapi1.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C shared library librexxapi1.so" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/rexxapi1.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/rexxapi1.dir/build: librexxapi1.so +.PHONY : CMakeFiles/rexxapi1.dir/build + +CMakeFiles/rexxapi1.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles/rexxapi1.dir/cmake_clean.cmake +.PHONY : CMakeFiles/rexxapi1.dir/clean + +CMakeFiles/rexxapi1.dir/depend: + cd /home/gmgauthier/Projects/code/rexx/api/classic/unix && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 /home/gmgauthier/Projects/code/rexx/api/classic/unix /home/gmgauthier/Projects/code/rexx/api/classic/unix /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles/rexxapi1.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : CMakeFiles/rexxapi1.dir/depend + diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/cmake_clean.cmake b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/cmake_clean.cmake new file mode 100644 index 0000000..d980a69 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/rexxapi1.dir/rexxapi1.c.o" + "CMakeFiles/rexxapi1.dir/rexxapi1.c.o.d" + "librexxapi1.pdb" + "librexxapi1.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/rexxapi1.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/compiler_depend.make b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/compiler_depend.make new file mode 100644 index 0000000..95727db --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for rexxapi1. +# This may be replaced when dependencies are built. diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/compiler_depend.ts b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/compiler_depend.ts new file mode 100644 index 0000000..2aec347 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for rexxapi1. diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/depend.make b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/depend.make new file mode 100644 index 0000000..1efbde0 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for rexxapi1. +# This may be replaced when dependencies are built. diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/flags.make b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/flags.make new file mode 100644 index 0000000..60197ff --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile C with /usr/bin/cc +C_DEFINES = -Drexxapi1_EXPORTS + +C_INCLUDES = + +C_FLAGS = -fPIC + diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/link.txt b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/link.txt new file mode 100644 index 0000000..ffe6654 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/cc -fPIC -shared -Wl,-soname,librexxapi1.so -o librexxapi1.so CMakeFiles/rexxapi1.dir/rexxapi1.c.o -lrexx -lrexxapi diff --git a/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/progress.make b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/progress.make new file mode 100644 index 0000000..abadeb0 --- /dev/null +++ b/modules/api/classic/unix/CMakeFiles/rexxapi1.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 + diff --git a/modules/api/classic/unix/CMakeLists.txt b/modules/api/classic/unix/CMakeLists.txt new file mode 100644 index 0000000..a680c5e --- /dev/null +++ b/modules/api/classic/unix/CMakeLists.txt @@ -0,0 +1,60 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples-api-classic-unix) + +add_subdirectory (callrexx) +add_subdirectory (rexxapi1) +add_subdirectory (rexxapi2) +add_subdirectory (rexxapi3) + +install(FILES rexxapi.README callrexx.README COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic ) diff --git a/modules/api/classic/unix/Makefile b/modules/api/classic/unix/Makefile new file mode 100644 index 0000000..fe30354 --- /dev/null +++ b/modules/api/classic/unix/Makefile @@ -0,0 +1,230 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx/api/classic/unix + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles /home/gmgauthier/Projects/code/rexx/api/classic/unix//CMakeFiles/progress.marks + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/api/classic/unix/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +#============================================================================= +# Target rules for targets named rexxapi1 + +# Build rule for target. +rexxapi1: cmake_check_build_system + $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 rexxapi1 +.PHONY : rexxapi1 + +# fast build rule for target. +rexxapi1/fast: + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/build +.PHONY : rexxapi1/fast + +rexxapi1.o: rexxapi1.c.o +.PHONY : rexxapi1.o + +# target to build an object file +rexxapi1.c.o: + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/rexxapi1.c.o +.PHONY : rexxapi1.c.o + +rexxapi1.i: rexxapi1.c.i +.PHONY : rexxapi1.i + +# target to preprocess a source file +rexxapi1.c.i: + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/rexxapi1.c.i +.PHONY : rexxapi1.c.i + +rexxapi1.s: rexxapi1.c.s +.PHONY : rexxapi1.s + +# target to generate assembly for a file +rexxapi1.c.s: + $(MAKE) $(MAKESILENT) -f CMakeFiles/rexxapi1.dir/build.make CMakeFiles/rexxapi1.dir/rexxapi1.c.s +.PHONY : rexxapi1.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... rexxapi1" + @echo "... rexxapi1.o" + @echo "... rexxapi1.i" + @echo "... rexxapi1.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/api/classic/unix/callrexx.README b/modules/api/classic/unix/callrexx.README new file mode 100644 index 0000000..6993374 --- /dev/null +++ b/modules/api/classic/unix/callrexx.README @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +The API samples in the "callrexx" directory demonstrate how to +invoke the interpreter from within an application. + +The callrexx1 sample (callrexx1.cpp) demonstrates the dynamic linking of +the REXXSTART-command. + +The callrexx2 sample demonstrates the dynamic loading of the +REXXSTART command via dlopen and dlsym functions from a calling +C program. + +The examples show + +- How to deliver Arguments to a Rexx program +- How data can be returned from a Rexx program +- How to use the instore feature +- How to use the Macrospace feature + +To build: + make -f Makefile.unix clean + make -f Makefile.unix + +To run: + + ./callrexx1 + ./callrexx2 + diff --git a/modules/api/classic/unix/callrexx/CMakeLists.txt b/modules/api/classic/unix/callrexx/CMakeLists.txt new file mode 100644 index 0000000..6b8dd5b --- /dev/null +++ b/modules/api/classic/unix/callrexx/CMakeLists.txt @@ -0,0 +1,103 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (callrexx) + +# set variables used in here +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/callrexx) +# add GROUP_WRITE right to default permissions +set (PERM_EXECUTE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) +set (PERM_RW PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ ) + +# message (STATUS PERM_EXECUTE=${PERM_EXECUTE} ) +# message (STATUS PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR} ) + +#################### callrexx1 (executable) ######################### +# additional source files required by specific platforms +# Sources for callrexx1 +add_executable(callrexx1 ${PROJECT_SOURCE_DIR}/callrexx1.cpp) +# Include file definition +target_include_directories(callrexx1 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(callrexx1 rexx rexxapi) +install(TARGETS callrexx1 RUNTIME DESTINATION ${DEST} ${PERM_EXECUTE}) +install(FILES callrexx1.cpp Makefile.unix COMPONENT Samples DESTINATION ${DEST} ${PERM_RW} ) + + +#################### callrexx2 (executable) ######################### +# additional source files required by specific platforms +#set (platform_callrexx2_libs ${ORX_SYSLIB_DL} ${ORX_SYSLIB_PTHREAD}) +# Sources for callrexx2 +add_executable(callrexx2 ${PROJECT_SOURCE_DIR}/callrexx2.c) +# Include file definition +target_include_directories(callrexx2 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(callrexx2 rexx rexxapi) +install(TARGETS callrexx2 RUNTIME DESTINATION ${DEST} ${PERM_EXECUTE}) +install(FILES callrexx2.c COMPONENT Samples DESTINATION ${DEST} ${PERM_RW}) + + +#################### Rexx scripts invoked by the executables ######################### +# o.k. install(PROGRAMS del_macro.rex example.rex load_macro.rex macros.rex startrx1.rex startrx2.rex startrx3.rex +# COMPONENT Samples DESTINATION ${DEST}) + +# install(DIRECTORY ${PROJECT_SOURCE_DIR} COMPONENT Samples DESTINATION ${DEST} FILES_MATCHING PATTERN "*.rex" ${PERM} ) +# install(DIRECTORY ${PROJECT_SOURCE_DIR} COMPONENT Samples DESTINATION ${DEST} FILES_MATCHING PATTERN "*.rex" ${PERM} ) + + +install(PROGRAMS del_macro.rex example.rex load_macro.rex macros.rex startrx1.rex startrx2.rex startrx3.rex + COMPONENT Samples DESTINATION ${DEST} ${PERM_EXECUTE}) + diff --git a/modules/api/classic/unix/callrexx/Makefile.unix b/modules/api/classic/unix/callrexx/Makefile.unix new file mode 100644 index 0000000..acc410c --- /dev/null +++ b/modules/api/classic/unix/callrexx/Makefile.unix @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2008-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + + +# A pretty simple make file that should work on most Unix-like platforms that have gcc. + +OOREXX_LFLAGS = -lrexx -lrexxapi # needs to follow after file for which link resoultion is needed +DL_LFLAGS = -ldl # dlopen etc. + +# What we want to build. +all: callrexx1 callrexx2 + +callrexx1: callrexx1.cpp + gcc callrexx1.cpp ${OOREXX_LFLAGS} -o callrexx1 + +callrexx2: callrexx2.c + gcc callrexx2.c $(OOREXX_LFLAGS) ${DL_LFLAGS} -o callrexx2 + +clean: + rm -f callrexx1 callrexx2 + diff --git a/modules/api/classic/unix/callrexx/callrexx1.cpp b/modules/api/classic/unix/callrexx/callrexx1.cpp new file mode 100644 index 0000000..44860f4 --- /dev/null +++ b/modules/api/classic/unix/callrexx/callrexx1.cpp @@ -0,0 +1,476 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2017 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: CALLREXX1.C */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: Samples of how to invoke the Open Object Rexx*/ +/* interpreter. */ +/* */ +/* Entry Points: main - main entry point */ +/* */ +/* Input: None */ +/* */ +/* Output: returns from the Open Object Rexx programs */ +/* */ +/*********************************************************************/ + +#include +#include +#include +#include +#include + +#include "rexx.h" + +char *pcharTemp; + +int main() +{ + CONSTRXSTRING arg[4]; /* argument string for Rexx */ + RXSTRING rexxretval; /* return value from Rexx */ + RXSTRING instore[2]; /* in storage parms */ + char *pszTemp; + RexxReturnCode rc = 0; /* return code from Rexx */ + short rexxrc = 0; /* return code from function */ + int ignore; // avoid warning: ignoring return value of 'int system(const char*)' + // avoid warning: ignoring return value of 'int scanf(const char*, ...)' + + char val; + const char *str1 = "Arg number one"; /* text to swap */ + const char *str2 = "Arg number two"; /* text to swap */ + const char *str3 = "Arg number three"; /* text to swap */ + const char *str4 = "Arg number four"; /* text to swap */ + const char *sync_tst = "call time 'Reset';" \ + "object1 = .example~new;" \ + "object2 = .example~new;" \ + "object3 = .example~new;" \ + "a.1 = object1~start('REPEAT', 4 , 'Object 1 running');" \ + "say a.1~result;" \ + "say 'The result method waits until the START message has completed:';" \ + "a.2 = object2~start('REPEAT', 2, 'Object 2 running');" \ + "a.3 = object3~start('REPEAT', 2, 'Object 3 running');" \ + "say a.2~result;" \ + "say a.3~result;" \ + "say 'main ended';" \ + "say 'Elapsed time: ' time('E');" \ + "exit;" \ + "::REQUIRES 'example.rex'"; + + /* By setting the strlength of the Rexx output to zero, the */ + /* interpreter allocates memory. */ + /* We can provide a buffer for the interpreter to use instead. */ + /* If the returned value does not fit into the buffer, Open Object Rexx */ + /* creates a new one. */ + + ignore = system("clear"); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + printf("This is an easy sample of how to invoke the Rexx interpreter. \n"); + printf("The Rexx commandfile which is started is named: startrx1.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + + /* This is the interpreter invocation. ---------------------------- */ + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx1.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("In this case a previously defined Resultstring is \n"); + printf("delivered to Open Object Rexx, which is large enough to \n"); + printf("hold the Return Value of the Rexx commandfile\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = (char *) malloc(100 * sizeof(char)); + rexxretval.strlength = 100; + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx1.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("In this case a previously defined Resultstring is \n"); + printf("delivered to Open Object Rexx, which is too small to\n"); + printf("hold the Return Value of the Rexx commandfile.\n"); + printf("Rexx reallocates the buffer which needs to be freed\n"); + printf("in the calling program\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = (char *) malloc(2 * sizeof(char)); + pszTemp = rexxretval.strptr; + rexxretval.strlength = 2; + + printf("The Length of the Resultstring is %zd\n", rexxretval.strlength); + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx1.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + printf("This is a sample with 4 arguments delivered to \n"); + printf("REXXSTART\n"); + printf("The Rexx commandfile which is started is named: startrx2.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + MAKERXSTRING(arg[0], str1, strlen(str1)); /* create input argument 1*/ + MAKERXSTRING(arg[1], str2, strlen(str2)); /* create input argument 2*/ + MAKERXSTRING(arg[2], str3, strlen(str3)); /* create input argument 3*/ + MAKERXSTRING(arg[3], str4, strlen(str4)); /* create input argument 4*/ + + rc=RexxStart( + 4, /* number of arguments */ + arg, /* array of arguments */ + "startrx2.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample with 2 arguments delivered to \n"); + printf("REXXSTART\n"); + printf("The Rexx commandfile which is started is named: startrx2.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc=RexxStart( + 2, /* number of arguments */ + arg, /* array of arguments */ + "startrx2.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample where the directory listing of the \n"); + printf("actual directory is returned by the Rexx program. The \n"); + printf("returned ResultString is displayed\n"); + printf("The Rexx commandfile which is started is named: startrx3.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx3.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample where the instore parameter [0] is \n"); + printf("tested. Instore parameter [0] is loaded with \n"); + printf("a small Open Object Rexx script showing the concurrency feature.\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + instore[0].strptr = const_cast(sync_tst); + instore[0].strlength = strlen(instore[0].strptr); + instore[1].strptr = NULL; + instore[1].strlength = 0; + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + NULL, /* name of Rexx file */ + instore, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("Now instore[1] is loaded with the content of instore[0]. \n"); + printf("It can be used on subsequent calls. instore[0] is set to NULL \n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + instore[0].strptr = NULL; + instore[0].strlength = 0; + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + NULL, /* name of Rexx file */ + instore, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + RexxFreeMemory(instore[1].strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample to show how to use the Rexx MacroSpace facility. \n"); + printf("First of all load_macro.rex is called to load \n"); + printf("the Rexx script macros.rex into Macrospace. The Macrospace- \n"); + printf("name is upload.rex. \n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "load_macro.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("Now the Open Object Rexx script macros.rex (named upload.rex) has been loaded\n"); + printf("into Macrospace. It is now used in the name option of\n"); + printf("the REXXSTART command. \n"); + printf("It is very important that instore paramenter [0] and [1] are\n"); + printf("initialized to NULL rsp. 0 and used as REXXSTART parameters\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + instore[1].strptr = NULL; + instore[1].strlength = 0; + instore[0].strptr = NULL; + instore[0].strlength = 0; + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "upload.rex", /* name of Rexx file */ + instore, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("Finally del_macro.rex is called to delete macros.rex (named upload.rex)\n"); + printf("out of the Open Object Rexx Macrospace.\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rc=RexxStart( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "del_macro.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX1 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX1 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX1 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); +} + diff --git a/modules/api/classic/unix/callrexx/callrexx2.c b/modules/api/classic/unix/callrexx/callrexx2.c new file mode 100644 index 0000000..8420d83 --- /dev/null +++ b/modules/api/classic/unix/callrexx/callrexx2.c @@ -0,0 +1,522 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: CALLREXX2.C */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: Samples of how to invoke the Open Object Rexx*/ +/* interpreter. It loads the Rexx library at */ +/* runtime. */ +/* */ +/* Entry Points: main - main entry point */ +/* */ +/* Input: None */ +/* */ +/* Output: returns from the Open Object Rexx programs */ +/* */ +/*********************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "rexx.h" + +char *pcharTemp; + +int main(int argc, char **argv) +{ + CONSTRXSTRING arg[4]; /* argument string for Rexx */ + RXSTRING rexxretval; /* return value from Rexx */ + RXSTRING instore[2]; /* in storage parms */ + PFNREXXSTART FuncAddress; + void *pLibHandle = NULL; /* Library handle */ + RexxReturnCode rc = 0; /* return code from Rexx */ + short rexxrc = 0; /* return code from function */ +#ifdef __APPLE__ + const char *pszLibraryName = "librexx.dylib"; /* define the library name */ +#else + const char *pszLibraryName = "librexx.so"; /* define the library name */ +#endif + char returnBuffer[100]; + int ignore; // avoid warning: ignoring return value of 'system' + // avoid warning: ignoring return value of 'scanf' + + char val; + const char *str1 = "Arg number one"; /* text to swap */ + const char *str2 = "Arg number two"; /* text to swap */ + const char *str3 = "Arg number three"; /* text to swap */ + const char *str4 = "Arg number four"; /* text to swap */ + + const char *sync_tst = "call time 'Reset';" \ + "object1 = .example~new;" \ + "object2 = .example~new;" \ + "object3 = .example~new;" \ + "a.1 = object1~start('REPEAT', 4 , 'Object 1 running');" \ + "say a.1~result;" \ + "say 'The result method waits until the START message has completed:';" \ + "a.2 = object2~start('REPEAT', 2, 'Object 2 running');" \ + "a.3 = object3~start('REPEAT', 2, 'Object 3 running');" \ + "say a.2~result;" \ + "say a.3~result;" \ + "say 'main ended';" \ + "say 'Elapsed time: ' time('E');" \ + "exit;" \ + "::REQUIRES 'example.rex'"; + + if (!(pLibHandle = dlopen(pszLibraryName, RTLD_LAZY ))) + { /* Load and resolve symbols immediately */ + fprintf(stderr, " *** Unable to load library %s !\nError message: %s\n", + pszLibraryName, dlerror()); + return 99; + } + + if(!(FuncAddress = (PFNREXXSTART) dlsym(pLibHandle, "RexxStart"))) + { + rc = 1; /* could not resolve */ + fprintf(stderr, " *** Unable to load function %s !\nError message: %s\n", + "RexxStart", dlerror()); + return 99; + } + + + /* By setting the strlength of the Rexx output to zero, the */ + /* interpreter allocates memory. */ + /* We can provide a buffer for the interpreter to use instead. */ + /* If the returned value does not fit into the buffer, */ + /* Open Object Rexx creates a new one. */ + + ignore = system("clear"); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + printf("This is an easy sample of how to invoke the Rexx interpreter. \n"); + printf("The Rexx commandfile which is started is named: startrx1.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + + /* This is the interpreter invocation. ------------------------------ */ + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx1.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + if (rexxretval.strptr != NULL) + { + RexxFreeMemory(rexxretval.strptr); + } + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("In this case a previously defined Resultstring is \n"); + printf("delivered to Open Object Rexx, which is large enough to \n"); + printf("hold the Return Value of the Rexx commandfile.\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = returnBuffer; + rexxretval.strlength = sizeof(returnBuffer); + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx1.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("rexxretval.strptr contains %s\n", rexxretval.strptr); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + /* if Rexx needed to allocate a new buffer, release that one */ + if (rexxretval.strptr != returnBuffer) + { + RexxFreeMemory(rexxretval.strptr); + } + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("In this case a previously defined Resultstring is \n"); + printf("delivered to Open Object Rexx, which is too small to\n"); + printf("hold the Return Value of the Rexx commandfile.\n"); + printf("Rexx reallocates the buffer which needs to be freed.\n"); + printf("in the calling program\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = (char *)returnBuffer; + rexxretval.strlength = 2; + + printf("The length of the Resultstring is %zd\n", rexxretval.strlength); + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx1.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("The ResultString contains %s after call\n", rexxretval.strptr); + printf("The length is now %zd\n", rexxretval.strlength); + + /* if Rexx needed to allocate a new buffer, release that one */ + if (rexxretval.strptr != returnBuffer) + { + RexxFreeMemory(rexxretval.strptr); + } + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + printf("This is a sample with 4 arguments delivered to \n"); + printf("REXXSTART\n"); + printf("The Rexx commandfile which is started is named: startrx2.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + MAKERXSTRING(arg[0], str1, strlen(str1)); /* create input argument 1 */ + MAKERXSTRING(arg[1], str2, strlen(str2)); /* create input argument 2 */ + MAKERXSTRING(arg[2], str3, strlen(str3)); /* create input argument 3 */ + MAKERXSTRING(arg[3], str4, strlen(str4)); /* create input argument 4 */ + + rc = (*FuncAddress)( + 4, /* number of arguments */ + arg, /* array of arguments */ + "startrx2.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample with 2 arguments delivered to \n"); + printf("REXXSTART\n"); + printf("The Rexx commandfile which is started is named: startrx2.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc = (*FuncAddress)( + 2, /* number of arguments */ + arg, /* array of arguments */ + "startrx2.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample where the directory listing of the \n"); + printf("actual directory is returned by the Rexx program. The \n"); + printf("returned ResultString is displayed\n"); + printf("The Rexx commandfile which is started is named: startrx3.rex\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "startrx3.rex", /* name of Rexx file */ + NULL, /* No INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample where the instore parameter [0] is \n"); + printf("tested. Instore parameter [0] is loaded with \n"); + printf("a small Open Object Rexx script showing the concurrency feature.\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + instore[0].strptr = (char *)sync_tst; + instore[0].strlength = strlen(instore[0].strptr); + instore[1].strptr = NULL; + instore[1].strlength = 0; + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + NULL, /* no name for Rexx file */ + instore, /* INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("Now instore[1] is loaded with the content of instore[0]. \n"); + printf("It can be used on subsequent calls. instore[0] is set to NULL \n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + instore[0].strptr = NULL; + instore[0].strlength = 0; + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + NULL, /* no name for Rexx file */ + instore, /* INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + free(instore[1].strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("This is a sample to show how to use the Rexx MacroSpace facility. \n"); + printf("First of all load_macro.rex is called to load \n"); + printf("the Rexx script macros.rex into Macrospace. The Macrospace- \n"); + printf("name is upload.rex. \n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "load_macro.rex", /* name for Rexx macrospacefile*/ + NULL, /* INSTORE not used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("Now the Open Object Rexx script macros.rex (named upload.rex) has been loaded\n"); + printf("into Macrospace. It is now used in the name option of\n"); + printf("the REXXSTART command. \n"); + printf("It is very important that instore paramenter [0] and [1] are\n"); + printf("initialized to NULL rsp. 0 and used as REXXSTART parameters\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rexxretval.strptr = NULL; /* initialize return-pointer to empty */ + rexxretval.strlength = 0; /* initialize return-length to zero */ + + instore[1].strptr = NULL; + instore[1].strlength = 0; + instore[0].strptr = NULL; + instore[0].strlength = 0; + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "upload.rex", /* name for Rexx macrospacefile */ + instore, /* INSTORE used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + free(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + + printf("Finally del_macro.rex is called to delete macros.rex (named upload.rex)\n"); + printf("out of the Open Object Rexx Macrospace.\n"); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + rc = (*FuncAddress)( + 0, /* number of arguments */ + NULL, /* array of arguments */ + "del_macro.rex", /* name for Rexx macrospacefile */ + NULL, /* INSTORE not used */ + "ksh", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + NULL, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("CALLREXX2 - Back from REXXSTART: Return Code: %d\n", rc); + printf("CALLREXX2 - RESULT-LENGTH: %zd\n", rexxretval.strlength); + printf("CALLREXX2 - RESULT-Value: %s\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); + + printf("Press Enter to continue\n"); + ignore = scanf("%c", &val); + + ignore = system("clear"); + return 0; +} + diff --git a/modules/api/classic/unix/callrexx/del_macro.rex b/modules/api/classic/unix/callrexx/del_macro.rex new file mode 100755 index 0000000..3a82ee7 --- /dev/null +++ b/modules/api/classic/unix/callrexx/del_macro.rex @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: del_macro */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + +call RxFuncAdd 'SysLoadFuncs', 'rexxutil', 'SysLoadFuncs' +call SysLoadFuncs +say 'start deleting macro' +rc = SysDropRexxMacro('upload.rex') +say 'I have deleted macros.rex named upload.rex from the Macrospace. Rc = 'rc +say time('E') +exit diff --git a/modules/api/classic/unix/callrexx/example.rex b/modules/api/classic/unix/callrexx/example.rex new file mode 100755 index 0000000..644fe40 --- /dev/null +++ b/modules/api/classic/unix/callrexx/example.rex @@ -0,0 +1,55 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: example */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + +::class example public +::method repeat + expose loops + use arg reps, msg + do reps + say msg + end + return 'Repeated' msg',' reps 'times.' diff --git a/modules/api/classic/unix/callrexx/load_macro.rex b/modules/api/classic/unix/callrexx/load_macro.rex new file mode 100755 index 0000000..42b4735 --- /dev/null +++ b/modules/api/classic/unix/callrexx/load_macro.rex @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: load_macro */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + +trace o +call RxFuncAdd 'SysLoadFuncs', 'rexxutil', 'SysLoadFuncs' +call SysLoadFuncs +rc = SysAddRexxMacro('upload.rex','macros.rex') +say 'i have added macros.rex with name upload.rex to the Macrospace. RC = ' rc +exit + diff --git a/modules/api/classic/unix/callrexx/macros.rex b/modules/api/classic/unix/callrexx/macros.rex new file mode 100755 index 0000000..62797e2 --- /dev/null +++ b/modules/api/classic/unix/callrexx/macros.rex @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: macros.rex */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + +do 10 + say "Now inside the file macros.rex which is located in the REXX Macrospace" + say "and named upload.rex" +end +exit diff --git a/modules/api/classic/unix/callrexx/startrx1.rex b/modules/api/classic/unix/callrexx/startrx1.rex new file mode 100755 index 0000000..c6eeb82 --- /dev/null +++ b/modules/api/classic/unix/callrexx/startrx1.rex @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: startrx1.rex */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + + +say ' ' +say ' Now inside startrx1.rex which can perform' +say ' tasks which are suitable for Open Object Rexx'. +say ' The return value is 99999999' +say ' ' +say ' ' + +exit 99999999 + diff --git a/modules/api/classic/unix/callrexx/startrx2.rex b/modules/api/classic/unix/callrexx/startrx2.rex new file mode 100755 index 0000000..8885be1 --- /dev/null +++ b/modules/api/classic/unix/callrexx/startrx2.rex @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: startrx2.rex */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + + +tmp = 0 +value = arg() + +say ' ' +say ' Now inside startrx2.rex. The amount of arguments ' +say ' delivered from the calling routine: ' value +say ' ' +say ' ' +do while(value > 0) + tmp = tmp +1 + value = value-1 + say ' content of argument' || tmp ':' arg(tmp) +end +say ' ' + +exit 0 + diff --git a/modules/api/classic/unix/callrexx/startrx3.rex b/modules/api/classic/unix/callrexx/startrx3.rex new file mode 100755 index 0000000..3e7bd38 --- /dev/null +++ b/modules/api/classic/unix/callrexx/startrx3.rex @@ -0,0 +1,67 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: startrx3.rex */ +/* */ +/* ----------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/*********************************************************************/ + +value_back = '' + +new_queue = rxqueue('create', 'test_queue') +old_queue = rxqueue('set', new_queue) + +address ksh 'ls -al | rxqueue' new_queue + +say 'Open Object Rexx has queued the filenames of the actual directory' +say 'in the queue ' new_queue'. Number of Elements in the queue: ' queued() + +do while queued() > 0 + parse pull element + value_back = value_back || '0A'x || element +end + +call rxqueue 'delete', new_queue +call rxqueue 'set', old_queue + +exit value_back + diff --git a/modules/api/classic/unix/cmake_install.cmake b/modules/api/classic/unix/cmake_install.cmake new file mode 100644 index 0000000..cccf1f5 --- /dev/null +++ b/modules/api/classic/unix/cmake_install.cmake @@ -0,0 +1,123 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/librexxapi1.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE SHARED_LIBRARY PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/api/classic/unix/librexxapi1.so") + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/rexxapi1.c;/api/classic/rexxapi1/readme.txt") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/readme.txt" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/Makefile.apple;/api/classic/rexxapi1/Makefile.linux") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/Makefile.apple" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/Makefile.linux" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/apitest1.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE PROGRAM FILES "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/apitest1.rex") +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/gmgauthier/Projects/code/rexx/api/classic/unix/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/modules/api/classic/unix/rexxapi.README b/modules/api/classic/unix/rexxapi.README new file mode 100644 index 0000000..dcafe90 --- /dev/null +++ b/modules/api/classic/unix/rexxapi.README @@ -0,0 +1,66 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +The API samples in the directories rexxapi1, rexxapi2, rexxapi3 demonstrate how to: + +- Register external functions from within external functions +- How you can provide external functions (written in C) in a library that can + be accessed from Open Object Rexx (after they have been registered) +- How data can be returned from external functions +- How the REXX Variable Pool Interface can be used to access and modify Open + Object Rexx variables + +rexxapi1 +======== +Start: "rexx apitest1.rex" +Description: This sample registers a few functions that produce some screen output or + return some data + +rexxapi2 +======== +Start: "rexx apitest2.rex" +Description: Sets the value of a variable by using the Rexx Variable Pool Interface + + +rexxapi3 +======== +Start: "rexx apitest3.rex" +Description: A more extensive use of the Rexx Variable Pool Interface + + +For more information about the Open Object Rexx API read rexxapi.pdf, "Chapter 2. +Classic Rexx Application Programming Interfaces". diff --git a/modules/api/classic/unix/rexxapi1/CMakeLists.txt b/modules/api/classic/unix/rexxapi1/CMakeLists.txt new file mode 100644 index 0000000..c5713ca --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/CMakeLists.txt @@ -0,0 +1,70 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxapi1) + +#################### rexxapi1 (executable) ######################### +# Sources for rexxapi1 +add_library(rexxapi1 SHARED ${PROJECT_SOURCE_DIR}/rexxapi1.c) +# Include file definition +target_include_directories(rexxapi1 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(rexxapi1 rexx rexxapi) +set_target_properties(rexxapi1 PROPERTIES OUTPUT_NAME "rexxapi1") +install(TARGETS rexxapi1 LIBRARY DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi1 + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) +install(FILES rexxapi1.c readme.txt COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi1) +install(FILES Makefile.apple Makefile.linux COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi1) +install(PROGRAMS ${PROJECT_SOURCE_DIR}/apitest1.rex COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi1) diff --git a/modules/api/classic/unix/rexxapi1/Makefile b/modules/api/classic/unix/rexxapi1/Makefile new file mode 100644 index 0000000..e2ab726 --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/Makefile @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -export-dynamic -shared -nostartfiles + + +# What we want to build. +all: librexxapi1.so + +rexxapi1.o: rexxapi1.c + gcc -c rexxapi1.c $(OOREXX_CFLAGS) -o rexxapi1.o + +librexxapi1.so: rexxapi1.o + gcc rexxapi1.o ${OOREXX_LFLAGS} -o librexxapi1.so + +clean: + rm -f *.so *.o librexxapi1.so + diff --git a/modules/api/classic/unix/rexxapi1/Makefile.apple b/modules/api/classic/unix/rexxapi1/Makefile.apple new file mode 100644 index 0000000..c8280ea --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/Makefile.apple @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -shared -lrexx -lrexxapi + + +# What we want to build. +all: librexxapi1.dylib + +rexxapi1.o: rexxapi1.c + gcc -c rexxapi1.c $(OOREXX_CFLAGS) -o rexxapi1.o + +librexxapi1.dylib: rexxapi1.o + gcc rexxapi1.o ${OOREXX_LFLAGS} -o librexxapi1.dylib + +clean: + rm -f *.so *.o librexxapi1.dylib + diff --git a/modules/api/classic/unix/rexxapi1/Makefile.linux b/modules/api/classic/unix/rexxapi1/Makefile.linux new file mode 100644 index 0000000..e2ab726 --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/Makefile.linux @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -export-dynamic -shared -nostartfiles + + +# What we want to build. +all: librexxapi1.so + +rexxapi1.o: rexxapi1.c + gcc -c rexxapi1.c $(OOREXX_CFLAGS) -o rexxapi1.o + +librexxapi1.so: rexxapi1.o + gcc rexxapi1.o ${OOREXX_LFLAGS} -o librexxapi1.so + +clean: + rm -f *.so *.o librexxapi1.so + diff --git a/modules/api/classic/unix/rexxapi1/apitest1.rex b/modules/api/classic/unix/rexxapi1/apitest1.rex new file mode 100755 index 0000000..a0ea1e7 --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/apitest1.rex @@ -0,0 +1,79 @@ + +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/***************************************************************************/ +/* */ +/* apitest1.rex Open Object Rexx samples */ +/* */ +/* ----------------------------------------------------------------------- */ +/* */ +/* Description: script to test the REXX interpreter API */ +/* */ +/***************************************************************************/ + +say "1a) 'call RxFuncAdd', expecting '0' as result" +Call RxFuncAdd "ApiLoadFuncs", "rexxapi1", "ApiLoadFuncs" +say "1b) result:" result +say "---" + +say "2a) 'call ApiLoadFuncs', null (empty) string expected as result" +Call ApiLoadFuncs +say "2b) result:" result +say "---" + +say "3a) 'call Api_Output_From_C', library version '1.0' expected as result" +call Api_Output_From_C +say "3b) result:" result +say "---" + +say "4a) 'call Api_Output_FROM_REXX', expecting string as result" +call Api_Output_From_REXX +say "4b) result:" result +say "---" + +say "5a) 'res=Api_Exchange_Data(23456,888, a)', expecting '0' as result" +a = 'This is a String' +res=Api_Exchange_Data(23456,888, a) +say "5b) res:" res +say "---" + +say "6a) 'call ApiDeregFunc', no result expected" +call ApiDeregFunc +say "6b) result:" result +say "---" + diff --git a/modules/api/classic/unix/rexxapi1/librexxapi1.so b/modules/api/classic/unix/rexxapi1/librexxapi1.so new file mode 100755 index 0000000..ae56aef Binary files /dev/null and b/modules/api/classic/unix/rexxapi1/librexxapi1.so differ diff --git a/modules/api/classic/unix/rexxapi1/readme.txt b/modules/api/classic/unix/rexxapi1/readme.txt new file mode 100644 index 0000000..7524374 --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/readme.txt @@ -0,0 +1,20 @@ +To run the sample on Linux you may have to set LD_LIBRARY_PATH, e.g.: + + LD_LIBRARY_PATH=`pwd` rexx apitest1.rex + +or + export LD_LIBRARY_PATH=`pwd` + rexx apitest1.rex + +--- + +To compile on Linux use Makefile.linux: + + make -f Makefile.linux clean + make -f Makefile.linux + +To compile on MacOS use Makefile.apple: + + make -f Makefile.apple clean + make -f Makefile.apple + diff --git a/modules/api/classic/unix/rexxapi1/rexxapi1.c b/modules/api/classic/unix/rexxapi1/rexxapi1.c new file mode 100644 index 0000000..5bffe14 --- /dev/null +++ b/modules/api/classic/unix/rexxapi1/rexxapi1.c @@ -0,0 +1,269 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/***************************************************************************/ +/* */ +/* rexxasp1.c Open Object Rexx samples */ +/* */ +/* ----------------------------------------------------------------------- */ +/* */ +/* Description: functions used by Open Object REXX script */ +/* */ +/***************************************************************************/ + +#include +#include +#include + +#include + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + +#ifdef __cplusplus +extern "C" { +#endif + +/*********************************************************************/ +/* ApiFncTable */ +/* Array of names of the REXXASP1 functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ +static const char *ApiFncTable[] = + { + "Api_Output_From_C", + "Api_Output_From_REXX", + "Api_Exchange_Data", + "ApiDeregFunc" + }; + + +/************************************************************************* +* Function: ApiLoadFuncs * +* * +* Syntax: call ApiLoadFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +RexxReturnCode REXXENTRY ApiLoadFuncs( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int entries; /* Num of entries */ + int j; /* Counter */ + + + entries = sizeof(ApiFncTable)/sizeof(const char *); + + for (j = 0; j < entries; j++) + { + RexxRegisterFunctionDll(ApiFncTable[j], "rexxapi1", ApiFncTable[j]); + } + + retstr->strlength = 0; /* return null string */ + + return VALID_ROUTINE; +} + + + +/************************************************************************* +* Function: ApiDeregFunc * +* * +* Syntax: call ApiDeregFuncs * +* * +* Params: none * +* * +* Return: no return value * +*************************************************************************/ + +RexxReturnCode REXXENTRY ApiDeregFunc( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int entries; /* Num of entries */ + int j; /* Counter */ + + retstr->strptr = NULL; /* no return value */ + + if (numargs > 0) + return INVALID_ROUTINE; + + + entries = sizeof(ApiFncTable)/sizeof(const char *); + + for (j = 0; j < entries; j++) + { + RexxDeregisterFunction(ApiFncTable[j]); + } + + return VALID_ROUTINE; +} + + + +/************************************************************************* +* Function: Api_Output_From_C * +* * +* Syntax: call Api_Output_From_C * +* * +* Params: none * +* * +* Return: Version of this Api support DLL * +*************************************************************************/ + +RexxReturnCode REXXENTRY Api_Output_From_C( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + + if (numargs > 0) + { + strcpy(retstr->strptr, "Api_OutPut_From_C does not support any Arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + printf("This Output is generated and displayed by the C-function Api_Output_From_C\n"); + fflush(NULL); + + strcpy(retstr->strptr, "1.0"); /* set return value to be "1.0" */ + retstr->strlength = 3; + + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: Api_Output_From_REXX * +* * +* Syntax: call Api_Output_From_C * +* * +* Params: none * +* * +* Return: String to be output by Rexx * +*************************************************************************/ + +RexxReturnCode REXXENTRY Api_Output_From_REXX( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + if (numargs > 0) + { + strcpy(retstr->strptr, "Api_Output_From_REXX does not support any Arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + strcpy(retstr->strptr, "This Output is generated by the C-function Api_Output_From_REXX and displayed by REXX"); + retstr->strlength = strlen(retstr->strptr); + + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: Api_Exchange_Data * +* * +* Syntax: call Api_Exchange_Data startsect, numsects, outbuf * +* * +* Params: parm1 - numeric value given by REXX * +* parm2 - numeric value given by REXX * +* outbuf - variable given by REXX * +* * +* Return: 0 - success, 1 - failure * +*************************************************************************/ + +RexxReturnCode REXXENTRY Api_Exchange_Data( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int parm1 = 0; + int parm2 = 0; + char outbuf[255]; + + /* we expect 3 arguments */ + + if (numargs != 3 ) + { + printf("Api_Exchange_Data function expects 3 arguments, instead received: %lu\n", numargs); + fflush(NULL); + strcpy(retstr->strptr, "1"); // return failure + retstr->strlength = 1; + return VALID_ROUTINE; + } + + /* read the values from the parameters */ + + parm1 = atoi(args[0].strptr); + parm2 = atoi(args[1].strptr); + strcpy(outbuf, args[2].strptr); + + printf("Api_Exchange_Data function has received following arguments:\n\tArgument 1: %d\n\tArgument 2: %d\n\tArgument 3: %s\n", + parm1, parm2, outbuf); + fflush(NULL); + + strcpy(retstr->strptr, "0"); // return success + retstr->strlength = 1; + + return VALID_ROUTINE; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/api/classic/unix/rexxapi1/rexxapi1.o b/modules/api/classic/unix/rexxapi1/rexxapi1.o new file mode 100644 index 0000000..5015e02 Binary files /dev/null and b/modules/api/classic/unix/rexxapi1/rexxapi1.o differ diff --git a/modules/api/classic/unix/rexxapi2/CMakeLists.txt b/modules/api/classic/unix/rexxapi2/CMakeLists.txt new file mode 100644 index 0000000..5709e05 --- /dev/null +++ b/modules/api/classic/unix/rexxapi2/CMakeLists.txt @@ -0,0 +1,66 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxapi2) + +#################### rexxapi2 (executable) ######################### +# Sources for rexxapi2 +add_library(rexxapi2 SHARED ${PROJECT_SOURCE_DIR}/rexxapi2.c) +# Include file definition +target_include_directories(rexxapi2 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(rexxapi2 rexx rexxapi) +install(TARGETS rexxapi2 LIBRARY DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi2) +install(FILES rexxapi2.c readme.txt Makefile.linux Makefile.apple COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi2) +install(PROGRAMS ${PROJECT_SOURCE_DIR}/apitest2.rex COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi2) diff --git a/modules/api/classic/unix/rexxapi2/Makefile.apple b/modules/api/classic/unix/rexxapi2/Makefile.apple new file mode 100644 index 0000000..dc89a5b --- /dev/null +++ b/modules/api/classic/unix/rexxapi2/Makefile.apple @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -shared -lrexx -lrexxapi + + +# What we want to build. +all: librexxapi2.dylib + +rexxapi22.o: rexxapi2.c + gcc -c rexxapi2.c $(OOREXX_CFLAGS) -o rexxapi2.o + +librexxapi2.dylib: rexxapi2.o + gcc rexxapi2.o ${OOREXX_LFLAGS} -o librexxapi2.dylib + +clean: + rm -f *.so *.o librexxapi2.dylib + diff --git a/modules/api/classic/unix/rexxapi2/Makefile.linux b/modules/api/classic/unix/rexxapi2/Makefile.linux new file mode 100644 index 0000000..acc5bfe --- /dev/null +++ b/modules/api/classic/unix/rexxapi2/Makefile.linux @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -export-dynamic -shared -nostartfiles + + +# What we want to build. +all: librexxapi2.so + +rexxapi2.o: rexxapi2.c + gcc -c rexxapi2.c $(OOREXX_CFLAGS) -o rexxapi2.o + +librexxapi2.so: rexxapi2.o + gcc rexxapi2.o ${OOREXX_LFLAGS} -o librexxapi2.so + +clean: + rm -f *.so *.o librexxapi2.so + diff --git a/modules/api/classic/unix/rexxapi2/apitest2.rex b/modules/api/classic/unix/rexxapi2/apitest2.rex new file mode 100755 index 0000000..92f8c04 --- /dev/null +++ b/modules/api/classic/unix/rexxapi2/apitest2.rex @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/***************************************************************************/ +/* */ +/* apitest2.rex Open Object Rexx samples */ +/* */ +/* ----------------------------------------------------------------------- */ +/* */ +/* Description: */ +/* */ +/* Object REXX starts a C-function that reads all variables that exist */ +/* in the variable pool of a running REXX program. */ +/* */ +/***************************************************************************/ + +Call RxFuncAdd "ApiLoadFuncs2", "rexxapi2", "ApiLoadFuncs2" +Call ApiLoadFuncs2 + +call Api_Fill_REXX_Variable_Pool "ReadBuf" +Say 'Length of Buffer allocated by the C-function: ' Length(ReadBuf) + +Say 'The C-function Api_Fill_REXX_Variable_Pool has put the following data into the buffer: ' + +Do i = 1 To Length(ReadBuf) + Say 'Position in buffer:' i 'Decimal Value:' C2D(SubStr(ReadBuf, i, 1)) 'Hex Value: ' C2X(SubStr(ReadBuf, i, 1)) +End + +call ApiDeregFunc2 + +exit diff --git a/modules/api/classic/unix/rexxapi2/readme.txt b/modules/api/classic/unix/rexxapi2/readme.txt new file mode 100644 index 0000000..c827cc4 --- /dev/null +++ b/modules/api/classic/unix/rexxapi2/readme.txt @@ -0,0 +1,20 @@ +To run the sample on Linux you may have to set LD_LIBRARY_PATH, e.g.: + + LD_LIBRARY_PATH=`pwd` rexx apitest2.rex + +or + export LD_LIBRARY_PATH=`pwd` + rexx apitest2.rex + +--- + +To compile on Linux use Makefile.linux: + + make -f Makefile.linux clean + make -f Makefile.linux + +To compile on MacOS use Makefile.apple: + + make -f Makefile.apple clean + make -f Makefile.apple + diff --git a/modules/api/classic/unix/rexxapi2/rexxapi2.c b/modules/api/classic/unix/rexxapi2/rexxapi2.c new file mode 100644 index 0000000..31be624 --- /dev/null +++ b/modules/api/classic/unix/rexxapi2/rexxapi2.c @@ -0,0 +1,224 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/***************************************************************************/ +/* */ +/* rexxasp2.c Open Object Rexx samples */ +/* */ +/* ----------------------------------------------------------------------- */ +/* */ +/* Description: functions used by Open Object Rexx script */ +/* */ +/***************************************************************************/ + +#include +#include +#include + +#include + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************/ +/* ApiFncTable */ +/* Array of names of the REXXAPI functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ +static const char *ApiFncTable[] = + { + "ApiDeregFunc2", + "Api_Fill_REXX_Variable_Pool" + }; + + +/************************************************************************* +* Function: ApiLoadFuncs2 * +* * +* Syntax: call ApiLoadFuncs2 * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +RexxReturnCode REXXENTRY ApiLoadFuncs2( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int entries; /* Num of entries */ + int j; /* Counter */ + + + entries = sizeof(ApiFncTable)/sizeof(const char *); + + for (j = 0; j < entries; j++) + { + RexxRegisterFunctionDll(ApiFncTable[j], "rexxapi2", ApiFncTable[j]); + } + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: ApiDeregFunc2 * +* * +* Syntax: call ApiDeregFuncs2 * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +RexxReturnCode REXXENTRY ApiDeregFunc2( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int entries; /* Num of entries */ + int j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + + if (numargs > 0) + return INVALID_ROUTINE; + + + entries = sizeof(ApiFncTable)/sizeof(const char *); + + for (j = 0; j < entries; j++) + { + RexxDeregisterFunction(ApiFncTable[j]); + } + return VALID_ROUTINE; +} + + + +/************************************************************************* +* Function: ApiRead * +* * +* Syntax: call Api_Fill_REXX_Variable_Pool * +* * +* Params: outbuf - variable that will be filled with data * +* Return: 0 - success, 1 - failure * +*************************************************************************/ + +RexxReturnCode REXXENTRY Api_Fill_REXX_Variable_Pool( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + char *outbuf = NULL; + char *ptr; + int i; + SHVBLOCK shvb; + + /* we expect 1 argument */ + + if (numargs != 1 ) /* validate arg count */ + { + strcpy(retstr->strptr, "Api_Fill_REXX_Variable_Pool expects 1 Arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + /* preset the return value */ + + strcpy(retstr->strptr, "0"); + retstr->strlength = strlen(retstr->strptr); + + outbuf = (char *) malloc(300); + if (outbuf == NULL) + { + strcpy(retstr->strptr, "Api_Fill_REXX_Variable_Pool received a allocation fault"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + ptr = outbuf; + for (i=0; i<300; i++) + { + *ptr = i % 256; + ptr++; + } + +/* copying the buffer to the Rexx Variable Pool ****************/ + + shvb.shvnext = NULL; + shvb.shvname.strptr = args[0].strptr; + shvb.shvname.strlength = strlen(args[0].strptr); + shvb.shvnamelen = shvb.shvname.strlength; + shvb.shvvalue.strptr = outbuf; + shvb.shvvalue.strlength = 300; + shvb.shvvaluelen = 300; + shvb.shvcode = RXSHV_SYSET; + shvb.shvret = 0; + if (RexxVariablePool(&shvb) == RXSHV_BADN) + { + free(outbuf); + strcpy(retstr->strptr, "1"); + return INVALID_ROUTINE; + } + + free(outbuf); + return VALID_ROUTINE; +} + + +#ifdef __cplusplus +} +#endif + + + diff --git a/modules/api/classic/unix/rexxapi3/CMakeLists.txt b/modules/api/classic/unix/rexxapi3/CMakeLists.txt new file mode 100644 index 0000000..2d83f89 --- /dev/null +++ b/modules/api/classic/unix/rexxapi3/CMakeLists.txt @@ -0,0 +1,66 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxapi3) + +#################### rexxapi3 (executable) ######################### +# Sources for rexxapi3 +add_library(rexxapi3 SHARED ${PROJECT_SOURCE_DIR}/rexxapi3.c) +# Include file definition +target_include_directories(rexxapi3 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(rexxapi3 rexx rexxapi) +install(TARGETS rexxapi3 LIBRARY DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi3) +install(FILES rexxapi3.c readme.txt Makefile.linux Makefile.apple COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi3) +install(PROGRAMS apitest3.rex COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi3) diff --git a/modules/api/classic/unix/rexxapi3/Makefile.apple b/modules/api/classic/unix/rexxapi3/Makefile.apple new file mode 100644 index 0000000..b10f491 --- /dev/null +++ b/modules/api/classic/unix/rexxapi3/Makefile.apple @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -shared -lrexx -lrexxapi + + +# What we want to build. +all: librexxapi3.dylib + +rexxapi3.o: rexxapi3.c + gcc -c rexxapi3.c $(OOREXX_CFLAGS) -o rexxapi3.o + +librexxapi3.dylib: rexxapi3.o + gcc rexxapi3.o ${OOREXX_LFLAGS} -o librexxapi3.dylib + +clean: + rm -f *.so *.o librexxapi3.dylib + diff --git a/modules/api/classic/unix/rexxapi3/Makefile.linux b/modules/api/classic/unix/rexxapi3/Makefile.linux new file mode 100644 index 0000000..60691d2 --- /dev/null +++ b/modules/api/classic/unix/rexxapi3/Makefile.linux @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# A make file that should work on most Unix-like platforms that have gcc + +OOREXX_CFLAGS = -fPIC +OOREXX_LFLAGS = -export-dynamic -shared -nostartfiles + + +# What we want to build. +all: librexxapi3.so + +rexxapi3.o: rexxapi3.c + gcc -c rexxapi3.c $(OOREXX_CFLAGS) -o rexxapi3.o + +librexxapi3.so: rexxapi3.o + gcc rexxapi3.o ${OOREXX_LFLAGS} -o librexxapi3.so + +clean: + rm -f *.so *.o librexxapi3.so + diff --git a/modules/api/classic/unix/rexxapi3/apitest3.rex b/modules/api/classic/unix/rexxapi3/apitest3.rex new file mode 100755 index 0000000..9e5bad3 --- /dev/null +++ b/modules/api/classic/unix/rexxapi3/apitest3.rex @@ -0,0 +1,67 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************************/ +/* */ +/* apitest3.rex Open Object Rexx samples */ +/* */ +/* ----------------------------------------------------------------------------- */ +/* */ +/* Description: */ +/* */ +/* REXX calls the Function Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP */ +/* and hands over the name of a stem. The C-function is able to access the */ +/* variable pool of a running Rexx program and read all elements of that stem. */ +/*********************************************************************************/ + +Call RxFuncAdd "ApiLoadFuncs3", "rexxapi3", "ApiLoadFuncs3" +Call ApiLoadFuncs3 + + +do j = 1 to 100 + x.j = j * j +end + +x.0 = 100 + +--call Api_Read_All_Variables_From_REXX_VP + +call Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP("x.0") + +call ApiDeregFunc3 + +exit diff --git a/modules/api/classic/unix/rexxapi3/readme.txt b/modules/api/classic/unix/rexxapi3/readme.txt new file mode 100644 index 0000000..bae5d0c --- /dev/null +++ b/modules/api/classic/unix/rexxapi3/readme.txt @@ -0,0 +1,20 @@ +To run the sample on Linux you may have to set LD_LIBRARY_PATH, e.g.: + + LD_LIBRARY_PATH=`pwd` rexx apitest3.rex + +or + export LD_LIBRARY_PATH=`pwd` + rexx apitest3.rex + +--- + +To compile on Linux use Makefile.linux: + + make -f Makefile.linux clean + make -f Makefile.linux + +To compile on MacOS use Makefile.apple: + + make -f Makefile.apple clean + make -f Makefile.apple + diff --git a/modules/api/classic/unix/rexxapi3/rexxapi3.c b/modules/api/classic/unix/rexxapi3/rexxapi3.c new file mode 100644 index 0000000..3b1dfa3 --- /dev/null +++ b/modules/api/classic/unix/rexxapi3/rexxapi3.c @@ -0,0 +1,368 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/***************************************************************************/ +/* */ +/* rexxapi3.c Open Object Rexx samples */ +/* */ +/* ----------------------------------------------------------------------- */ +/* */ +/* Description: functions used by Open Object Rexx script */ +/* */ +/***************************************************************************/ + +#include +#include +#include + +#include + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/*********************************************************************/ +/* ApiFncTable */ +/* Array of names of the REXXAPI functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ +static const char *ApiFncTable[] = + { + "Api_Exchange_Data", + "ApiDeregFunc3", + "Api_Read_All_Variables_From_REXX_VP", + "Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP" + }; + + +/************************************************************************* +* Function: ApiLoadFuncs * +* * +* Syntax: call ApiLoadFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +RexxReturnCode REXXENTRY ApiLoadFuncs3( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int entries; /* Num of entries */ + int j; /* Counter */ + + + entries = sizeof(ApiFncTable)/sizeof(const char *); + + for (j = 0; j < entries; j++) + { + RexxRegisterFunctionDll(ApiFncTable[j], "rexxapi3", ApiFncTable[j]); + } + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: ApiDeregFunc * +* * +* Syntax: call ApiDeregFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +RexxReturnCode REXXENTRY ApiDeregFunc3( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int entries; /* Num of entries */ + int j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + + if (numargs > 0) + return INVALID_ROUTINE; + + + entries = sizeof(ApiFncTable)/sizeof(const char *); + + for (j = 0; j < entries; j++) + { + RexxDeregisterFunction(ApiFncTable[j]); + } + return VALID_ROUTINE; +} + +/************************************************************************* +* Function: Api_Read_All_Variables_From_REXX_VP * +* * +* Syntax: call Api_Read_All_Variables_From_REXX_VP * +* * +* Params: No parameter required. The function is called by APITEST. * +* It uses a while loop to read all the variables in the active* +* REXX-variable pool. The shared variable block request code * +* is RXSHV_NEXTV. Be aware that with this request code REXX * +* treads every Stem variable as a variable itself (not the * +* whole stem). This gives the calling C-routine a chance * +* to clear up memory which was previously allocated by REXX * +* for every returned variable. If you don't free memory the * +* system will get out of storage. * +* Be aware that the returned variables are NOT in any spe- * +* cified order. * +* Return: 0 - success, 1 - failure * +*************************************************************************/ + +RexxReturnCode REXXENTRY Api_Read_All_Variables_From_REXX_VP( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + SHVBLOCK *prxshv; + RexxReturnCode rc; + int i = 1; + + strcpy(retstr->strptr, "0"); + retstr->strlength = strlen(retstr->strptr); + + prxshv = (PSHVBLOCK)malloc(sizeof(SHVBLOCK)); + if (!prxshv) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + prxshv->shvnext = NULL; + prxshv->shvname.strlength = 0; + prxshv->shvname.strptr = NULL; + prxshv->shvvalue.strptr = NULL; /*** let Rexx allocate for me ***/ + prxshv->shvcode = RXSHV_NEXTV; + +/* Now reading all variables from the Rexx-variable pool ***********/ + + rc = RexxVariablePool(prxshv); + if (rc) + { + if (rc != RXSHV_LVAR) + { + printf("ERROR: shvret is %x hex after var nr. %d \n",rc,i); + } + } + + printf("Name of the variable from the Variable Pool: %s, Value: %s \n", prxshv->shvname.strptr, prxshv->shvvalue.strptr); + i++; + + while (!prxshv->shvret) + { + + prxshv->shvnext = (PSHVBLOCK)malloc(sizeof(SHVBLOCK)); + prxshv = prxshv->shvnext; + if (!prxshv) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + prxshv->shvnext = NULL; + prxshv->shvname.strlength = 0; + prxshv->shvname.strptr = NULL; + prxshv->shvvalue.strptr = NULL; /*** let Rexx allocate for me ***/ + prxshv->shvcode = RXSHV_NEXTV; + rc = RexxVariablePool(prxshv); + if (rc) + { + if (rc== RXSHV_MEMFL) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + else if (rc != RXSHV_LVAR) + { + printf("ERROR: shvret is %x hex after var nr. %d\n",rc,i); + return INVALID_ROUTINE; + } + } + i++; + printf("Name of the variable from the Variable Pool: %s, Value: %s \n", prxshv->shvname.strptr, prxshv->shvvalue.strptr); + RexxFreeMemory((void *)prxshv->shvname.strptr); + RexxFreeMemory((void *)prxshv->shvvalue.strptr); + } + return VALID_ROUTINE; +} + +/************************************************************************* +* Function: Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP * +* * +* Syntax: call Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP * +* with the stem variable the values should be returned * +* * +* Params: A stem where all values of the stem variables should be * + returned. * +* The shared variable block request code is RXSHV_SYFET. * +* Only ONE call is necessary. If the stem contains to many * +* variables the memory resources are exhausted and Rexx * +* should return RXSHV_MEMFL. There is no change for the * +* calling routine to handle the problem with DosFreeMem * +* because it doesn't get any control before Rexx terminates. * +* The problem is during allocating memory for the values of * +* the stem-variables by DosAllocMem which allocates on 64k * +* boundary. * +* Return: 0 - success, 1 - failure * +*************************************************************************/ + +RexxReturnCode REXXENTRY Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP( + const char *name, /* Function name */ + size_t numargs, /* Number of arguments */ + CONSTRXSTRING args[], /* Argument array */ + const char * queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + SHVBLOCK *prxshv, *temp, *interim, rxshv; + RexxReturnCode rc; + char array[20], value[11]; + char *pch, *result; + int chars; + int j, k = 0; + prxshv = &rxshv; + + if (numargs != 1 ) /* validate arg count */ + return INVALID_ROUTINE; + strcpy(retstr->strptr, "0"); + retstr->strlength = strlen(retstr->strptr); + + pch = (char *) malloc(strlen(args[0].strptr) +1); + strcpy(pch, args[0].strptr); + + prxshv->shvnext = NULL; + prxshv->shvname.strlength = strlen(pch); + prxshv->shvname.strptr = pch; + prxshv->shvvalue.strptr = NULL; /*** let Rexx allocate for me ***/ + prxshv->shvcode = RXSHV_SYFET; + + rc = RexxVariablePool(prxshv); + if (rc) + { + strcpy(retstr->strptr, "APIFETCH failed \n"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + j = atoi(prxshv->shvvalue.strptr); + chars = '.'; + result = strrchr(pch, chars); + result++; + *result = 0x00; + + temp = prxshv; + + memset(array, 0x00, sizeof(array)); + memset(value, 0x00, sizeof(value)); + for (k = 1;k <= j; k++) + { + temp->shvnext = (PSHVBLOCK)malloc(sizeof(SHVBLOCK)); + temp = temp->shvnext; + if (!temp) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + strcpy(array, pch); + sprintf(value, "%d", k); + strcat(array, value); + temp->shvnext = NULL; + temp->shvname.strlength = strlen(array); + temp->shvname.strptr = (char *) malloc(strlen(array)+1); + strcpy((char *)temp->shvname.strptr, array); + temp->shvvalue.strptr = NULL; /*** let Rexx allocate for me ***/ + temp->shvcode = RXSHV_SYFET; + } + rc = RexxVariablePool(prxshv->shvnext); + if (rc) + { + if (rc== RXSHV_MEMFL) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + else if (rc != RXSHV_LVAR) + { + printf("ERROR: shvret is %x hex \n",rc); + return INVALID_ROUTINE; + } + } + temp = prxshv->shvnext; + + for (k = 1;k <= j; k++) + { + printf("Name of the Stem-variable from the Rexx Variable Pool: %s, Value: %s \n", temp->shvname.strptr, temp->shvvalue.strptr); + interim = temp; + RexxFreeMemory((void *)temp->shvname.strptr); + RexxFreeMemory((void *)temp->shvvalue.strptr); + temp = temp->shvnext; + free(interim); + } + + RexxFreeMemory((void *)prxshv->shvvalue.strptr); + free(pch); + + return VALID_ROUTINE; +} + +#ifdef __cplusplus +} +#endif + diff --git a/modules/api/classic/unix/trexx b/modules/api/classic/unix/trexx new file mode 100644 index 0000000..5c8ebd4 --- /dev/null +++ b/modules/api/classic/unix/trexx @@ -0,0 +1,47 @@ +#!/usr/bin/sh +#******************************************************************************* +# +# Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. +# Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. +# +# This program and the accompanying materials are made available under +# the terms of the Common Public License v1.0 which accompanies this +# distribution. A copy is also available at the following address: +# https://www.oorexx.org/license.html +# +# 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. +# +# Neither the name of Rexx Language Association nor the names +# of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# 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 +# OWNER 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. +# +#*****************************************************************************/ +#-->>>__open_up_a_window_and_call_rexx_rexxtry.cmd__<<<-- +echo " A window for rexxtry has been started on host $DISPLAY " +if [ $# != 0 ] + then + A="$1 $2 $3 $4 $5 $6 $7 $8 $9 ;say press enter; pull;" +else + A="" +fi; +xterm -ah -rw -sb -T rexxtry -e rexx rexxtry.cmd $A & diff --git a/modules/api/classic/windows/CMakeLists.txt b/modules/api/classic/windows/CMakeLists.txt new file mode 100644 index 0000000..312f800 --- /dev/null +++ b/modules/api/classic/windows/CMakeLists.txt @@ -0,0 +1,62 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples-windows-api) + +add_subdirectory (callrxnt) +add_subdirectory (callrxwn) +add_subdirectory (rexxexit) +add_subdirectory (rexxapi1) +add_subdirectory (rexxapi2) +add_subdirectory (rexxapi3) + +install(FILES readme.txt COMPONENT Samples DESTINATION ${INSTALL_SAMPLES_DIR}/api/classic ) diff --git a/modules/api/classic/windows/callrxnt/CMakeLists.txt b/modules/api/classic/windows/callrxnt/CMakeLists.txt new file mode 100644 index 0000000..3ea369c --- /dev/null +++ b/modules/api/classic/windows/callrxnt/CMakeLists.txt @@ -0,0 +1,68 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (callrxnt) + +#################### callrxnt (executable) ######################### +# additional source files required by specific platforms +# Sources for callrxnt +add_executable(callrxnt callrxnt.c callrxnt.ico) +# Include file definition +target_include_directories(callrxnt PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(callrxnt rexx rexxapi) +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/callrxnt) +install(TARGETS callrxnt RUNTIME COMPONENT Samples DESTINATION ${DEST}) +install(FILES callrxnt.c callrxnt.ico callrxnt.mak COMPONENT Samples DESTINATION ${DEST}) +install(PROGRAMS ${PROJECT_SOURCE_DIR}/backward.fnc COMPONENT Samples DESTINATION ${DEST}) diff --git a/modules/api/classic/windows/callrxnt/backward.fnc b/modules/api/classic/windows/callrxnt/backward.fnc new file mode 100644 index 0000000..979ee6c --- /dev/null +++ b/modules/api/classic/windows/callrxnt/backward.fnc @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* BACKWARD.FNC - Reverse the words in a string */ +/* */ +/* This program is called by CALLRXNT.EXE. */ +/* */ +/* Input: A string of words */ +/* */ +/* Output: A string containing the same words but in opposite order */ +/* */ +/*********************************************************************/ + +Parse Arg Data /* get argument string */ +OutString = '' /* initialize output to empty */ +Count = Words(Data) /* find number of words */ +Do i = Count To 1 By -1 /* for each word in string */ + OutString = OutString Word(Data,i) /* add word to output string*/ + End /* end do */ +Return Strip(OutString) /* return reversed string, */ + /* removing any blanks on the */ + /* front or back. */ diff --git a/modules/api/classic/windows/callrxnt/callrxnt.c b/modules/api/classic/windows/callrxnt/callrxnt.c new file mode 100644 index 0000000..c7a67fd --- /dev/null +++ b/modules/api/classic/windows/callrxnt/callrxnt.c @@ -0,0 +1,102 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: CALLRXNT.C */ +/* */ +/* Description: Provides a sample call to the REXX */ +/* interpreter, passing in an environment name, */ +/* a file name, and a single argument string. */ +/* */ +/* Entry Points: main - main entry point */ +/* */ +/* Input: None */ +/* */ +/* Output: returns 0 in all cases. */ +/* */ +/*********************************************************************/ + +#include /* needed for RexxStart() */ +#include /* needed for printf() */ +#include /* needed for strlen() */ + +int main() +{ + CONSTRXSTRING arg; /* argument string for REXX */ + RXSTRING rexxretval; /* return value from REXX */ + + char *str = "These words will be swapped"; /* text to swap */ + + RexxReturnCode rc; /* return code from REXX */ + short rexxrc = 0; /* return code from function */ + + printf("\nThis program will call the REXX interpreter "); + printf("to reverse the order of the\n"); + printf("\twords in a string. "); + printf("The interpreter is invoked with an initial\n"); + printf("\tenvironment name of 'FNC' "); + printf("and a file name of 'BACKWARD.FNC'\n\n"); + + /* By setting the strlength of the output RXSTRING to zero, we */ + /* force the interpreter to allocate memory and return it to us. */ + /* We could provide a buffer for the interpreter to use instead. */ + rexxretval.strlength = 0L; /* initialize return to empty*/ + + MAKERXSTRING(arg, str, strlen(str));/* create input argument */ + + /* Here we call the interpreter. */ + rc=RexxStart(1, /* number of arguments */ + &arg, /* array of arguments */ + "BACKWARD.FNC", /* name of REXX file */ + 0, /* No INSTORE used */ + "FNC", /* Command env. name */ + RXSUBROUTINE, /* Code for how invoked */ + 0, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval ); /* Rexx program output */ + + printf("Interpreter Return Code: %d\n", rc); + printf("Function Return Code: %d\n", (int) rexxrc); + printf("Original String: '%s'\n", arg.strptr); + printf("Backwards String: '%s'\n", rexxretval.strptr); + + RexxFreeMemory(rexxretval.strptr); /* Release storage */ + /* given to us by REXX. */ + system("PAUSE"); + return 0; +} diff --git a/modules/api/classic/windows/callrxnt/callrxnt.ico b/modules/api/classic/windows/callrxnt/callrxnt.ico new file mode 100644 index 0000000..319507f Binary files /dev/null and b/modules/api/classic/windows/callrxnt/callrxnt.ico differ diff --git a/modules/api/classic/windows/callrxnt/callrxnt.mak b/modules/api/classic/windows/callrxnt/callrxnt.mak new file mode 100644 index 0000000..4335ad2 --- /dev/null +++ b/modules/api/classic/windows/callrxnt/callrxnt.mak @@ -0,0 +1,65 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file to build the REXX sample program CALLRXNT.EXE. +# This example is a console mode application. +# +# Notes: +# - Make sure the path to rexx.lib and rexxapi.lib is in your LIB environment +# variable +# - Make sure the path to rexx.h is in your INCLUDE environment variable +# - Uses /D_CRT_SECURE_NO_DEPRECATE to eliminate deprecation warnings under +# MS Visual Studio 2005 + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +all: callrxnt.exe + +callrxnt.exe: callrxnt.obj + link callrxnt.obj \ + /NOLOGO /SUBSYSTEM:Console user32.lib comdlg32.lib gdi32.lib kernel32.lib \ + rexx.lib rexxapi.lib + +callrxnt.obj: callrxnt.c + cl callrxnt.c \ + /nologo /D:_X86_ /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /W3 -c -G3 /I. + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 diff --git a/modules/api/classic/windows/callrxwn/CMakeLists.txt b/modules/api/classic/windows/callrxwn/CMakeLists.txt new file mode 100644 index 0000000..26bb507 --- /dev/null +++ b/modules/api/classic/windows/callrxwn/CMakeLists.txt @@ -0,0 +1,68 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (callrxwn) + +#################### callrxwn (executable) ######################### +# Sources for callrxwn +add_executable(callrxwn WIN32 callrxwn.c callrxwn.rc callrxwn.ico) +# Include file definition +target_include_directories(callrxwn PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(callrxwn rexx) +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/callrxwn) +install(TARGETS callrxwn RUNTIME COMPONENT Samples DESTINATION ${DEST}) +install(FILES callrxwn.c callrxwn.h callrxwn.ico callrxwn.mak callrxwn.rc + COMPONENT Samples DESTINATION ${DEST}) +install(PROGRAMS backward.fnc COMPONENT Samples DESTINATION ${DEST}) diff --git a/modules/api/classic/windows/callrxwn/backward.fnc b/modules/api/classic/windows/callrxwn/backward.fnc new file mode 100644 index 0000000..afee5a6 --- /dev/null +++ b/modules/api/classic/windows/callrxwn/backward.fnc @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* BACKWARD.FNC - Reverse the words in a string */ +/* */ +/* This program is called by CALLRXWN.EXE. */ +/* */ +/* Input: A string of words */ +/* */ +/* Output: A string containing the same words but in opposite order */ +/* */ +/*********************************************************************/ + +Parse Arg Data /* get argument string */ +OutString = '' /* initialize output to empty */ +Count = Words(Data) /* find number of words */ +Do i = Count To 1 By -1 /* for each word in string */ + OutString = OutString Word(Data,i) /* add word to output string */ + End /* end do */ +Return Strip(OutString) /* return reversed string, */ + /* removing any blanks on the */ + /* front or back. */ diff --git a/modules/api/classic/windows/callrxwn/callrxwn.c b/modules/api/classic/windows/callrxwn/callrxwn.c new file mode 100644 index 0000000..87002b9 --- /dev/null +++ b/modules/api/classic/windows/callrxwn/callrxwn.c @@ -0,0 +1,265 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* +/* File Name: CALLRXWN - Windows application +/* +/* Description: Provides a sample call to the REXX +/* interpreter, passing in an environment name, +/* a file name, and a single argument string. +/* +/* A dialog box is created for the output. +/* Note that you must define a REXX standard +/* input and output exit handler for Windows +/* applications. Console applications are +/* not required to do this. +/* +/* +/* Entry Points: main - main entry point +/* RexxIOExit - REXX input and output exit +/* +/* Input: None +/* +/* Output: returns 0 in all cases. +/* +\*********************************************************************/ + +#include /* needed for RexxStart() */ +#include /* needed for printf() */ +#include /* needed for strlen() */ +#include "callrxwn.h" /* prototypes, globals, const */ + +/*********************************************************************\ +* +* function: WinMain() +* +* input parameters: c.f. generic sample +* +\**********************************************************************/ +int REXXENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpCmdLine, int nCmdShow) +{ +int ret; + + UNREFERENCED_PARAMETER( hPrevInstance ); + UNREFERENCED_PARAMETER( lpCmdLine ); + UNREFERENCED_PARAMETER( nCmdShow); + // create a dialog box for REXX STDIO + ret = (int)DialogBox (hInstance, MAKEINTRESOURCE(IDD_CALLREXX_DLG), NULL, (DLGPROC)MainDlgProc); + return ret; +} + +/**********************************************************************\ +* +* function: MainDlgProc() +* +* input parameters: standard window procedure parameters. +* +* Description: at initialization time, call CallRexx routine to do +* rexxstart +* +\**********************************************************************/ +LRESULT CALLBACK MainDlgProc(HWND hwnd, WORD msg, WPARAM wParam, LPARAM lParam) +{ + + UNREFERENCED_PARAMETER(lParam); + + + switch (msg) { + + case WM_INITDIALOG: { + gHwnd=hwnd; // Save handle for exits + (VOID)CallRexx(hwnd); // call RexxStart + } break; + + + /******************************************************************\ + * WM_SYSCOMMAND + * + * ignore all syscommand messages, except for SC_CLOSE. + * on this one, call EndDialog(). + \******************************************************************/ + case WM_SYSCOMMAND: + if (wParam == SC_CLOSE) { + EndDialog (hwnd, TRUE); + return TRUE; + } else + return FALSE; + break; + + + default: return FALSE; + } /* end switch(message) */ + return 0; +} + + +/*********************************************************************\ +* function: CallRexx() +* +* Description: Provides a sample call to the REXX +* interpreter, passing in an environment name, +* a file name, and a single argument string. +* +* input parameters: +* hwnd - parent of the list box with the info. +* +* output: +* returns 0 +* +* +\*********************************************************************/ +int CallRexx(HWND hwnd) +{ + + RXSYSEXIT exitlist[9]; /* Exit list array */ + CONSTRXSTRING arg; /* argument string for REXX */ + RXSTRING rexxretval; /* return value from REXX */ + + CHAR *str = "These words will be swapped"; /* text to swap */ + + RexxReturnCode rc; /* return code from REXX */ + SHORT rexxrc = 0; /* return code from function */ + CHAR *chTextOut[]={ + "This program will call the REXX interpreter to reverse ", + " the order of the words in a string. The interpreter ", + " is invoked with an initial environment name of 'FNC'", + " and a file name of 'BACKWARD.FNC'" , + "" , + "Below is the result of invoking the interpreter:" , + "" , + "The example is finished, close the" , + "dialog when convenient." , + "" + }; + SHORT sIndex; /* index into output text */ + + /* put info text on dialog */ + for (sIndex=0; sIndex < 7; sIndex++) { + SendDlgItemMessage (hwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)chTextOut[sIndex] ); + } + + /* By setting the strlength of the output RXSTRING to zero, we */ + /* force the interpreter to allocate memory and return it to us. */ + /* We could provide a buffer for the interpreter to use instead. */ + rexxretval.strlength = 0L; /* initialize return to empty */ + + MAKERXSTRING(arg, str, strlen(str));/* create input argument */ + + /* register exit handler */ + rc = RexxRegisterExitExe("RexxIOExit", + (REXXPFN)&RexxIOExit, /* located at this address */ + NULL); + + /* set up for RXSIO exit */ + exitlist[0].sysexit_name = "RexxIOExit"; + exitlist[0].sysexit_code = RXSIO; + exitlist[1].sysexit_code = RXENDLST; + + /* Here we call the interpreter. */ + rc=RexxStart(1, /* number of arguments */ + &arg, /* array of arguments */ + "BACKWARD.FNC", /* name of REXX file */ + 0, /* No INSTORE used */ + "FNC", /* Command env. name */ + RXSUBROUTINE, /* Code for how invoked */ + exitlist, /* No EXITs on this call */ + &rexxrc, /* Rexx program output */ + &rexxretval); /* Rexx program output */ + + /* send rc info to dialog box */ + wsprintf (chTxtBuffer," %s %d", "Interpreter Return Code:", rc); + SendDlgItemMessage (hwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)chTxtBuffer); + + wsprintf (chTxtBuffer," %s %d", "Function Return Code: ", (int) rexxrc); + SendDlgItemMessage (hwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)chTxtBuffer); + + wsprintf (chTxtBuffer," %s '%s'", "Original String: ", arg.strptr); + SendDlgItemMessage (hwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)chTxtBuffer); + + wsprintf (chTxtBuffer," %s '%s'", "Backwards String: ", rexxretval.strptr); + SendDlgItemMessage (hwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)chTxtBuffer); + + for (sIndex=6; sIndex < 10; sIndex++) { + SendDlgItemMessage (hwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)chTextOut[sIndex] ); + } + + RexxFreeMemory(rexxretval.strptr); /* Release storage */ + /* given to us by REXX. */ + /* remove the exit */ + RexxDeregisterExit("RexxIOExit",NULL); + + return 0; + } + +/*********************************************************************\ +* function: CallRexx() +* +* Description: This is our REXX Standard input and output handler +* +\*********************************************************************/ +int REXXENTRY RexxIOExit( + int ExitNumber, /* code defining exit function*/ + int Subfunction, /* code defining exit subfunc */ + PEXIT parmblock) /* func dependent control bloc*/ +{ + RXSIOSAY_PARM *sparm ; + RXSIOTRC_PARM *tparm ; + + switch (Subfunction) { + case RXSIOSAY: /* write line to standard */ + /* output stream for SAY instr*/ + sparm = ( RXSIOSAY_PARM * )parmblock ; + SendDlgItemMessage (gHwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)sparm->rxsio_string.strptr); + break; + case RXSIOTRC: /* write line to standard */ + /* error stream for trace or */ + /* error messages */ + tparm = ( RXSIOTRC_PARM * )parmblock ; + SendDlgItemMessage (gHwnd, IDC_LISTBOX, LB_ADDSTRING, 0, (LPARAM)tparm->rxsio_string.strptr); + break; + case RXSIOTRD: /* read line from standard */ + /* input stream (PULL) */ + case RXSIODTR: /* read line from standard */ + default: /* input stream for */ + break; /* interactive debug */ + } /* endswitch */ + + return RXEXIT_HANDLED; /* successfully handled */ + +} diff --git a/modules/api/classic/windows/callrxwn/callrxwn.h b/modules/api/classic/windows/callrxwn/callrxwn.h new file mode 100644 index 0000000..cf4a714 --- /dev/null +++ b/modules/api/classic/windows/callrxwn/callrxwn.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* function prototypes. Window procedures first. */ +LRESULT CALLBACK MainDlgProc(HWND hwnd, WORD msg, WPARAM wParam, LPARAM lParam); +int CallRexx(HWND hwnd); +int REXXENTRY RexxIOExit(int ExitNumber, int Subfunction, PEXIT ParmBlock); + +/* global for Window Handle */ +HWND gHwnd; + +/* */ +CHAR chTxtBuffer[128]; /* text buffer for formatting */ + +/* IDs for the dialog box. */ +#define IDI_APP_ICON 1 +#define IDD_CALLREXX_DLG 100 +#define IDC_LISTBOX 200 + diff --git a/modules/api/classic/windows/callrxwn/callrxwn.ico b/modules/api/classic/windows/callrxwn/callrxwn.ico new file mode 100644 index 0000000..fe6573e Binary files /dev/null and b/modules/api/classic/windows/callrxwn/callrxwn.ico differ diff --git a/modules/api/classic/windows/callrxwn/callrxwn.mak b/modules/api/classic/windows/callrxwn/callrxwn.mak new file mode 100644 index 0000000..35622b2 --- /dev/null +++ b/modules/api/classic/windows/callrxwn/callrxwn.mak @@ -0,0 +1,75 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file to build REXX sample program callrxwn.exe. +# This example is a Windows mode (GUI) application. +# +# Notes: +# - Make sure the path to rexx.lib and rexxapi.lib is in your LIB environment +# variable +# - Make sure the path to rexx.h is in your INCLUDE environment variable +# - Uses /D_CRT_SECURE_NO_DEPRECATE to eliminate deprecation warnings under +# MS Visual Studio 2005 + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +TARGET=callrxwn + +all: $(TARGET).exe + +callrxwn.exe: callrxwn.obj callrxwn.res + link callrxwn.obj callrxwn.res \ + /NOLOGO /SUBSYSTEM:Windows user32.lib gdi32.lib winspool.lib \ + comdlg32.lib advapi32.lib ole32.lib oleaut32.lib uuid.lib \ + shell32.lib kernel32.lib \ + rexx.lib rexxapi.lib + +callrxwn.obj: callrxwn.c + @ECHO Compiling $(@B).c + cl callrxwn.c \ + /nologo /D:_X86_ /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /W3 -c + + +callrxwn.res: callrxwn.rc callrxwn.h + @ECHO ResourceCompiling $(@B).res + rc /DWIN32 -r -fo callrxwn.res callrxwn.rc + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 diff --git a/modules/api/classic/windows/callrxwn/callrxwn.rc b/modules/api/classic/windows/callrxwn/callrxwn.rc new file mode 100644 index 0000000..3e496a6 --- /dev/null +++ b/modules/api/classic/windows/callrxwn/callrxwn.rc @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#include +#include "callrxwn.h" + +IDI_APP_ICON ICON "callrxwn.ico" + +// Dialog +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CALLREXX_DLG DIALOGEX 30, 30, 256, 207 +STYLE DS_MODALFRAME | DS_SETFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Call RexxStart" +FONT 10, "Courier", 400, 0, 0 +BEGIN + LISTBOX IDC_LISTBOX, 8, 9, 243, 194, WS_VSCROLL +END diff --git a/modules/api/classic/windows/readme.txt b/modules/api/classic/windows/readme.txt new file mode 100644 index 0000000..9ecd803 --- /dev/null +++ b/modules/api/classic/windows/readme.txt @@ -0,0 +1,134 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +Open Object Rexx API samples + +This is the read me for the three API samples, callrxwn, callrxnt, and +rexxexit. Each sample is installed in its own directory. The wpipe samples +have their own read me file in the wpipe directory. + +The following notes on compiling the samples also apply to the wpipe samples. + +Make files, which are compatible with nmake, are included in each sample +directory so that you can rebuild the samples. In order to use the make files +to build the samples, you must set up the environment variables INCLUDE and +LIB. + +Compilation: +------------ +The environment variable INCLUDE must contain the path to rexx.h as well as +the regular compiler include paths. The rexx.h file is located in the top +level api\ directory of the ooRexx installation. + +Linking: +-------- +The environment variable LIB must contain the path to rexx.lib and rexxapi.lib +as well as the regular compiler library paths. These library files are +included in the same location as rexx.h, that is, in the top level api\ +directory of the ooRexx installation. + +Samples: +-------- + +callrxwn - Windows mode application + + - Provides a sample call to the REXX interpreter, passing + in an environment name, a file name, and a single argument + string. A dialog box is created for the output. + + - Note that you must define a REXX standard input and + output exit handler for a Windows mode application. + This is not necessary for Console mode applications, however. + + +callrxnt - Console mode application + + - Has similar functionality to callrxwn + + - Console mode applications calling Object REXX do not + require input and output exit handlers. + +rexxexit - Console mode application + + - Provides a sample call to the REXX interpreter, passing + in arguments from the command line. A REXX input and + output exit handler is also demonstrated. + + - An example input file, testRexxExit is provided. Using that file + an invocation of rexxexit.exe would look like: + + rexxexit testRexxExit "18 9" + + The two numbers need to be in quotes because rexxexit no more + than two arguments, the input file name and a single argument for + the input file. + +The API samples in the directories WPIPE1, WPIPE2, WPIPE3 demonstrate: + +- How to register external functions from within external functions + +- How you can provide external functions (written in C) in a dynamic link + library that can be accessed from Open Object Rexx (after they have been + registered) + +- How data can be returned from external functions. + +- How the REXX Variable Pool Interface can be used to access and modify Open + Object Rexx variables + +rexxapi1 +======== +Start: "rexx apitest1" +Description: Registers a number of functions that produce some screen output or + return some data. + +rexxapi2 +======== +Start: "rexx apitest2" +Description: Sets the value of a variable by using the REXX Variable Pool + Interface + +rexxapi3 +======== +Start: "rexx apitest3" +Description: Demonstrates a more extensive use of the REXX Variable Pool + Interface + +The demonstrated Open Object Rexx APIs are documented in "Chapter 2. +Classic Rexx Application Programming Interfaces" in rexxapi.pdf, "ooRexx +APIs (Application Programming Interfaces)". + diff --git a/modules/api/classic/windows/rexxapi1/CMakeLists.txt b/modules/api/classic/windows/rexxapi1/CMakeLists.txt new file mode 100644 index 0000000..0689ebc --- /dev/null +++ b/modules/api/classic/windows/rexxapi1/CMakeLists.txt @@ -0,0 +1,68 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxapi1) + +#################### rexxapi1 (executable) ######################### +# Sources for rexxapi1 +add_library(rexxapi1 SHARED rexxapi1.c rexxapi1.def) +# Include file definition +target_include_directories(rexxapi1 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi1) +target_link_libraries(rexxapi1 rexx rexxapi) +install(TARGETS rexxapi1 RUNTIME COMPONENT Samples DESTINATION ${DEST}) +install(FILES rexxapi1.c rexxapi1.def rexxapi1.mak COMPONENT Samples DESTINATION ${DEST}) +install(PROGRAMS apitest1.rex COMPONENT Samples DESTINATION ${DEST}) + diff --git a/modules/api/classic/windows/rexxapi1/apitest1.rex b/modules/api/classic/windows/rexxapi1/apitest1.rex new file mode 100755 index 0000000..578dab7 --- /dev/null +++ b/modules/api/classic/windows/rexxapi1/apitest1.rex @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: apitest1.rex */ +/* Type: ooRexx Script */ +/* Description: calls the external functions provided in REXXAPI1.DLL */ +/* */ +/****************************************************************************/ +Call RxFuncAdd "ApiLoadFuncs", "REXXAPI1", "ApiLoadFuncs" +Call ApiLoadFuncs + +call Api_Output_From_C + +call Api_Output_From_REXX +say RESULT + +Say Api_Exchange_Data(23456,888,"ReadBuf") + +call ApiDeregFunc + +exit diff --git a/modules/api/classic/windows/rexxapi1/rexxapi1.c b/modules/api/classic/windows/rexxapi1/rexxapi1.c new file mode 100644 index 0000000..aa38cb5 --- /dev/null +++ b/modules/api/classic/windows/rexxapi1/rexxapi1.c @@ -0,0 +1,246 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include + +#include + +#include + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + + +/*********************************************************************/ +/* ApiFncTable */ +/* Array of names of the REXXASP1 functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ +static PSZ ApiFncTable[] = + { + "Api_Output_From_C", + "Api_Output_From_REXX", + "Api_Exchange_Data", + "ApiDeregFunc" + }; + + +/************************************************************************* +* Function: ApiLoadFuncs * +* * +* Syntax: call ApiLoadFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +LONG REXXENTRY ApiLoadFuncs( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + + entries = sizeof(ApiFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + { + RexxRegisterFunctionDll(ApiFncTable[j], + "REXXAPI1", ApiFncTable[j]); + } + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: ApiDeregFunc * +* * +* Syntax: call ApiDeregFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +LONG REXXENTRY ApiDeregFunc( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + + if (numargs > 0) + return INVALID_ROUTINE; + + + entries = sizeof(ApiFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + { + RexxDeregisterFunction(ApiFncTable[j]); + } + RexxDeregisterFunction("ApiLoadFuncs"); + return VALID_ROUTINE; +} + + + +/************************************************************************* +* Function: Api_Output_From_C * +* * +* Syntax: call Api_Output_From_C * +* * +* Params: none * +* * +* Return: Version of this API support DLL * +*************************************************************************/ + +LONG REXXENTRY Api_Output_From_C( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + + if (numargs > 0) + { + strcpy(retstr->strptr, "Api_OutPut_From_C does not support any arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + printf("This output was generated and displayed by the C-function Api_Output_From_C\n"); + fflush(NULL); + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: Api_Output_From_REXX * +* * +* Syntax: call Api_Output_From_REXX * +* * +* Params: none * +* * +* Return: Version of this API support DLL * +*************************************************************************/ + +LONG REXXENTRY Api_Output_From_REXX( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + if (numargs > 0) + { + strcpy(retstr->strptr, "Api_OutPut_From_REXX does not support any arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + strcpy(retstr->strptr, "This output was returned from the C-function Api_Output_From_REXX and is displayed by REXX"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; +} + +/************************************************************************* +* Function: Api_Exchange_Data * +* * +* Syntax: call Api_Exchange_Data startsect, numsects, outbuf * +* * +* Params: parm1 - numeric value given by REXX * +* parm2 - numeric value given by REXX * +* outbuf - variable given by REXX * +* * +* Return: 0 - success, 1 - failure * +*************************************************************************/ + +LONG REXXENTRY Api_Exchange_Data( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + int parm1 = 0; + int parm2 = 0; + char outbuf[255]; + + /* we expect 3 arguments */ + + if (numargs != 3 ) + { + strcpy(retstr->strptr, "Api_Exchange_Data function expects 3 arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + strcpy(retstr->strptr, "\0"); + retstr->strlength = strlen(retstr->strptr); + + /* read the values from the parameters */ + + parm1 = atoi(args[0].strptr); + parm2 = atoi(args[1].strptr); + strcpy(outbuf, args[2].strptr); + + printf("Api_Exchange_Data function has received the following arguments: Argument 1: %d, Argument 2: %d, Argument 3 %s\n", + parm1, parm2, outbuf); + fflush(NULL); + + return VALID_ROUTINE; + +} diff --git a/modules/api/classic/windows/rexxapi1/rexxapi1.def b/modules/api/classic/windows/rexxapi1/rexxapi1.def new file mode 100644 index 0000000..8cb4eb0 --- /dev/null +++ b/modules/api/classic/windows/rexxapi1/rexxapi1.def @@ -0,0 +1,7 @@ +LIBRARY rexxapi1 +EXPORTS + APILOADFUNCS = ApiLoadFuncs + APIDEREGFUNC = ApiDeregFunc + API_OUTPUT_FROM_C = Api_Output_From_C + API_OUTPUT_FROM_REXX = Api_Output_From_REXX + API_EXCHANGE_DATA = Api_Exchange_Data diff --git a/modules/api/classic/windows/rexxapi1/rexxapi1.mak b/modules/api/classic/windows/rexxapi1/rexxapi1.mak new file mode 100644 index 0000000..23faaef --- /dev/null +++ b/modules/api/classic/windows/rexxapi1/rexxapi1.mak @@ -0,0 +1,61 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file to build the REXX sample REXXAPI1.DLL +# +# Notes: +# Uses /D_CRT_SECURE_NO_DEPRECATE to eliminate deprecation warnings under +# MS Visual Studio 2005 + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +all: rexxapi1.dll + +rexxapi1.dll: rexxapi1.obj + link rexxapi1.obj \ + /NOLOGO user32.lib comdlg32.lib gdi32.lib kernel32.lib \ + rexx.lib rexxapi.lib /DLL /DEF:REXXAPI1.DEF + +rexxapi1.obj: rexxapi1.c + cl rexxapi1.c /nologo /D:_X86_ /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /W3 /I. -c -G3 + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 + diff --git a/modules/api/classic/windows/rexxapi2/CMakeLists.txt b/modules/api/classic/windows/rexxapi2/CMakeLists.txt new file mode 100644 index 0000000..e6c3f4d --- /dev/null +++ b/modules/api/classic/windows/rexxapi2/CMakeLists.txt @@ -0,0 +1,68 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxapi2) + +#################### wpipe1 (executable) ######################### +# Sources for rexxapi2 +add_library(rexxapi2 SHARED ${PROJECT_SOURCE_DIR}/rexxapi2.c + ${PROJECT_SOURCE_DIR}/rexxapi2.def) +# Include file definition +target_include_directories(rexxapi2 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(rexxapi2 rexx rexxapi) +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi2) +install(TARGETS rexxapi2 RUNTIME COMPONENT Samples DESTINATION ${DEST}) +install(FILES rexxapi2.c rexxapi2.def rexxapi2.mak COMPONENT Samples DESTINATION ${DEST}) +install(PROGRAMS apitest2.rex COMPONENT Samples DESTINATION ${DEST}) diff --git a/modules/api/classic/windows/rexxapi2/apitest2.rex b/modules/api/classic/windows/rexxapi2/apitest2.rex new file mode 100755 index 0000000..c63b3fc --- /dev/null +++ b/modules/api/classic/windows/rexxapi2/apitest2.rex @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* Testing the REXX-API *****************************************************************/ +/* */ +/* REXX calls the Function Api_Fill_REXX_Variable_Pool and hands over the name of */ +/* a buffer. The C-function creates a REXX variable with the specified name and */ +/* initializes the variable. REXX is able to access the variable using the buffer name. */ +/* */ +/****************************************************************************************/ + +/****************************************************************************/ +/* Name: apitest2.rex */ +/* Type: ooRexx Script */ +/* Description: */ +/* */ +/* REXX calls the Function Api_Fill_REXX_Variable_Pool and hands over the */ +/* name of a buffer. The C-function creates a REXX variable with the */ +/* specified name and initializes the variable. */ +/* REXX is able to access the variable using the buffer name. */ +/* */ +/****************************************************************************/ + +Call RxFuncAdd "ApiLoadFuncs", "REXXAPI2", "ApiLoadFuncs" +Call ApiLoadFuncs + +call Api_Fill_REXX_Variable_Pool "ReadBuf" +Say 'Length of buffer created by external function: ' Length(ReadBuf) + + +Say 'The C-function Api_Fill_REXX_Variable_Pool has put the following data into the buffer: ' + +Do i = 1 To Length(ReadBuf) + Say 'Position in buffer:' i 'Decimal Value:' C2D(SubStr(ReadBuf, i, 1)) 'Hex Value: ' C2X(SubStr(ReadBuf, i, 1)) +End + +call ApiDeregFunc + +exit diff --git a/modules/api/classic/windows/rexxapi2/rexxapi2.c b/modules/api/classic/windows/rexxapi2/rexxapi2.c new file mode 100644 index 0000000..fd13fbe --- /dev/null +++ b/modules/api/classic/windows/rexxapi2/rexxapi2.c @@ -0,0 +1,207 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include + +#include +#include + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + + +/*********************************************************************/ +/* ApiFncTable */ +/* Array of names of the REXXApi functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ +static PSZ ApiFncTable[] = + { + "Api_Exchange_Data", + "ApiDeregFunc", + "Api_Fill_REXX_Variable_Pool" + }; + + +/************************************************************************* +* Function: ApiLoadFuncs * +* * +* Syntax: call ApiLoadFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +LONG REXXENTRY ApiLoadFuncs( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + + entries = sizeof(ApiFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + { + RexxRegisterFunctionDll(ApiFncTable[j], + "REXXAPI2", ApiFncTable[j]); + } + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: ApiDeregFunc * +* * +* Syntax: call ApiDeregFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +LONG REXXENTRY ApiDeregFunc( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + + if (numargs > 0) + return INVALID_ROUTINE; + + + entries = sizeof(ApiFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + { + RexxDeregisterFunction(ApiFncTable[j]); + } + return VALID_ROUTINE; + RexxDeregisterFunction("ApiLoadFuncs"); +} + + + +/************************************************************************* +* Function: ApiRead * +* * +* Syntax: call Api_Fill_REXX_Variable_Pool * +* * +* Params: outbuf - variable that will be filled with data * +* Return: 0 - success, 1 - failure * +*************************************************************************/ + +LONG REXXENTRY Api_Fill_REXX_Variable_Pool( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + char *outbuf = NULL; + char *ptr; + int i; + SHVBLOCK shvb; + + /* we expect 1 argument */ + + if (numargs != 1 ) /* validate arg count */ + { + strcpy(retstr->strptr, "Api_Fill_REXX_Variable_Pool expects 1 arguments"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + /* preset the return value */ + + strcpy(retstr->strptr, "0"); + retstr->strlength = 1; + + outbuf = malloc(300); + if (outbuf == NULL) + { + strcpy(retstr->strptr, "Memory allocation error in Api_Fill_REXX_Variable_Pool!"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + ptr = outbuf; + for (i=0; i<300; i++) + { + *ptr = i % 256; + ptr++; + } + +/* Create a new variable in the REXX Variable Pool ****************/ + + shvb.shvnext = NULL; + shvb.shvname.strptr = args[0].strptr; + shvb.shvname.strlength = strlen(args[0].strptr); + shvb.shvnamelen = shvb.shvname.strlength; + shvb.shvvalue.strptr = outbuf; + shvb.shvvalue.strlength = 300; + shvb.shvvaluelen = 300; + shvb.shvcode = RXSHV_SYSET; + shvb.shvret = 0; + if (RexxVariablePool(&shvb) == RXSHV_BADN) + { + free(outbuf); + strcpy(retstr->strptr, "1"); + return INVALID_ROUTINE; + } + + free(outbuf); + return VALID_ROUTINE; +} diff --git a/modules/api/classic/windows/rexxapi2/rexxapi2.def b/modules/api/classic/windows/rexxapi2/rexxapi2.def new file mode 100644 index 0000000..4a34b4f --- /dev/null +++ b/modules/api/classic/windows/rexxapi2/rexxapi2.def @@ -0,0 +1,5 @@ +LIBRARY rexxapi2 +EXPORTS + APILOADFUNCS = ApiLoadFuncs + APIDEREGFUNC = ApiDeregFunc + API_FILL_REXX_VARIABLE_POOL = Api_Fill_REXX_Variable_Pool diff --git a/modules/api/classic/windows/rexxapi2/rexxapi2.mak b/modules/api/classic/windows/rexxapi2/rexxapi2.mak new file mode 100644 index 0000000..29dbed2 --- /dev/null +++ b/modules/api/classic/windows/rexxapi2/rexxapi2.mak @@ -0,0 +1,62 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file to build the REXX sample program rexxapi2.dll +# +# Notes: +# Uses /D_CRT_SECURE_NO_DEPRECATE to eliminate deprecation warnings under +# MS Visual Studio 2005 + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +all: rexxapi2.dll + +rexxapi2.dll: rexxapi2.obj + link rexxapi2.obj \ + /NOLOGO user32.lib comdlg32.lib gdi32.lib kernel32.lib \ + rexx.lib rexxapi.lib /DLL /DEF:REXXAPI2.DEF + +rexxapi2.obj: rexxapi2.c + cl rexxapi2.c /nologo /D:_X86_ /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /W3 /I. -c -G3 + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 + + diff --git a/modules/api/classic/windows/rexxapi3/CMakeLists.txt b/modules/api/classic/windows/rexxapi3/CMakeLists.txt new file mode 100644 index 0000000..ccf39fe --- /dev/null +++ b/modules/api/classic/windows/rexxapi3/CMakeLists.txt @@ -0,0 +1,68 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxapi3) + +#################### rexxapi3 (executable) ######################### +# Sources for rexxapi3 +add_library(rexxapi3 SHARED ${PROJECT_SOURCE_DIR}/rexxapi3.c + ${PROJECT_SOURCE_DIR}/rexxapi3.def) +# Include file definition +target_include_directories(rexxapi3 PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/rexxapi3) +target_link_libraries(rexxapi3 rexx rexxapi) +install(TARGETS rexxapi3 RUNTIME COMPONENT Samples DESTINATION ${DEST}) +install(FILES rexxapi3.c rexxapi3.def rexxapi3.mak COMPONENT Samples DESTINATION ${DEST}) +install(PROGRAMS apitest3.rex COMPONENT Samples DESTINATION ${DEST}) diff --git a/modules/api/classic/windows/rexxapi3/apitest3.rex b/modules/api/classic/windows/rexxapi3/apitest3.rex new file mode 100755 index 0000000..7ba7d37 --- /dev/null +++ b/modules/api/classic/windows/rexxapi3/apitest3.rex @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: apitest3.rex */ +/* Type: ooRexx Script */ +/* Description: */ +/* The function Api_Read_All_Variables_From_REXX_VP reads all variables */ +/* from the REXX Variable Pool one by one. */ +/* The function Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP */ +/* reads all elements of a specific stem located in the REXX variable Pool. */ +/* */ +/****************************************************************************/ + +Call RxFuncAdd "ApiLoadFuncs", "REXXAPI3", "ApiLoadFuncs" +Call ApiLoadFuncs + +do j = 1 to 20 + x.j = j * j +end + +x.0 = 20 +RESULT = 0 + +call Api_Read_All_Variables_From_REXX_VP + +call Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP "x.0" + +call ApiDeregFunc + +exit diff --git a/modules/api/classic/windows/rexxapi3/rexxapi3.c b/modules/api/classic/windows/rexxapi3/rexxapi3.c new file mode 100644 index 0000000..2317605 --- /dev/null +++ b/modules/api/classic/windows/rexxapi3/rexxapi3.c @@ -0,0 +1,347 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include + +#include +#include + +/*********************************************************************/ +/* Numeric Return calls */ +/*********************************************************************/ + +#define INVALID_ROUTINE 40 /* Raise Rexx error */ +#define VALID_ROUTINE 0 /* Successful completion */ + + +/*********************************************************************/ +/* ApiFncTable */ +/* Array of names of the REXXApi functions. */ +/* This list is used for registration and deregistration. */ +/*********************************************************************/ +static PSZ ApiFncTable[] = + { + "Api_Exchange_Data", + "ApiDeregFunc", + "Api_Read_All_Variables_From_REXX_VP", + "Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP" + }; + + +/************************************************************************* +* Function: ApiLoadFuncs * +* * +* Syntax: call ApiLoadFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +LONG REXXENTRY ApiLoadFuncs( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + + entries = sizeof(ApiFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + { + RexxRegisterFunctionDll(ApiFncTable[j], + "REXXAPI3", ApiFncTable[j]); + } + return VALID_ROUTINE; +} + + +/************************************************************************* +* Function: ApiDeregFunc * +* * +* Syntax: call ApiDeregFuncs * +* * +* Params: none * +* * +* Return: null string * +*************************************************************************/ + +LONG REXXENTRY ApiDeregFunc( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + INT entries; /* Num of entries */ + INT j; /* Counter */ + + retstr->strlength = 0; /* set return value */ + + if (numargs > 0) + return INVALID_ROUTINE; + + + entries = sizeof(ApiFncTable)/sizeof(PSZ); + + for (j = 0; j < entries; j++) + { + RexxDeregisterFunction(ApiFncTable[j]); + } + RexxDeregisterFunction("ApiLoadFuncs"); + return VALID_ROUTINE; +} + +/************************************************************************* +* Function: Api_Read_All_Variables_From_REXX_VP * +* * +* Syntax: call Api_Read_All_Variables_From_REXX_VP * +* * +* Params: No parameter required. The function is called by Apitest3. * +* It uses a while loop to read all the variables in the active* +* REXX-variable pool. The shared variable block request code * +* is RXSHV_NEXTV. Be aware that with this request code REXX * +* treads every Stem variable as a variable itself (not the * +* whole stem). This gives the calling C-routine a chance * +* to clear up memory which was previously allocated by REXX * +* for every returned variable. If you don't free memory, the * +* system will run out of storage. * +* Be aware that the returned variables are NOT in any spe- * +* cified order. * +*************************************************************************/ + +LONG REXXENTRY Api_Read_All_Variables_From_REXX_VP( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + SHVBLOCK rxshv; + SHVBLOCK *prxshv = &rxshv; + RexxReturnCode rc; + int i = 1; + + strcpy(retstr->strptr, "0"); + retstr->strlength = strlen(retstr->strptr); + + prxshv->shvnext = NULL; + prxshv->shvname.strlength = 0; + prxshv->shvname.strptr = NULL; /* let rexx allocate it for me */ + prxshv->shvvalue.strptr = NULL; /* let rexx allocate it for me */ + /* Another way would be to assign an existing buffer and specify its max. length */ + prxshv->shvcode = RXSHV_NEXTV; + +/* Now reading all variables from the REXX-variable pool ***********/ + + rc = RexxVariablePool(prxshv); + if (rc) + { + if (rc != RXSHV_LVAR) + { + printf("ERROR: shvret is %x hex after var nr. %d \n",rc,i); + return INVALID_ROUTINE; + } + } + + if (prxshv->shvvalue.strlength) + printf("Name of the variable from the Variable Pool: %s, Value: %s \n", prxshv->shvname.strptr, prxshv->shvvalue.strptr); + else + printf("Name of the variable from the Variable Pool: %s, Empty\n", prxshv->shvname.strptr); + i++; + RexxFreeMemory((void *)prxshv->shvname.strptr); /* free pointers allocated by REXX */ + RexxFreeMemory(prxshv->shvvalue.strptr); /* free pointers allocated by REXX */ + + while (!prxshv->shvret) + { + prxshv->shvret = 0; + prxshv->shvnext = NULL; + prxshv->shvname.strlength = 0; + prxshv->shvname.strptr = NULL; /* let rexx allocate it for me */ + prxshv->shvvalue.strptr = NULL; /* let rexx allocate it for me */ + prxshv->shvcode = RXSHV_NEXTV; + rc = RexxVariablePool(prxshv); + if (rc) + { + if (rc== RXSHV_MEMFL) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + else if (rc != RXSHV_LVAR) + { + printf("ERROR: shvret is %x hex after var nr. %d\n",rc,i); + return INVALID_ROUTINE; + } + } + i++; + if (!prxshv->shvret) + { + if (prxshv->shvvalue.strlength) + printf("Name of the variable from the Variable Pool: %s, Value: %s \n", prxshv->shvname.strptr, prxshv->shvvalue.strptr); + else + printf("Name of the variable from the Variable Pool: %s, Empty\n", prxshv->shvname.strptr); + RexxFreeMemory((void *)prxshv->shvname.strptr); /* free pointers allocated by REXX */ + RexxFreeMemory(prxshv->shvvalue.strptr); /* free pointers allocated by REXX */ + } + } + return VALID_ROUTINE; +} + +/************************************************************************* +* Function: Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP * +* * +* Syntax: call Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP * +* with the stem variable the values should be returned * +* * +* Params: A stem where all values of the stem variables should be * +* returned. * +* The shared variable block request code is RXSHV_SYFET. * +* Only ONE call is necessary * +* * +*************************************************************************/ + +LONG REXXENTRY Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP( + PSZ name, /* Function name */ + LONG numargs, /* Number of arguments */ + RXSTRING args[], /* Argument array */ + PSZ queuename, /* Current queue */ + PRXSTRING retstr ) /* Return RXSTRING */ +{ + SHVBLOCK rxshv; + SHVBLOCK *prxshv = &rxshv, *temp, *interim; + RexxReturnCode rc; + char array[20], value[10]; + char pch[64], *result; + char *varName; + + int chars; + int j, k = 0; + + if (numargs != 1 ) /* validate arg count */ + return INVALID_ROUTINE; + strcpy(retstr->strptr, "0"); + retstr->strlength = strlen(retstr->strptr); + + strncpy(pch, args[0].strptr, 64); + + prxshv->shvnext = NULL; + prxshv->shvname.strptr = pch; /* here we use our own buffer that is limited to 64 characters */ + prxshv->shvname.strlength = strlen(pch); + prxshv->shvvalue.strptr = NULL; /* let rexx allocate for me */ + prxshv->shvcode = RXSHV_SYFET; + + rc = RexxVariablePool(prxshv); + if (rc) + { + strcpy(retstr->strptr, "ApiFETCH failed \n"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + + j = atoi(prxshv->shvvalue.strptr); + + chars = '.'; + result = strrchr(pch, chars); + result++; + *result = 0x00; + + temp = prxshv; + + memset(array, 0x00, sizeof(array)); + memset(value, 0x00, sizeof(value)); + for (k = 1;k <= j; k++) + { + temp->shvnext = (PSHVBLOCK)malloc(sizeof(SHVBLOCK)); /* allocate a new node */ + temp = temp->shvnext; + if (!temp) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + strcpy(array, pch); + sprintf(value, "%d", k); + strcat(array, value); + temp->shvnext = NULL; + temp->shvname.strlength = strlen(array); + varName = malloc(strlen(array)+1); + strcpy(varName, array); + temp->shvname.strptr = varName; + temp->shvvalue.strptr = NULL; /* let rexx allocate it for me */ + temp->shvcode = RXSHV_SYFET; + } + + temp = prxshv->shvnext; /* first allocated one */ + rc = RexxVariablePool(temp); + if (rc) + { + if (rc== RXSHV_MEMFL) + { + strcpy(retstr->strptr, "Allocation error occured"); + retstr->strlength = strlen(retstr->strptr); + return VALID_ROUTINE; + } + else if (rc != RXSHV_LVAR) + { + printf("ERROR: shvret is %x hex after var nr. %d\n",rc,k); + return INVALID_ROUTINE; + } + } + + for (k = 1;k <= j; k++) + { + printf("Name of the Stem-variable from the Variable Pool: %s, Value: %s \n", temp->shvname.strptr,temp->shvvalue.strptr); + free((void *)temp->shvname.strptr); /* allocated by us and therefore freed with free */ + RexxFreeMemory(temp->shvvalue.strptr); /* allocated by REXX and therefore freed by RexxFreeMemory */ + interim = temp; + temp = temp->shvnext; /* process next in list */ + free(interim); /* free current node */ + } + RexxFreeMemory(prxshv->shvvalue.strptr); /* allocated by REXX and freed by RexxFreeMemory */ + + return VALID_ROUTINE; +} + diff --git a/modules/api/classic/windows/rexxapi3/rexxapi3.def b/modules/api/classic/windows/rexxapi3/rexxapi3.def new file mode 100644 index 0000000..e827f6a --- /dev/null +++ b/modules/api/classic/windows/rexxapi3/rexxapi3.def @@ -0,0 +1,6 @@ +LIBRARY REXXAPI3 +EXPORTS + APILOADFUNCS = ApiLoadFuncs + APIDEREGFUNC = ApiDeregFunc + API_READ_ALL_VARIABLES_FROM_REXX_VP = Api_Read_All_Variables_From_REXX_VP + API_READ_ALL_ELEMENTS_OF_A_SPECIFIC_STEM_FROM_REXX_VP = Api_Read_All_Elements_Of_A_Specific_Stem_From_REXX_VP diff --git a/modules/api/classic/windows/rexxapi3/rexxapi3.mak b/modules/api/classic/windows/rexxapi3/rexxapi3.mak new file mode 100644 index 0000000..f8258b3 --- /dev/null +++ b/modules/api/classic/windows/rexxapi3/rexxapi3.mak @@ -0,0 +1,60 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file to build the REXX sample program rexxapi3.dll +# +# Notes: +# Uses /D_CRT_SECURE_NO_DEPRECATE to eliminate deprecation warnings under +# MS Visual Studio 2005 + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +all: rexxapi3.dll + +rexxapi3.dll: rexxapi3.obj + link rexxapi3.obj \ + /NOLOGO user32.lib comdlg32.lib gdi32.lib kernel32.lib \ + rexx.lib rexxapi.lib /DLL /DEF:REXXAPI3.DEF + +rexxapi3.obj: rexxapi3.c + cl rexxapi3.c /nologo /D:_X86_ /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /W3 /I. -c -G3 + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 diff --git a/modules/api/classic/windows/rexxexit/CMakeLists.txt b/modules/api/classic/windows/rexxexit/CMakeLists.txt new file mode 100644 index 0000000..68ac3e2 --- /dev/null +++ b/modules/api/classic/windows/rexxexit/CMakeLists.txt @@ -0,0 +1,67 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (rexxexit) + +#################### rexxexit (executable) ######################### +# Sources for rexxexit +add_executable(rexxexit rexxexit.c rexxexit.ico) +# Include file definition +target_include_directories(rexxexit PUBLIC + ${build_api_dir} + ${build_api_platform_dir}) +# Extra link library definitions +target_link_libraries(rexxexit rexx rexxapi) +set (DEST ${INSTALL_SAMPLES_DIR}/api/classic/rexxexit) +install(TARGETS rexxexit RUNTIME COMPONENT Samples DESTINATION ${DEST}) +install(FILES rexxexit.c rexxexit.ico rexxexit.mak COMPONENT Samples DESTINATION ${DEST}) +install(PROGRAMS testRexxExit COMPONENT Samples DESTINATION ${DEST}) diff --git a/modules/api/classic/windows/rexxexit/rexxexit.c b/modules/api/classic/windows/rexxexit/rexxexit.c new file mode 100644 index 0000000..e12e1fa --- /dev/null +++ b/modules/api/classic/windows/rexxexit/rexxexit.c @@ -0,0 +1,168 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2018 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*********************************************************************/ +/* */ +/* File Name: REXXEXIT.C */ +/* */ +/* Description: Provides a sample call to the REXX */ +/* interpreter, passing in an environment name, */ +/* a file name, and a single argument string. */ +/* */ +/* Entry Points: main - main entry point */ +/* */ +/* Input: None */ +/* */ +/* Output: returns 0 in all cases. */ +/* */ +/*********************************************************************/ +#include +#include /* needed for RexxStart() */ +#include /* needed for printf() */ +#include /* needed for strlen() */ + +// +// Prototypes +// +int __cdecl main(int argc, char *argv[]); /* main entry point */ +RexxReturnCode REXXENTRY MY_IOEXIT( int ExitNumber, int Subfunction, PEXIT ParmBlock); + +// +// MAIN program +// +int __cdecl main(int argc, char *argv[]) +{ + RXSYSEXIT exit_list[9]; /* Exit list array */ + short rexxrc = 0; /* return code from rexx */ + int rc; /* actually running program RC */ + CONSTRXSTRING argument; /* rexxstart argument */ + RXSTRING rxretbuf; // program return buffer + + rc = 0; /* set default return */ + + /* just one argument is accepted by this program */ + if ((argc < 2) || (argc > 3)) + { + printf("Wrong arguments: REXXEXIT program [argument]\n"); + exit(-1); + } + + /* + * Convert the input array into a single string for the Object REXX + * argument string. Initialize the RXSTRING variable to point to this + * string. Keep the string null terminated so we can print it for debug. + * First argument is name of the REXX program + * Next argument(s) are parameters to be passed + */ + + /* By setting the strlength of the output RXSTRING to zero, we */ + /* force the interpreter to allocate memory and return it to us. */ + /* We could provide a buffer for the interpreter to use instead. */ + rxretbuf.strlength = 0L; /* initialize return to empty*/ + + if (argc == 3) + { + MAKERXSTRING(argument, argv[2], strlen(argv[2]));/* create input argument */ + } + else + MAKERXSTRING(argument, "", 0);/* create blank argument */ + + // register IO exit + rc = RexxRegisterExitExe("MY_IOC", (REXXPFN)&MY_IOEXIT, NULL); + + /* run this via RexxStart */ + exit_list[0].sysexit_name = "MY_IOC"; + exit_list[0].sysexit_code = RXSIO; + exit_list[1].sysexit_code = RXENDLST; + + /* Here we call the interpreter. */ + rc=REXXSTART(1, /* number of arguments */ + &argument, /* array of arguments */ + argv[1], /* name of REXX file */ + NULL, /* No INSTORE used */ + "CMD", /* Command env. name */ + RXCOMMAND, /* Code for how invoked */ + exit_list, /* exits for this call */ + &rexxrc, /* Rexx program output */ + &rxretbuf ); /* Rexx program output */ + + /* free memory allocated for the return result */ + if (rc==0) + { + RexxFreeMemory(rxretbuf.strptr); + } + RexxDeregisterExit("MY_IOC",NULL); // remove the exit in exe exit list + // return interpeter or rexx program return code + return rc ? rc : rexxrc; +} + + +RexxReturnCode REXXENTRY MY_IOEXIT(int ExitNumber, int Subfunction, PEXIT parmblock) +{ + RXSIOSAY_PARM *sparm; + RXSIOTRC_PARM *tparm; + RXSIOTRD_PARM *rparm; + RXSIODTR_PARM *dparm; + + switch (Subfunction) + { + case RXSIOSAY: + sparm = ( RXSIOSAY_PARM * )parmblock ; + printf("%s\n",sparm->rxsio_string.strptr); + break; + case RXSIOTRC: + tparm = ( RXSIOTRC_PARM * )parmblock ; + printf("%s\n",tparm->rxsio_string.strptr); + break; + case RXSIOTRD: + rparm = (RXSIOTRD_PARM * )parmblock ; + gets_s(rparm->rxsiotrd_retc.strptr, rparm->rxsiotrd_retc.strlength); + rparm->rxsiotrd_retc.strlength=strlen(rparm->rxsiotrd_retc.strptr); + break; + case RXSIODTR: + dparm = (RXSIODTR_PARM * )parmblock ; + gets_s(dparm->rxsiodtr_retc.strptr, dparm->rxsiodtr_retc.strlength); + dparm->rxsiodtr_retc.strlength=strlen(dparm->rxsiodtr_retc.strptr); + break; + default: + break; + } + + return RXEXIT_HANDLED; +} + + diff --git a/modules/api/classic/windows/rexxexit/rexxexit.ico b/modules/api/classic/windows/rexxexit/rexxexit.ico new file mode 100644 index 0000000..9c9460e Binary files /dev/null and b/modules/api/classic/windows/rexxexit/rexxexit.ico differ diff --git a/modules/api/classic/windows/rexxexit/rexxexit.mak b/modules/api/classic/windows/rexxexit/rexxexit.mak new file mode 100644 index 0000000..5045623 --- /dev/null +++ b/modules/api/classic/windows/rexxexit/rexxexit.mak @@ -0,0 +1,63 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file to build the REXX sample program rexxexit.exe +# +# Notes: +# Uses /D_CRT_SECURE_NO_DEPRECATE to eliminate deprecation warnings under +# MS Visual Studio 2005 + + +!IF DEFINED(REXX_HOME) +INCLUDE = $(INCLUDE);$(REXX_HOME)\api +LIB = $(LIB);$(REXX_HOME)\api +!ENDIF + +all: rexxexit.exe + +rexxexit.exe: rexxexit.obj + link rexxexit.obj \ + /NOLOGO /SUBSYSTEM:Console user32.lib comdlg32.lib gdi32.lib kernel32.lib \ + rexx.lib rexxapi.lib + +rexxexit.obj: rexxexit.c + cl /Tprexxexit.c \ + /nologo /D:_X86_ /DWIN32 /D_CRT_SECURE_NO_DEPRECATE /W3 /I. -c -G3 + +clean: + del *.exe *.dll *.obj *.ilk *.pdb *.lib *.exp *.suo *.cod 1>nul 2>&1 + diff --git a/modules/api/classic/windows/rexxexit/testRexxExit b/modules/api/classic/windows/rexxexit/testRexxExit new file mode 100644 index 0000000..6b92c71 --- /dev/null +++ b/modules/api/classic/windows/rexxexit/testRexxExit @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * File Name: testRexxExit + * + * Description: Provides an input file for the rexxexit.exe example. This + * particular input file is designed to be used in the Start Menu + * item that is set up by the Windows installation. However, it + * also serves as an input file when rexxexit is run from the + * command prompt. + */ + +say "Hello World!" +say + +num1 = 6 +num2 = 5 + +if arg(1, 'E') then do + say 'Argument:' arg(1) + parse value arg(1) with n1 n2 . + if n1~datatype('W') then num1 = n1 + if n2~datatype('W') then num2 = n2 + + if arg(1)~words <> 2 | \n1~datatype('W') | \n2~datatype('W') then do + say "The argument should be two numbers, in quotes. I.e.:" + say 'rexxexit testRexxExit "6 5"' + say + end +end +else do + say "No argumet." + say "You could pass in two numbers, in quotes. I.e.:" + say 'rexxexit testRexxExit "6 5"' + say +end + +say num1 "+" num2 "is" (num1 + num2) +say +say 'Press ENTER key to exit...' +pull + diff --git a/modules/api/readme.txt b/modules/api/readme.txt new file mode 100644 index 0000000..9345687 --- /dev/null +++ b/modules/api/readme.txt @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + + +readme.txt +---------- + +This directory contains examples that demonstrate how to interact with ooRexx +via the classic ("SAA") application programming interfaces (APIs) and +the powerful ooRexx C++ APIs introduced with ooRexx 4.0. + +The ooRexx API documentation can be found in rexxapi.pdf: + + Chapter 1. Rexx C++ Application Programming Interfaces + Chapter 2. Classic Rexx Application Programming Interfaces + +Clearly, the subdirectory "c++" demonstrates C++ APIs and the subdirectory +"classic" demonstrates the classic SAA APIs. + diff --git a/modules/c++/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/c++/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/c++/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/c++/CMakeFiles/progress.marks b/modules/c++/CMakeFiles/progress.marks new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/modules/c++/CMakeFiles/progress.marks @@ -0,0 +1 @@ +10 diff --git a/modules/c++/Makefile b/modules/c++/Makefile new file mode 100644 index 0000000..3decabb --- /dev/null +++ b/modules/c++/Makefile @@ -0,0 +1,189 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/c++//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/c++/call.example/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/c++/call.example/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/c++/call.example/CMakeFiles/progress.marks b/modules/c++/call.example/CMakeFiles/progress.marks new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/progress.marks @@ -0,0 +1 @@ +4 diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/DependInfo.cmake b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/DependInfo.cmake new file mode 100644 index 0000000..76b9a31 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/runRexxProgram.cpp" "c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o" "gcc" "c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/build.make b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/build.make new file mode 100644 index 0000000..38c3749 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include c++/call.example/CMakeFiles/runRexxProgram.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.make + +# Include the progress variables for this target. +include c++/call.example/CMakeFiles/runRexxProgram.dir/progress.make + +# Include the compile flags for this target's objects. +include c++/call.example/CMakeFiles/runRexxProgram.dir/flags.make + +c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o: c++/call.example/CMakeFiles/runRexxProgram.dir/flags.make +c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o: /home/gmgauthier/Projects/code/rexx/api/c++/call.example/runRexxProgram.cpp +c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o: c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o -MF CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o.d -o CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o -c /home/gmgauthier/Projects/code/rexx/api/c++/call.example/runRexxProgram.cpp + +c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.i" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/c++/call.example/runRexxProgram.cpp > CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.i + +c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.s" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/c++/call.example/runRexxProgram.cpp -o CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.s + +# Object files for target runRexxProgram +runRexxProgram_OBJECTS = \ +"CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o" + +# External object files for target runRexxProgram +runRexxProgram_EXTERNAL_OBJECTS = + +c++/call.example/runRexxProgram: c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o +c++/call.example/runRexxProgram: c++/call.example/CMakeFiles/runRexxProgram.dir/build.make +c++/call.example/runRexxProgram: c++/call.example/CMakeFiles/runRexxProgram.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable runRexxProgram" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/runRexxProgram.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +c++/call.example/CMakeFiles/runRexxProgram.dir/build: c++/call.example/runRexxProgram +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/build + +c++/call.example/CMakeFiles/runRexxProgram.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && $(CMAKE_COMMAND) -P CMakeFiles/runRexxProgram.dir/cmake_clean.cmake +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/clean + +c++/call.example/CMakeFiles/runRexxProgram.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/c++/call.example /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/c++/call.example /home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/runRexxProgram.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/depend + diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/cmake_clean.cmake b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/cmake_clean.cmake new file mode 100644 index 0000000..d2444bc --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o" + "CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o.d" + "runRexxProgram" + "runRexxProgram.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/runRexxProgram.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.make b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.make new file mode 100644 index 0000000..9f09d26 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for runRexxProgram. +# This may be replaced when dependencies are built. diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.ts b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.ts new file mode 100644 index 0000000..4f2c4df --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for runRexxProgram. diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/depend.make b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/depend.make new file mode 100644 index 0000000..29202c2 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for runRexxProgram. +# This may be replaced when dependencies are built. diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/flags.make b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/flags.make new file mode 100644 index 0000000..179c101 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile CXX with /usr/bin/c++ +CXX_DEFINES = + +CXX_INCLUDES = + +CXX_FLAGS = + diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/link.txt b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/link.txt new file mode 100644 index 0000000..6ea6d6a --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ -rdynamic CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o -o runRexxProgram -lrexx -lrexxapi -lrexx -lrexxapi diff --git a/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/progress.make b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/progress.make new file mode 100644 index 0000000..5a7451d --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/runRexxProgram.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 17 +CMAKE_PROGRESS_2 = 18 + diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/DependInfo.cmake b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/DependInfo.cmake new file mode 100644 index 0000000..1e3f9b4 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/stackOverflow.cpp" "c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o" "gcc" "c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/build.make b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/build.make new file mode 100644 index 0000000..cda733f --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include c++/call.example/CMakeFiles/stackOverflow.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.make + +# Include the progress variables for this target. +include c++/call.example/CMakeFiles/stackOverflow.dir/progress.make + +# Include the compile flags for this target's objects. +include c++/call.example/CMakeFiles/stackOverflow.dir/flags.make + +c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o: c++/call.example/CMakeFiles/stackOverflow.dir/flags.make +c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o: /home/gmgauthier/Projects/code/rexx/api/c++/call.example/stackOverflow.cpp +c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o: c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o -MF CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o.d -o CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o -c /home/gmgauthier/Projects/code/rexx/api/c++/call.example/stackOverflow.cpp + +c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/stackOverflow.dir/stackOverflow.cpp.i" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/c++/call.example/stackOverflow.cpp > CMakeFiles/stackOverflow.dir/stackOverflow.cpp.i + +c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/stackOverflow.dir/stackOverflow.cpp.s" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/c++/call.example/stackOverflow.cpp -o CMakeFiles/stackOverflow.dir/stackOverflow.cpp.s + +# Object files for target stackOverflow +stackOverflow_OBJECTS = \ +"CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o" + +# External object files for target stackOverflow +stackOverflow_EXTERNAL_OBJECTS = + +c++/call.example/stackOverflow: c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o +c++/call.example/stackOverflow: c++/call.example/CMakeFiles/stackOverflow.dir/build.make +c++/call.example/stackOverflow: c++/call.example/CMakeFiles/stackOverflow.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable stackOverflow" + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/stackOverflow.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +c++/call.example/CMakeFiles/stackOverflow.dir/build: c++/call.example/stackOverflow +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/build + +c++/call.example/CMakeFiles/stackOverflow.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/c++/call.example && $(CMAKE_COMMAND) -P CMakeFiles/stackOverflow.dir/cmake_clean.cmake +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/clean + +c++/call.example/CMakeFiles/stackOverflow.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/c++/call.example /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/c++/call.example /home/gmgauthier/Projects/code/rexx/c++/call.example/CMakeFiles/stackOverflow.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/depend + diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/cmake_clean.cmake b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/cmake_clean.cmake new file mode 100644 index 0000000..40b735d --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o" + "CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o.d" + "stackOverflow" + "stackOverflow.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/stackOverflow.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.make b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.make new file mode 100644 index 0000000..6e9e79b --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for stackOverflow. +# This may be replaced when dependencies are built. diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.ts b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.ts new file mode 100644 index 0000000..8ea33a4 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for stackOverflow. diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/depend.make b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/depend.make new file mode 100644 index 0000000..02c305a --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for stackOverflow. +# This may be replaced when dependencies are built. diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/flags.make b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/flags.make new file mode 100644 index 0000000..179c101 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile CXX with /usr/bin/c++ +CXX_DEFINES = + +CXX_INCLUDES = + +CXX_FLAGS = + diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/link.txt b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/link.txt new file mode 100644 index 0000000..f9238c3 --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ -rdynamic CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o -o stackOverflow -lrexx -lrexxapi diff --git a/modules/c++/call.example/CMakeFiles/stackOverflow.dir/progress.make b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/progress.make new file mode 100644 index 0000000..48b3d8a --- /dev/null +++ b/modules/c++/call.example/CMakeFiles/stackOverflow.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 19 +CMAKE_PROGRESS_2 = 20 + diff --git a/modules/c++/call.example/Makefile b/modules/c++/call.example/Makefile new file mode 100644 index 0000000..43e5031 --- /dev/null +++ b/modules/c++/call.example/Makefile @@ -0,0 +1,273 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/c++/call.example//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +c++/call.example/CMakeFiles/stackOverflow.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/CMakeFiles/stackOverflow.dir/rule +.PHONY : c++/call.example/CMakeFiles/stackOverflow.dir/rule + +# Convenience name for target. +stackOverflow: c++/call.example/CMakeFiles/stackOverflow.dir/rule +.PHONY : stackOverflow + +# fast build rule for target. +stackOverflow/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/build +.PHONY : stackOverflow/fast + +# Convenience name for target. +c++/call.example/CMakeFiles/runRexxProgram.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/call.example/CMakeFiles/runRexxProgram.dir/rule +.PHONY : c++/call.example/CMakeFiles/runRexxProgram.dir/rule + +# Convenience name for target. +runRexxProgram: c++/call.example/CMakeFiles/runRexxProgram.dir/rule +.PHONY : runRexxProgram + +# fast build rule for target. +runRexxProgram/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/build +.PHONY : runRexxProgram/fast + +runRexxProgram.o: runRexxProgram.cpp.o +.PHONY : runRexxProgram.o + +# target to build an object file +runRexxProgram.cpp.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.o +.PHONY : runRexxProgram.cpp.o + +runRexxProgram.i: runRexxProgram.cpp.i +.PHONY : runRexxProgram.i + +# target to preprocess a source file +runRexxProgram.cpp.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.i +.PHONY : runRexxProgram.cpp.i + +runRexxProgram.s: runRexxProgram.cpp.s +.PHONY : runRexxProgram.s + +# target to generate assembly for a file +runRexxProgram.cpp.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/runRexxProgram.dir/build.make c++/call.example/CMakeFiles/runRexxProgram.dir/runRexxProgram.cpp.s +.PHONY : runRexxProgram.cpp.s + +stackOverflow.o: stackOverflow.cpp.o +.PHONY : stackOverflow.o + +# target to build an object file +stackOverflow.cpp.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.o +.PHONY : stackOverflow.cpp.o + +stackOverflow.i: stackOverflow.cpp.i +.PHONY : stackOverflow.i + +# target to preprocess a source file +stackOverflow.cpp.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.i +.PHONY : stackOverflow.cpp.i + +stackOverflow.s: stackOverflow.cpp.s +.PHONY : stackOverflow.s + +# target to generate assembly for a file +stackOverflow.cpp.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/call.example/CMakeFiles/stackOverflow.dir/build.make c++/call.example/CMakeFiles/stackOverflow.dir/stackOverflow.cpp.s +.PHONY : stackOverflow.cpp.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... runRexxProgram" + @echo "... stackOverflow" + @echo "... runRexxProgram.o" + @echo "... runRexxProgram.i" + @echo "... runRexxProgram.s" + @echo "... stackOverflow.o" + @echo "... stackOverflow.i" + @echo "... stackOverflow.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/c++/call.example/cmake_install.cmake b/modules/c++/call.example/cmake_install.cmake new file mode 100644 index 0000000..144d100 --- /dev/null +++ b/modules/c++/call.example/cmake_install.cmake @@ -0,0 +1,180 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/c++/call.example + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/c++/callsample/stackOverflow" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/callsample/stackOverflow") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/c++/callsample/stackOverflow" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/stackOverflow") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE EXECUTABLE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/c++/call.example/stackOverflow") + if(EXISTS "$ENV{DESTDIR}/api/c++/callsample/stackOverflow" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/callsample/stackOverflow") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/c++/callsample/stackOverflow") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/stackOverflow.cpp") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/stackOverflow.cpp") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/c++/callsample/runRexxProgram" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/callsample/runRexxProgram") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/c++/callsample/runRexxProgram" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/runRexxProgram") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE EXECUTABLE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/c++/call.example/runRexxProgram") + if(EXISTS "$ENV{DESTDIR}/api/c++/callsample/runRexxProgram" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/callsample/runRexxProgram") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/c++/callsample/runRexxProgram") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/runRexxProgram.cpp") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/runRexxProgram.cpp") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/HelloWorld.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/HelloWorld.rex") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/backward.fnc") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/backward.fnc") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/tooRecursiveTrapped.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/tooRecursiveTrapped.rex") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/tooRecursiveUnhandled.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/tooRecursiveUnhandled.rex") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/callsample/readme.txt;/api/c++/callsample/Makefile.windows;/api/c++/callsample/Makefile.unix") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/callsample" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/readme.txt" + "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/Makefile.windows" + "/home/gmgauthier/Projects/code/rexx/api/c++/call.example/Makefile.unix" + ) +endif() + diff --git a/modules/c++/cmake_install.cmake b/modules/c++/cmake_install.cmake new file mode 100644 index 0000000..a06712b --- /dev/null +++ b/modules/c++/cmake_install.cmake @@ -0,0 +1,63 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/c++ + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/readme.txt") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++" TYPE FILE FILES "/home/gmgauthier/Projects/code/rexx/api/c++/readme.txt") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/home/gmgauthier/Projects/code/rexx/c++/call.example/cmake_install.cmake") + include("/home/gmgauthier/Projects/code/rexx/c++/external/cmake_install.cmake") + +endif() + diff --git a/modules/c++/external/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/c++/external/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/c++/external/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/DependInfo.cmake b/modules/c++/external/CMakeFiles/external_methods.dir/DependInfo.cmake new file mode 100644 index 0000000..75cb574 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods.cpp" "c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o" "gcc" "c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/build.make b/modules/c++/external/CMakeFiles/external_methods.dir/build.make new file mode 100644 index 0000000..0ad8ef0 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include c++/external/CMakeFiles/external_methods.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include c++/external/CMakeFiles/external_methods.dir/compiler_depend.make + +# Include the progress variables for this target. +include c++/external/CMakeFiles/external_methods.dir/progress.make + +# Include the compile flags for this target's objects. +include c++/external/CMakeFiles/external_methods.dir/flags.make + +c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o: c++/external/CMakeFiles/external_methods.dir/flags.make +c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o: /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods.cpp +c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o: c++/external/CMakeFiles/external_methods.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o -MF CMakeFiles/external_methods.dir/external_methods.cpp.o.d -o CMakeFiles/external_methods.dir/external_methods.cpp.o -c /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods.cpp + +c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/external_methods.dir/external_methods.cpp.i" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods.cpp > CMakeFiles/external_methods.dir/external_methods.cpp.i + +c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/external_methods.dir/external_methods.cpp.s" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods.cpp -o CMakeFiles/external_methods.dir/external_methods.cpp.s + +# Object files for target external_methods +external_methods_OBJECTS = \ +"CMakeFiles/external_methods.dir/external_methods.cpp.o" + +# External object files for target external_methods +external_methods_EXTERNAL_OBJECTS = + +c++/external/libexternal_methods.so: c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o +c++/external/libexternal_methods.so: c++/external/CMakeFiles/external_methods.dir/build.make +c++/external/libexternal_methods.so: c++/external/CMakeFiles/external_methods.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX shared library libexternal_methods.so" + cd /home/gmgauthier/Projects/code/rexx/c++/external && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/external_methods.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +c++/external/CMakeFiles/external_methods.dir/build: c++/external/libexternal_methods.so +.PHONY : c++/external/CMakeFiles/external_methods.dir/build + +c++/external/CMakeFiles/external_methods.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/c++/external && $(CMAKE_COMMAND) -P CMakeFiles/external_methods.dir/cmake_clean.cmake +.PHONY : c++/external/CMakeFiles/external_methods.dir/clean + +c++/external/CMakeFiles/external_methods.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/c++/external /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/c++/external /home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/external_methods.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : c++/external/CMakeFiles/external_methods.dir/depend + diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/cmake_clean.cmake b/modules/c++/external/CMakeFiles/external_methods.dir/cmake_clean.cmake new file mode 100644 index 0000000..188a8a7 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/external_methods.dir/external_methods.cpp.o" + "CMakeFiles/external_methods.dir/external_methods.cpp.o.d" + "libexternal_methods.pdb" + "libexternal_methods.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/external_methods.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/compiler_depend.make b/modules/c++/external/CMakeFiles/external_methods.dir/compiler_depend.make new file mode 100644 index 0000000..4082ae1 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for external_methods. +# This may be replaced when dependencies are built. diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/compiler_depend.ts b/modules/c++/external/CMakeFiles/external_methods.dir/compiler_depend.ts new file mode 100644 index 0000000..502acc4 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for external_methods. diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/depend.make b/modules/c++/external/CMakeFiles/external_methods.dir/depend.make new file mode 100644 index 0000000..75805d9 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for external_methods. +# This may be replaced when dependencies are built. diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/flags.make b/modules/c++/external/CMakeFiles/external_methods.dir/flags.make new file mode 100644 index 0000000..d433a2f --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile CXX with /usr/bin/c++ +CXX_DEFINES = -Dexternal_methods_EXPORTS + +CXX_INCLUDES = + +CXX_FLAGS = -fPIC + diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/link.txt b/modules/c++/external/CMakeFiles/external_methods.dir/link.txt new file mode 100644 index 0000000..be05c16 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ -fPIC -shared -Wl,-soname,libexternal_methods.so -o libexternal_methods.so CMakeFiles/external_methods.dir/external_methods.cpp.o -lrexxapi diff --git a/modules/c++/external/CMakeFiles/external_methods.dir/progress.make b/modules/c++/external/CMakeFiles/external_methods.dir/progress.make new file mode 100644 index 0000000..3a86673 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 5 +CMAKE_PROGRESS_2 = 6 + diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/DependInfo.cmake b/modules/c++/external/CMakeFiles/external_methods_routines.dir/DependInfo.cmake new file mode 100644 index 0000000..83b7ac1 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods_routines.cpp" "c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o" "gcc" "c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/build.make b/modules/c++/external/CMakeFiles/external_methods_routines.dir/build.make new file mode 100644 index 0000000..bb71185 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include c++/external/CMakeFiles/external_methods_routines.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.make + +# Include the progress variables for this target. +include c++/external/CMakeFiles/external_methods_routines.dir/progress.make + +# Include the compile flags for this target's objects. +include c++/external/CMakeFiles/external_methods_routines.dir/flags.make + +c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o: c++/external/CMakeFiles/external_methods_routines.dir/flags.make +c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o: /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods_routines.cpp +c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o: c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o -MF CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o.d -o CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o -c /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods_routines.cpp + +c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.i" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods_routines.cpp > CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.i + +c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.s" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods_routines.cpp -o CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.s + +# Object files for target external_methods_routines +external_methods_routines_OBJECTS = \ +"CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o" + +# External object files for target external_methods_routines +external_methods_routines_EXTERNAL_OBJECTS = + +c++/external/libexternal_methods_routines.so: c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o +c++/external/libexternal_methods_routines.so: c++/external/CMakeFiles/external_methods_routines.dir/build.make +c++/external/libexternal_methods_routines.so: c++/external/CMakeFiles/external_methods_routines.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX shared library libexternal_methods_routines.so" + cd /home/gmgauthier/Projects/code/rexx/c++/external && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/external_methods_routines.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +c++/external/CMakeFiles/external_methods_routines.dir/build: c++/external/libexternal_methods_routines.so +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/build + +c++/external/CMakeFiles/external_methods_routines.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/c++/external && $(CMAKE_COMMAND) -P CMakeFiles/external_methods_routines.dir/cmake_clean.cmake +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/clean + +c++/external/CMakeFiles/external_methods_routines.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/c++/external /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/c++/external /home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/external_methods_routines.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/depend + diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/cmake_clean.cmake b/modules/c++/external/CMakeFiles/external_methods_routines.dir/cmake_clean.cmake new file mode 100644 index 0000000..81df358 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o" + "CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o.d" + "libexternal_methods_routines.pdb" + "libexternal_methods_routines.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/external_methods_routines.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.make b/modules/c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.make new file mode 100644 index 0000000..f997a70 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for external_methods_routines. +# This may be replaced when dependencies are built. diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.ts b/modules/c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.ts new file mode 100644 index 0000000..81ffa4a --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for external_methods_routines. diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/depend.make b/modules/c++/external/CMakeFiles/external_methods_routines.dir/depend.make new file mode 100644 index 0000000..be76d7b --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for external_methods_routines. +# This may be replaced when dependencies are built. diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/flags.make b/modules/c++/external/CMakeFiles/external_methods_routines.dir/flags.make new file mode 100644 index 0000000..4432e48 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile CXX with /usr/bin/c++ +CXX_DEFINES = -Dexternal_methods_routines_EXPORTS + +CXX_INCLUDES = + +CXX_FLAGS = -fPIC + diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/link.txt b/modules/c++/external/CMakeFiles/external_methods_routines.dir/link.txt new file mode 100644 index 0000000..5eec5ac --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ -fPIC -shared -Wl,-soname,libexternal_methods_routines.so -o libexternal_methods_routines.so CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o -lrexxapi diff --git a/modules/c++/external/CMakeFiles/external_methods_routines.dir/progress.make b/modules/c++/external/CMakeFiles/external_methods_routines.dir/progress.make new file mode 100644 index 0000000..72bb7dd --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_methods_routines.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 7 +CMAKE_PROGRESS_2 = 8 + diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/DependInfo.cmake b/modules/c++/external/CMakeFiles/external_routines.dir/DependInfo.cmake new file mode 100644 index 0000000..5e3a4d5 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/external/external_routines.cpp" "c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o" "gcc" "c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/build.make b/modules/c++/external/CMakeFiles/external_routines.dir/build.make new file mode 100644 index 0000000..d214a3c --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include c++/external/CMakeFiles/external_routines.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include c++/external/CMakeFiles/external_routines.dir/compiler_depend.make + +# Include the progress variables for this target. +include c++/external/CMakeFiles/external_routines.dir/progress.make + +# Include the compile flags for this target's objects. +include c++/external/CMakeFiles/external_routines.dir/flags.make + +c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o: c++/external/CMakeFiles/external_routines.dir/flags.make +c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o: /home/gmgauthier/Projects/code/rexx/api/c++/external/external_routines.cpp +c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o: c++/external/CMakeFiles/external_routines.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o -MF CMakeFiles/external_routines.dir/external_routines.cpp.o.d -o CMakeFiles/external_routines.dir/external_routines.cpp.o -c /home/gmgauthier/Projects/code/rexx/api/c++/external/external_routines.cpp + +c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/external_routines.dir/external_routines.cpp.i" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/c++/external/external_routines.cpp > CMakeFiles/external_routines.dir/external_routines.cpp.i + +c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/external_routines.dir/external_routines.cpp.s" + cd /home/gmgauthier/Projects/code/rexx/c++/external && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/c++/external/external_routines.cpp -o CMakeFiles/external_routines.dir/external_routines.cpp.s + +# Object files for target external_routines +external_routines_OBJECTS = \ +"CMakeFiles/external_routines.dir/external_routines.cpp.o" + +# External object files for target external_routines +external_routines_EXTERNAL_OBJECTS = + +c++/external/libexternal_routines.so: c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o +c++/external/libexternal_routines.so: c++/external/CMakeFiles/external_routines.dir/build.make +c++/external/libexternal_routines.so: c++/external/CMakeFiles/external_routines.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX shared library libexternal_routines.so" + cd /home/gmgauthier/Projects/code/rexx/c++/external && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/external_routines.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +c++/external/CMakeFiles/external_routines.dir/build: c++/external/libexternal_routines.so +.PHONY : c++/external/CMakeFiles/external_routines.dir/build + +c++/external/CMakeFiles/external_routines.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/c++/external && $(CMAKE_COMMAND) -P CMakeFiles/external_routines.dir/cmake_clean.cmake +.PHONY : c++/external/CMakeFiles/external_routines.dir/clean + +c++/external/CMakeFiles/external_routines.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/c++/external /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/c++/external /home/gmgauthier/Projects/code/rexx/c++/external/CMakeFiles/external_routines.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : c++/external/CMakeFiles/external_routines.dir/depend + diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/cmake_clean.cmake b/modules/c++/external/CMakeFiles/external_routines.dir/cmake_clean.cmake new file mode 100644 index 0000000..84d169f --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/external_routines.dir/external_routines.cpp.o" + "CMakeFiles/external_routines.dir/external_routines.cpp.o.d" + "libexternal_routines.pdb" + "libexternal_routines.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/external_routines.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/compiler_depend.make b/modules/c++/external/CMakeFiles/external_routines.dir/compiler_depend.make new file mode 100644 index 0000000..9feff1d --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for external_routines. +# This may be replaced when dependencies are built. diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/compiler_depend.ts b/modules/c++/external/CMakeFiles/external_routines.dir/compiler_depend.ts new file mode 100644 index 0000000..936c6be --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for external_routines. diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/depend.make b/modules/c++/external/CMakeFiles/external_routines.dir/depend.make new file mode 100644 index 0000000..590f6c9 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for external_routines. +# This may be replaced when dependencies are built. diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/flags.make b/modules/c++/external/CMakeFiles/external_routines.dir/flags.make new file mode 100644 index 0000000..37ecd13 --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile CXX with /usr/bin/c++ +CXX_DEFINES = -Dexternal_routines_EXPORTS + +CXX_INCLUDES = + +CXX_FLAGS = -fPIC + diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/link.txt b/modules/c++/external/CMakeFiles/external_routines.dir/link.txt new file mode 100644 index 0000000..25583bd --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ -fPIC -shared -Wl,-soname,libexternal_routines.so -o libexternal_routines.so CMakeFiles/external_routines.dir/external_routines.cpp.o -lrexxapi diff --git a/modules/c++/external/CMakeFiles/external_routines.dir/progress.make b/modules/c++/external/CMakeFiles/external_routines.dir/progress.make new file mode 100644 index 0000000..b700c2c --- /dev/null +++ b/modules/c++/external/CMakeFiles/external_routines.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 9 +CMAKE_PROGRESS_2 = 10 + diff --git a/modules/c++/external/CMakeFiles/progress.marks b/modules/c++/external/CMakeFiles/progress.marks new file mode 100644 index 0000000..1e8b314 --- /dev/null +++ b/modules/c++/external/CMakeFiles/progress.marks @@ -0,0 +1 @@ +6 diff --git a/modules/c++/external/Makefile b/modules/c++/external/Makefile new file mode 100644 index 0000000..02ac2a3 --- /dev/null +++ b/modules/c++/external/Makefile @@ -0,0 +1,315 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/c++/external//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +c++/external/CMakeFiles/external_routines.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/CMakeFiles/external_routines.dir/rule +.PHONY : c++/external/CMakeFiles/external_routines.dir/rule + +# Convenience name for target. +external_routines: c++/external/CMakeFiles/external_routines.dir/rule +.PHONY : external_routines + +# fast build rule for target. +external_routines/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/build +.PHONY : external_routines/fast + +# Convenience name for target. +c++/external/CMakeFiles/external_methods.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/CMakeFiles/external_methods.dir/rule +.PHONY : c++/external/CMakeFiles/external_methods.dir/rule + +# Convenience name for target. +external_methods: c++/external/CMakeFiles/external_methods.dir/rule +.PHONY : external_methods + +# fast build rule for target. +external_methods/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/build +.PHONY : external_methods/fast + +# Convenience name for target. +c++/external/CMakeFiles/external_methods_routines.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 c++/external/CMakeFiles/external_methods_routines.dir/rule +.PHONY : c++/external/CMakeFiles/external_methods_routines.dir/rule + +# Convenience name for target. +external_methods_routines: c++/external/CMakeFiles/external_methods_routines.dir/rule +.PHONY : external_methods_routines + +# fast build rule for target. +external_methods_routines/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/build +.PHONY : external_methods_routines/fast + +external_methods.o: external_methods.cpp.o +.PHONY : external_methods.o + +# target to build an object file +external_methods.cpp.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.o +.PHONY : external_methods.cpp.o + +external_methods.i: external_methods.cpp.i +.PHONY : external_methods.i + +# target to preprocess a source file +external_methods.cpp.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.i +.PHONY : external_methods.cpp.i + +external_methods.s: external_methods.cpp.s +.PHONY : external_methods.s + +# target to generate assembly for a file +external_methods.cpp.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods.dir/build.make c++/external/CMakeFiles/external_methods.dir/external_methods.cpp.s +.PHONY : external_methods.cpp.s + +external_methods_routines.o: external_methods_routines.cpp.o +.PHONY : external_methods_routines.o + +# target to build an object file +external_methods_routines.cpp.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.o +.PHONY : external_methods_routines.cpp.o + +external_methods_routines.i: external_methods_routines.cpp.i +.PHONY : external_methods_routines.i + +# target to preprocess a source file +external_methods_routines.cpp.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.i +.PHONY : external_methods_routines.cpp.i + +external_methods_routines.s: external_methods_routines.cpp.s +.PHONY : external_methods_routines.s + +# target to generate assembly for a file +external_methods_routines.cpp.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_methods_routines.dir/build.make c++/external/CMakeFiles/external_methods_routines.dir/external_methods_routines.cpp.s +.PHONY : external_methods_routines.cpp.s + +external_routines.o: external_routines.cpp.o +.PHONY : external_routines.o + +# target to build an object file +external_routines.cpp.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.o +.PHONY : external_routines.cpp.o + +external_routines.i: external_routines.cpp.i +.PHONY : external_routines.i + +# target to preprocess a source file +external_routines.cpp.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.i +.PHONY : external_routines.cpp.i + +external_routines.s: external_routines.cpp.s +.PHONY : external_routines.s + +# target to generate assembly for a file +external_routines.cpp.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f c++/external/CMakeFiles/external_routines.dir/build.make c++/external/CMakeFiles/external_routines.dir/external_routines.cpp.s +.PHONY : external_routines.cpp.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... external_methods" + @echo "... external_methods_routines" + @echo "... external_routines" + @echo "... external_methods.o" + @echo "... external_methods.i" + @echo "... external_methods.s" + @echo "... external_methods_routines.o" + @echo "... external_methods_routines.i" + @echo "... external_methods_routines.s" + @echo "... external_routines.o" + @echo "... external_routines.i" + @echo "... external_routines.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/c++/external/cmake_install.cmake b/modules/c++/external/cmake_install.cmake new file mode 100644 index 0000000..a9f52d6 --- /dev/null +++ b/modules/c++/external/cmake_install.cmake @@ -0,0 +1,216 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/c++/external + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/readme.txt;/api/c++/external/Makefile.unix;/api/c++/external/Makefile.windows") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/external/readme.txt" + "/home/gmgauthier/Projects/code/rexx/api/c++/external/Makefile.unix" + "/home/gmgauthier/Projects/code/rexx/api/c++/external/Makefile.windows" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/c++/external/libexternal_routines.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/external/libexternal_routines.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/c++/external/libexternal_routines.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/libexternal_routines.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE SHARED_LIBRARY PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/c++/external/libexternal_routines.so") + if(EXISTS "$ENV{DESTDIR}/api/c++/external/libexternal_routines.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/external/libexternal_routines.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/c++/external/libexternal_routines.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/external_routines.cpp") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/external/external_routines.cpp") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/useExternalRoutines.rex;/api/c++/external/useExternalRoutines2.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE FILES + "/home/gmgauthier/Projects/code/rexx/api/c++/external/useExternalRoutines.rex" + "/home/gmgauthier/Projects/code/rexx/api/c++/external/useExternalRoutines2.rex" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/c++/external/libexternal_methods.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/external/libexternal_methods.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/c++/external/libexternal_methods.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/libexternal_methods.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE SHARED_LIBRARY PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/c++/external/libexternal_methods.so") + if(EXISTS "$ENV{DESTDIR}/api/c++/external/libexternal_methods.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/external/libexternal_methods.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/c++/external/libexternal_methods.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/external_methods.cpp") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods.cpp") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/useExternalMethods.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/api/c++/external/useExternalMethods.rex") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/c++/external/libexternal_methods_routines.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/external/libexternal_methods_routines.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/c++/external/libexternal_methods_routines.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/libexternal_methods_routines.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE SHARED_LIBRARY PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/c++/external/libexternal_methods_routines.so") + if(EXISTS "$ENV{DESTDIR}/api/c++/external/libexternal_methods_routines.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/c++/external/libexternal_methods_routines.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/c++/external/libexternal_methods_routines.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/external_methods_routines.cpp") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/c++/external/external_methods_routines.cpp") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/c++/external/useExternalMethodsRoutines.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/c++/external" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/api/c++/external/useExternalMethodsRoutines.rex") +endif() + diff --git a/modules/classic/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/classic/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/classic/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/classic/CMakeFiles/progress.marks b/modules/classic/CMakeFiles/progress.marks new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/modules/classic/CMakeFiles/progress.marks @@ -0,0 +1 @@ +10 diff --git a/modules/classic/Makefile b/modules/classic/Makefile new file mode 100644 index 0000000..b6a6f3d --- /dev/null +++ b/modules/classic/Makefile @@ -0,0 +1,189 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/classic//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/classic/cmake_install.cmake b/modules/classic/cmake_install.cmake new file mode 100644 index 0000000..a4d609c --- /dev/null +++ b/modules/classic/cmake_install.cmake @@ -0,0 +1,50 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/home/gmgauthier/Projects/code/rexx/classic/unix/cmake_install.cmake") + +endif() + diff --git a/modules/classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/classic/unix/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/classic/unix/CMakeFiles/progress.marks b/modules/classic/unix/CMakeFiles/progress.marks new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/modules/classic/unix/CMakeFiles/progress.marks @@ -0,0 +1 @@ +10 diff --git a/modules/classic/unix/Makefile b/modules/classic/unix/Makefile new file mode 100644 index 0000000..e9e4fc3 --- /dev/null +++ b/modules/classic/unix/Makefile @@ -0,0 +1,189 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/classic/unix//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/classic/unix/callrexx/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/classic/unix/callrexx/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/DependInfo.cmake b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/DependInfo.cmake new file mode 100644 index 0000000..5aa20e9 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx1.cpp" "classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o" "gcc" "classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make new file mode 100644 index 0000000..acba096 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.make + +# Include the progress variables for this target. +include classic/unix/callrexx/CMakeFiles/callrexx1.dir/progress.make + +# Include the compile flags for this target's objects. +include classic/unix/callrexx/CMakeFiles/callrexx1.dir/flags.make + +classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o: classic/unix/callrexx/CMakeFiles/callrexx1.dir/flags.make +classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o: /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx1.cpp +classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o: classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building CXX object classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -MD -MT classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o -MF CMakeFiles/callrexx1.dir/callrexx1.cpp.o.d -o CMakeFiles/callrexx1.dir/callrexx1.cpp.o -c /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx1.cpp + +classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing CXX source to CMakeFiles/callrexx1.dir/callrexx1.cpp.i" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx1.cpp > CMakeFiles/callrexx1.dir/callrexx1.cpp.i + +classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling CXX source to assembly CMakeFiles/callrexx1.dir/callrexx1.cpp.s" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && /usr/bin/c++ $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx1.cpp -o CMakeFiles/callrexx1.dir/callrexx1.cpp.s + +# Object files for target callrexx1 +callrexx1_OBJECTS = \ +"CMakeFiles/callrexx1.dir/callrexx1.cpp.o" + +# External object files for target callrexx1 +callrexx1_EXTERNAL_OBJECTS = + +classic/unix/callrexx/callrexx1: classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o +classic/unix/callrexx/callrexx1: classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make +classic/unix/callrexx/callrexx1: classic/unix/callrexx/CMakeFiles/callrexx1.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking CXX executable callrexx1" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/callrexx1.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +classic/unix/callrexx/CMakeFiles/callrexx1.dir/build: classic/unix/callrexx/callrexx1 +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/build + +classic/unix/callrexx/CMakeFiles/callrexx1.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && $(CMAKE_COMMAND) -P CMakeFiles/callrexx1.dir/cmake_clean.cmake +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/clean + +classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/callrexx1.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend + diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/cmake_clean.cmake b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/cmake_clean.cmake new file mode 100644 index 0000000..98601db --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/callrexx1.dir/callrexx1.cpp.o" + "CMakeFiles/callrexx1.dir/callrexx1.cpp.o.d" + "callrexx1" + "callrexx1.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang CXX) + include(CMakeFiles/callrexx1.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.make new file mode 100644 index 0000000..2b6e436 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for callrexx1. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.ts b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.ts new file mode 100644 index 0000000..57863e1 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for callrexx1. diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend.make new file mode 100644 index 0000000..b46e8d5 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for callrexx1. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/flags.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/flags.make new file mode 100644 index 0000000..179c101 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile CXX with /usr/bin/c++ +CXX_DEFINES = + +CXX_INCLUDES = + +CXX_FLAGS = + diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/link.txt b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/link.txt new file mode 100644 index 0000000..b1aa8e7 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/c++ -rdynamic CMakeFiles/callrexx1.dir/callrexx1.cpp.o -o callrexx1 -lrexx -lrexxapi diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/progress.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/progress.make new file mode 100644 index 0000000..abadeb0 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx1.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 + diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/DependInfo.cmake b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/DependInfo.cmake new file mode 100644 index 0000000..e888911 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx2.c" "classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o" "gcc" "classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make new file mode 100644 index 0000000..8e9a150 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.make + +# Include the progress variables for this target. +include classic/unix/callrexx/CMakeFiles/callrexx2.dir/progress.make + +# Include the compile flags for this target's objects. +include classic/unix/callrexx/CMakeFiles/callrexx2.dir/flags.make + +classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o: classic/unix/callrexx/CMakeFiles/callrexx2.dir/flags.make +classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o: /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx2.c +classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o: classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o -MF CMakeFiles/callrexx2.dir/callrexx2.c.o.d -o CMakeFiles/callrexx2.dir/callrexx2.c.o -c /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx2.c + +classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/callrexx2.dir/callrexx2.c.i" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx2.c > CMakeFiles/callrexx2.dir/callrexx2.c.i + +classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/callrexx2.dir/callrexx2.c.s" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx2.c -o CMakeFiles/callrexx2.dir/callrexx2.c.s + +# Object files for target callrexx2 +callrexx2_OBJECTS = \ +"CMakeFiles/callrexx2.dir/callrexx2.c.o" + +# External object files for target callrexx2 +callrexx2_EXTERNAL_OBJECTS = + +classic/unix/callrexx/callrexx2: classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o +classic/unix/callrexx/callrexx2: classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make +classic/unix/callrexx/callrexx2: classic/unix/callrexx/CMakeFiles/callrexx2.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C executable callrexx2" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/callrexx2.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +classic/unix/callrexx/CMakeFiles/callrexx2.dir/build: classic/unix/callrexx/callrexx2 +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/build + +classic/unix/callrexx/CMakeFiles/callrexx2.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx && $(CMAKE_COMMAND) -P CMakeFiles/callrexx2.dir/cmake_clean.cmake +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/clean + +classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/CMakeFiles/callrexx2.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend + diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/cmake_clean.cmake b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/cmake_clean.cmake new file mode 100644 index 0000000..d21d527 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/callrexx2.dir/callrexx2.c.o" + "CMakeFiles/callrexx2.dir/callrexx2.c.o.d" + "callrexx2" + "callrexx2.pdb" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/callrexx2.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.make new file mode 100644 index 0000000..4710ea8 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for callrexx2. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.ts b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.ts new file mode 100644 index 0000000..acb37f8 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for callrexx2. diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend.make new file mode 100644 index 0000000..86add49 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for callrexx2. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/flags.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/flags.make new file mode 100644 index 0000000..7dbb39f --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile C with /usr/bin/cc +C_DEFINES = + +C_INCLUDES = + +C_FLAGS = + diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/link.txt b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/link.txt new file mode 100644 index 0000000..4896481 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/cc -rdynamic CMakeFiles/callrexx2.dir/callrexx2.c.o -o callrexx2 -lrexx -lrexxapi diff --git a/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/progress.make b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/progress.make new file mode 100644 index 0000000..8c8fb6f --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/callrexx2.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 3 +CMAKE_PROGRESS_2 = 4 + diff --git a/modules/classic/unix/callrexx/CMakeFiles/progress.marks b/modules/classic/unix/callrexx/CMakeFiles/progress.marks new file mode 100644 index 0000000..b8626c4 --- /dev/null +++ b/modules/classic/unix/callrexx/CMakeFiles/progress.marks @@ -0,0 +1 @@ +4 diff --git a/modules/classic/unix/callrexx/Makefile b/modules/classic/unix/callrexx/Makefile new file mode 100644 index 0000000..bb7e338 --- /dev/null +++ b/modules/classic/unix/callrexx/Makefile @@ -0,0 +1,273 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/classic/unix/callrexx//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule + +# Convenience name for target. +callrexx1: classic/unix/callrexx/CMakeFiles/callrexx1.dir/rule +.PHONY : callrexx1 + +# fast build rule for target. +callrexx1/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/build +.PHONY : callrexx1/fast + +# Convenience name for target. +classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule +.PHONY : classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule + +# Convenience name for target. +callrexx2: classic/unix/callrexx/CMakeFiles/callrexx2.dir/rule +.PHONY : callrexx2 + +# fast build rule for target. +callrexx2/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/build +.PHONY : callrexx2/fast + +callrexx1.o: callrexx1.cpp.o +.PHONY : callrexx1.o + +# target to build an object file +callrexx1.cpp.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.o +.PHONY : callrexx1.cpp.o + +callrexx1.i: callrexx1.cpp.i +.PHONY : callrexx1.i + +# target to preprocess a source file +callrexx1.cpp.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.i +.PHONY : callrexx1.cpp.i + +callrexx1.s: callrexx1.cpp.s +.PHONY : callrexx1.s + +# target to generate assembly for a file +callrexx1.cpp.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx1.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx1.dir/callrexx1.cpp.s +.PHONY : callrexx1.cpp.s + +callrexx2.o: callrexx2.c.o +.PHONY : callrexx2.o + +# target to build an object file +callrexx2.c.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.o +.PHONY : callrexx2.c.o + +callrexx2.i: callrexx2.c.i +.PHONY : callrexx2.i + +# target to preprocess a source file +callrexx2.c.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.i +.PHONY : callrexx2.c.i + +callrexx2.s: callrexx2.c.s +.PHONY : callrexx2.s + +# target to generate assembly for a file +callrexx2.c.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/callrexx/CMakeFiles/callrexx2.dir/build.make classic/unix/callrexx/CMakeFiles/callrexx2.dir/callrexx2.c.s +.PHONY : callrexx2.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... callrexx1" + @echo "... callrexx2" + @echo "... callrexx1.o" + @echo "... callrexx1.i" + @echo "... callrexx1.s" + @echo "... callrexx2.o" + @echo "... callrexx2.i" + @echo "... callrexx2.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/classic/unix/callrexx/cmake_install.cmake b/modules/classic/unix/callrexx/cmake_install.cmake new file mode 100644 index 0000000..3e5e6a3 --- /dev/null +++ b/modules/classic/unix/callrexx/cmake_install.cmake @@ -0,0 +1,139 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/classic/callrexx/callrexx1" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/callrexx/callrexx1") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/classic/callrexx/callrexx1" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/callrexx/callrexx1") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/callrexx" TYPE EXECUTABLE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/callrexx1") + if(EXISTS "$ENV{DESTDIR}/api/classic/callrexx/callrexx1" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/callrexx/callrexx1") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/classic/callrexx/callrexx1") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/callrexx/callrexx1.cpp;/api/classic/callrexx/Makefile.unix") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/callrexx" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx1.cpp" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/Makefile.unix" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/classic/callrexx/callrexx2" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/callrexx/callrexx2") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/classic/callrexx/callrexx2" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/callrexx/callrexx2") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/callrexx" TYPE EXECUTABLE PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/callrexx2") + if(EXISTS "$ENV{DESTDIR}/api/classic/callrexx/callrexx2" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/callrexx/callrexx2") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/classic/callrexx/callrexx2") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/callrexx/callrexx2.c") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/callrexx" TYPE FILE PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ GROUP_WRITE WORLD_READ FILES "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/callrexx2.c") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/callrexx/del_macro.rex;/api/classic/callrexx/example.rex;/api/classic/callrexx/load_macro.rex;/api/classic/callrexx/macros.rex;/api/classic/callrexx/startrx1.rex;/api/classic/callrexx/startrx2.rex;/api/classic/callrexx/startrx3.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/callrexx" TYPE PROGRAM PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/del_macro.rex" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/example.rex" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/load_macro.rex" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/macros.rex" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/startrx1.rex" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/startrx2.rex" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx/startrx3.rex" + ) +endif() + diff --git a/modules/classic/unix/cmake_install.cmake b/modules/classic/unix/cmake_install.cmake new file mode 100644 index 0000000..01cf853 --- /dev/null +++ b/modules/classic/unix/cmake_install.cmake @@ -0,0 +1,68 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi.README;/api/classic/callrexx.README") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi.README" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/callrexx.README" + ) +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/home/gmgauthier/Projects/code/rexx/classic/unix/callrexx/cmake_install.cmake") + include("/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/cmake_install.cmake") + include("/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/cmake_install.cmake") + include("/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/cmake_install.cmake") + +endif() + diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/classic/unix/rexxapi1/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/progress.marks b/modules/classic/unix/rexxapi1/CMakeFiles/progress.marks new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/progress.marks @@ -0,0 +1 @@ +2 diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/DependInfo.cmake b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/DependInfo.cmake new file mode 100644 index 0000000..cfbda53 --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c" "classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o" "gcc" "classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make new file mode 100644 index 0000000..bca90fd --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.make + +# Include the progress variables for this target. +include classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/progress.make + +# Include the compile flags for this target's objects. +include classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/flags.make + +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/flags.make +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o -MF CMakeFiles/rexxapi1.dir/rexxapi1.c.o.d -o CMakeFiles/rexxapi1.dir/rexxapi1.c.o -c /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c + +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/rexxapi1.dir/rexxapi1.c.i" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c > CMakeFiles/rexxapi1.dir/rexxapi1.c.i + +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/rexxapi1.dir/rexxapi1.c.s" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c -o CMakeFiles/rexxapi1.dir/rexxapi1.c.s + +# Object files for target rexxapi1 +rexxapi1_OBJECTS = \ +"CMakeFiles/rexxapi1.dir/rexxapi1.c.o" + +# External object files for target rexxapi1 +rexxapi1_EXTERNAL_OBJECTS = + +classic/unix/rexxapi1/librexxapi1.so: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o +classic/unix/rexxapi1/librexxapi1.so: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make +classic/unix/rexxapi1/librexxapi1.so: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C shared library librexxapi1.so" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/rexxapi1.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build: classic/unix/rexxapi1/librexxapi1.so +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build + +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 && $(CMAKE_COMMAND) -P CMakeFiles/rexxapi1.dir/cmake_clean.cmake +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/clean + +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1 /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend + diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/cmake_clean.cmake b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/cmake_clean.cmake new file mode 100644 index 0000000..d980a69 --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/rexxapi1.dir/rexxapi1.c.o" + "CMakeFiles/rexxapi1.dir/rexxapi1.c.o.d" + "librexxapi1.pdb" + "librexxapi1.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/rexxapi1.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.make b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.make new file mode 100644 index 0000000..95727db --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for rexxapi1. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.ts b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.ts new file mode 100644 index 0000000..2aec347 --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for rexxapi1. diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend.make b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend.make new file mode 100644 index 0000000..1efbde0 --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for rexxapi1. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/flags.make b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/flags.make new file mode 100644 index 0000000..60197ff --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile C with /usr/bin/cc +C_DEFINES = -Drexxapi1_EXPORTS + +C_INCLUDES = + +C_FLAGS = -fPIC + diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/link.txt b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/link.txt new file mode 100644 index 0000000..ffe6654 --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/cc -fPIC -shared -Wl,-soname,librexxapi1.so -o librexxapi1.so CMakeFiles/rexxapi1.dir/rexxapi1.c.o -lrexx -lrexxapi diff --git a/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/progress.make b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/progress.make new file mode 100644 index 0000000..596289c --- /dev/null +++ b/modules/classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 11 +CMAKE_PROGRESS_2 = 12 + diff --git a/modules/classic/unix/rexxapi1/Makefile b/modules/classic/unix/rexxapi1/Makefile new file mode 100644 index 0000000..8e01f8b --- /dev/null +++ b/modules/classic/unix/rexxapi1/Makefile @@ -0,0 +1,231 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi1/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi1/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi1/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi1/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule +.PHONY : classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule + +# Convenience name for target. +rexxapi1: classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rule +.PHONY : rexxapi1 + +# fast build rule for target. +rexxapi1/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build +.PHONY : rexxapi1/fast + +rexxapi1.o: rexxapi1.c.o +.PHONY : rexxapi1.o + +# target to build an object file +rexxapi1.c.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.o +.PHONY : rexxapi1.c.o + +rexxapi1.i: rexxapi1.c.i +.PHONY : rexxapi1.i + +# target to preprocess a source file +rexxapi1.c.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.i +.PHONY : rexxapi1.c.i + +rexxapi1.s: rexxapi1.c.s +.PHONY : rexxapi1.s + +# target to generate assembly for a file +rexxapi1.c.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/build.make classic/unix/rexxapi1/CMakeFiles/rexxapi1.dir/rexxapi1.c.s +.PHONY : rexxapi1.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... rexxapi1" + @echo "... rexxapi1.o" + @echo "... rexxapi1.i" + @echo "... rexxapi1.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/classic/unix/rexxapi1/cmake_install.cmake b/modules/classic/unix/rexxapi1/cmake_install.cmake new file mode 100644 index 0000000..359e368 --- /dev/null +++ b/modules/classic/unix/rexxapi1/cmake_install.cmake @@ -0,0 +1,113 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1 + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/librexxapi1.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE SHARED_LIBRARY PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE FILES "/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi1/librexxapi1.so") + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/classic/rexxapi1/librexxapi1.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/rexxapi1.c;/api/classic/rexxapi1/readme.txt") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/rexxapi1.c" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/readme.txt" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/Makefile.apple;/api/classic/rexxapi1/Makefile.linux") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/Makefile.apple" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/Makefile.linux" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi1/apitest1.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi1" TYPE PROGRAM FILES "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi1/apitest1.rex") +endif() + diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/classic/unix/rexxapi2/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/progress.marks b/modules/classic/unix/rexxapi2/CMakeFiles/progress.marks new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/progress.marks @@ -0,0 +1 @@ +2 diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/DependInfo.cmake b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/DependInfo.cmake new file mode 100644 index 0000000..2bac385 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/rexxapi2.c" "classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o" "gcc" "classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make new file mode 100644 index 0000000..a665136 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.make + +# Include the progress variables for this target. +include classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/progress.make + +# Include the compile flags for this target's objects. +include classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/flags.make + +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/flags.make +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/rexxapi2.c +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o -MF CMakeFiles/rexxapi2.dir/rexxapi2.c.o.d -o CMakeFiles/rexxapi2.dir/rexxapi2.c.o -c /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/rexxapi2.c + +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/rexxapi2.dir/rexxapi2.c.i" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/rexxapi2.c > CMakeFiles/rexxapi2.dir/rexxapi2.c.i + +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/rexxapi2.dir/rexxapi2.c.s" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/rexxapi2.c -o CMakeFiles/rexxapi2.dir/rexxapi2.c.s + +# Object files for target rexxapi2 +rexxapi2_OBJECTS = \ +"CMakeFiles/rexxapi2.dir/rexxapi2.c.o" + +# External object files for target rexxapi2 +rexxapi2_EXTERNAL_OBJECTS = + +classic/unix/rexxapi2/librexxapi2.so: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o +classic/unix/rexxapi2/librexxapi2.so: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make +classic/unix/rexxapi2/librexxapi2.so: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C shared library librexxapi2.so" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/rexxapi2.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build: classic/unix/rexxapi2/librexxapi2.so +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build + +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 && $(CMAKE_COMMAND) -P CMakeFiles/rexxapi2.dir/cmake_clean.cmake +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/clean + +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2 /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2 /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend + diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/cmake_clean.cmake b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/cmake_clean.cmake new file mode 100644 index 0000000..f4f6082 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/rexxapi2.dir/rexxapi2.c.o" + "CMakeFiles/rexxapi2.dir/rexxapi2.c.o.d" + "librexxapi2.pdb" + "librexxapi2.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/rexxapi2.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.make b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.make new file mode 100644 index 0000000..6063914 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for rexxapi2. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.ts b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.ts new file mode 100644 index 0000000..4b2593a --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for rexxapi2. diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend.make b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend.make new file mode 100644 index 0000000..be85bb8 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for rexxapi2. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/flags.make b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/flags.make new file mode 100644 index 0000000..8830b81 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile C with /usr/bin/cc +C_DEFINES = -Drexxapi2_EXPORTS + +C_INCLUDES = + +C_FLAGS = -fPIC + diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/link.txt b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/link.txt new file mode 100644 index 0000000..4381070 --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/cc -fPIC -shared -Wl,-soname,librexxapi2.so -o librexxapi2.so CMakeFiles/rexxapi2.dir/rexxapi2.c.o -lrexx -lrexxapi diff --git a/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/progress.make b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/progress.make new file mode 100644 index 0000000..d92f75a --- /dev/null +++ b/modules/classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 13 +CMAKE_PROGRESS_2 = 14 + diff --git a/modules/classic/unix/rexxapi2/Makefile b/modules/classic/unix/rexxapi2/Makefile new file mode 100644 index 0000000..81fe898 --- /dev/null +++ b/modules/classic/unix/rexxapi2/Makefile @@ -0,0 +1,231 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi2/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi2/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi2/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi2/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule +.PHONY : classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule + +# Convenience name for target. +rexxapi2: classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rule +.PHONY : rexxapi2 + +# fast build rule for target. +rexxapi2/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build +.PHONY : rexxapi2/fast + +rexxapi2.o: rexxapi2.c.o +.PHONY : rexxapi2.o + +# target to build an object file +rexxapi2.c.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.o +.PHONY : rexxapi2.c.o + +rexxapi2.i: rexxapi2.c.i +.PHONY : rexxapi2.i + +# target to preprocess a source file +rexxapi2.c.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.i +.PHONY : rexxapi2.c.i + +rexxapi2.s: rexxapi2.c.s +.PHONY : rexxapi2.s + +# target to generate assembly for a file +rexxapi2.c.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/build.make classic/unix/rexxapi2/CMakeFiles/rexxapi2.dir/rexxapi2.c.s +.PHONY : rexxapi2.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... rexxapi2" + @echo "... rexxapi2.o" + @echo "... rexxapi2.i" + @echo "... rexxapi2.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/classic/unix/rexxapi2/cmake_install.cmake b/modules/classic/unix/rexxapi2/cmake_install.cmake new file mode 100644 index 0000000..78bb61c --- /dev/null +++ b/modules/classic/unix/rexxapi2/cmake_install.cmake @@ -0,0 +1,100 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2 + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi2/librexxapi2.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi2/librexxapi2.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/classic/rexxapi2/librexxapi2.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi2/librexxapi2.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi2" TYPE SHARED_LIBRARY FILES "/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi2/librexxapi2.so") + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi2/librexxapi2.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi2/librexxapi2.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/classic/rexxapi2/librexxapi2.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi2/rexxapi2.c;/api/classic/rexxapi2/readme.txt;/api/classic/rexxapi2/Makefile.linux;/api/classic/rexxapi2/Makefile.apple") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi2" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/rexxapi2.c" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/readme.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/Makefile.linux" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/Makefile.apple" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi2/apitest2.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi2" TYPE PROGRAM FILES "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi2/apitest2.rex") +endif() + diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/CMakeDirectoryInformation.cmake b/modules/classic/unix/rexxapi3/CMakeFiles/CMakeDirectoryInformation.cmake new file mode 100644 index 0000000..46ef49d --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/CMakeDirectoryInformation.cmake @@ -0,0 +1,16 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Relative path conversion top directories. +set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/gmgauthier/Projects/code/rexx/api") +set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/gmgauthier/Projects/code/rexx") + +# Force unix paths in dependencies. +set(CMAKE_FORCE_UNIX_PATHS 1) + + +# The C and CXX include file regular expressions for this directory. +set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$") +set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$") +set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN}) +set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN}) diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/progress.marks b/modules/classic/unix/rexxapi3/CMakeFiles/progress.marks new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/progress.marks @@ -0,0 +1 @@ +2 diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/DependInfo.cmake b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/DependInfo.cmake new file mode 100644 index 0000000..64d5fe0 --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/DependInfo.cmake @@ -0,0 +1,23 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/rexxapi3.c" "classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o" "gcc" "classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o.d" + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES + ) + +# Targets to which this target links which contain Fortran sources. +set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make new file mode 100644 index 0000000..d739c15 --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make @@ -0,0 +1,110 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +# Include any dependencies generated for this target. +include classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.make + +# Include the progress variables for this target. +include classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/progress.make + +# Include the compile flags for this target's objects. +include classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/flags.make + +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/flags.make +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/rexxapi3.c +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o -MF CMakeFiles/rexxapi3.dir/rexxapi3.c.o.d -o CMakeFiles/rexxapi3.dir/rexxapi3.c.o -c /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/rexxapi3.c + +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/rexxapi3.dir/rexxapi3.c.i" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/rexxapi3.c > CMakeFiles/rexxapi3.dir/rexxapi3.c.i + +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/rexxapi3.dir/rexxapi3.c.s" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 && /usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/rexxapi3.c -o CMakeFiles/rexxapi3.dir/rexxapi3.c.s + +# Object files for target rexxapi3 +rexxapi3_OBJECTS = \ +"CMakeFiles/rexxapi3.dir/rexxapi3.c.o" + +# External object files for target rexxapi3 +rexxapi3_EXTERNAL_OBJECTS = + +classic/unix/rexxapi3/librexxapi3.so: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o +classic/unix/rexxapi3/librexxapi3.so: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make +classic/unix/rexxapi3/librexxapi3.so: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/gmgauthier/Projects/code/rexx/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C shared library librexxapi3.so" + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 && $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/rexxapi3.dir/link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build: classic/unix/rexxapi3/librexxapi3.so +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build + +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/clean: + cd /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 && $(CMAKE_COMMAND) -P CMakeFiles/rexxapi3.dir/cmake_clean.cmake +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/clean + +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/gmgauthier/Projects/code/rexx/api /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3 /home/gmgauthier/Projects/code/rexx /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3 /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/DependInfo.cmake "--color=$(COLOR)" +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend + diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/cmake_clean.cmake b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/cmake_clean.cmake new file mode 100644 index 0000000..7a0dc3e --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/cmake_clean.cmake @@ -0,0 +1,11 @@ +file(REMOVE_RECURSE + "CMakeFiles/rexxapi3.dir/rexxapi3.c.o" + "CMakeFiles/rexxapi3.dir/rexxapi3.c.o.d" + "librexxapi3.pdb" + "librexxapi3.so" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/rexxapi3.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.make b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.make new file mode 100644 index 0000000..b8275a2 --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for rexxapi3. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.ts b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.ts new file mode 100644 index 0000000..8f30b33 --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for rexxapi3. diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend.make b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend.make new file mode 100644 index 0000000..bd73999 --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for rexxapi3. +# This may be replaced when dependencies are built. diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/flags.make b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/flags.make new file mode 100644 index 0000000..f1dafaf --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# compile C with /usr/bin/cc +C_DEFINES = -Drexxapi3_EXPORTS + +C_INCLUDES = + +C_FLAGS = -fPIC + diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/link.txt b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/link.txt new file mode 100644 index 0000000..089cd2f --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/link.txt @@ -0,0 +1 @@ +/usr/bin/cc -fPIC -shared -Wl,-soname,librexxapi3.so -o librexxapi3.so CMakeFiles/rexxapi3.dir/rexxapi3.c.o -lrexx -lrexxapi diff --git a/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/progress.make b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/progress.make new file mode 100644 index 0000000..a35c33b --- /dev/null +++ b/modules/classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/progress.make @@ -0,0 +1,3 @@ +CMAKE_PROGRESS_1 = 15 +CMAKE_PROGRESS_2 = 16 + diff --git a/modules/classic/unix/rexxapi3/Makefile b/modules/classic/unix/rexxapi3/Makefile new file mode 100644 index 0000000..763d128 --- /dev/null +++ b/modules/classic/unix/rexxapi3/Makefile @@ -0,0 +1,231 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "Unix Makefiles" Generator, CMake Version 3.28 + +# Default target executed when no arguments are given to make. +default_target: all +.PHONY : default_target + +# Allow only one "make -f Makefile2" at a time, but pass parallelism. +.NOTPARALLEL: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +# The shell in which to execute make rules. +SHELL = /bin/sh + +# The CMake executable. +CMAKE_COMMAND = /usr/bin/cmake + +# The command to remove a file. +RM = /usr/bin/cmake -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = /home/gmgauthier/Projects/code/rexx/api + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = /home/gmgauthier/Projects/code/rexx + +#============================================================================= +# Targets provided globally by CMake. + +# Special rule for the target edit_cache +edit_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "No interactive CMake dialog available..." + /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. +.PHONY : edit_cache + +# Special rule for the target edit_cache +edit_cache/fast: edit_cache +.PHONY : edit_cache/fast + +# Special rule for the target rebuild_cache +rebuild_cache: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Running CMake to regenerate build system..." + /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) +.PHONY : rebuild_cache + +# Special rule for the target rebuild_cache +rebuild_cache/fast: rebuild_cache +.PHONY : rebuild_cache/fast + +# Special rule for the target list_install_components +list_install_components: + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Available install components are: \"Samples\" \"Unspecified\"" +.PHONY : list_install_components + +# Special rule for the target list_install_components +list_install_components/fast: list_install_components +.PHONY : list_install_components/fast + +# Special rule for the target install +install: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install + +# Special rule for the target install +install/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Install the project..." + /usr/bin/cmake -P cmake_install.cmake +.PHONY : install/fast + +# Special rule for the target install/local +install/local: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local + +# Special rule for the target install/local +install/local/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing only the local directory..." + /usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake +.PHONY : install/local/fast + +# Special rule for the target install/strip +install/strip: preinstall + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip + +# Special rule for the target install/strip +install/strip/fast: preinstall/fast + @$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --cyan "Installing the project stripped..." + /usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake +.PHONY : install/strip/fast + +# The main all target +all: cmake_check_build_system + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles /home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3//CMakeFiles/progress.marks + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi3/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/gmgauthier/Projects/code/rexx/CMakeFiles 0 +.PHONY : all + +# The main clean target +clean: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi3/clean +.PHONY : clean + +# The main clean target +clean/fast: clean +.PHONY : clean/fast + +# Prepare targets for installation. +preinstall: all + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi3/preinstall +.PHONY : preinstall + +# Prepare targets for installation. +preinstall/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi3/preinstall +.PHONY : preinstall/fast + +# clear depends +depend: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 +.PHONY : depend + +# Convenience name for target. +classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule +.PHONY : classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule + +# Convenience name for target. +rexxapi3: classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rule +.PHONY : rexxapi3 + +# fast build rule for target. +rexxapi3/fast: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build +.PHONY : rexxapi3/fast + +rexxapi3.o: rexxapi3.c.o +.PHONY : rexxapi3.o + +# target to build an object file +rexxapi3.c.o: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.o +.PHONY : rexxapi3.c.o + +rexxapi3.i: rexxapi3.c.i +.PHONY : rexxapi3.i + +# target to preprocess a source file +rexxapi3.c.i: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.i +.PHONY : rexxapi3.c.i + +rexxapi3.s: rexxapi3.c.s +.PHONY : rexxapi3.s + +# target to generate assembly for a file +rexxapi3.c.s: + cd /home/gmgauthier/Projects/code/rexx && $(MAKE) $(MAKESILENT) -f classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/build.make classic/unix/rexxapi3/CMakeFiles/rexxapi3.dir/rexxapi3.c.s +.PHONY : rexxapi3.c.s + +# Help Target +help: + @echo "The following are some of the valid targets for this Makefile:" + @echo "... all (the default if no target is provided)" + @echo "... clean" + @echo "... depend" + @echo "... edit_cache" + @echo "... install" + @echo "... install/local" + @echo "... install/strip" + @echo "... list_install_components" + @echo "... rebuild_cache" + @echo "... rexxapi3" + @echo "... rexxapi3.o" + @echo "... rexxapi3.i" + @echo "... rexxapi3.s" +.PHONY : help + + + +#============================================================================= +# Special targets to cleanup operation of make. + +# Special rule to run CMake to check the build system integrity. +# No rule that depends on this can have commands that come from listfiles +# because they might be regenerated. +cmake_check_build_system: + cd /home/gmgauthier/Projects/code/rexx && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 +.PHONY : cmake_check_build_system + diff --git a/modules/classic/unix/rexxapi3/cmake_install.cmake b/modules/classic/unix/rexxapi3/cmake_install.cmake new file mode 100644 index 0000000..bc81ba1 --- /dev/null +++ b/modules/classic/unix/rexxapi3/cmake_install.cmake @@ -0,0 +1,100 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3 + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi3/librexxapi3.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi3/librexxapi3.so") + file(RPATH_CHECK + FILE "$ENV{DESTDIR}/api/classic/rexxapi3/librexxapi3.so" + RPATH "") + endif() + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi3/librexxapi3.so") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi3" TYPE SHARED_LIBRARY FILES "/home/gmgauthier/Projects/code/rexx/classic/unix/rexxapi3/librexxapi3.so") + if(EXISTS "$ENV{DESTDIR}/api/classic/rexxapi3/librexxapi3.so" AND + NOT IS_SYMLINK "$ENV{DESTDIR}/api/classic/rexxapi3/librexxapi3.so") + if(CMAKE_INSTALL_DO_STRIP) + execute_process(COMMAND "/usr/bin/strip" "$ENV{DESTDIR}/api/classic/rexxapi3/librexxapi3.so") + endif() + endif() +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Unspecified" OR NOT CMAKE_INSTALL_COMPONENT) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi3/rexxapi3.c;/api/classic/rexxapi3/readme.txt;/api/classic/rexxapi3/Makefile.linux;/api/classic/rexxapi3/Makefile.apple") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi3" TYPE FILE FILES + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/rexxapi3.c" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/readme.txt" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/Makefile.linux" + "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/Makefile.apple" + ) +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/classic/rexxapi3/apitest3.rex") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api/classic/rexxapi3" TYPE PROGRAM FILES "/home/gmgauthier/Projects/code/rexx/api/classic/unix/rexxapi3/apitest3.rex") +endif() + diff --git a/modules/cmake_install.cmake b/modules/cmake_install.cmake new file mode 100644 index 0000000..1250601 --- /dev/null +++ b/modules/cmake_install.cmake @@ -0,0 +1,73 @@ +# Install script for directory: /home/gmgauthier/Projects/code/rexx/api + +# Set the install prefix +if(NOT DEFINED CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "/usr/local") +endif() +string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Set the install configuration name. +if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) + if(BUILD_TYPE) + string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" + CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") + else() + set(CMAKE_INSTALL_CONFIG_NAME "") + endif() + message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") +endif() + +# Set the component getting installed. +if(NOT CMAKE_INSTALL_COMPONENT) + if(COMPONENT) + message(STATUS "Install component: \"${COMPONENT}\"") + set(CMAKE_INSTALL_COMPONENT "${COMPONENT}") + else() + set(CMAKE_INSTALL_COMPONENT) + endif() +endif() + +# Install shared libraries without execute permission? +if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE) + set(CMAKE_INSTALL_SO_NO_EXE "1") +endif() + +# Is this installation the result of a crosscompile? +if(NOT DEFINED CMAKE_CROSSCOMPILING) + set(CMAKE_CROSSCOMPILING "FALSE") +endif() + +# Set default install directory permissions. +if(NOT DEFINED CMAKE_OBJDUMP) + set(CMAKE_OBJDUMP "/usr/bin/objdump") +endif() + +if(CMAKE_INSTALL_COMPONENT STREQUAL "Samples" OR NOT CMAKE_INSTALL_COMPONENT) + list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES + "/api/readme.txt") + if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION) + message(WARNING "ABSOLUTE path INSTALL DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION) + message(FATAL_ERROR "ABSOLUTE path INSTALL DESTINATION forbidden (by caller): ${CMAKE_ABSOLUTE_DESTINATION_FILES}") + endif() + file(INSTALL DESTINATION "/api" TYPE FILE FILES "/home/gmgauthier/Projects/code/rexx/api/readme.txt") +endif() + +if(NOT CMAKE_INSTALL_LOCAL_ONLY) + # Include the install script for each subdirectory. + include("/home/gmgauthier/Projects/code/rexx/c++/cmake_install.cmake") + include("/home/gmgauthier/Projects/code/rexx/classic/cmake_install.cmake") + +endif() + +if(CMAKE_INSTALL_COMPONENT) + set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt") +else() + set(CMAKE_INSTALL_MANIFEST "install_manifest.txt") +endif() + +string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT + "${CMAKE_INSTALL_MANIFEST_FILES}") +file(WRITE "/home/gmgauthier/Projects/code/rexx/${CMAKE_INSTALL_MANIFEST}" + "${CMAKE_INSTALL_MANIFEST_CONTENT}") diff --git a/modules/windows/0ReadMe.first b/modules/windows/0ReadMe.first new file mode 100644 index 0000000..6019421 --- /dev/null +++ b/modules/windows/0ReadMe.first @@ -0,0 +1,81 @@ + + + Windows ooRexx Example Programs + =============================== + + The Windows distribution of ooRexx comes with a large number of example + programs that demonstrate programming with ooRexx. Many of these + programs are primarily used to show features of one of the extensions + to ooRexx, such as the ooDialog framework, or the OleObject class. + + To make locating a program of interest easier, the example programs are + grouped in subdirectories. This read me file serves as an additional + resource to help document the location of different examples. + + samples\ + + This top-level directory, (the directory containing this read me file,) + contains samples that run unchanged on any platform supported by + ooRexx. Subdirectories, with the exception of samples\native.api, + contain examples that use Windows only extensions. + + samples\api\classic\ + + This directory contains Windows only examples using the old API to + write Rexx extensions. The use of the old API to write new Rexx + extensions is discouraged and the examples may be removed in future + distributions. + + samples\misc\ + + This directory contains miscellaneous Windows only examples that do not + fit well in the other categories. + + samples\api\c++\ + + This directory contains platform independent samples using the C++ API + introduced in ooRexx 4.0.0 to write ooRexx extensions. nMake + compatible make files for the examples are included in this directory. + + samples\ole + + This directory and its subdirectories contain examples using the + OleObject class, a Windows only class that gives the programmer access + OLE objects. + + A few additional samples that combine using the OleObject class and the + ooDialog framework are located under samples\oodialog. + + samples\oodialog + + This directory and its subdirectories contain all example programs that + use the ooDialog framework. The ooDialog framework allows the Rexx + programmer to easy create programs that have a graphical user + interface. + + A number of the programs included with the ooDialog examples + demonstrate combining other Windows only extensions with the ooDialog + framework. + + samples\rexxutils + + This directory contains example programs that use some of the Windows + only functions from RexxUtils. + + Note: + ----- + + One of the interesting Windows only extensions is the winsystm.cls. + The example programs for this class all make use of the ooDialog + framework. The examples for the winsystm.cls are located at: + + samples\oodialog\winsystm\ + + Two excellent examples of using the OleObject, oleinfo.rex and + sysinfo.rex, are also located under the oodialog subdirectory. These + examples are located at: + + samples\oodialog\oleinfo + + samples\oodialog\sysinfo + diff --git a/modules/windows/CMakeLists.txt b/modules/windows/CMakeLists.txt new file mode 100644 index 0000000..3e58ee3 --- /dev/null +++ b/modules/windows/CMakeLists.txt @@ -0,0 +1,56 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2014-2021 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +#/*----------------------------------------------------------------------------*/ +#/* Global settings */ +#/*----------------------------------------------------------------------------*/ +if (APPLE) +# apple build with lower cmake version have an @rpath problem + cmake_minimum_required (VERSION 3.12) +else() +#for other platforms + cmake_minimum_required (VERSION 2.8.12) +endif() +cmake_policy(VERSION 2.8...3.3) + +#/*----------------------------------------------------------------------------*/ +#/* Project settings */ +#/*----------------------------------------------------------------------------*/ +project (samples-windows) + +# add_subdirectory (api) + diff --git a/modules/windows/misc/fileDrop.ReadMe b/modules/windows/misc/fileDrop.ReadMe new file mode 100644 index 0000000..e9b9a8e --- /dev/null +++ b/modules/windows/misc/fileDrop.ReadMe @@ -0,0 +1,18 @@ + fileDrop.rex + +The fileDrop.rex program demonstrates how Rexx programs with the .rex +extensions act as Drop Handlers. During the installation process on +Windows, files with the extension of .rex are registered with the operating +system as 'drop handlers.' + +In Windows explorer, the user can drag and drop any file over the icon for +any Rexx program (one with the .rex extension.) The icon drawn for the drag +operation will change over the Rexx program to one indicating that the Rexx +program accepts dropping. If the user drops the file on the Rexx program, +the operating system executes the Rexx program and provides the full path +name for the file as the argument to the program. + +In Windows Explorer, drag any file over fileDrop.rex and drop it. The +program demonstrates 'handling' the dropped file. The file: fileDrop.input +is used to simulate a data input file. When dropped on fileDrop.rex, the +program will process the data and produce a result. diff --git a/modules/windows/misc/fileDrop.empty b/modules/windows/misc/fileDrop.empty new file mode 100644 index 0000000..e69de29 diff --git a/modules/windows/misc/fileDrop.input b/modules/windows/misc/fileDrop.input new file mode 100644 index 0000000..793830d --- /dev/null +++ b/modules/windows/misc/fileDrop.input @@ -0,0 +1,14 @@ +/* Don't move or moditfy the third line. */ +/* The record processor searches for this marker. */ +----data input file---- + +This is +just +a fake +file +to +simulate processing a data input +file. +It +has no +meaning. diff --git a/modules/windows/misc/fileDrop.rex b/modules/windows/misc/fileDrop.rex new file mode 100644 index 0000000..1a99401 --- /dev/null +++ b/modules/windows/misc/fileDrop.rex @@ -0,0 +1,164 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Demonstrates handling files 'dropped' on this program. In Windows explorer, + * drag any file over this program and drop it. The OS will then execute this + * program and provide the complete path name of the 'dropped' file as the + * argument to this program. The program then 'handles' the dropped file. Use + * fileDrop.input to simulate processing a data input file. + * + * Note that you can also run this program from the command prompt by supplying + * the correct file name argument. I.e.: + * + * rexx fileDrop.rex fileDrop.input + * + */ +use arg fileName + + -- Note that the OS seems to tack an extra space on the end of the file name + -- argument. So, we strip it off to start with. + fileName = fileName~strip + + -- Display the fileName argument. + msg = "Got file name argument:" || .endOfLine || .endOfLine || fileName + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + + -- Check if the file exists. If not, this program was probably invoked from + -- the command line rather than through drag-and-drop. + if \ SysFileExists(fileName) then do + msg = "The file does not exist." || .endOfLine || .endOfLine || - + "Perhaps you are not using drag and drop?" || .endOfLine || - + "In Windows explorer, drag a file and drop" || .endOfLine || - + "it on this program's icon." + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + return 9 + end + + -- Check if it is a directory. + if SysIsFileDirectory(fileName) then do + msg = 'Dropped file is a directory. Will print out directory contents.' + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + + count = printDirectory(fileName) + msg = 'There were' count 'entries in the directory. Quitting.' + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + return 0 + end + + -- Should be a file, be sure we can read it. + f = .stream~new(fileName) + if f~open("READ") \== "READY:" then do + msg = "Could not open:" || .endOfLine || .endOfLine || - + fileName || .endOfLine || .endOfLine || - + "for reading. Quitting" + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + return 9 + end + + -- Collect some data on the file and then display it. + count = f~lines + if count >= 3 then do + line = f~linein(3) + number = 3 + end + else if count >= 1 then do + line = f~linein(1) + number = 1 + end + else do + line = "The file is empty." + number = 0 + end + f~close + + msg = "The file has" count "lines." || .endOfLine || .endOfLine + if number == 0 then do + msg = msg || line + end + else do + msg = msg || "Line number" number "reads as follows:" || .endOfLine || .endOfLine || line + end + + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + + -- This would be a check that the file is a correct data input file. + if line == "----data input file----" then do + recordCount = updateDataBase(f) + msg = "Processed" recordCount "database records. Finished." + end + else do + msg = "Invalid data file. Quitting" + end + + j = RxMessageBox(msg, "ooRexx File Drop Handling", "OK", "INFORMATION") + return 0 + +-- Print out the directory entries in the specified directory +::routine printDirectory + use strict arg directoryName + + dir = directoryName || '\*.*' + count = -1 + + j = SysFileTree(dir, f., 'BT') + if j == 0 then do + do i = 1 to f.0 + say f.i + end + count = f.0 + end + + return count + +-- Update the database use the specified information. +::routine updateDataBase + use strict arg f + + -- Simulate processing / updating database records using the data input file. + -- We just fake it. + countProcessed = 0 + ret = f~seek('=1 READ') + do while f~state == "READY" + line = f~linein + countProcessed += 1 + end + + countProcessed *= random(2, 9) + + f~close + return countProcessed diff --git a/modules/windows/ole/ReadMe.first b/modules/windows/ole/ReadMe.first new file mode 100644 index 0000000..66f7122 --- /dev/null +++ b/modules/windows/ole/ReadMe.first @@ -0,0 +1,17 @@ + + + OLE Object Examples + =================== + + This directory and its subdirectories contain a number of example + programs that use the OleObject class. + + There are two other nice example programs that combine using the + OleObject class and the ooDialog framework. Those programs are + included in the ooDialog examples in the following directories: + + samples\oodialog\oleinfo + + and + + samples\oodialog\sysinfo diff --git a/modules/windows/ole/adsi/adsi1.rex b/modules/windows/ole/adsi/adsi1.rex new file mode 100755 index 0000000..b6a72f0 --- /dev/null +++ b/modules/windows/ole/adsi/adsi1.rex @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 1: */ +/* */ +/* Retrieve information about a computer with ADSI. */ +/* */ +/* */ +/*******************************************************************/ + +ComputerName = value("COMPUTERNAME",,"ENVIRONMENT") +myComputer = .OLEObject~GetObject("WinNT://"||ComputerName||",computer") + +say "Standard properties of this computer:" +say left("Name:", 10) myComputer~name +say left("Class:", 10) myComputer~class +say left("GUID:", 10) myComputer~guid +say left("ADsPath:",10) myComputer~adspath +say left("Parent:", 10) myComputer~parent +say left("Schema:", 10) myComputer~schema + +return 0 + diff --git a/modules/windows/ole/adsi/adsi2.rex b/modules/windows/ole/adsi/adsi2.rex new file mode 100755 index 0000000..24b9750 --- /dev/null +++ b/modules/windows/ole/adsi/adsi2.rex @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 2: */ +/* */ +/* Get a users' full name and change it. */ +/* */ +/*******************************************************************/ + +ComputerName = value("COMPUTERNAME",,"ENVIRONMENT") -- get ComputerName +UserID = value("USERNAME",,"ENVIRONMENT" ) -- get UserName + +userObject = .OLEObject~GetObject("WinNT://"||ComputerName||"/"||UserID||",user") + +/* using the object property */ +say "The full name for" UserID "is" userObject~FullName + +/* using the standard get method for ADSI objects */ +say "The full name for" UserID "is" userObject~Get("FullName") + +say "Would you like to rename the full name (y/n)?" +pull answer + +if answer = "Y" then do + say "New full name:" + parse pull answer + + /* set the property */ + /* as an alternative, the property can also be set with the standard put */ + /* method of ADSI objects: */ + /* userObject~Put("FullName",answer) */ + userObject~FullName=answer + + /* because properties are cached to avoid network calls, changing the */ + /* properties of an object will only affect the cache at first. */ + /* the object gets updated with the SetInfo method: */ + userObject~SetInfo + + say "updated the full name for" UserID +end + +return 0 diff --git a/modules/windows/ole/adsi/adsi3.rex b/modules/windows/ole/adsi/adsi3.rex new file mode 100755 index 0000000..5716111 --- /dev/null +++ b/modules/windows/ole/adsi/adsi3.rex @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 3: */ +/* */ +/* Showing the use of ADSI containers. */ +/* */ +/*******************************************************************/ + +computerName = value("COMPUTERNAME",,"ENVIRONMENT") -- alternatively: '.' +groupName = getLocalAdministratorGroupName(computerName) +container = .OLEObject~GetObject("WinNT://"computerName||"/"groupName",group") +do member over container~members + say member~class ":" member~name "["member~description"]" +end + +/* Cf. (as of 2022-05-07): + + , +*/ + +::routine getLocalAdministratorGroupName -- return local name of the administrator group + use arg computer + sid="S-1-5-32-544" -- SID for local administrator group + wmiService = .oleObject~getObject("winmgmts:\\"computer"\root\cimv2") + -- will return a collection with a single element + groups=wmiService~execQuery("select * from Win32_Group where LocalAccount = TRUE and sid='"sid"'") + if groups=.nil then return "Administrators" -- default: return English name + return groups~itemIndex(0)~name -- return local group name + diff --git a/modules/windows/ole/adsi/adsi4.rex b/modules/windows/ole/adsi/adsi4.rex new file mode 100755 index 0000000..d6fe938 --- /dev/null +++ b/modules/windows/ole/adsi/adsi4.rex @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 4: */ +/* */ +/* Using filters with ADSI collections. */ +/* */ +/*******************************************************************/ + +ComputerName = value("COMPUTERNAME",,"ENVIRONMENT") + +computerObject = .OLEObject~GetObject("WinNT://"||ComputerName) + +computerObject~Filter = .array~of("Group","Service") + +/* show only objects of type Group and Service: */ +do item over computerObject + say item~class ":" item~name +end + +return 0 diff --git a/modules/windows/ole/adsi/adsi5.rex b/modules/windows/ole/adsi/adsi5.rex new file mode 100755 index 0000000..f6a30c9 --- /dev/null +++ b/modules/windows/ole/adsi/adsi5.rex @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 5: */ +/* */ +/* Displaying namespaces and domains. */ +/* */ +/*******************************************************************/ + +myADS = .OLEObject~GetObject("ADs:") + +do namespace over myADS + say "Domains in" namespace~Name + do domain over namespace + if domain \= .nil then + say " " domain~name + else + say domain + end +end + +return 0 diff --git a/modules/windows/ole/adsi/adsi6.rex b/modules/windows/ole/adsi/adsi6.rex new file mode 100755 index 0000000..d42af0f --- /dev/null +++ b/modules/windows/ole/adsi/adsi6.rex @@ -0,0 +1,74 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 6: */ +/* */ +/* Inspecting properties of an object. */ +/* */ +/*******************************************************************/ + +ComputerName = value("COMPUTERNAME",,"ENVIRONMENT") + +myDomain = .OLEObject~GetObject("WinNT://"||ComputerName) +mySchemaClass = .OLEObject~GetObject(myDomain~schema) + +say "Properties for the" myDomain~name "object:" +say + +if mySchemaClass~container = 1 then do + say myDomain~name "may contain the following objects:" + do i over mySchemaClass~Containment + say " " i + end +end +else + say myDomain~name "is not a container." + +say +say "Mandatory properties:" +do i over mySchemaClass~MandatoryProperties + say " " i +end + +say +say "Optional properties:" +do i over mySchemaClass~OptionalProperties + say " " i +end + +return 0 diff --git a/modules/windows/ole/adsi/adsi7.rex b/modules/windows/ole/adsi/adsi7.rex new file mode 100755 index 0000000..23971e7 --- /dev/null +++ b/modules/windows/ole/adsi/adsi7.rex @@ -0,0 +1,81 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 7: */ +/* */ +/* Create a group and several users in it. */ +/* */ +/*******************************************************************/ + +ComputerName = value("COMPUTERNAME",,"ENVIRONMENT") -- get ComputerName + +computer = .OLEObject~GetObject("WinNT://"||ComputerName) + +/* create a new group */ +newGroup = computer~Create("group", "REXX-TestGroup") +newGroup~Description = "A test group created with REXX" +newGroup~SetInfo + +/* make sure the information in the object cache is up-to-date */ +newGroup~GetInfo + +say "Created new group" newGroup~Name +say "Description:" newGroup~Description + +say +say "Creating 15 users in this group:" +say "User01..User15 with passwords demo01..demo15" +/* create several new users */ +do i = 1 to 15 + /* create name and other information */ + userName = "User"right(i,2,'0') + userFullName = "Demo User Number" i + userDescription = "A demo user that was created with REXX" + userPassword = "demo"right(i,2,'0') + + newUser = computer~Create("user", userName) + newUser~FullName = userFullName + newUser~Description = userDescription + newUser~SetPassword(userPassword) + newUser~SetInfo + newGroup~Add(newUser~ADsPath) +end + +say "done" + +return 0 diff --git a/modules/windows/ole/adsi/adsi8.rex b/modules/windows/ole/adsi/adsi8.rex new file mode 100755 index 0000000..0fb9e7a --- /dev/null +++ b/modules/windows/ole/adsi/adsi8.rex @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* ADSI Sample 8: */ +/* */ +/* Remove the users and the group that were created in */ +/* sample 7. */ +/* */ +/*******************************************************************/ + +ComputerName = value("COMPUTERNAME",,"ENVIRONMENT") -- get ComputerName +computer = .OLEObject~GetObject("WinNT://"||ComputerName) + +say "Removing the fifteen users..." +do i = 1 to 15 + computer~Delete("user", "User"||right(i,2,'0')) +end + +say "Removing the test group..." + +computer~Delete("group", "REXX-TestGroup") + +say "done" + +return 0 diff --git a/modules/windows/ole/apps/AOO_scalc_chart.rex b/modules/windows/ole/apps/AOO_scalc_chart.rex new file mode 100755 index 0000000..6e67c06 --- /dev/null +++ b/modules/windows/ole/apps/AOO_scalc_chart.rex @@ -0,0 +1,138 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + AOO_scalc_chart.rex using OLE (object linking and embedding) with ooRexx + + Links: + + + + + Using OLE create a new scalc worksheet, create random data and a chart based on it. + Demonstrates how to use UNO reflection and incorporate UNO_CONSTANTS and UNO_ENUM + values into a Rexx directory for easier use. +***********************************************************************/ + +/* create a spreadsheet, add data for comparing two years by quarter, add a chart */ +serviceManager = .OLEObject~new('com.sun.star.ServiceManager') +/* create spreadsheet, get first sheet */ +desktop = serviceManager~createInstance('com.sun.star.frame.Desktop') +noProps = .array~new /* empty array (no properties) */ +document = desktop~loadComponentFromURL('private:factory/scalc', '_blank', 0, noProps) +sheet = document~sheets~getByIndex(0) -- get first spreadsheet + +/* note values can be assigned to cells with "string", "formula" or "value" (for numbers) */ +/* create the titles, pretend the last two yers */ +year = date()~right(4)-2 +titles = "Quarter", year, year+1 /* title array */ +do col = 1 to titles~items + sheet~getCellByPosition(col-1,0)~string = titles[col] +end +/* get all UNO_ENUM values in a Rexx directory */ +justify = getAsDirectory(serviceManager, "com.sun.star.table.CellHoriJustify") +say "justify:" justify +/* right adjust the last two years + - possibility 1: sheet~getCellRangeByName("B1:C1")~setPropertyValue("HoriJustify", justify~right) + - or: */ +sheet~getCellRangeByName("B1:C1")~HoriJustify = justify~right + +/* get all UNO_CONSTANTS values in a Rexx directory */ +weights = getAsDirectory(serviceManager,"com.sun.star.awt.FontWeight") +say "weights:" weights +sheet~getCellRangeByName("A1:C1")~CharWeight = weights~bold /* column headings */ + +/* create random values for the quarter numbers */ +do line = 1 to 4 + sheet~getCellByPosition(0,line)~string = "Q"line /* title in first column */ + sheet~getCellByPosition(1,line)~value = random(0,500000)/100 + sheet~getCellByPosition(2,line)~value = random(0,750000)/100 +end +sheet~getCellRangeByName("A2:A5")~CharWeight = weights~bold /* column headings */ +/* format numbers, predefined style, format: "#,##0.00" */ +sheet~getCellRangeByName("B2:C5")~setPropertyValue("NumberFormat",4) + +/* create a chart from the data */ +structRect = serviceManager~bridge_getStruct("com.sun.star.awt.Rectangle") +structRect~X = 300 -- x-offset: 0.300 cm +structRect~Y = 2250 -- y-offset: 2.250 cm +structRect~Width = 16000 -- width: 16.000 cm +structRect~Height = 8000 -- height: 8.000 cm + +range = sheet~getCellRangeByName("A1:C5") /* data to be used for the chart */ +rangeAddr = range~getRangeAddress +arrOfAddr = .array~of(rangeAddr) /* create array with the range address */ +tableCharts = sheet~getCharts /* get chart collection & insert */ +tableCharts~addNewByName("FirstChart", structRect, arrOfAddr, .true, .true) + +/* Routine returns a Rexx directory containing all names and values of the supplied + UNO_CONSTANTS or UNO_ENUM class name (needs to be fully qualified). */ +::routine getAsDirectory + use strict arg serviceManager, unoClzName + + dir = .Directory~new -- directory will get + dir~objectName = unoClzName -- allows to show the uno class it represents + + ctxt = serviceManager~defaultContext + tdm = ctxt~getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager") + reflClz= tdm~getByHierarchicalName(unoClzName) + if reflClz~isNil then return dir -- return empty directory + + typeClass = reflClz~getTypeClass + if typeClass = 30 then -- UNO_CONSTANTS + do + dir~objectName = unoClzName "(UNO_CONSTANTS)" -- supply type info to name + do c over reflClz~getConstants -- iterate over constant fields + name = c~getName -- fully qualified + name = name~substr(name~lastPos('.')+1) -- extract last word + dir[name] = c~getConstantValue -- store constant values with their names + -- say "name:" name "->" c~getConstantValue + end + end + else if typeClass = 15 then -- UNO_ENUMERATION + do + dir~objectName = unoClzName "(UNO_ENUM)" -- supply type info to name + enumNames = reflClz~getEnumNames -- get all enumeration names + enumValues = reflClz~getEnumValues -- get all enumeration values + do i=1 to enumNames~items + name = enumNames[i] + name = name~substr(name~lastPos('.')+1) -- extract last word + dir[name] = enumValues[i] -- store enum values with their names + -- say "name:" name "->" enumValues[i] + end + end + return dir diff --git a/modules/windows/ole/apps/AOO_simpress_present.rex b/modules/windows/ole/apps/AOO_simpress_present.rex new file mode 100755 index 0000000..3bed5c5 --- /dev/null +++ b/modules/windows/ole/apps/AOO_simpress_present.rex @@ -0,0 +1,124 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + AOO_simpress_present.rex using OLE (object linking and embedding) with ooRexx + + Links: + + + + + Using OLE create a new simpress presentation about REXX and ooRexx and then + display it as a presentation. Demonstrates how to use enumeration to + enumerate paragraphs of a text and query their 'NumberingLevel' property. +***********************************************************************/ + +/* create a presentation, then start it */ +serviceManager = .OLEObject~new('com.sun.star.ServiceManager') +desktop = serviceManager~createInstance('com.sun.star.frame.Desktop') +noProps = .array~new /* empty array (no properties) */ +document = desktop~loadComponentFromURL('private:factory/simpress', '_blank', 0, noProps) + +drawPages = document~getDrawPages -- get DrawPages + -- first page +drawPage=drawPages~getByIndex(0) -- get first (empty) page +drawPage~setPropertyValue("Layout", 0) -- "Title Slide" + +title = "ooRexx" +shape = drawPage~getByIndex(0) -- get first shape (title) +shape~setString(title) + +shape = drawPage~getByIndex(1) -- get second shape (subtitle) +cursor = shape~createTextCursor -- get XTextCursor +cr="0d"x +shape~insertString(cursor,"Open Object Rexx (ooRexx)"cr, .false) + +textRange=shape~getEnd -- get a XTextRange +textRange~setPropertyValue("CharHeight", 15) -- use 15 pixel height +info="(Presentation created:" .dateTime~new")" +textRange~setString(info) -- set it to this string + + -- add a second page +drawPage=drawPages~~insertNewByIndex(1)~getByIndex(1) -- insert at end, get access +drawPage~setPropertyValue("Layout", 1) -- "Title Content" +drawPage~getByIndex(0)~setString("Open Object Rexx (ooRexx)") -- first shape + +text=drawPage~getByIndex(1) -- get second shape (listing) +-- add string, supply level +call addItem text, "REXX (IBM)", 0 +call addItem text, "First released in 1979 for IBM mainframes", 1 +call addItem text, "Object REXX (IBM)", 0 +call addItem text, "Object-oriented successor to REXX", 1 +call addItem text, "First released in 1994 with IBM's OS/2 Warp", 1 +call addItem text, "Negotiations about open-sourcing with RexxLA", 1 +call addItem text, "Rexx Language Association (www.RexxLA.org)", 2 +call addItem text, "Source code handed over to RexxLA in 2003", 2 +call addItem text, "Open Object Rexx (ooRexx by RexxLA)", 0 +call addItem text, "First released in 2004 by RexxLA", 1, .false + +document~setModified(.false) -- inhibit save-as popup +/* OOo OLE interface does not answer hasOleMethod('start') with .true + therefore forcing "start" to be dispatched to Windows */ +document~getPresentation~dispatch("start") -- start presentation + +say "double-check: dump NumberingLevel of each text paragraph:" +call dumpItems text -- demonstrates enumerating listing text + + +::routine addItem -- adds string at the given (0-based outline) level + use arg xText, string, level, bNewParagraph=.true + + xTR=xText~getEnd -- get XTextRange + xTR~setPropertyValue("NumberingLevel",level) -- set XTextRange level + xTR~setString(string) -- set string + + if bNewParagraph=.true then -- add new paragraph + xTR~getEnd~setString("0a"x) -- add linefeed character -> new paragraph + +::routine dumpItems -- show level and string from XText + use arg xText + + enum=xText~createEnumeration -- enumerate paragraphs + do i=1 while enum~hasMoreElements + xtr=enum~nextElement -- we need XTextRange's string & properties + nl=xtr~getPropertyValue("NumberingLevel") + say " item #" i": NumberingLevel="pp(nl) pp(xtr~getString) + end + return +pp: -- "pretty print", internal routine: return argument enclosed in square brackets + return "["arg(1)"]" diff --git a/modules/windows/ole/apps/AOO_swriter_paragraphs.rex b/modules/windows/ole/apps/AOO_swriter_paragraphs.rex new file mode 100755 index 0000000..83dc3eb --- /dev/null +++ b/modules/windows/ole/apps/AOO_swriter_paragraphs.rex @@ -0,0 +1,115 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + AOO_swriter_paragraphs.rex using OLE (object linking and embedding) with ooRexx + + Links: + + + + + Using OLE create a new swriter document, add paragraphs that get aligned + in four different ways. Demonstrates how to use UNO reflection and + incorporate UNO_CONSTANTS and UNO_ENUM values into a Rexx directory for + easier use. +***********************************************************************/ + +/* create a text document, demonstrate how to align paragraphs */ +serviceManager = .OLEObject~new('com.sun.star.ServiceManager') +/* create text document */ +desktop = serviceManager~createInstance('com.sun.star.frame.Desktop') +noProps = .array~new /* empty array (no properties) */ +document = desktop~loadComponentFromURL('private:factory/swriter', '_blank', 0, noProps) + +text = document~getText -- get text object +text~setString("Hello, this is ooRexx on:" .DateTime~new"!") +cursor = text~createTextCursor + +ctlChars = getAsDirectory(serviceManager, "com.sun.star.text.ControlCharacter") -- UNO_CONSTANT +paraBreak = ctlChars~paragraph_break -- get paragraph break constant + +paraAdj = getAsDirectory(serviceManager, "com.sun.star.style.ParagraphAdjust") -- UNO_ENUM + +arr = .array~of("right", "center", "block", "left") -- adjustments +do adj over arr -- iterate over adjustments, create string, adjust + cursor~gotoEnd(.false) -- position at end + text~insertControlCharacter(cursor, paraBreak, .false) + string = ("This paragraph will be" adj"-adjusted. ")~copies(8) + text~insertString(cursor, string, .true) + -- fetch appropriate adjust enum value from directory + cursor~setPropertyValue("ParaAdjust", paraAdj~send(adj)) +end + + +/* Routine returns a Rexx directory containing all names and values of the supplied + UNO_CONSTANTS or UNO_ENUM class name (needs to be fully qualified). */ +::routine getAsDirectory + use strict arg serviceManager, unoClzName + + dir = .Directory~new -- directory will get + dir~objectName = unoClzName -- allows to show the uno class it represents + + ctxt = serviceManager~defaultContext + tdm = ctxt~getValueByName("/singletons/com.sun.star.reflection.theTypeDescriptionManager") + reflClz= tdm~getByHierarchicalName(unoClzName) + if reflClz~isNil then return dir -- return empty directory + + typeClass = reflClz~getTypeClass + if typeClass = 30 then -- UNO_CONSTANTS + do + dir~objectName = unoClzName "(UNO_CONSTANTS)" -- supply type info to name + do c over reflClz~getConstants -- iterate over constant fields + name = c~getName -- fully qualified + name = name~substr(name~lastPos('.')+1) -- extract last word + dir[name] = c~getConstantValue -- store constant values with their names + -- say "name:" name "->" c~getConstantValue + end + end + else if typeClass = 15 then -- UNO_ENUMERATION + do + dir~objectName = unoClzName "(UNO_ENUM)" -- supply type info to name + enumNames = reflClz~getEnumNames -- get all enumeration names + enumValues = reflClz~getEnumValues -- get all enumeration values + do i=1 to enumNames~items + name = enumNames[i] + name = name~substr(name~lastPos('.')+1) -- extract last word + dir[name] = enumValues[i] -- store enum values with their names + -- say "name:" name "->" enumValues[i] + end + end + return dir diff --git a/modules/windows/ole/apps/AOO_swriter_table.rex b/modules/windows/ole/apps/AOO_swriter_table.rex new file mode 100755 index 0000000..a0cc262 --- /dev/null +++ b/modules/windows/ole/apps/AOO_swriter_table.rex @@ -0,0 +1,181 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + AOO_swriter_table.rex using OLE (object linking and embedding) with ooRexx + + Links: + + + + + This is the ooRexx version (which includes corrections) of the VBScript + "A Quick Tour" example from the AOO (Apache OpenOffice) DevGuide, chapter + "Automation_Bridge" documentation. + + Using OLE create a new swriter document, a TextTable, a TextFrame, paragraphs + and apply various formatings. +***********************************************************************/ + + -- The service manager is always the starting point + -- If there is no office running then an office is started up + objServiceManager= .OleObject~new("com.sun.star.ServiceManager") + + -- Create the Desktop + objDesktop= objServiceManager~createInstance("com.sun.star.frame.Desktop") + + -- Open a new empty writer document + args=.array~new + objDocument= objDesktop~loadComponentFromURL("private:factory/swriter", "_blank", 0, args) + + -- Create a text object + objText= objDocument~getText + + -- Create a cursor object + objCursor= objText~createTextCursor + + -- Inserting some Text + vbLf = "0a"x -- line-feed character + objText~insertString( objCursor, "The first line in the newly created text document."vbLf, .false) + + -- Inserting a second line + objText~insertString( objCursor, "Now we-- re in the second line", .false) + + -- Create instance of a text table with 4 columns and 4 rows + objTable= objDocument~createInstance( "com.sun.star.text.TextTable") + objTable~initialize( 4, 4 ) + + -- Insert the table + objText~insertTextContent( objCursor, objTable, .false) + + -- Get first row + objRows= objTable~getRows + objRow= objRows~getByIndex( 0) + + -- Set the table background color + objTable~setPropertyValue( "BackTransparent", .false) + objTable~setPropertyValue( "BackColor", 13421823) + + -- Set a different background color for the first row + objRow~setPropertyValue( "BackTransparent", .false) + objRow~setPropertyValue( "BackColor", 6710932) + + -- Fill the first table row + call insertIntoCell "A1","FirstColumn", objTable -- insertIntoCell is a helper function, see below + call insertIntoCell "B1","SecondColumn", objTable + call insertIntoCell "C1","ThirdColumn", objTable + call insertIntoCell "D1","SUM", objTable + + objTable~getCellByName("A2")~setValue( 22.5 ) + objTable~getCellByName("B2")~setValue( 5615.3 ) + objTable~getCellByName("C2")~setValue( -2315.7 ) + objTable~getCellByName("D2")~setFormula( "=sum ++" ) + + objTable~getCellByName("A3")~setValue( 21.5 ) + objTable~getCellByName("B3")~setValue( 615.3 ) + objTable~getCellByName("C3")~setValue( -315.7 ) + objTable~getCellByName("D3")~setFormula( "sum ++" ) + + objTable~getCellByName("A4")~setValue( 121.5 ) + objTable~getCellByName("B4")~setValue( -615.3 ) + objTable~getCellByName("C4")~setValue( 415.7 ) + objTable~getCellByName("D4")~setFormula( "sum ++" ) + + range=objTable~getCellRangeByName("A2:D4") + range~setPropertyValue("NumberFormat", 4) -- set number format + -- use ParaAdjust: com.sun.star.style.ParagraphAdjust.RIGHT + range~setPropertyValue("ParaAdjust", 1) -- align right + + -- Change the CharColor and add a Shadow + objCursor~setPropertyValue( "CharColor", 255) + objCursor~setPropertyValue( "CharShadowed", .true) + + -- Create a paragraph break + -- The second argument is a com::sun::star::text::ControlCharacter::PARAGRAPH_BREAK constant + objText~insertControlCharacter( objCursor, 0 , .false) + + -- Inserting colored Text. + objText~insertString( objCursor, " This is a colored Text - blue with shadow"vbLf, .false) + + -- Create a paragraph break ( ControlCharacter::PARAGRAPH_BREAK). + objText~insertControlCharacter( objCursor, 0, .false) + + -- Create a TextFrame~ + objTextFrame= objDocument~createInstance("com.sun.star.text.TextFrame") + + -- Create a Size struct~ + objSize = objServiceManager~Bridge_GetStruct("com.sun.star.awt.Size") + objSize~Width= 15000 + objSize~Height= 400 + objTextFrame~setSize( objSize) + + -- TextContentAnchorType.AS_CHARACTER = 1 + objTextFrame~setPropertyValue( "AnchorType", 1) + + -- insert the frame + objText~insertTextContent( objCursor, objTextFrame, .false) + + -- Get the text object of the frame + objFrameText= objTextFrame~getText + + -- Create a cursor object + objFrameTextCursor= objFrameText~createTextCursor + + -- Inserting some Text + objFrameText~insertString( objFrameTextCursor, "The first line in the newly created text frame.", - + .false) + objFrameText~insertString( objFrameTextCursor, - + vbLf"With this second line the height of the frame raises.", .false) + + -- Create a paragraph break + -- The second argument is a com::sun::star::text::ControlCharacter::PARAGRAPH_BREAK constant + objFrameText~insertControlCharacter( objCursor, 0 , .false) + + -- Change the CharColor and remove the Shadow + objCursor~setPropertyValue( "CharColor", 65536) + objCursor~setPropertyValue( "CharShadowed", .false) + + -- Insert another string + objText~insertString( objCursor, " That-- s all for now !!", .false) + +::routine insertIntoCell + use arg strCellName, strText, objTable + + objCellText= objTable~getCellByName( strCellName) + objCellCursor= objCellText~createTextCursor + objCellCursor~setPropertyValue( "CharColor",16777215) + objCellText~insertString( objCellCursor, strText, .false) diff --git a/modules/windows/ole/apps/Lotus123.rex b/modules/windows/ole/apps/Lotus123.rex new file mode 100755 index 0000000..56a1797 --- /dev/null +++ b/modules/windows/ole/apps/Lotus123.rex @@ -0,0 +1,132 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* Lotus123.rex: OLE Automation with ooRexx */ +/* */ +/* Create a new spreadsheet in 1-2-3 and fill in a table with fictive */ +/* revenue numbers. The table will also contain a calculated field */ +/* and different styles. A second sheet is added with a 3D chart */ +/* displaying the revenue data. */ +/* */ +/**********************************************************************/ + +/* create a new 123 Workbook */ +Workbook = .OLEObject~New("Lotus123.Workbook") +Range = Workbook~Ranges("A1") +Range~Contents = "Open Object Rexx OLE Sample spreadsheet" + +/* fill the first column with month names */ +Col = "A" +Row = 3 +Range = Workbook~Ranges(Col || Row) +Range~Contents = "Month" +Range~Font~FontName = "Times New Roman" +Range~Font~Bold = "True" + +Do Month = 1 To 12 + Row = Row + 1 + Range = Workbook~Ranges(Col || Row) + Range~Contents = '"' || Right(Month, 2, "0") || "/98" + Range~TextHorizontalAlign = "$AlignLeft" +End + +Row = Row + 1 +Range = Workbook~Ranges(Col || Row) +Range~Contents = "All 1998" +Range~Font~Bold = "True" + +/* fill the second column with random revenue numbers */ +Col = "B" +Row = 3 +Range = Workbook~Ranges(Col || Row) +Range~Contents = "Revenue" +Range~Font~FontName = "Times New Roman" +Range~Font~Bold = "True" + +Do Month = 1 To 12 + Row = Row + 1 + Range = Workbook~Ranges(Col || Row) + Range~Contents = Random(20000, 100000) + Range~FormatName = "US Dollar" + Range~FormatDecimals = 0 +End + +Row = Row + 1 +Range = Workbook~Ranges(Col || Row) +Range~Contents = "@SUM(B4..B15)" +Range~Font~Bold = "True" +Range~FormatName = "US Dollar" +Range~FormatDecimals = 0 + +/* put a grid around the table */ +Range = Workbook~Ranges("A3..B16") +Range~GridBorder~Style = "$SolidBorder" + +/* use thick bottom lines for title and sum lines */ +Range = Workbook~Ranges("A3..B3") +Range~BottomBorder~Style = "$DoubleBorder" +Range = Workbook~Ranges("A16..B16") +Range~TopBorder~Style = "$DoubleBorder" + + +/* create a 3d chart showing revenue over month */ +Sheet = Workbook~NewSheet("$Last", 1, "False") +Range = Workbook~Ranges("A:A4..A:B15") +Chart = Sheet~NewChart(0, 0, 12800, 9600, Range) +Chart~Is3D = .True +Chart~Title~Lines(1)~Text = "Revenue development 1998" +Chart~Legend~Visible = .False + +Chart~XAxis~Title~Text = "Month" +Chart~XAxis~Title~Font~Size = "36" +Chart~XAxis~TickLabels~Font~Size = "36" + +Chart~YAxis~Title~Text = "Revenue" +Chart~YAxis~Title~Font~Size = "36" +Chart~YAxis~TickLabels~Font~Size = "36" +Chart~YAxis~SubTitle~Visible = .False + +/* save spreadsheet as file OLETest */ +Workbook~SaveAs("OLETest") + +say "Created" workbook~name + +Workbook~Close + + diff --git a/modules/windows/ole/apps/LotusNotes_mail.rex b/modules/windows/ole/apps/LotusNotes_mail.rex new file mode 100755 index 0000000..ec86166 --- /dev/null +++ b/modules/windows/ole/apps/LotusNotes_mail.rex @@ -0,0 +1,91 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* LotusNotes_mail.rex: OLE Automation with ooRexx */ +/* */ +/* Create a mail message in Lotus Notes and send it to a number of */ +/* recipients automatically. */ +/* */ +/**********************************************************************/ + +say "Please enter your name" +parse pull yourName + +/* create an array of the recipients */ +Recipients = .array~new + +say "Please enter a list of recipients (email addresses). Press enter ", + "after each entry (end list with 'Q')." + +i = 0 +do until answer~translate == "Q" + parse pull answer + if answer~translate \= "Q" then do + i = i + 1 + Recipients[i] = answer + end +end + +/* Create Notes object */ +Session = .OLEObject~New("Notes.NotesSession") +MailServer = Session~GetEnvironmentString("MailServer", .True) +MailFile = Session~GetEnvironmentString("MailFile", .True) +MailDb = Session~GetDatabase(MailServer, MailFile) + +Say "Creating mail to be sent to" i "recipients..." +MailDoc = MailDb~CreateDocument +MailDoc~Form = "Memo" +MailDoc~Logo = "StdNotesLtr9" +MailDoc~From = yourName +MailDoc~Subject = "Rexx OLE automation test mail" + +/* create a new body text with multiple lines */ +NewBody = MailDoc~CreateRichTextItem("Body") +NewBody~AppendText("To the readers of this mail message:") +NewBody~AddNewLine(2) +NewBody~AppendText("This mail has been sent with Open Object Rexx for Windows.") +NewBody~AddNewLine(1) +NewBody~AppendText("It was created automatically at" Time("N") "on" Date("N")) +NewBody~AppendText(" and then sent without any user interacting with the program.") + +MailDoc~SendTo = Recipients +MailDoc~Save(.False, .False) +MailDoc~Send(.False, Recipients) + +Say "Mail has been sent" diff --git a/modules/windows/ole/apps/LotusWordPro.rex b/modules/windows/ole/apps/LotusWordPro.rex new file mode 100755 index 0000000..5669d11 --- /dev/null +++ b/modules/windows/ole/apps/LotusWordPro.rex @@ -0,0 +1,80 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* LotusWordPro.rex: OLE Automation with ooRexx */ +/* */ +/* Create a new document in WordPro 97, enter some text with */ +/* different attributes and finally save and print the document. */ +/* */ +/* Since no check is done do ensure the new document does not already */ +/* exist you will get a popup message from WordPro asking to */ +/* overwrite an already existing document when this sample is run */ +/* multiple times. */ +/* */ +/**********************************************************************/ + +WordProApp = .OLEObject~New("WordPro.Application") +WordProApp~NewDocument("AutomatedDocument.lwp","","default.mwp") +WPDoc = WordProApp~ActiveDocument +WPDocText = WordProApp~Text + +WordProApp~Type("This is the first paragraph entered from REXX via ") +WordProApp~Type("the OLE automation classes.[Enter]") + +WordProApp~Type("The second paragraph will be changed in its ") +WordProApp~Type("appearance.") +WordProApp~SelectParagraph +WPDocText~Font~Name = "Arial" +WPDocText~Font~Bold = .True +WPDocText~Font~Italic = .True +WPDocText~Font~Size = 15 + +WordProApp~Type("[End][Enter][End]Document created at:" Time("N") "on" Date("N")) + +WPDoc~Save + +/* if you want this document printed, comment in the next line */ +--WordProApp~PrintOut(1, 1, 1, .True) + +say "Created" WPDoc~Path"\"WPDoc~Name + +WPDoc~Close +WordProApp~Quit + + diff --git a/modules/windows/ole/apps/LotusWordPro_clickHereFields.mwp b/modules/windows/ole/apps/LotusWordPro_clickHereFields.mwp new file mode 100644 index 0000000..054d194 Binary files /dev/null and b/modules/windows/ole/apps/LotusWordPro_clickHereFields.mwp differ diff --git a/modules/windows/ole/apps/LotusWordPro_clickHereFields.rex b/modules/windows/ole/apps/LotusWordPro_clickHereFields.rex new file mode 100755 index 0000000..491465e --- /dev/null +++ b/modules/windows/ole/apps/LotusWordPro_clickHereFields.rex @@ -0,0 +1,91 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* LotusWordPro_clickHereFields.rex: OLE Automation with ooRexx */ +/* */ +/* Create a new document in WordPro 97 with a provided Smartmaster. */ +/* Fill in some "Click here" fields with data prompted by the program */ +/* or queried from the system. Finally the document will be saved to */ +/* the same directory where this REXX program is located and sent to */ +/* the printer. */ +/* */ +/* Since no check is done do ensure the new document does not already */ +/* exist you will get a popup message from WordPro asking to */ +/* overwrite an already existing document when this sample is run */ +/* multiple times. */ +/* */ +/**********************************************************************/ + +/* determine path of this sample program */ +Parse Source . . ProgName +ProgPath = ProgName~Left(ProgName~LastPos("\")) + +/* determine the version of REXX currently running */ +Parse Version VersStr + +/* prompt user for some information */ +Say "Please enter your name:" +Parse Pull Name +If Name~Length = 0 Then + Name = "No name entered!" + +Say "Please enter your phone number:" +Parse Pull Phone +If Phone~Length = 0 Then + Phone = "No phone entered!" + +/* create a new document */ +WordProApp = .OLEObject~New("WordPro.Application") +docName = "LotusWordPro_clickHereFields.lwp" +smartMaster = "LotusWordPro_clickHereFields.mwp" +WordProApp~NewDocument(docName, ProgPath, ProgPath || smartMaster) + +/* replace the click here blocks in the document with the new values */ +WordProApp~Foundry~ClickHeres("YourName")~InsertText(Name) +WordProApp~Foundry~ClickHeres("YourPhone")~InsertText(Phone) +WordProApp~Foundry~ClickHeres("ProgramName")~InsertText(ProgName) +WordProApp~Foundry~ClickHeres("RexxVersion")~InsertText(VersStr) + +WordProApp~Save +--WordProApp~PrintOut(1, 1, 1, .True) + +WordProApp~Close(.False) +WordProApp~Quit + + diff --git a/modules/windows/ole/apps/MSAccessDemo.rex b/modules/windows/ole/apps/MSAccessDemo.rex new file mode 100644 index 0000000..16850c3 --- /dev/null +++ b/modules/windows/ole/apps/MSAccessDemo.rex @@ -0,0 +1,207 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2006-2024 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* + purpose: Demonstrate how one can interact with a MS Access databases using ActiveX/OLE + needs: MS Access installed + + links: + + +*/ + +accessApp =.OleObject~new("Access.Application") +dbFileName=directory()"\ooRexxDemo.mdb" -- define database file name +if SysFileExists(dbFileName) then -- open existing database + accessApp~openCurrentDatabase(dbFileName) +else + accessApp~newCurrentDatabase(dbFileName) -- create new database + +conn=accessApp~currentProject~connection -- get connection object + +call dropTable conn -- make sure table is dropped +call createTable conn -- create a table in the database +call fillTable conn -- enter records to the table +call showTable conn -- show presently stored records +call deleteAndShow conn -- delete a record, show results +call updateAndShow conn -- update a few records, show results +conn~close -- close connection to the database + +accessApp~closeCurrentDatabase -- close database +call compressAndRepair accessApp, dbFileName -- compress database + +say ".rexxInfo~architecture:" pp(.rexxInfo~architecture) "(bitness)" + +/* ------------------------------------------------------------------------- */ +::routine dropTable + use arg conn -- fetch connection to database + + signal on any -- intercept any exception + conn~execute("drop table myTable") -- execute SQL statement + say "dropped 'myTable'" + say center(" end of dropTable ", 70, "-") + say + return +any: + say "could not drop 'myTable' (does it exist?)" + say center(" end of dropTable ", 70, "-") + say + return + +/* ------------------------------------------------------------------------- */ +::routine createTable + use arg conn -- fetch connection to database + + sql="create table myTable (id integer, name text (30) )" + say "executing" pp(sql) "..." + conn~execute(sql) + say center(" end of createTable ", 70, "-") + say + +/* ------------------------------------------------------------------------- */ +::routine fillTable + use arg conn -- fetch connection to database + + -- define a few names to insert into the database + s=.set~of("Chip Davis", "Christian Michel", "David Ashley", - + "Erich Steinböck", "Florian Große-Coosmann", "Frank Clark", - + "Gil Barmwater", "Jan Engehausen", "Lavrentios Servissoglou", - + "Jean-Louis Faucher", "Kurt Märker", "Lee Peedin", - + "Manfred Schweizer", "Mark Hessling", "Mark Miesfeld", - + "Mike F. Cowlishaw", "Pam Taylor", "P.O. Jonsson", - + "Reiner Micke", "René Jansen", "Rick McGuire", - + "Rony G. Flatscher", "Stefan Dörsam", "Uwe Berger", - + "Walter Pachl" - + ) + + -- an entry in the .local or .environment directory can be referenced by using an + -- environment symbol, e.g. the entry "TOTAL.RECS" can be referred to with its + -- environment symbol ".TOTAL.RECS" (note the leading dot) from any Rexx program + .local~total.recs=s~items -- save number of records in local environment + say "inserting" pp(.total.recs) "record(s) into the table..." + say + + do counter c name over s -- iterate over collected items (arbitrary order) + sql="insert into myTable (id, name) values ("right(c,2)", '"name"' )" + say " " right(c,2)":" pp(sql) -- show sql statement + conn~execute(sql) -- execute the statement + end + say center(" end of fillTable ", 70, "-") + say + +/* ------------------------------------------------------------------------- */ +::routine showTable + use arg conn -- fetch connection to database + + sql="select * from myTable order by id" + rs=conn~execute(sql) + rs~moveFirst -- just make sure, it is pointing to the first record + do counter c while rs~eof=.false -- loop over record set + say " " right(c,2) - + "id="pp(rs~fields["id"]~value~right(2)) - + "name="pp(rs~fields["name"]~value) + rs~moveNext + end + rs~close + say center(" end of showTable ", 70, "-") + say + return + +/* ------------------------------------------------------------------------- */ +::routine deleteAndShow -- delete a random row + use arg conn -- fetch connection to database + + say "deleting a record from the table:" + say + -- delete row with an arbitrary value for the field "id" + sql="delete from myTable where id="random(1,.total.recs) + say " executing" pp(sql) "..." + + param=.OLEVariant~new(count) + conn~execute(sql, param) + say " " pp(param~!varValue_) "record deleted." + say + + .local~total.recs=.total.recs-1 -- adjust total number of records + + call showTable conn -- show presently stored records + +/* ------------------------------------------------------------------------- */ +::routine updateAndShow + use arg conn -- fetch connection to database + + say "updating a few records from the table:" + say + -- update some records randomly + sql="update myTable set id=id*3 where id >" random(1,.total.recs) + say " executing" pp(sql) "..." + param = .OLEVariant~new(count) + conn~execute(sql, param) + say " " pp(param~!varValue_) "record(s) affected." + say + + call showTable conn -- show presently stored records + +/* ------------------------------------------------------------------------- */ +::routine compressAndRepair + use strict arg accessApp, dbFileName + + say "before compress & repair, database file size:" pp(stream(dbFileName, "c", "query size")) + compressedName=SysTempFileName(dbFileName"-cmp???") -- get a unique new file name + + dbEngine=accessApp~DBEngine -- get database engine + dbEngine~compactDatabase(dbFileName, compressedName) -- carry out compact & repair + + say "after compress & repair, database file size:" pp(stream(compressedName, "c", "query size")) + -- create a unique backup file name containing date and time of backup + newBkpFileName=dbFileName"-bkp-"date("S")"-"time()~changestr(":","") + + say "renaming work files..." + -- rename original database file name to backup file name + cmdText="ren" '"'dbFileName'"' filespec("Name", newBkpFileName) + say "DOS command:" pp(cmdText) + address cmd cmdText -- use ADDRESS CMD explicitly + + -- now rename new compressed file to original databse file name + cmdText="ren" '"'compressedName'"' filespec("Name", dbFileName) + say "DOS command:" pp(cmdText) + cmdText -- this uses ADDRESS CMD implicitly + say center(" end of compressAndRepair ", 70, "-") + say + +/* ------------------------------------------------------------------------- */ +::routine pp -- "pretty print" ;) + return "[" || arg(1) || "]" diff --git a/modules/windows/ole/apps/MSAccessDemo_32bit_only.rex b/modules/windows/ole/apps/MSAccessDemo_32bit_only.rex new file mode 100755 index 0000000..3dc5e21 --- /dev/null +++ b/modules/windows/ole/apps/MSAccessDemo_32bit_only.rex @@ -0,0 +1,307 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2006-2024 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* + purpose: Demonstrate how one can interact with Jet (MS Access) databases using ActiveX/OLE + needs: MS Access resp. the JetEngine installed + + notes: This sample can only run on a 32-bit ooRexx. The Jet Engine can not + read Office 2007 database file formats. Therefore, we check if + Access is 2007, and if so, force the database to be created in + Access 2003 format. Look at the createDataBaseFile() routine for + how this is done. + + This sample uses some public routines from the oleUtils framework. + getAddressingMode() + createOleObject() + + links: + + +*/ + +-- This first function just checks to be sure the sample can execute on the +-- current system. Look at the function code at the end of the file for the +-- details. The function returns the oleObject, access application object, on +-- success and .nil if this sample can not run on the current system. +accessApplication = checkSystem() +if accessApplication == .nil then return + + +dbFileName=directory()"\ooRexxDemo.mdb" -- define database file name +call createDataBaseFile dbFileName, accessApplication -- create database file, if necessary + +conn=.oleobject~new("ADODB.Connection") -- create an ADO conncection to the database +conn~provider="Microsoft.Jet.OLEDB.4.0" -- tell the connection what driver to use + +conn~open(dbFileName) -- open a connection to the database + +call dropTable conn -- make sure table is dropped +call createTable conn -- create a table in the database +call fillTable conn -- enter records to the table +call showTable conn -- show presently stored records +call deleteAndShow conn -- delete a record, show results +call updateAndShow conn -- update a few records, show results + +conn~close -- close connection to the database + +call compressAndRepair dbFileName + +::requires 'oleUtils.frm' + +::routine createDataBaseFile + use strict arg dbFileName, appAccess + + if stream(dbFileName, "c", "query exists")="" then -- database file does not exist + do + -- We have to know if this is Access 2007 or not. The Jet Engine can not + -- read the Access 2007 default file format. So, if this is Access 2007, + -- we force the database to be created Access 2002-2003 format. + + -- create the database file + if appAccess~version >= 12 then do + formatConstant = appAccess~getConstant('acNewDatabaseFormatAccess2002') + appAccess~NewCurrentDatabase(dbFileName, formatConstant) + + -- With Access 2007, we have to explicitly close the database, or the + -- Jet Engine can not open it. Prior to Access 2007, this step is not + -- needed. + appAccess~closeCurrentDatabase + end + else do + -- Prior to Access 2007, the NewCurrentDatabase only takes 1 argument. + appAccess~NewCurrentDatabase(dbFileName) + end + say "created database file" pp(dbFileName) + end + else + say "database file" pp(dbFileName) "exists already" + + say center(" end of createDataBaseFile ", 70, "-") + say + + -- This is the last place in this example where the Access application object + -- is needed. So we close it now. All the work is actually done by the Jet + -- Engine. + appAccess~quit + + +::routine dropTable + use arg conn -- retrieve connection to database + + signal on any -- intercept any exception + conn~execute("drop table myTable") -- execute SQL statement + say "dropped 'myTable'" + say center(" end of dropTable ", 70, "-") + say + return +any: + say "could not drop 'myTable'" + say condition("C") condition("D") + say center(" end of dropTable ", 70, "-") + say + return + +::routine createTable + use arg conn -- retrieve connection to database + + sql="create table myTable (id integer, name text (30) )" + say "executing" pp(sql) "..." + conn~execute(sql) + say center(" end of createTable ", 70, "-") + say + +::routine fillTable + use arg conn -- retrieve connection to database + + -- define a few names to insert into the database + s=.set~of("Chip Davis", "Christian Michel", "David Ashley", - + "Florian Große-Coosmann", "Frank Clark", "Gil Barmwater", - + "Jan Engehausen", "Lavrentios Servissoglou", "Lee Peedin", - + "Manfred Schweizer", "Mark Hessling", "Pam Taylor", - + "Reiner Micke", "René Jansen", "Rick McGuire", - + "Rony G. Flatscher", "Stefan Dörsam", "Uwe Berger", - + "Walter Pachl", "Mark Miesfeld" - + ) + + .local~tmp.nrRecs=s~items -- save number of records in local environment + .local~tmp.length=length(.tmp.nrRecs) -- save length + + say "inserting" pp(.tmp.nrRecs) "record(s) into the table..." + say + + i=0 + do name over s -- iterate over collected items (arbitrary order) + i=i+1 -- calc unique id value + sql="insert into myTable (id, name) values ("i~right(.tmp.length)", '"name"' )" + say " " i~right(.tmp.length)":" pp(sql) -- show sql statement + conn~execute(sql) -- execute the statement + end + say center(" end of fillTable ", 70, "-") + say + + +::routine showTable + use arg conn -- retrieve connection to database + + rs=.oleObject~new("ADODB.Recordset") -- create an ADO recordset object + + rs~CursorType = 1 -- .ole.const~adOpenKeyset + rs~LockType = 3 -- .ole.const~adLockOptimistic + sql="select * from myTable order by id" + rs~open(sql, conn) -- open the table + totRecs=rs~recordCount -- get recordCount + say "nr. of records:" pp(totRecs)":" + say + rs~moveFirst -- just make sure, it is pointing to the first record + do i=1 to totRecs while rs~eof=.false -- loop over record set + say " " i~right(.tmp.length)":" - + "id="pp(rs~fields["id"]~value~right(.tmp.length)) - + "name="pp(rs~fields["name"]~value) + rs~moveNext + end + rs~close + say center(" end of showTable ", 70, "-") + say + +::routine deleteAndShow + use arg conn -- retrieve connection to database + + say "deleting a record from the table:" + say + -- delete row with an arbitrary value for the field "id" + sql="delete from myTable where id="random(1,.tmp.nrRecs) + say " executing" pp(sql) "..." + conn~execute(sql) + say + + .local~tmp.nrRecs=.tmp.nrRecs-1 -- subtract 1 from total number of records + .local~tmp.length=length(.tmp.nrRecs) -- save length + + call showTable conn -- show presently stored records + +::routine updateAndShow + use arg conn -- retrieve connection to database + + say "updating a few records from the table:" + say + -- update some records randomly + sql="update myTable set id=id*3 where id >" random(1,.tmp.nrRecs) + say " executing" pp(sql) "..." + param = .OLEVariant~new(count) + conn~execute(sql, param) + say " " pp(param~!varValue_) "record(s) affected." + say + + call showTable conn -- show presently stored records + + +::routine compressAndRepair -- Jet (= MS Access) databases tend to grow considerably + parse arg dbFileName + + say "before compress & repair, database file size:" pp(stream(dbFileName, "c", "query size")) + compressedName=SysTempFileName(dbFileName"-cmp???") -- get a unique new file name + +/* + -- Hint: if your MDB-database is secured with a database password, you must supply + -- that password in the variable "pw": + + if pw="" then pwdString="" + else pwdString=";Jet OLEDB:Database Password="pw + + fromString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="dbFileName || pwdString + toString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="compressedName || pwdString +*/ + + -- Hint: MDB database files have no database password set + fromString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="dbFileName + toString ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="compressedName + + + jro=.oleObject~new("JRO.JetEngine") + jro~compactDatabase(fromString, toString) -- carry out compact & repair + say "after compress & repair, database file size:" pp(stream(compressedName, "c", "query size")) + + -- create a unique backup file name containing date and time of backup + newBkpFileName=dbFileName"-bkp-"date("S")"-"time()~changestr(":","") + + say "renaming work files..." + -- rename original database file name to backup file name + cmdText="ren" '"'dbFileName'"' filespec("Name", newBkpFileName) + say "DOS command:" pp(cmdText) + address cmd cmdText -- use ADDRESS CMD explicitly + + -- now rename new compressed file to original databse file name + cmdText="ren" '"'compressedName'"' filespec("Name", dbFileName) + say "DOS command:" pp(cmdText) + cmdText -- this uses ADDRESS CMD implicitly + say center(" end of compressAndRepair ", 70, "-") + say + + +::routine pp + return "[" || arg(1) || "]" + +::routine checkSystem + + mode = getAddressingMode() + if mode == 64 then do + say + say 'You are running a 64-bit compiled ooRexx' + say + say 'This sample relies on the Microsoft Jet Database Engine.' + say 'There is no 64-bit version of Jet, therefore a 64-bit' + say 'compiled ooRexx can not run this sample. This sample' + say 'may be upgraded in the future to work with Access 2007' + say 'and its Microsoft Access Engine (ACE). ACE is also' + say '32-bit. It is not clear at the current time whether ACE' + say 'will be ported to 64-bit.' + say + say 'Sorry, this sample is 32-bit only.' + + return .nil + end + + -- We have to have Access, exit gracefully if not. + accessApplication = createOleObject("Access.Application", .true) + if accessApplication == .nil then do + say + say 'This example requires Microsoft Access, which does not seem' + say 'to be installed. Quitting.' + end + + return accessApplication + diff --git a/modules/windows/ole/apps/MSAccess_contacts.rex b/modules/windows/ole/apps/MSAccess_contacts.rex new file mode 100755 index 0000000..05acb5b --- /dev/null +++ b/modules/windows/ole/apps/MSAccess_contacts.rex @@ -0,0 +1,93 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* MSAccess_contacts.rex: OLE Automation with ooRexx */ +/* */ +/* Creating a database in Microsoft Access. */ +/* */ +/**********************************************************************/ + +-- Initialize string to database path. +-- get TEMP directory of current user +tempDir = value("TEMP",,"ENVIRONMENT") -- get value of environment variable "TEMP" +strDB = tempDir"\newDatabaseByooRexx.mdb" -- define fully qualified database name +say "Fully qualifed database file name:" strDB + +-- Remove any previously created copy of this sample database +if stream(strDB,'c','query exists') \= '' then + do + say 'Database exists (from earlier run), deleting it ...' + rv = SysFileDelete(strDB) + if rv \= 0 then + do + say 'Delete of previous database failed, exiting now' + exit -1 -- return code not 0 so to indicate problem + end + end + +-- Create new instance of Microsoft Access. +appAccess = .OLEObject~new("Access.Application") + +-- Open database in Microsoft Access window. +appAccess~NewCurrentDatabase(strDB) + +-- Get Database object variable. +dbs = appAccess~CurrentDb + +-- Create new table. +tdf = dbs~CreateTableDef("Contacts") + +-- Create field in new table. +/* Please note how to access the constant. + Microsoft documentation and the MS OLEViewer output + these constants as dbText, dbBinary, etc. - the type library + however prints them as DB_TEXT, DB_BINARY, etc.. Unless + documentation is found why the names should be translated, + the OLE code will *NOT* convert the names. */ +fld = tdf~CreateField("CompanyName", appAccess~getConstant("db_Text"), 40) + +-- Append Field and TableDef objects. +tdf~Fields~Append(fld) +dbs~TableDefs~Append(tdf) + +appAccess~quit + +-- keep window open if invoked via Explorer to allow reading the output +say "Press enter to continue ..." +parse pull . diff --git a/modules/windows/ole/apps/MSExcel.rex b/modules/windows/ole/apps/MSExcel.rex new file mode 100755 index 0000000..1c53536 --- /dev/null +++ b/modules/windows/ole/apps/MSExcel.rex @@ -0,0 +1,120 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* MSExcel.rex: OLE Automation with ooRexx */ +/* */ +/* Create Microsoft Excel sheet, enter some data and save it. */ +/* */ +/**********************************************************************/ + +excelApplication = .OLEObject~new("Excel.Application") +excelApplication~visible = .true -- make Excel visible +Worksheet = excelApplication~Workbooks~Add~Worksheets[1] + +colTitles = "ABCDEFGHI" -- define first nine column letters +lastLine = 12 -- number of lines to process + + /* HINT: if your local Excel user interface language is not English, you may need to rename the + function name 'sum' to your user interface language, e.g. in German to 'summe' */ +sumFormula = "=sum(?2:?"lastLine-1")" -- English formula: question marks will be changed to column letter +say "sumFormula: " sumFormula "(question marks will be changed to column letter)" + +xlHAlignRight = excelApplication~getConstant("xlHAlignRight") -- get value of "horizontal align right" constant + +do line = 1 to lastLine -- iterate over lines + do col = 1 to colTitles~length -- iterate over columns + colLetter = colTitles[col] -- get column letter + cell = Worksheet~Range(colLetter||line) -- e.g. ~Range("A1") + + if line = 1 then do -- first row? yes, build title + cell~value = "Type" colLetter -- header in first row + cell~font~bold = .true -- make font bold + cell~Interior~ColorIndex = 36 -- light yellow + cell~style~horizontalAlignment = xlHAlignRight -- right adjust title + end + else if line = lastLine then do -- last row? yes, build sums + /* set formula, e.g. "=sum(B2:B9)" */ + cell~formula = sumFormula~changeStr("?",colLetter) -- adjust formula to column to sum up + cell~Interior~ColorIndex = 8 -- light blue + end + else do -- a row between 2 and 9: fill with random values + cell~value = random(999999) / 100 -- create a random decimal value + cell~font~ColorIndex = 11 -- set from black to violet + end + end +end + + -- check whether Excel's user interface language causes the "#NAME?" error, if so advice +sumCell = WorkSheet~range("A"lastLine) -- get sum-cell of column A +if sumCell~text = "#NAME?" then +do + say + say "** Excel reports a '#NAME?' error for the 'sum' function! Probable cause: **" + say "** your local Excel user interface language is not set to English, therefore you need **" + say "** to adjust the function name 'sum' in the variable 'sumFormula' to your user interface **" + say "** language and rerun this program (e.g. in German you need to rename 'sum' to 'summe') **" + say "** sumCell~formula:" sumCell~formula + say "** sumCell~text: " sumCell~text + say "** sumCell~value: " sumCell~value + say +end + + -- create a format string for our numbers, use thousands and decimal separators +formatString = "#"excelApplication~thousandsSeparator"##0"excelApplication~decimalSeparator"00" +say "formatString: " formatString -- show format string + +excelApplication~useSystemSeparators = .false -- allow our format string to be used everywhere +stringRange="A2:"colTitles~right(1)lastLine +say "formatting range:" stringRange +WorkSheet~range(stringRange)~numberFormat = formatString -- get range and set its number format + + -- make sure that file gets quietly overwritten in case it exists already +excelApplication~DisplayAlerts = .false -- no alerts from now on + +/* save sheet in user's home directory */ +homeDir = value("USERPROFILE",,"ENVIRONMENT")-- get value for environment variable "USERPROFILE" +fileName = homeDir"\samp09_ooRexx.xlsx" -- build fully qualified filename +say "fully qualified fileName:" fileName -- show fully qualifed filename +Worksheet~SaveAs(fileName) -- save file + + -- let the user inspect the Excel file +say "Excel sheet got saved to file, press enter to continue ..." +parse pull . -- wait for user to press enter +excelApplication~Quit -- close Excel + diff --git a/modules/windows/ole/apps/MSExcel_cURL.rex b/modules/windows/ole/apps/MSExcel_cURL.rex new file mode 100644 index 0000000..ff62c80 --- /dev/null +++ b/modules/windows/ole/apps/MSExcel_cURL.rex @@ -0,0 +1,88 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022-2024 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + MSExcel_cURL.rex: using OLE (object linking and embedding) with ooRexx + + Get temperature from using cURL, documentation can be found + at . + + Note: cURL is included by default since Windows 10 build 17063. + + Links: + + + + Using OLE create a new Microsoft Excel worksheet, query the weather with + the cURL command and insert the received data. Using the worksheet temperature + data create a simple chart. + +***********************************************************************/ + +-- Get information using curl, save results in array +cityArr = .array~of("Vienna", "Graz", "Linz", "Salzburg", "Innsbruck", "Klagenfurt", "Bregenz", "Eisenstadt", "Sankt-Poelten", "Wien") +cityWeather = .array~new -- array for weather information +do counter i name over cityArr + command='curl https://wttr.in/'name'?format="%l:+%t"' -- https://github.com/chubin/wttr.in + say "#" i":" command -- give user feedback + outArr = .array~new -- array for stdout + ADDRESS SYSTEM command with output using (outArr) error using (.array~new) + cityWeather~append(outArr[1]) -- append output to array +end + +-- Start Excel with empty worksheet +excelApplication = .OLEObject~new("Excel.Application") +excelApplication~visible = .true -- make Excel visible +Worksheet = excelApplication~Workbooks~Add~Worksheets[1] -- add worksheet +-- Create bold collum header in first row +colhead = .array~of("City", "Celsius") -- array with header text +do counter col name over colhead + Worksheet~cells(1,col)~Value = name -- insert items from array + Worksheet~cells(1,col)~font~bold = .true -- make bold +end +-- Insert information from gained with curl +do counter row name over cityWeather + parse var name city ":" temperature "°C" -- parse curled informations + Worksheet~cells(row+1,1)~Value = city -- city in collum 1 + Worksheet~cells(row+1,2)~Value = temperature -- temperature in collum 2 +end +-- Select range for chart, use left upper and lower right cell location +Worksheet~Range("A1:B" || (row+1))~Select -- include title row +-- Add Chart +excelApplication~Charts~Add -- create new chart +excelApplication~ActiveChart~HasTitle = .True -- add title +excelApplication~ActiveChart~ChartTitle~Characters~Text = "Temperature" diff --git a/modules/windows/ole/apps/MSExcel_usingRexxArray.rex b/modules/windows/ole/apps/MSExcel_usingRexxArray.rex new file mode 100755 index 0000000..dd5b53d --- /dev/null +++ b/modules/windows/ole/apps/MSExcel_usingRexxArray.rex @@ -0,0 +1,95 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + MSExcel_usingRexxArray.rex: using OLE (object linking and embedding) with ooRexx + + Links: + + + + Using OLE create a new Microsoft Excel, create and place additional + sheets, rename sheets, iterate over sheets, fill in first sheet with generated data + from an ooRexx array, create a chart from the data. + +***********************************************************************/ + +excel = .OleObject~new("Excel.Application") +excel~visible = .true -- show Excel +book = excel~workbooks~add -- create a workbook +sheet = book~worksheets(1) -- get first sheet (exists always) from workbook +sheet1 = book~worksheets~add(sheet) -- add and get a sheet before previous "sheet" +book~worksheets~add(,sheet) -- add and get sheet after "sheet" + +do counter c ws over book~worksheets-- rename the worksheets sequentially + ws~name="Sheet #" c +end +sheet1~name = sheet1~name "(data)" -- add hint to name of first work sheet + +say "do i=1 to book~worksheets~count:" -- use: do i=1 ... +do i=1 to book~worksheets~count -- list all worksheets by name + say "... i="i":" book~worksheets(i)~name +end +say + +say "do counter c ws over book~worksheets:" -- use: do...over +do counter c ws over book~worksheets -- list all worksheets by name + say "... c="c":" ws~name +end + +-- set titles from an ooRexx array +sheet1~range("A1:C1")~value = ("Delivered", "En route", "To be shipped") +-- define data range and set its data from an ooRexx array +sheet1~range("A2:C7")~value = createData(6) -- create and assign ooRexx array + +/* cf. */ +chart = excel~charts~add -- get the chart collection, add and get a new chart +chart~chartType = excel~getConstant("xlAreaStacked") +plotBy = excel~getConstant("xlColumns") +chart~setSourceData(sheet1~range("A1:C7"), plotBy) -- includes titles +chart~hasTitle = .true +chart~chartTitle~text = "A Chart by ooRexx (".DateTime~new")" + +::routine createData -- create arbitrary data using Rexx' random(min,max) function + use arg items=5 + arr=.array~new -- create Rexx array + do i=1 to items -- create random numbers + arr[i,1] = random( 50,2000) + arr[i,2] = random(100,2500) + arr[i,3] = random(150,1500) + end + return arr -- return Rexx array diff --git a/modules/windows/ole/apps/MSInternetExplorer_events.rex b/modules/windows/ole/apps/MSInternetExplorer_events.rex new file mode 100755 index 0000000..ea2b15a --- /dev/null +++ b/modules/windows/ole/apps/MSInternetExplorer_events.rex @@ -0,0 +1,94 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* MSInternetExplorer_events.rex: OLE Automation with ooRexx */ +/* */ +/* Using events with the Internet Explorer: */ +/* Navigate to the IBM homepage and disallow changing the URL to a */ +/* page not in that "address space". */ +/* */ +/**********************************************************************/ + +/* instantiate an instance of the Internet Explorer */ +myIE = .watchedIE~new("InternetExplorer.Application","WITHEVENTS") + +myIE~visible = .true +myIE~navigate("http://www.ibm.com/") + +/* wait for the OnQuit event of the browser to change */ +/* the !active attribute of the REXX object to false */ +myIE~!active = .true +do while myIE~!active = .true + call syssleep 2 +end + +/* this class is derived from OLEObject and contains several */ +/* methods that will be called when certain events take place. */ +::CLASS watchedIE SUBCLASS OLEObject + +/* this is an event of the Internet Explorer */ +::METHOD BeforeNavigate2 + /* these are the arguments of this event. Cancel is an out parameter and */ + /* will be set to the return value of the method when it was processed. */ + /* have a look at the documentation for a detailed description of events.*/ + use arg pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel + + /* default: do not stop loading of this URL */ + stopLoading = .false + + /* if the target URL does not begin with "http://www.ibm.com/", don't */ + /* load it... try this by typing a different URL into the address field */ + /* when this sample is running. */ + if URL~substr(1,19) \= "http://www.ibm.com/" then do + stopLoading = .true + say "Refusing to load" URL + end + + return stopLoading + +/* this is an event of the Internet Explorer */ +::METHOD TitleChange + use arg Text + say "The title has changed to:" text + +/* this is an event of the Internet Explorer */ +::METHOD OnQuit + self~!active = .false -- terminates the waiting loop in main code + +::METHOD !active ATTRIBUTE -- store the active attribute diff --git a/modules/windows/ole/apps/MSInternetExplorer_getMethods.rex b/modules/windows/ole/apps/MSInternetExplorer_getMethods.rex new file mode 100755 index 0000000..41c0246 --- /dev/null +++ b/modules/windows/ole/apps/MSInternetExplorer_getMethods.rex @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + + MSInternetExplorer_getMethods.rex: using OLE (object linking and embedding) with ooRexx + + -- cf. "winextensions.pdf", "Example 8.11. OLEObject - getKnownMethods method" + + Link: + + Query and list all known methods from Microsoft Internet Explorer + +***********************************************************************/ +myOLEObject = .OLEObject~new("InternetExplorer.Application") +methods. = myOLEObject~getKnownMethods + +if methods. == .nil then + say "Sorry, no information on the methods available!" +else do + say "The following methods are available to this OLE object:" + do i = 1 to methods.0 + say methods.i.!NAME + end +end +exit diff --git a/modules/windows/ole/apps/MSInternetExplorer_navigate.rex b/modules/windows/ole/apps/MSInternetExplorer_navigate.rex new file mode 100755 index 0000000..1e6e312 --- /dev/null +++ b/modules/windows/ole/apps/MSInternetExplorer_navigate.rex @@ -0,0 +1,75 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* MSInternetExplorer_navigate.rex: OLE Automation with ooRexx */ +/* */ +/* Start Internet Explorer and show the IBM homepage. After 10 seconds*/ +/* the RexxLA events page will be displayed for 10 seconds. */ +/* */ +/**********************************************************************/ + +/* create an object for IE */ +myIE = .OLEObject~New("InternetExplorer.Application") + +myIE~Width = 1000 +myIE~Height = 800 +Say "current dimensions of Internet Explorer (IE) are:" myIE~Width "by" myIE~Height + +/* set new dimensions and browse IBM homepage */ +Say "changing IE dimensions ..." +myIE~Width = 1280 +myIE~Height = 1024 +Say "IE dimensions changed to:" myIE~Width "by" myIE~Height +Say "making IE visible ..." +myIE~Visible = .True -- now show the window +say "navigating to:" "https://www.ibm.com" +myIE~Navigate("https://www.ibm.com") + +/* wait for 10 seconds */ +say "now sleeping for 10 seconds ..." +Call SysSleep 10 + +/* browse RexxLA event page */ +say "navigating to:" "https://www.rexxla.org/events" +myIE~Navigate("https://www.rexxla.org/events") + +/* wait for 10 seconds */ +say "now sleeping for 10 seconds before quitting ..." +Call SysSleep 10 +myIE~quit diff --git a/modules/windows/ole/apps/MSInternetExplorer_search.rex b/modules/windows/ole/apps/MSInternetExplorer_search.rex new file mode 100755 index 0000000..d5dc2e5 --- /dev/null +++ b/modules/windows/ole/apps/MSInternetExplorer_search.rex @@ -0,0 +1,159 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* MSInternetExplorer_search.rex: OLE Automation with ooRexx */ +/* */ +/* Using events with the Internet Explorer: */ +/* Search for the string "Cloud" on the IBM web page and go randomly */ +/* to one of the found sites. */ +/* */ +/* Note that this sample no longer seems to work using IE9 on */ +/* Windows. Invoking the click() method on the Search button seems */ +/* have no effect. Geting the form instead fo the button and */ +/* invoking submit() also doesn't work. */ +/**********************************************************************/ + + +/* instantiate an instance of the Internet Explorer */ +myIE = .controlledIE~new("InternetExplorer.Application","WITHEVENTS") + +myIE~visible = .true +myIE~navigate("http://www.ibm.com/") + +myIE~wait /* wait for page to be loaded */ + +doc = myIE~document + +/* set query field on the IBM page to Cloud */ +textInput = doc~GetElementById("q") +if textInput == .nil then do + say "Failed to get text input object." + say "Website may have changed, aborting." + myIE~quit + return 99 +end + +textInput~value = "Cloud" + +/* click on the search image to submit the query */ +submitInput = doc~getElementById("ibm-search") +if submitIput == .nil then do + say "Failed to get submit input object." + say "Website may have changed, aborting." + + myIE~quit + return 99 +end + +submitInput~click + +myIE~wait /* wait for page to be loaded */ + +/* get the new page */ +doc = myIE~document +all = doc~GetElementsByTagName("A") /* get all elements */ + +/* get all links to Cloud pages into a table */ +cloudlinks = .table~new + +j = 1 +do i over all + if i~innertext~pos("Cloud") > 0 |, + i~innertext~pos("Downloads") > 0 |, + i~innertext~pos("Learning") > 0 |, + i~innertext~pos("Produkte") > 0 then do + cloudlinks~put(i~href,j) + j = j + 1 + end +end +if cloudlinks~items < 1 then do + msg = "No links were found. Submitting the search" || .endOfLine || - + "probably failed. This happens with IE9" || .endOfLine || - + "on Windows 7." + ret = RxMessageBox(msg, "Done", "OK", "INFORMATION") + signal on syntax -- in case the user closes the MSIE window before the RxMessageBox + myIE~quit +syntax: + return 99 +end + +/* select one of the Cloud links randomly... */ +choice = random(1,cloudlinks~items) +hint="randomly picked Cloud page link #" choice"/"cloudlinks~items +say "Navigating to" hint + +/* ...and go there */ +myIE~navigate(cloudlinks~at(choice)) +myIE~wait + +/* wait for user to acknowledge, then shut down example */ +call RxMessageBox "We're now at a" hint, "Done", "OK", "INFORMATION" + +signal on syntax -- in case the user closes the MSIE window before the RxMessageBox +myIE~quit +syntax: + +exit + + + +/* this class is derived from OLEObject and contains two methods */ +/* that will be called when certain events take place. */ +::CLASS controlledIE SUBCLASS OLEObject + +::METHOD init + self~block = .true + forward class(super) + +::METHOD block ATTRIBUTE + +/* this is a helper method */ +::METHOD wait + do until self~block == .false + call SysSleep 1 + end + return + +/* this event takes several parameters, but all can be ignored here */ +::METHOD BeforeNavigate2 + self~block = .true + +/* when this event takes place, the block attribute is set to false */ +::METHOD DocumentComplete + self~block = .false diff --git a/modules/windows/ole/apps/MSInternetExplorer_stockPrice.rex b/modules/windows/ole/apps/MSInternetExplorer_stockPrice.rex new file mode 100755 index 0000000..14a8531 --- /dev/null +++ b/modules/windows/ole/apps/MSInternetExplorer_stockPrice.rex @@ -0,0 +1,100 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* MSInternetExplorer_stockPrice.rex: OLE Automation with ooRexx */ +/* */ +/* Get stock price from IBM internet page with Microsoft Internet */ +/* Explorer and store it in a REXX variable. */ +/* */ +/**********************************************************************/ + +/* Get stock price from IBM internet page with MS IE and OLE */ + +say "Getting stock price from IBM Internet page." +say + +Explorer = .OLEObject~new("InternetExplorer.Application") +Explorer~Visible = .true +Explorer~Navigate("http://www.ibm.com/investor/") + +-- Wait for browser to load the page, with a time out. If the page is not +-- loaded by the timout, then quit. +count = 0 +do while Explorer~busy & count < 12 + do while Explorer~readyState <> 4 & count < 12 + j = SysSleep(.5) + count += 1 + end +end + +if Explorer~busy | Explorer~readyState <> 4 then do + say 'Timed out waiting for page: http://www.ibm.com/investor/' + say 'to load. Going to quit.' + Explorer~quit + return 99 +end + +/* obtain text representation of the page */ +doc = Explorer~document -- DOM document +body = doc~body -- get BODY +textrange = body~CreateTextRange -- get TextRange +text = textrange~Text -- get the contents + +/* extract stock price information, this is dependent on page not changing */ +parse var text . "(NYSE)" '0d0a'x stockprice "0d0a"x . +if stockprice = "" then do + stockprice = "" + gotPrice = .false +end +else do + gotPrice = .true +end + +if gotPrice = .false then +do + say "Press enter to continue ..." + parse pull +end + +/* end Explorer */ +Explorer~quit + +say "IBM stocks are at" stockprice"." +if \ gotPrice then say "Web page has likely changed format." + diff --git a/modules/windows/ole/apps/MSOutlook.rex b/modules/windows/ole/apps/MSOutlook.rex new file mode 100644 index 0000000..8f38f7d --- /dev/null +++ b/modules/windows/ole/apps/MSOutlook.rex @@ -0,0 +1,72 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/********************************************************************* + + MSOutlook.rex: using OLE (object linking and embedding) with ooRexx + + Links: + + + + Open Microsoft Outlook and show inbox. Count mails in inbox, + show sender of all mails currently in inbox, then wait for 10 seconds. + +*********************************************************************/ + + Outlook = .OLEObject~new("Outlook.Application") + NameSpace = Outlook~GetNamespace("MAPI") + + -- In Outlook folder have numbers: + -- DeletedItems (3), Outbox (4), SentMail (5), Inbox (6), + -- Calendar (9), Contacts (10), Journal (11), Notes (12), + -- Tasks (13) + Inbox = NameSpace~GetDefaultFolder("6") -- selects Inbox + + -- makes Outlook visible and shows Inbox + Inbox~Display + + InboxItems = Inbox~Items + MailCount = InboxItems~Count -- count items in Inbox + say "You have" MailCount "Mail(s) in your Inbox:" + -- may require to allow access to email information + Do ItemNumber = 1 to MailCount -- go through each item + Item = Inbox~Items(ItemNumber) + Sender = Item~Sender~Name -- sender of item + say "#" ItemNumber"." Sender + end + +Call SysSleep 10 diff --git a/modules/windows/ole/apps/MSOutlook_monitorInbox.rex b/modules/windows/ole/apps/MSOutlook_monitorInbox.rex new file mode 100755 index 0000000..dd8ccde --- /dev/null +++ b/modules/windows/ole/apps/MSOutlook_monitorInbox.rex @@ -0,0 +1,147 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/********************************************************************* + + MSOutlook_monitorInput.rex: using OLE (object linking and embedding) with ooRexx + + -- cf. "winextensions.pdf", "Example 8.3. OLEObject - Monitor Outlook" + + Links: + + + + Open Microsoft Outlook, attach an ooRexx "ItemAdd" event listener + to monitor the inbox for adding new mails. The program takes commands + by watching every second whether one of the files 'pause.monitor', + 'restart.monitor' or 'stop.monitor' got created in the meantime by the user. + +*********************************************************************/ + +/* Monitor OutLook for new mail */ + say; say; say 'ooRexx Mail Monitor version 1.0.0' + + outLook = .oleObject~new("Outlook.Application") + + inboxID = outLook~getConstant(olFolderInBox) + inboxItems = outLook~getNameSpace("MAPI")~getDefaultFolder(inboxID)~items + + if \ inboxItems~isConnectable then do + say 'Inbox items is NOT connectable, quitting' + return 99 + end + + inboxItems~addEventMethod("ItemAdd", .methods~printNewMail) + inboxItems~connectEvents + + if \ inboxItems~isConnected then do + say 'Error connecting to inbox events, quitting' + return 99 + end + + monitor = .Monitor~new + say 'ooRexx Mail Monitor - monitoring ...' + do while monitor~isActive + j = SysSleep(1) + status = monitor~getStatus + + select + when status == 'disconnect' then do + inboxItems~disconnectEvents + say 'ooRexx Mail Monitor - paused ...' + end + when status == "reconnect" then do + inboxItems~connectEvents + say 'ooRexx Mail Monitor - monitoring ...' + end + otherwise do + nop + end + end + -- End select + end + say 'ooRexx Mail Monitor version 1.0.0 ended' + +return 0 + +::method printNewMail unguarded + use arg mailItem + say 'You have mail' + say 'Subject:' mailItem~subject + +::class 'Monitor' +::method init + expose state active + + state = 'continue' + active = .true + j = SysFileDelete('stop.monitor') + j = SysFileDelete('pause.monitor') + j = SysFileDelete('restart.monitor') + +::method isActive + expose active + return active + +::method getStatus + expose state active + + if SysIsFile('stop.monitor') then do + j = SysFileDelete('stop.monitor') + active = .false + state = 'quit' + return state + end + + if SysIsFile('pause.monitor') then do + j = SysFileDelete('pause.monitor') + if state == "paused" then return "continue" + + if state \== 'quit' then do + state = "paused" + return 'disconnect' + end + end + + if SysIsFile('restart.monitor') then do + j = SysFileDelete('restart.monitor') + if state == 'continue' then return state + if state \== 'quit' then do + state = 'continue' + return 'reconnect' + end + end + return 'continue' diff --git a/modules/windows/ole/apps/MSPowerPoint_layouts.rex b/modules/windows/ole/apps/MSPowerPoint_layouts.rex new file mode 100644 index 0000000..4dca39c --- /dev/null +++ b/modules/windows/ole/apps/MSPowerPoint_layouts.rex @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/********************************************************************* + + MSPowerPoint.rex: using OLE (object linking and embedding) with ooRexx + + Using OLE open MSPowerPoint and add a Title slide with Title and SubTitle + shapes (sections). + Append slides with various styles, get slide count and amount of shapes per + slide, list names of shapes on each slide. + Save pptx file with a unique name and close PowerPoint. + +*********************************************************************/ + +-- Start PowerPoint +PP = .OLEObject~New("PowerPoint.Application") +PP~Visible = .TRUE -- make PP visible +-- Add first Slide +PP~Presentations~Add~Slides~Add(1, 1) -- add: Title-Slide +FirstSlide = PP~ActivePresentation~Slides(1) +FirstSlide~Shapes(1)~TextFrame~TextRange = "New Presentation Title" -- first Shape is Title +FirstSlide~Shapes(2)~TextFrame~TextRange = "Subtitle at:" .dateTime~new -- second Shape is SubTitle +-- Append several Slides +ActivePresentation = PP~ActivePresentation +ActivePresentation~Slides~Add(2, 1) -- append: second Title-Slide +ActivePresentation~Slides~Add(3, 2) -- append: Title and Text Slide +ActivePresentation~Slides~Add(4, 3) -- append: Title and 2-Columne Text +ActivePresentation~Slides~Add(5, 5) -- append: Title, Text and Chart +-- Check what on Slide +SlideCount = ActivePresentation~Slides~Range~Count -- get amount of Slides +say "Your Presentation has" SlideCount "Slides" +do SlideNumber = 1 to SlideCount -- go through each Slide + ShapeCount = ActivePresentation~Slides(SlideNumber)~Shapes~Range~Count -- get amount of Shapes per Slide + say " Slide" SlideNumber "has" ShapeCount "Shapes" + do ShapeNumber = 1 to ShapeCount -- go through each Shape + -- List names of Shapes on Slide + say " ("ShapeNumber"/"ShapeCount"):" ActivePresentation~Slides(SlideNumber)~Shapes(ShapeNumber)~name + end +end + +say "Press any key to save and close!" +parse pull -- wait for key press + +-- Save and Close +homeDir = VALUE('USERPROFILE',,'ENVIRONMENT') -- get user's home directory +fileOut = homedir"\Desktop\PP_" || date("S") || "_" || changeStr(":",time(),"") || ".pptx" +say "File to save to:" fileOut +ActivePresentation~SaveAs(fileOut) -- save pptx file +PP~Quit -- close PP diff --git a/modules/windows/ole/apps/MSPowerPoint_present.rex b/modules/windows/ole/apps/MSPowerPoint_present.rex new file mode 100755 index 0000000..ac3e348 --- /dev/null +++ b/modules/windows/ole/apps/MSPowerPoint_present.rex @@ -0,0 +1,91 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/********************************************************************* + + MSPowerPoint_present.rex: using OLE (object linking and embedding) with ooRexx + + Using OLE create a new MS PowerPoint presentation about REXX and + ooRexx and then start it as a presentation. + +*********************************************************************/ + +-- start PowerPoint +pp = .OLEObject~new("PowerPoint.Application") +pp~visible = .true -- make PP visible + +-- add titleSlide +pp~presentations~add~slides~add(1, 1) -- add: Title-Slide +titleSlide = pp~activePresentation~slides(1) +titleSlide~shapes(1)~textFrame~textRange = "ooRexx" -- first Shape is Title +titleSlide~shapes(2)~textFrame~textRange = "Open Object Rexx (ooRexx)" +info="0d"x"(Presentation created:" .dateTime~new")" -- add CR plus hint +oRange=titleSlide~shapes(2)~textFrame~textRange~insertAfter(info) +oRange~Font~Size = 15 + +-- add another slide +activePresentation = pp~activePresentation +-- add(after,type) +slide = activePresentation~slides~add(2, 2) -- append: Title and Text Slide +slide~shapes(1)~textFrame~textRange = "Open Object Rexx (ooRexx)" -- set title + +textRange = slide~shapes(2)~textFrame~textRange +-- add string, supply level +call addItem textRange, "REXX (IBM)", 1 +call addItem textRange, "First released in 1979 for IBM mainframes", 2 +call addItem textRange, "Object REXX (IBM)", 1 +call addItem textRange, "Object-oriented successor to REXX", 2 +call addItem textRange, "First released in 1994 with IBM's OS/2 Warp", 2 +call addItem textRange, "Negotiations about open-sourcing with RexxLA", 2 +call addItem textRange, "Rexx Language Association (www.RexxLA.org)", 3 +call addItem textRange, "Source code handed over to RexxLA in 2003", 3 +call addItem textRange, "Open Object Rexx (ooRexx by RexxLA)", 1 +call addItem textRange, "First released in 2004 by RexxLA", 2 + +-- go into presentation mode +activePresentation~slideShowSettings~run + +say "Press any key to quit!" +parse pull -- wait for key press + +pp~displayAlerts = .false -- do not ask user +pp~quit + + +::routine addItem -- add string to textRange, set it to given level + use arg textRange, string, level + textRange~InsertAfter(string)~IndentLevel = level + TextRange~InsertAfter("0d"x) -- add CR, i.e. a new paragraph diff --git a/modules/windows/ole/apps/MSWord_createModify.rex b/modules/windows/ole/apps/MSWord_createModify.rex new file mode 100755 index 0000000..8d93240 --- /dev/null +++ b/modules/windows/ole/apps/MSWord_createModify.rex @@ -0,0 +1,162 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* SAMP08.REX: OLE Automation with Open Object REXX - Sample 8 */ +/* */ +/* Create a Word document, enter some text, save it. Load it again */ +/* and modify it. */ +/* */ +/**********************************************************************/ + +/* get a Word application object */ +Word = .OLEObject~New("Word.Application") + +/* set Word visible to see what happens */ +Word~Visible = .TRUE + +/* new document */ +Document = Word~Documents~Add + +/* get the selection object */ +Selection = Word~Selection + +/* type two lines of text and new paragraph */ +Selection~TypeText("This is a text sent to MS Word with the Open Object Rexx OLE interface") +Selection~TypeParagraph +Selection~TypeText("This is a text in a new line") + +/* select all */ +Selection~WholeStory + +/* get the font object */ +Font = Selection~Font + +/* change the font size and behavior */ +Font~Name="Arial" +Font~Size="12" +Font~Bold = .TRUE +Font~Italic = .TRUE + +/* get the environment variable TEMP and create filename to save */ +TempDir = VALUE( "TEMP",,ENVIRONMENT) +-- use ".doc" instead of ".docx" to allow older Word apps to work: +FileName = TempDir || "\" || "WordCreatedByRexx.doc" + +/* "save as..." and close Word */ +Document~SaveAs(FileName) +Word~Quit + +say "Created" FileName". Press enter to continue" +pull + +/* get a Word application object */ +Word = .OLEObject~New("Word.Application") + +/* set word visible to see what happens */ +Word~Visible = .TRUE + +/* get the documents object and open a file */ +Documents = Word~Documents +Documents~Open(FileName) + +/* get the selection object and go to end of document */ +Selection = Word~Selection +Selection~EndKey("6") + +/* add a paragraph */ +Selection~TypeParagraph + +/* get active document object */ +ActiveDocument = Word~ActiveDocument + +/* invoke print preview */ +ActiveDocument~PrintPreview + +/* get active window object */ +ActiveWindow = Word~ActiveWindow + +/* change zoom percentage */ +ActiveWindow~ActivePane~View~Zoom~Percentage = "200" + +/* wait a little bit */ +say "Showing Print Preview with 200%. Press enter to continue." +pull + +/* change zoom percentage */ +ActiveWindow~ActivePane~View~Zoom~Percentage = "100" + +/* wait a little bit */ +call syssleep 2 + +/* close print preview */ +ActiveDocument~ClosePrintPreview + +/* add a paragraph */ +Selection~TypeParagraph + +/* add a table */ +ActiveDocument~Tables~Add(Selection~Range,4,5) + +/* autoformat table to color */ +Selection~Tables(1)~AutoFormat(9) + +/* fill table */ + +header = .array~of("Year", "January", "February", "March", "April") +do i over header + Selection~TypeText(i) + Selection~MoveRight +end + +do i=2000 to 2002 + Selection~MoveRight(12) + Selection~TypeText(i) + Selection~MoveRight + do 4 + Selection~TypeText(random(31)) + Selection~MoveRight + end +end + +say "Done. Press enter to quit." +pull + +Word~Quit(.false) + + diff --git a/modules/windows/ole/apps/MSWord_useStyles.rex b/modules/windows/ole/apps/MSWord_useStyles.rex new file mode 100644 index 0000000..f05b7f9 --- /dev/null +++ b/modules/windows/ole/apps/MSWord_useStyles.rex @@ -0,0 +1,98 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/********************************************************************* + + MSWord_useStyles.rex: using OLE (object linking and embedding) with ooRexx + + Links: + + + + Using OLE create a Microsoft Word document, add text using various + styles and wait for the user to press the enter (return) key before + changing the font attributes of the styles named "Title" and "Heading 1". + +*********************************************************************/ + +-- Start Word with empty document +Word = .OLEObject~New("Word.Application") +Word~Visible = .TRUE -- make Word visible +Document = Word~Documents~Add -- add document +Selection = Word~Selection -- selection object +say "# 1: Create: title style..." +Selection~Style = "Title" -- Create selection with style: Title +Selection~TypeText("TITLE") -- give selection a text +Selection~TypeParagraph -- add paragraph (go to next line) +say "# 2: Create: heading 1 style..." +Selection~Style = "Heading 1" -- Create selection with style: Heading 1 +Selection~TypeText("HEADING 1") -- give selection a text +Selection~TypeParagraph -- add paragraph (go to next line) +say "# 3: Create: heading 2 style..." +Selection~Style = "Heading 2" -- Create selection with style: Heading 2 +Selection~TypeText("HEADING 2") -- give selection a text +Selection~TypeParagraph -- add paragraph (go to next line) + -- Note: Usually the style "Normal" follows heading styles +Selection~TypeText("Reset to normal ...") -- "Normal" follows "Heading 2" +Selection~TypeParagraph -- add paragraph (go to next line) +say "# 4: Create: normal text style..." +Selection~Style = "Normal" -- Create selection with style: normal +Selection~TypeText("I am Normal Text.") -- give selection a text + +say "Press any key to change style!" +parse pull -- wait for key press + +-- Go through each sentence +SentenceCount = Document~Sentences~Count -- get sentence count +Font = Selection~Font -- get font object +do SentenceNumber = 1 to SentenceCount -- go through each sentence + + Document~Sentences(SentenceNumber)~Select -- select sentence + StyleName = Selection~Style~NameLocal -- get style name of sentence + Select case StyleName -- make changes depending on style name + when "Title" then do + Font~Name="Arial" + Font~Size="38" + Font~Bold = .TRUE + end + when "Heading 1" then do + Font~Name="Times New Roman" + Font~Size="22" + Font~Italic = .TRUE + end + otherwise NOP + end +end diff --git a/modules/windows/ole/apps/ScriptingFileSystemObject.rex b/modules/windows/ole/apps/ScriptingFileSystemObject.rex new file mode 100755 index 0000000..7d275d0 --- /dev/null +++ b/modules/windows/ole/apps/ScriptingFileSystemObject.rex @@ -0,0 +1,90 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* ScriptingFileSystemObject.rex: OLE Automation with ooRexx */ +/* */ +/* Use the Windows Script Host FileSystemObject to obtain information */ +/* on drives of the system. */ +/* */ +/**********************************************************************/ + +fsObject = .OLEObject~new("Scripting.FileSystemObject") + +allDrives = fsObject~drives + +if allDrives = .NIL then do + say "The object did not return information on your drives!" + exit 1 +end + +do i over allDrives + info = i~DriveLetter "-" + + /* show the DriveType in human-readable form */ + j = i~DriveType + select + when j=1 then do + info = info "Removable" + end + when j=2 then do + info = info "Fixed" + end + when j=3 then do + info = info "Network" + end + when j=4 then do + info = info "CD-ROM" + end + when j=5 then do + info = info "RAM Disk" + end + otherwise + info = info "Unknown" + end + + /* append the ShareName for a network drive... */ + if j=3 then info = info i~ShareName + /* ...and the VolumeName for the other ones */ + else if i~IsReady then info = info i~VolumeName + say info +end + +exit 0 + + diff --git a/modules/windows/ole/apps/ShellApplication_listSystemFolders.rex b/modules/windows/ole/apps/ShellApplication_listSystemFolders.rex new file mode 100755 index 0000000..6e97019 --- /dev/null +++ b/modules/windows/ole/apps/ShellApplication_listSystemFolders.rex @@ -0,0 +1,99 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/********************************************************************** + ShellApplication_listSystemFolders.rex: using OLE (object linking and embedding) with ooRexx + + Links: + + + Using OLE and Windows' 'Shell.Application' query all Windows system + folders. +***********************************************************************/ + +-- "ShellSpecialFolderConstants" (shldisp.h), cf. (2022-06-23) +-- an array of name/folderID arrays +arr = .array~of( - + ("ALTSTARTUP " , "1d"x ), - + ("APPDATA " , "1a"x ), - + ("BITBUCKET " , "0a"x ), - + ("COMMONALTSTARTUP" , "1e"x ), - + ("COMMONAPPDATA " , "23"x ), - + ("COMMONDESKTOPDIR" , "19"x ), - + ("COMMONFAVORITES " , "1f"x ), - + ("COMMONPROGRAMS " , "17"x ), - + ("COMMONSTARTMENU " , "16"x ), - + ("COMMONSTARTUP " , "18"x ), - + ("CONTROLS " , "03"x ), - + ("COOKIES " , "21"x ), - + ("DESKTOP " , "00"x ), - + ("DESKTOPDIRECTORY" , "10"x ), - + ("DRIVES " , "11"x ), - + ("FAVORITES " , "06"x ), - + ("FONTS " , "14"x ), - + ("HISTORY " , "22"x ), - + ("INTERNETCACHE " , "20"x ), - + ("LOCALAPPDATA " , "1c"x ), - + ("MYPICTURES " , "27"x ), - + ("NETHOOD " , "13"x ), - + ("NETWORK " , "12"x ), - + ("PERSONAL " , "05"x ), - + ("PRINTERS " , "04"x ), - + ("PRINTHOOD " , "1b"x ), - + ("PROFILE " , "28"x ), - + ("PROGRAMFILES " , "26"x ), - + ("PROGRAMFILESx86 " , "30"x ), - + ("PROGRAMS " , "02"x ), - + ("RECENT " , "08"x ), - + ("SENDTO " , "09"x ), - + ("STARTMENU " , "0b"x ), - + ("STARTUP " , "07"x ), - + ("SYSTEM " , "25"x ), - + ("SYSTEMx86 " , "29"x ), - + ("TEMPLATES " , "15"x ), - + ("WINDOWS " , "24"x ) - + ) + +objShell = .oleObject~new('Shell.Application') +say "Windows system folders on this computer:" +do counter c obj over arr -- iterate over array + -- query path of special folder in hand + name =obj[1] + folderId=obj[2] + val=objShell~nameSpace(folderId~c2d)~self~path + say c~right(2)":" name "("""folderId~c2x"""x)="val +end diff --git a/modules/windows/ole/apps/WScriptNetwork.rex b/modules/windows/ole/apps/WScriptNetwork.rex new file mode 100755 index 0000000..516d067 --- /dev/null +++ b/modules/windows/ole/apps/WScriptNetwork.rex @@ -0,0 +1,68 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* WScriptNetwork.rex: OLE Automation with ooRexx */ +/* */ +/* Show some features of the Windows Scripting Host Network object: */ +/* - Query computer name, user name */ +/* - List network connections for drives and printers */ +/* */ +/**********************************************************************/ + +WshNetObj = .OLEObject~New("WScript.Network") + +Say "Computer Name:" WshNetObj~ComputerName +Say "User Domain :" WshNetObj~UserDomain +Say "User Name :" WshNetObj~UserName +say + +Say "The following network drives are currently mapped:" +MappedDrives = WshNetObj~EnumNetworkDrives +Do i=0 To MappedDrives~Count/2 - 1 + Say " Drive" MappedDrives[i*2] "is mapped to" MappedDrives[i*2 + 1] +End +say + +Say "The following network printers are currently connected:" +Printers = WshNetObj~EnumPrinterConnections +Do i=0 To Printers~Count/2 - 1 + Say " Port" Printers[i*2] "is connected to" Printers[i*2 + 1] +End + + diff --git a/modules/windows/ole/apps/WScriptShell.rex b/modules/windows/ole/apps/WScriptShell.rex new file mode 100755 index 0000000..5df6da7 --- /dev/null +++ b/modules/windows/ole/apps/WScriptShell.rex @@ -0,0 +1,68 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**********************************************************************/ +/* */ +/* WScriptShell.rex: OLE Automation with ooRexx */ +/* */ +/* Show some features of the Windows Scripting Host Shell Object: */ +/* - Query environment string */ +/* - List special folders */ +/* - Create a shortcut on the desktop */ +/* - Use a GUI popup */ +/* */ +/**********************************************************************/ + +WshShellObj = .OLEObject~New("WScript.Shell") + +WshEnv = WshShellObj~Environment +Say "Operating system:" WshEnv["OS"] +Say "You have" WshEnv["NUMBER_OF_PROCESSORS"] "processor(s) of", + WshEnv["PROCESSOR_ARCHITECTURE"] "architecture in your system." + +Say "The following directories represent special folders on your system:" +Do Folder Over WshShellObj~SpecialFolders + Say " " Folder +End + +Say "Creating a shortcut for NOTEPAD.EXE on your Desktop..." +Desktop = WshShellObj~SpecialFolders("Desktop") +ShortCut = WshShellObj~CreateShortcut(Desktop || "\Shortcut to Notepad.lnk") +ShortCut~TargetPath = "%WINDIR%\notepad.exe" +ShortCut~Save + +WshShellObj~Popup("Processing of REXX script has finished!") diff --git a/modules/windows/ole/apps/oleUtils.frm b/modules/windows/ole/apps/oleUtils.frm new file mode 100644 index 0000000..edd3539 --- /dev/null +++ b/modules/windows/ole/apps/oleUtils.frm @@ -0,0 +1,435 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + File: OleUtils.frm + + Purpose: + Provides some useful utilities for working with the .OLEObject class. + + Assumes: + ooRexx version 4.0.0 as a minimum. + + Notes: + This framework was originally written to work on ooRexx 3.1.2. However, + that was in the previous decade. This version of OleUtils.frm now requires + ooRexx 4.0.0 at a minimum. + + Public Routines: + This is a list of the public routines and their syntax. Arguments in square + brackets indicate they are optional. Complete details on usage is in the + header comments for each routine. + + oleOjbect = createOleOjbect(id, [verbose]) + boolean = displayKnownMethods(oleObj, [verbose]) + boolean = displayKnownConstants(oleObj) + boolean = isRexxTrue(obj) + boolean = isOORexx4OrLater() + mode = getAddressingMode() + +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +/* createOleObject( id ) - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Creates an .OLEObject instance, a proxy for the specified COM object. This + routine is used to trap the REXX error that happens when the proxied COM + object can not be created. + + Input: + id REQUIRED + The string used to create the COM object. I.e., the ProgID or CLSID. + + verbose OPTIONAL + If true and the OleObject is not created, the error message is displayed. + If false, the default, the message is not displayed. + + Returns: + An instance of .OLEObject on success, .nil on failure. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine createOleObject public + use strict arg id, verbose = .false + + if isRexxTrue(verbose) then + verbose = .true + else + verbose = .false + + signal on syntax name returnNil + + oleObject = .OLEObject~new(id, "NOEVENTS") + signal on syntax + return oleObject + +returnNil: + signal on syntax + if verbose then + say "Error" rc":" errortext(rc)||'0d0a'x||condition('o')~message + + return .nil +-- End createOleObject( id, verbose ) + +/* displayKnownMethods( oleObj, verbose )- - - - - - - - - - - - - - - - - - -*\ + + Formats and displays the known methods of an .OLEObject instance. Known + methods can only be displayed for OLE / COM objects that provide TypeInfo. If + there is no known information, a simple string stating as much is displayed. + + Input: + oleObj REQUIRED + An instance of the .OLEObject whose known methods are to be displayed. + + verbose OPTIONAL + If true all information concerning the methods is displayed. Parameters, + parameter types, return type, etc.. If false, the default, only the + method names are displayed. + + Returns: + 0 if the specified object is not an instance of the .OLEObject classs, + otherwise 1. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine displayKnownMethods public + use strict arg oleObj, verbose = .false + + if \ oleObj~isInstanceOf(.OLEObject) then do + say "Known methods can only be displayed for instances of the .OLEObject." + say " Arg 1 class:" oleObj~class + return 0 + end + + if isRexxTrue(verbose) then + verbose = .true + else + verbose = .false + + say + j = printInstanceInfo(oleObj) + + known. = oleObj~getKnownMethods + + if known. == .nil then do + say "There is no known method information for this object" + return 1 + end + + say "Containing Type Library:" known.!LIBNAME + if known.!LIBDOC~left(2) <> "!L" then + say "Library Description: " known.!LIBDOC + say + + say "COM Class: " known.!COCLASSNAME + if known.!COCLASSDOC~left(2) <> "!C" then + say "Class Description:" known.!COCLASSDOC + say "Known methods: " known.0 + say + + if \ verbose then do + say " Methods:" + do i = 1 to known.0 + say " " known.i.!NAME + end + return 1 + end + + do i = 1 to known.0 + ret = known.i.!RETTYPE + name = known.i.!NAME + doc = known.i.!DOC + invk = known.i.!INVKIND + + say " " name + + if doc~pos("!DOC") == 0 then + say " Decscription:" doc + + say " " invkindToString(invk) "returns" ret + say + + if ret == "VT_VOID" then + line = " obj~"name + else + line = " " || changeVariant(ret) || "= obj~"name + + select + when invk == 2 then + say line + + when known.i.!PARAMS.0 == 0 then + say line"()" + + otherwise do + line = line"( " + indent = " "~copies(line~length) + + do j = 1 to known.i.!PARAMS.0 + param = known.i.!PARAMS.j.!TYPE known.i.!PARAMS.j.!FLAGS - + known.i.!PARAMS.j.!NAME + + select + when j == 1 & known.i.!PARAMS.0 == 1 then do + say line || param" )" + end + when j == 1 then do + say line || param"," + end + when j == known.i.!PARAMS.0 then do + say indent || param" )" + end + otherwise do + say indent || param"," + end + end + -- End select + end + -- End do j = 1 to known.i.!PARAMS.0 + end + -- End otherwise do + end + -- End select + + say + end + -- End do i = 1 to known.0 + +return 1 +-- End displayKnownMethods( oleObj ) + +/* displayKnownConstants( oleObj ) - - - - - - - - - - - - - - - - - - - - - -*\ + + Prints out all the known constants for the specified object, if any are + available. + + Input: + oleObj REQUIRED + An instance of the .OLEObject whose known methods are to be displayed. + + Returns: + 0 if the oleObj argument was not an instance of .OLEObject, otherwise 1. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine displayKnownConstants public + use strict arg oleObj + + if \ oleObj~isInstanceOf(.OLEObject) then do + say "Known constants can only be displayed for instances of the .OLEObject." + say " Arg 1 class:" oleObj~class + return 0 + end + + say + j = printInstanceInfo(oleObj) + + constants = oleObj~getConstant + if constants == .nil | constants~items == 0 then do + say "There are no known constants for this object" + return 1 + end + + say "Known constants:" constants~items + say + + -- Some of Microsoft's constant names are very long. + line = " "~copies(42) || "= " + do name over constants + say line~overlay(name~substr(2), 3) || constants[name] + end + +return 1 +-- End displayKnownConstants( oleObj ) + +/* isRexxTrue( obj ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Tests if obj is strictly .true. (To some degree, actually just tests that obj + is exactly '1'.) + + Input: + obj REQUIRED + The object to test. + + Returns: + True if obj is strictly true, otherwise false. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine isRexxTrue public + use strict arg obj + + if obj~class == .string then + if obj~datatype('W') then + if obj == 1 then + return .true + +return .false +-- End isRexxTrue( obj ) + +/* isOORexx4OrLater( ) - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Returns true if the running interpreter is ooRexx 4.0.0 or later. + + Input: + None. + + Returns: + True if this is ooRexx 4.0.0 or later, otherwise false. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine isOORexx4OrLater public + use strict arg + + parse version interpreterName languageLevel interpreterDate + parse var interpreterName junk "_" ver "." moreJunk + if ver >= 4 then return .true + +return .false +-- End isOORexx4OrLater( ) + +/** getAddressingMode() + * Determine if this is a 32-bit or 64-bit interpreter. + */ +::routine getAddressingMode public + use strict arg + + parse version rexx'_'ver'_'mode'-bit' . + return mode + +return mode + +/* changeVariant( vt ) - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Helper function to turn a VARTYPE symbol into a "prettified" object name. + + E.g., VT_DISPATCH becomes dispatchObj, VT_I4 becomes i4Obj. + + Input: + vt REQUIRED + + Returns: + The prettified version of the specified VARTYPE. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine changeVariant + use strict arg vt + + -- TODO: it would be nice to turn VT_I4 to something like int4ByteObj, VT_R4 + -- to float4ByteObj, etc. + retStr = vt~substr(4) || "Obj" + +return retStr~lower +-- End changeVariant( vt ) + +/* invkindToString( kind ) - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Helper function to return a string value for the specified invocation type. + + Input: + kind REQUIRED + A number representing a COM INVOKEKIND enumeration. + + Returns: + Returns the enumeration symbol, (string symbol) for the specified kind. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine invkindToString + use strict arg kind + + select + when kind == 1 then + kindString = "" + when kind == 2 then + kindString = "" + when kind == 4 then + kindString = "" + when kind == 8 then + kindString = "" + otherwise + kindString = "" + end + -- End select + +return kindString +-- End invkindToString( kind ) + +/* printInstanceInfo( oleObj ) - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Helper function to print out instance information for an .OLEObject object. + + Input: + oleObj REQUIRED + The object whose instance information is to be printed. + + Returns: + 0, always. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::routine printInstanceInfo + use strict arg oleObj + + progID = oleObj~!getVar("!PROGID") + clsID = oleObj~!getVar("!CLSID") + disp = oleObj~!getVar("!IDISPATCH") + typeInfo = oleObj~!getVar("!ITYPEINFO") + + if isOORexx4OrLater() then do + if progID == .nil then + progID = "null" + if clsID == .nil then + clsID = "null" + if disp == .nil then + disp = "null" + if typeInfo == .nil then + typeInfo = "null" + end + else do + if progID~left(2) == "!P" then + progID = "null" + if clsID~left(2) == "!C" then + clsID = "null" + if disp~left(3) == "!ID" then + disp = "null" + if typeInfo~left(3) == "!IT" then + typeInfo = "null" + end + + say "ProgID: " progID + say "ClsID: " clsID + say "Dispatch Pointer:" disp + say "TypeInfo Pointer:" typeInfo + say + +return 0 +-- End printInstanceInfo( oleObj ) + + + +/* - - - - - - - - - - End of file: OleUtils.frm- - - - - - - - - - - - - - - */ diff --git a/modules/windows/ole/methinfo/main.rex b/modules/windows/ole/methinfo/main.rex new file mode 100755 index 0000000..340ba96 --- /dev/null +++ b/modules/windows/ole/methinfo/main.rex @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* Sample application that demonstrates the use of the */ +/* GetKnownMethods method. */ +/*******************************************************************/ + +say "Please enter a ProgID or a CLSID (e.g. InternetExplorer.Application):" +parse pull oleName + +theObject = .OLEObject~new(oleName) + +info = .methodInfo~new(theObject) + +say "Here is the available information on" oleName + +info~print + +exit + + +::requires "METHINFO.CLS" diff --git a/modules/windows/ole/methinfo/methinfo.cls b/modules/windows/ole/methinfo/methinfo.cls new file mode 100644 index 0000000..d7fc32d --- /dev/null +++ b/modules/windows/ole/methinfo/methinfo.cls @@ -0,0 +1,71 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*******************************************************************/ +/* methodInfo class: */ +/* retrieve method information from OLE object and output it */ +/* to stdout. */ +/*******************************************************************/ + +::class 'MethodInfo' public + +::method init + expose methods. + use arg oleobj + methods. = oleobj~GetKnownMethods + +::method print + expose methods. + if methods. == .nil then return + do i = 1 to methods.0 + signature = methods.i.!RETTYPE + signature = signature methods.i.!NAME + if methods.i.!INVKIND = 4 then + signature = signature"= ("methods.i.!PARAMS.1.!TYPE "as the argument)" + else do + do j = 1 to methods.i.!PARAMS.0 + if j = 1 then signature = signature"(" + signature = signature||methods.i.!PARAMS.j.!FLAGS methods.i.!PARAMS.j.!TYPE methods.i.!PARAMS.j.!NAME + if j = methods.i.!PARAMS.0 then signature = signature")" + else signature = signature", " + end + end + say signature + interpret 'exists = var("methods.'i'.!DOC")' + if exists = 1 then say methods.i.!DOC + if i < methods.0 then say "-"~copies(64) + end diff --git a/modules/windows/ole/oleinfo/createOleInfo.rex b/modules/windows/ole/oleinfo/createOleInfo.rex new file mode 100644 index 0000000..bef7f7f --- /dev/null +++ b/modules/windows/ole/oleinfo/createOleInfo.rex @@ -0,0 +1,175 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*********************************************************************** + program: createOleInfo.rex + type: Object Rexx for Windows + purpose: Query the OLE/ActiveX automation interface, create HTML-renderings, + optionally display HTML-renderings with Internet Explorer + + needs: oleinfo2html.frm + + usage: can be used as a function or as a command + + - can be called from the command line as well: + + rexx createOleInfo.rex app_name [mode [display]] + + where: + app_name ... OLE/ActiveX: a string denominating either PROGID or CLSID + mode ... 0|1 full=default (0) or compact (1) listing + display ... 0|1 no display (0) or display=default (1) with Internet Explorer + + example (command-line): rexx createOleInfo InternetExplorer.Application 1 1 + + - called as an external function: + + res=createOleInfo(app_name | {ole_object [, [header]} [, [mode] [, [display]]]] ) + ... invocation as a function, e.g. from *any* running Object Rexx program, + returns .true, if OLEObject could get created|interrogated, .false else + where: + app_name ... OLE/ActiveX: a string denominating either PROGID or CLSID + or + ole_object ... OLE/ActiveX-object to interrogate + + header ... HTML-heading, if 1st argument is an OLE-object + mode ... 0|1 full (0) or compact=default (1) listing + display ... 0|1 no display (0) or display=default (1) with Internet Explorer + + example: ole=.OleObject~new("InternetExplorer.Application") + success=createOleInfo(ole, "Interfaces for the Internet Explorer") + +***********************************************************************/ + + if arg()=0 then -- show usage + do + do i=1 to 999 until pos("usage:", sourceline(i)) > 0; nop; end + do i=i to 999 while pos("*/", sourceline(i))=0;say strip(sourceline(i));end + exit + end + + parse source . calltype . -- get type of invocation + + bCommand=(calltype="COMMAND") -- called as function ? + if bCommand then + do + parse arg app bCompact bShowInBrowser -- called from the commandline + fn=sanitize(app) + end + else -- called from another Rexx program + do + use arg app, header=("Name of OLE-Object Not Supplied by Programmer!
created on:" date("S") time()), - + bCompact=.false, bShowInBrowser=.true -- called as a function + fn=sanitize(header) + end + + if bCompact = "" then bCompact=.false -- default to .false + else bCompact = (bCompact=.true | translate(bCompact)="TRUE") + + if bShowInBrowser = "" then + bShowInBrowser=.true -- default to .true + else + bShowInBrowser = \(bShowInBrowser=.false | translate(bShowInBrowser)="FALSE") -- default to .true + + if app~class=.string then -- first argument is a String (PROGID or ClSID), not an OLEObject ! + do + resArr=oleinfo2html(app, .nil, bCompact) -- create OLE object and render interrogation results + end + else + do -- 'app' is assumed to be an OleObject + resArr=oleinfo2html(header, app, bCompact) -- pass OLE object and render interrogation results + end + + if resArr~items=0 then + do + .error~say('Problem: could not create an OLEObject for supplied ProgID/CLSID "'app'"') + return .false -- "app": not an OLEobject, return .false + end + + -- create html-file, add extension ".html" to given name + hint="" + if bCompact then hint="reference_" + + -- fn= app || "_" || hint || date("S") || "_" || changestr(" ", translate(time(),"",":"), "") || ".html" + fn= fn || "_" || hint || date("S") || "_" || changestr(" ", translate(time(),"",":"), "") || ".html" + + + -- write received data into file, close it + str=.stream~new(fn) + str~~open("write replace")~~lineout("")~~arrayout(resArr)~~lineout("")~close + + if \bShowInBrowser then return .true -- do not run IE, hence exit + +/* --- although works as of 2022-04-28, Microsoft actively deprecates its Internet explorer + in favor of its Chromium based replacement ("Edge"), which cannot be addressed via OLE + -- still, the InternetExplorer.Application PROGID may still be operable + -- create an instance of Internet Explorer + myIE=.OLEObject~new("InternetExplorer.Application") + myIE~visible=.true -- make it visible + myIE~navigate2(str~qualify) -- load freshly created html file, needs full path with filename + return .true +-- */ + + address system qu(fn) -- let Windows open file in default browser + return .true -- indicate success + +::requires "oleinfo2html.frm" + + + +/* Make sure we create a valid name for Windows, cf. + defining the illegal chars: + < (less than) + > (greater than) + : (colon) + " (double quote) + / (forward slash) + \ (backslash) + | (vertical bar or pipe) + ? (question mark) + * (asterisk) +*/ + +::routine sanitize + parse arg fn + return translate(fn, "", "<>:""/\|?*", " ")~space(1)~changestr(" ","_") + +/* Put quotes around filename and make sure parentheses get escaped with ^. */ +::routine qu + return '"'arg(1)~changeStr('(','^(')~changeStr(')','^)')'"' + diff --git a/modules/windows/ole/oleinfo/getOleConstants.rex b/modules/windows/ole/oleinfo/getOleConstants.rex new file mode 100644 index 0000000..c04f419 --- /dev/null +++ b/modules/windows/ole/oleinfo/getOleConstants.rex @@ -0,0 +1,182 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*********************************************************************** + name: getOleConstants.rex + purpose: create an Object Rexx file which saves the constants of the given + OLE/ActiveX appId/clsId in a directory called "ole.const" in the + environment .local (and hence can be retrieved by the environment + symbol ".ole.const") + usage: getOleConstants appid/clsid [outfile] + + appid/clsid ... OLE/ActiveX application ID or CLSID + outfile ....... optional name of the outputfile, otherwise STDOUT is used + + use the above outfile in a "::requires" directive + which then allows you to use the defined constants, + e.g. ".ole.const~SWC_3RDPARTY" + + example: rexx getOleConstants InternetExplorer.Application msie_const.rex + ... then, whenever you need to access MSIE-constants, then merely use + "::requires msie_const.rex" and refer to them e.g. like + ".ole.const~csc_navigateBack" + +***********************************************************************/ + + if arg()=0 then -- show usage + do + say .resources~usage + exit + end + + +parse arg appId outFile + +-- ole=.oleobject~new(appId) -- get OLE proxy +ole=createOleObject(appId) -- try to create OLE proxy +if ole=.nil then +do + .error~say(appId": could not create the OLE proxy, aborting ...") + exit -1 +end + +oleconst="ole.const" -- define directory name to store OLE constants, change if needed + + -- get OLE constants, create sortable stem +constants.=ole~getConstant +stem. = .stem~new + +stem.0=0 +max=0 +do counter i idx over constants. + idx=substr(idx,2) -- remove leading "!" character + stem.i=idx || "09"x || ole~getConstant(idx) + stem.0=i + max=max(max, length(idx)) -- save longest constant name +end + + -- if no constants, abort +if stem.0=0 then +do + .error~say("No constants found for:" pp(appId)", aborting ..." ) + exit -1 +end + +call SysStemSort "stem.", "A", "I" -- sort stem + + -- dump infos +parse source . . thisPgm + + -- open file-stream +if outfile="" then of=.output -- appId"_constants.rex" + else of=.stream~new(strip(outFile))~~open("write replace") + +of~say("/*" pp(filespec("name", thisPgm)) "run on:" pp(.dateTime~new) "*/" ) +of~say +tmpStr1="are" +tmpStr2="constants" +if stem.0=1 then -- singular +do + tmpStr1="is" + tmpStr2="constant" +end + +of~say("-- OLE/ActiveX-application/clsid:" pp(appId) "- there" tmpStr1 pp(stem.0) tmpStr2 ) +of~say +of~say("-- create stringTable '"OLECONST"', if necessary; maybe shared with OLE constant definitions of other programs") +of~say("if .local~hasentry('"oleconst"')=.false then .local~"oleconst"=.stringTable~new -- create stringTable '"OLEconst"' in .local") +of~say + +do i=1 to stem.0 + parse var stem.i const "09"x value + of~say( '.'oleconst'~'left(const, max) '=' encode(value) ) +end + +of~close + +::routine pp + return "[" || arg(1)~string || "]" + +::routine encode -- if a number, leave unchanged, else escape quotes Rexx-style, enclose string into quotes + + if datatype(arg(1), "Number") & length(arg(1))<=digits() then return arg(1) -- if a number, return value unchanged + + quote='"' + tmp=changestr(quote, arg(1), quote||quote) + return quote || tmp || quote + +::resource usage -- usage instructions +usage: getOleConstants appid/clsid [outfile] + + appid/clsid ... OLE/ActiveX application ID or CLSID + outfile ....... optional name of the outputfile, otherwise STDOUT is used + + use the above outputfile in a "::requires" directive + which then allows you to use the defined constants, + e.g. ".ole.const~SWC_3RDPARTY" + + example: rexx getOleConstants InternetExplorer.Application msie_const.rex + + ... creates an ooRexx program named "msie_const.rex" which adds + all found constants to the .ole.const stringTable (ooRexx 5.0, + like a directory) + + ... then, whenever you need to access MSIE-constants, merely use + + ::requires "msie_const.rex" + + in your program. This makes the InternetExplorer constants + available via the environment symbol ".ole.const" such that + you can refer to the constants by name in your programs like: + + val=.ole.const~csc_navigateBack -- get the constant + + Note: you can require as many different ole constant files as + necessary in a single program; all constants will get + saved in ".ole.const" + +::END + +/** Makes sure that program does not get stopped if OLEObject cannot be created (e.g. SYNTAX 92.911), + rather return .nil in that case. */ +::routine createOleObject + use strict arg appId + signal on syntax + return .oleobject~new(appId) -- get OLE proxy +syntax: + return .nil diff --git a/modules/windows/ole/oleinfo/listProgIds.rex b/modules/windows/ole/oleinfo/listProgIds.rex new file mode 100644 index 0000000..d4f6346 --- /dev/null +++ b/modules/windows/ole/oleinfo/listProgIds.rex @@ -0,0 +1,123 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*********************************************************************** + name: listProgIds.rex + purpose: list all ProgIDs to stdout, optionally with their CLSID + + usage: listProgIds.rex + listProgIds.rex needle + listProgIds.rex 1 + listProgIds.rex 1 needle + ... needle: optional: a string, list ProgIdDs that contain this string (caseless comparison) + ... 1 optional: supply CLSID + +***********************************************************************/ + +parse arg indicator needle . +bCLSID=(indicator=1) +if \bCLSID then needle=indicator -- shift to needle + +bTiming=.false -- .true -- determines whether timings are shown +time0=.DateTime~new + +.clsid~analyze_and_build -- let the class method query and analyze the registry, +all_progid= .clsid~all_progid -- get ProgID directory + +time1=.DateTime~new +if bTiming then say "analyzing registry time spent:" pp(time1-time0) + -- sort all ProgID indixes caselessly +allProgIds = all_progid~allIndexes~sortWith(.CaselessComparator~new) + +time2=.DateTime~new +items=allProgIds~items +if bTiming then +do + say "sorting" items "took:" pp(time2-time1) + say +end +prefix=.rexxinfo~architecture"-bit #" +len=items~length +bDots=.false +do counter i idx over allProgIds -- idx is the ProgID + if needle<>"", idx~caselessPos(needle)=0 then iterate + + o=all_progid~at(idx) -- get ooRexx classid object + hint=checkProgId(idx) -- supply hint whether ProgID adheres to MS specs + if bCLSID then + do + if bDots then + say prefix i~right(len)"/"items":" "ProgId:" pp(idx)~left(70,".") || hint~left(5,".") "CLSID:" o~clsid + else + say prefix i~right(len)"/"items":" "ProgId:" pp(idx)~left(70) || hint~left(5) "CLSID:" o~clsid + bDots=\bDots + end + else + say prefix i~right(len)"/"items":" "ProgId:" pp(idx)~left(70) || hint~left(5) +end +time3=.DateTime~new +if bTiming then +do + say "output took: " pp(time3-time2) + say "total time: " pp(time3-time0) +end + + + +::requires "reg_classids4ole.cls" -- get support for analyzing the registry + +::routine pp + return "["arg(1)"]" + +::routine checkProgId -- checks whether ProgID adheres to Microsoft's specifications + use arg progid + -- check validity of ProgId according to: : + -- length<=39, no punctuation (except dots), not start with a digit, .. + -- also discussion at: + hint="" + -- too long or empty string? + if progid~length >39 then hint="l" + else if progid="" then hint="l" + -- illegal character? + if verify(progid,"ABCDEFGHIJKLMNOPQRSTUVWXYZ.abcdefghijklmnopqrstuvwxyz0123456789")>0 then hint||="c" + -- must not start with a digit + if datatype(progid[1],"W") then hint="d" + if hint<>"" then return "*"hint"*" + + return hint + diff --git a/modules/windows/ole/oleinfo/oleinfo.cls b/modules/windows/ole/oleinfo/oleinfo.cls new file mode 100644 index 0000000..614b0e3 --- /dev/null +++ b/modules/windows/ole/oleinfo/oleinfo.cls @@ -0,0 +1,297 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*********************************************************************** + program: oleinfo.cls + + purpose: Query the OLE/ActiveX automation interface, create an Object Rexx proxy + which contains all relevant information in an edited and easy to use form + + usage: require this file + + returns: an instance of class "rgf.oleinfo" + +***********************************************************************/ + + + -- define invocation types +tmp.="???" +tmp.1="regularMethodCall" +tmp.2="getProperty" +tmp.4="putProperty" +tmp.8="letProperty" -- a put property (assigning a reference, distinguishment not important for Rexx) +.local~rgf.invKind= tmp. -- save stem + + + -- class to parse and create sorted list of methods +::class rgf.oleinfo public + +::method oleObject attribute -- OLEobject itself + +::method oleString attribute -- app_name +::method libname attribute +::method libdoc attribute + +::method allMethodDir attribute -- contains all methods +::method allMethodRel attribute +::method allMethodSortedStem attribute + +::method methodDir attribute + +::method getPropertyDir attribute +::method putPropertyDir attribute + +::method naDir attribute -- directory for storing methods with unknown invocation types + +::method getAndPutPropertyDir attribute +::method getOnlyPropertyDir attribute +::method putOnlyPropertyDir attribute + +::method eventDir attribute +::method eventSortedStem attribute + +::method constantSortedStem attribute + +::method init + expose oleObject oleString libname libdoc allMethodDir allMethodSortedStem methodDir getPropertyDir , + putPropertyDir naDir getAndPutPropertyDir getOnlyPropertyDir putOnlyPropertyDir eventDir eventSortedStem, + constantSortedStem + + use arg oleobject, oleString + + signal on syntax -- if OLEobject cannot be created, return .nil + if arg(1)="" | arg(1)=.nil then oleobject=.oleobject~new(oleString, "WITHEVENTS") + + if arg(2, "Omitted") then oleString="n/a" + + methodDir =.directory~new -- method directory + allMethodDir =.directory~new + allMethodSortedStem = .stem~new + + getPropertyDir =.directory~new -- get property directory + putPropertyDir =.directory~new -- set property directory + + naDir =.directory~new + + getAndPutPropertyDir = .directory~new + getOnlyPropertyDir = .directory~new + putOnlyPropertyDir = .directory~new + + eventDir =.directory~new -- event directory + eventSortedStem = .stem~new + constantSortedStem = .stem~new + + m. = oleobject~getKnownMethods -- get all known methods + if m. <> .nil then + do + libname=choose( var("m.!LibName"), m.!LibName, "n/a") + libdoc =choose( var("m.!LibDoc"), m.!libDoc, "n/a" ) + + -- determine kind of methods, build collection objects + j=0 + tmpSet=.set~new -- used to lookup whether name already collected + mStem.0=m.0 + do i=1 to m.0 + mo=.ole_method~new(m., i ) -- create object + name=mo~name + + allMethodDir~setentry(name, mo) -- save method-object + + if mo~invKind=1 then methodDir~setentry(name, mo) -- a normal method + else if mo~invKind=2 then getPropertyDir~setentry(name, mo) -- a get property + else if mo~invKind=4 | mo~invKind=8 then putPropertyDir~setentry(name, mo) -- a put property + + uname=translate(name) + if tmpSet~hasindex(uname) then iterate + j=j+1 + mStem.j=name + mStem.0=J + tmpSet~put(uname) + end + + call SysStemSort mStem., "Ascending", "Ignore" -- makes problem if used under MSIE (as of: 2002-05-27) + self~allMethodSortedStem = mStem. -- save sorted stem + end + + -- methods which possess an unknown invocation type: + naDir=allMethodDir~difference(methodDir)~difference(getPropertyDir)~difference(putPropertyDir) + + getAndPutPropertyDir = getPropertyDir~intersection(putPropertyDir) + getOnlyPropertyDir = getPropertyDir~difference(putPropertyDir) + putOnlyPropertyDir = putPropertyDir~difference(getPropertyDir) + + ev. = oleobject~getKnownEvents -- get all known events + + if ev. <> .nil then + do + evStem.0=ev.0 + do i=1 to ev.0 + ev=.ole_event~new(ev., i ) -- create object + eventDir~setentry(ev~name, ev) + evStem.i=ev~name + end + + call SysStemSort evStem., "Ascending", "Ignore" + self~eventSortedStem = evStem. -- save sorted stem + end + +-- call alert "oleobject="oleObject "ev.0="ev.0 "evStem.0="evStem.0 "sel~eventSortedStem="self~eventSortedStem + + c. = oleobject~getConstant -- OLE object needs to have been created with the "WITHEVENTS"-option + if c. <> .nil then + do + i=0 + do item over c. + i=i+1 + constStem.i=substr(item, 2) + end + constStem.0=i + + if constStem.0>0 then + call SysStemSort constStem., "A", "I" -- get constants and sort ascendingly + self~constantSortedStem = constStem. + end + + RETURN + +syntax: + oleObject=.nil + return + + + -- pretty print +::routine pp + return "[" || arg(1) || "]" + + + -- OLE MethodOrEvent +::class methodOrEvent +::method init + expose name doc params + use arg stem., idx + + name=stem.idx.!Name + + if var("stem.idx.!doc") then doc=stem.idx.!Doc + else doc="n/a" -- .nil + + params =.list~new + do i=1 to stem.idx.!params.0 + params~insert( .ole_param~new( stem.idx.!params.i.!name, - + stem.idx.!params.i.!type, - + stem.idx.!params.i.!flags ) ) + end + +::method name attribute +::method doc attribute +::method params attribute -- list of params, if any + +::method makestring -- create string rendering + expose name doc params + + tmp="" + do param over params + tmp=tmp "," param~makestring + end + tmp=substr(tmp,4) + return name pp( doc ) "(" tmp ")" + + + -- OLE Method +::class ole_method subclass MethodOrEvent + +::method init + expose invkind retType + use arg stem., idx + + forward class (super) continue -- let super initialize + + invkind=stem.idx.!InvKind + if invkind=.nil then invkind="??? unknown type #" stem.idx.!InvKind "???" + + -- if invkind="4" then self~name=(self~name || "=") + retType=stem.idx.!retType + +::method invkind attribute -- 1=method, 2=getProperty, 4=putProperty +::method retType attribute + +::method makestring -- create string rendering + expose invKind retType + return (.rgf.invKind[invKind]~string) (self~makestring:super~string) "retType --->" (retType~string) + + + -- OLE Event +::class ole_event subclass MethodOrEvent + + + + -- OLE Parameter +::class ole_param +::method init + expose name in out opt type + parse arg name, type, flags + in =pos("in", flags)>0 + out=pos("out", flags)>0 + opt=pos("opt", flags)>0 + +::method name attribute +::method in attribute +::method out attribute +::method opt attribute +::method type attribute + +::method makestring -- render to a string + expose name in out opt type type + + tmp=name + if in then tmp=tmp "in" + else tmp=tmp " " + + if out then tmp=tmp"/out" + + tmp=tmp":" type + + if opt then tmp=pp(tmp) -- indicate optionality by enclosing in brackets + return tmp + + + -- C++/Java like choice ("...?...:...;") +:: routine choose public + if arg(1)=.true then return arg(2) + return arg(3) + diff --git a/modules/windows/ole/oleinfo/oleinfo.css b/modules/windows/ole/oleinfo/oleinfo.css new file mode 100644 index 0000000..d19dc0d --- /dev/null +++ b/modules/windows/ole/oleinfo/oleinfo.css @@ -0,0 +1,195 @@ +/* + *----------------------------------------------------------------------------* + * * + * Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. * + * Copyright (c) 2023 Rexx Language Association. All rights reserved. * + * * + * This program and the accompanying materials are made available under * + * the terms of the Common Public License v1.0 which accompanies this * + * distribution. A copy is also available at the following address: * + * https: www.oorexx.org license.html * + * * + * 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. * + * * + * Neither the name of Rexx Language Association nor the names * + * of its contributors may be used to endorse or promote products * + * derived from this software without specific prior written permission. * + * * + * 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 * + * OWNER 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. * + * * + *----------------------------------------------------------------------------* + + purpose: formatting information for the "oleinfo*" set of Object Rexx programs + and HTML-files which embed Object Rexx code + +*/ + +@media screen { + + H1 { color: blue; + } + + body { background-color: lightgoldenrodyellow /* #ffffdd */ ; + font-family: Times, Avantgarde; + font-family: Arial,sans-serif; + font-size: 14pt; + } + + div.alert { + background-color: black; + color: white; + text-align: center; + padding: 5 5 5 5; + } + + + .choose { color: brown; + font-weight: bold; + } + + A.choose { + text-decoration: none; + } + + .choose:hover { + font-size: 150%; + font-weight: bolder; + text-decoration: none; + } + + .hint_not_found { + font-weight: bold; + color: red; + } + + .hint { + font-size: 75%; + } + + table.hint { + color: blue; + } + + + col.th_hint { color: orange; + text-align: right; + } + + col.td_hint { + color: black; + } + +} + + +@media screen, print { + + H1 { color: blue; + text-align: center; + font-family: Arial,sans-serif; + font-size: 200%; + } + + table.all_CLSIDs { + font-size: 75%; + } + + .doc { color: blue; + font-style: italic; + } + + .name { + color: red /* red */ ; + font-weight: bold; + } + + .hilite { background-color: yellow; } + + .optional { font-style: italic; + font-size: 90%; + } + + .inout { vertical-align: sub; + font-size: smaller; + } + + + .info { font-style: italic; + font-weight: bold; + font-variant: small-caps; + font-size: 80%; + text-align: right; + } + + + .type { font-variant: small-caps; + font-family: Arial,sans-serif; + font-size: 75%; + font-style: italic; + font-weight: bold; + color: green; + } + + .number { text-align: right; + font-style: italic; + } + + + tr.odd { + background-color: rgb(235, 235, 235) ; /* also in hex possible, e.g. #f1f1f1 */ + } + + td.indent { + text-indent: 1cm; + } + + .bottom_info { font-variant: small-caps; + font-family: Arial,sans-serif; + font-size: 65%; + font-style: italic; + text-align: center; + font-weight: bold; + } + + +} + + +@media print { + BODY { + font-size: 12pt; + } + + TABLE { + padding: 1px; + font-size: 10pt; + } + + tr.return { color: green; border: 1px solid black; } +} + + +@media all { + +/* BODY { line-height: 1.2;} */ +} + + diff --git a/modules/windows/ole/oleinfo/oleinfo.properties b/modules/windows/ole/oleinfo/oleinfo.properties new file mode 100644 index 0000000..5d3c3be --- /dev/null +++ b/modules/windows/ole/oleinfo/oleinfo.properties @@ -0,0 +1,51 @@ +-- *----------------------------------------------------------------------------* +-- * * +-- * Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. * +-- * Copyright (c) 2023 Rexx Language Association. All rights reserved. * +-- * * +-- * This program and the accompanying materials are made available under * +-- * the terms of the Common Public License v1.0 which accompanies this * +-- * distribution. A copy is also available at the following address: * +-- * https: www.oorexx.org license.html * +-- * * +-- * 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. * +-- * * +-- * Neither the name of Rexx Language Association nor the names * +-- * of its contributors may be used to endorse or promote products * +-- * derived from this software without specific prior written permission. * +-- * * +-- * 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 * +-- * OWNER 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. * +-- * * +-- *----------------------------------------------------------------------------* + +-- purpose: allows to define the name of the css to use and whether it is to +-- be incorporated into the generated html documentation + +-- Please note: - the keys are case sensitive +-- - leading blanks after the equal sign get preserved + +cssFileName = oleinfo.css + +-- if incorporateCSS=0 then external links get generated, else if 1 the css +-- gets incorporated into the header of the generated html documentation +incorporateCSS =1 + + diff --git a/modules/windows/ole/oleinfo/oleinfo2html.frm b/modules/windows/ole/oleinfo/oleinfo2html.frm new file mode 100644 index 0000000..5d6cd66 --- /dev/null +++ b/modules/windows/ole/oleinfo/oleinfo2html.frm @@ -0,0 +1,992 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*********************************************************************** + program: oleinfo2html.frm + purpose: Query the OLE/ActiveX automation interface, create HTML renderings of results + + needs: oleinfo.cls + + usage: require this file + + oleinfo(app_name[, [oleobj] [, [bCompact] [, HTMLString]]] ) + + app_name OLE/ActiveX program name or class-id + oleobj OLE object, .nil or empty string + ... if .nil or empty string, an OLE object is created with app_name + bCompact ... .true=compact rendering, .false=full rendering including constants + HTMLString ... if given, gets inserted right before tables begin + + returns: array with two elements: string of and string of + +***********************************************************************/ + +nl="0d0a"x +parse source . . thisPgm +thisLocation=filespec('location',thisPgm) + + -- create a stylesheet link with a fully quailified name in addition to one without a path + +-- oleinfo.properties +propsFile="oleinfo.properties" +if \sysFileExists(propsFile) then propsFile=thisLocation||propsFile + +if sysFileExists(propsFile) then +do + props=.Properties~load(propsFile) + stylesheet =props~getProperty("cssFileName", stylesheet)~strip + bIncorporateCss=props~getLogical("incorporateCSS", .true) +end +else -- no cssFile found, just refer to it, do not attempt to incorporate +do + stylesheet ="oleinfo.css" + bIncorporateCss=.false +end + +if bIncorporateCss then -- does stylesheet exist? +do + if \sysFileExists(stylesheet) then + do + tmpStyleSheet=thisLocation||stylesheet + if sysFileExists(tmpStyleSheet) then + styleSheet=tmpStyleSheet + else -- does not exist, do not incorporate CSS, leave original name intact + bIncorporateCss=.false + end +end + +tmpLocalCss="" +if bIncorporateCss then -- if .true get css-definitions and copy them into the head +do + s=.stream~new(stylesheet)~~open("read") + tmp="" nl -- incorporate css definitions + s~close +end +else +do + tmp=stream(stylesheet, "c", "query exists") + + if tmp="" then -- hmm, not found, maybe wer are not in our home directory, try it with that + do + errMsg="Problem, cannot locate stylesheet:" stylesheet + if window <> "WINDOW" then call alert msg + else .error~say(msg) + end + + tmpLocalCss=' ' + if tmp <> "" then + do + tmp=' 'nl , + ' ' + end + else + tmp="" +end + + -- HTML head text +.local~head.text = , + ' 'nl , + ' 'nl , + ' 'nl , + ' 'nl , + 'OLE/ActiveX Automation Interfaces for "\\//" 'nl , + tmpLocalCss nl , + nl , + tmp nl , + ' 'nl , + .resources~flip.js nl , + ' 'nl , + ' 'nl , + '
'nl + + -- HTML body text leadin +.local~leadin.body.text = '
'nl + + -- HTML body text leadout +.local~leadout.body.text = '
'nl + + + -- flip-code +.local ~ flip.code = nl , + ' 'nl , + ' 'nl + + + -- query computer, domain and user-name, save info with the local environment for later referral +if .rgf.info=".RGF.INFO" then -- not set yet, query WSH for user data +do + wn = .OLEObject~New("WScript.Network") + .local~rgf.info = wn~userName"/"wn~userDomain"@\\"wn~computerName +end + + +::requires "oleinfo.cls" -- class which queries and keeps the OLE-infos + + /* create the HTML rendered output of the ole-infos */ +::routine oleinfo2html public + use arg olestring, oleobj, bCompact, htmlString + + bCompact = (bCompact=.true) -- default to .false, i.e. more verbose output + bBrowser = (window<>"WINDOW") -- determine whether running under MS Internet Explorer + if bBrowser then -- assuming to run under WWW-browser + window~status='Interrogating the OLE object automation interface ...' + + if arg(2)="" | arg(2)=.nil then a=.rgf.oleinfo~new(.nil, olestring) -- create a parsed OLEObject object + else a=.rgf.oleinfo~new(oleobj, olestring) + + if a~oleobject=.nil then return .array~new -- no OLEObject available, return empty array + + ts. = a~allMethodSortedStem -- stem with all methods sorted + +-- outArray = .array~new -- create array which contains the HTML-lines +-- aIdx = 1 -- set array index to 1 + + outMB=.mutableBuffer~new + -- call time "r" + + call sag '

' a~oleString '

' + call sag + call sag 'Definitions from typelib:' '['a~libname']' + call sag 'with the brief documentation:' + call sag '['a~libdoc']' + + -- determine date of ooRexx interpreter, if newer than 20220516, then the attributes CLSID and ProgId are available + sdate=date("s",.rexxinfo~date) -- turns ooRexx production date into a sorted date (YYYYMMDD) + if sdate>"20220516" then -- show attributes ProgID and CLSID + do + call sag '

Effective ProgID: ['a~oleobject~progid']' + call sag 'CLSID: ['a~oleobject~clsid']

' + end + + call sag '
(These published interfaces got retrieved using the .OLEInfo class from ooRexx with the exact name: "'.rexxinfo~name'".)' + call sag + + if arg(4, "Exists") then call sag htmlString -- insert received HTML-string + + if bCompact then call do_the_work_compact + else + do +-- call sag .flip.code -- add flip-code for showing/hiding table bodies + call do_the_work + end + + call sag '

' + call sag '

' + call sag '
' + call sag 'Created with ' + call sag '
ooRexx (Open Object' + call sag 'Rexx) ("createOleInfo.rex")' + + call sag 'on' '' pp(date("s") time()) '' + call sag 'run by' '' pp(.rgf.info) '' + call sag '
' + call sag '
' + + call sag + + tmp=outMB~string + + -- broken up into two pieces: a string for and one for + return .array~of( changestr( "\\//", .head.text, olestring), .leadin.body.text tmp .leadout.body.text ) + + + /* create the HTML text for documenting the OLE interfaces: methods, get/put properties, events, constants */ +do_the_work: + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* dump methods */ + + call sag '

' + + o=a~methodDir -- get method directory from OLEInfo object + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'methods ...' + + call sag + call sag '' + -- call sag '
' + + if o~items=0 then + do + tmp1='' + tmp2='style="display:none"' + end + else + do + tmp1='checked' + tmp2='' + end + + call sag + call sag '' + call sag '' + call sag + + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'methods ...' + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + call sag '' + call sag '
show', + '' + + call sag '' '' a~methodDir~items 'Method[s]' '' + call sag '
No. Name Documentation, Argument[s], Return Value' + call sag '
'm '' ts.i , + ' ' ot~doc~string '' '
' + + call sag + call sag '' + if ot~params~items > 0 then + do + call sag '
arg: ' + call write_arguments ot~params + end + call sag '
returns: ' ot~retType choose(ot~retType="VT_VOID", "( no return value )", "") + call sag '
' + end + call sag + end + call sag '
' + call sag + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* readonly properties */ + call sag '

' + + o=a~getOnlyPropertyDir -- get directory with the read-only properties from OLEinfo object + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'read-only properties ...' + + + call sag + call sag '' + + if o~items=0 then + do + tmp1='' + tmp2='style="display:none"' + end + else + do + tmp1='checked' + tmp2='' + end + + call sag '' + call sag + call sag '' + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + -- call sag '' + call sag '
show', + '' + + call sag '' '' a~getOnlyPropertyDir~items 'Read-only Properties' '' + + call sag '
No. Name Documentation, Return Value' + call sag '
'm '' ts.i ' ' ot~doc~string '' '
' + + call sag '
'm '' ts.i , + ' ' ot~doc~string '' '
' + + + call sag + call sag '' + if ot~params~items > 0 then + do + call sag '
arg: ' + call write_arguments ot~params + end + call sag '
returns: ' ot~retType choose(ot~retType="VT_VOID", "( no return value )", "") + + call sag '
' + call sag + end + end + call sag '
' + call sag + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* write-only properties */ + call sag '

' + + o=a~putOnlyPropertyDir -- get write-only property from OLEinfo object + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'write-only properties ...' + + call sag + call sag '' + + if o~items=0 then + do + tmp1='' + tmp2='style="display:none"' + end + else + do + tmp1='checked' + tmp2='' + end + + call sag '' + call sag + call sag '' + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + -- call sag '' + call sag '
show', + '' + + call sag '' '' a~putOnlyPropertyDir~items 'Write-only Properties' '' + + call sag '
No. Name Documentation, Argument[s], Return Value' + call sag '
'm '' ts.i ' ' ot~doc~string '' '
' + + call sag '
'm '' ts.i , + ' ' ot~doc~string '' '
' + + + call sag + call sag '' + if ot~params~items > 0 then + do + call sag '
arg: ' + call write_arguments ot~params + end + call sag '
returns: ' ot~retType choose(ot~retType="VT_VOID", "( no return value )", "") + call sag '
' + end + call sag + end + call sag '
' + + call sag + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* read/write properties */ + call sag '

' + o=a~getAndPutPropertyDir + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'read/write properties ...' + + call sag + call sag '' + + if o~items=0 then + do + tmp1='' + tmp2='style="display:none"' + end + else + do + tmp1='checked' + tmp2='' + end + + call sag '' + call sag + call sag '' + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + -- call sag '' + call sag '
show', + '' + + call sag '' '' a~getAndPutPropertyDir~items 'Read/Write Properties' '' + + call sag '
No. Name Documentation, Argument[s], Return Value' + call sag '
'm '' ts.i ' ' ot~doc~string'' '
' + + call sag '
'm '' ts.i , + ' ' ot~doc~string '' '
' + + call sag + call sag '' + if ot~params~items > 0 then + do + call sag '
arg: ' + call write_arguments ot~params + end + call sag '
needs/returns: ' ot~retType choose(ot~retType="VT_VOID", "( no return value )", "") + call sag '
' + call sag + end + end + call sag '
' + call sag + + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* unknown properties/methods, i.e. unknown invocation type */ + call sag '

' + o=a~naDir + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'unknown invocation types ...' + + call sag + call sag '' + + if o~items=0 then + do + tmp1='' + tmp2='style="display:none"' + end + else + do + tmp1='checked' + tmp2='' + end + + call sag '' + call sag + call sag '' + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + -- call sag '' + call sag '
show', + '' + + call sag '' '' a~naDir~items 'Methods with Unknown Invocation Type Properties' '' + + call sag '
No. Name Documentation, Argument[s], Return Value' + call sag '
'm '' ts.i ' ' '
' + call sag '
'm '' ts.i , + ' ' ot~doc~string '' '
' + + call sag 'Invocation type:' ot~invkind "(".rgf.invKind[ot~invkind]")" '
' + + call sag + call sag '' + + if ot~params~items > 0 then + do + call sag '
arg: ' + call write_arguments ot~params + end + + call sag '
returns: ' ot~retType choose(ot~retType="VT_VOID", "( no return value )", "") + call sag '
' + call sag '
' + end + call sag + end + call sag '
' + call sag + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* events */ + call sag '

' + o=a~eventDir + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'events ...' + + call sag + call sag '' + + if o~items=0 then + do + tmp1='' + tmp2='style="display:none"' + end + else + do + tmp1='checked' + tmp2='' + end + + call sag '' + call sag + call sag '' + + ts. = a~eventSortedStem + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + call sag '" + call sag '
show', + '' + + call sag '' '' a~eventDir~items 'Event(s)' '' + + call sag '
No. Name Documentation, Argument[s], Return Value' + call sag '
'm '' ts.i , + ' ' ot~doc~string '' '
' + + if ot~params~items > 0 then + do + + call sag + call sag '' + call sag '
arg: ' + call write_arguments ot~params + call sag '
' + end + else call sag ' ' + call sag + end + end + call sag "
' + call sag + + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + /* constants */ + ts.=a~constantSortedStem + + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' ts.0 'constants ...' + + call sag '

' + call sag + call sag '' + call sag '' + call sag + call sag '' + + + do i=1 to ts.0 + call sag '" + call sag "
show', + '' + + call sag '' '' ts.0 'Constant(s)' '' + + tmp2='style="display:none"' + call sag '
No. Name Value' + call sag '
'i '' ts.i '' a~oleobject~getconstant( ts.i ) + end + call sag "
" + call sag + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + call sag + + if bBrowser then -- assuming to run under WWW-browser + window~status='Done.' + return + + + + /* create a compact (terse) output: methods, properties, events */ +do_the_work_compact: + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + + call sag '

' + + o=a~methodDir + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'methods ...' + + call sag + call sag '' + + call sag ' ' + call sag + call sag ' ' + + + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + + p_items=ot~params~items -- get number of arguments/parameters + + evenOdd=choose( m//2, "odd", "even") + + call sag '' + call sag ' ' + call sag '
' '' a~methodDir~items 'Method[s]' '' + + call sag '
No. Name' + call sag ' Argument[s], Documentation' + call sag '
' m + retType=ot~retType + call sag ' 'choose(retType="VT_VOID", "", retType)'' + call sag ' ' ts.i'' + -- call sag ' ' + call sag ' ' + if p_items > 0 then + do + call sag '( ' + call write_arguments_compact ot~params + call sag ' )' + end + + if wordpos( ot~doc~string, "n/a (null)") = 0 then + do + if p_items>0 then call sag '
' + call sag '' ot~doc~string '' + end + call sag + end + end + call sag '
' + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + + call sag '


' + + Prop_totals=a~getPropertyDir~items + a~putPropertyDir~items + a~naDir~items + + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' prop_totals 'properties ...' + + call sag + call sag '' + call sag ' ' + call sag + call sag ' ' + + -- o=a~methodDir + + m=0 + do i=1 to ts.0 + tmpList=.list~new + tmp=a~getPropertyDir~entry(ts.i) -- a get property? + getName="" + if tmp <> .nil then + do + tmpList~insert(tmp) + getName=ts.i + end + + tmp=a~putPropertyDir~entry(ts.i) -- a put property? + if tmp <> .nil then tmpList~insert(tmp) + + tmp=a~naDir~entry(ts.i) -- an unknown invoked method property? + if tmp <> .nil then tmpList~insert(tmp) + + do ot over tmpList -- get all entries for + m=m+1 + -- ot=aMD~entry(ts.i) -- get property + + p_items=ot~params~items -- get number of arguments/parameters + + evenOdd=choose( m//2, "odd", "even") + + call sag '' + call sag ' ' + call sag '
' '' prop_totals 'Property[ies]' '' + + call sag '
No. Name' + call sag ' Argument[s], Documentation' + call sag '
' m + retType=ot~retType + call sag ' 'choose(retType="VT_VOID", "", retType)'' + + -- indicate the put-property by appending the assing operator "=" + call sag ' ' ts.i || choose(ot~invKind=4, "=", "") '' + -- call sag ' ' + call sag ' ' + if p_items > 0 then + do + call sag '( ' + call write_arguments_compact ot~params + call sag ' )' + end + + if wordpos( ot~doc~string, "n/a (null)") = 0 & \(ot~invKind=4 & getName=ts.i) then + do + if p_items>0 then call sag '
' + call sag '' ot~doc~string '' + end + end + call sag + end + call sag '
' + + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + + call sag '


' + + o=a~eventDir + if bBrowser then -- assuming to run under WWW-browser + window~status='Analyzing and creating HTML-text for available' o~items 'events ...' + + call sag + call sag '' + call sag ' ' + call sag + call sag ' ' + + ts. = a~eventSortedStem + + m=0 + do i=1 to ts.0 + if o~hasentry(ts.i) then + do + m=m+1 + ot=o~entry(ts.i) + + p_items=ot~params~items -- get number of arguments/parameters + + evenOdd=choose( m//2, "odd", "even") + + call sag '' + call sag ' " + call sag '
' '' o~items 'Event(s)' '' + call sag '
No. Name' + call sag ' Argument[s], Documentation' + call sag '
' m + + call sag ' ' + call sag ' ' ts.i'' + -- call sag ' ' + call sag ' ' + if p_items > 0 then + do + call sag '( ' + call write_arguments_compact ot~params + call sag ' )' + end + + if wordpos( ot~doc~string, "n/a (null)") = 0 then + do + if p_items>0 then call sag '
' + + call sag '' ot~doc~string '' + end + end + call sag + end + call sag "
' + call sag + + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + + /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ + call sag + + if bBrowser then -- assuming to run under WWW-browser + window~status='Done.' + return + + + + -- write all arguments of this method, event +write_arguments: procedure expose outMB -- outArray aIdx + use arg ot + if ot~items=0 then return + + call sag + call sag '' + call sag '' , + '' , + '
arg #' m 'of' t':' '' choose(o~opt, pp(o~name), o~name) , + -- call sag '
' choose(o~opt, pp(o~name), o~name) , + call sag '
#' m':' '' choose(o~opt, '[ ' || o~name || ' ]', o~name) , + '' choose(o~in, "in", "") , + '' choose(o~out, "/out", "") , + '' choose(o~opt, '[ optional ]', "") , + '' o~type + end + + call sag '
' + + return + + + + -- write all arguments of this method, event +write_arguments_compact : procedure expose outMB -- outArray aIdx + use arg ot + if ot~items=0 then return + + t=ot~items + m=0 + do o over ot + m=m+1 + tmp = ''o~name'' + + tmp = tmp || ' ' || o~type || "" + + if o~out then + tmp = tmp || ' ' || choose(o~in, "in/", "---") || "out" + + + call sag choose( o~opt, ''pp(' 'tmp' ')"" , tmp) + if m <> t then -- if not last argument, add comma + call sag " ," + end + return + + + + -- save text in array +sag: procedure expose outMB -- outArray aIdx + + outMB~~append(arg(1))~~append("0d0a"x) + return + + -- cheap "pretty" print +pp: procedure + return "[" || arg(1)~string || "]" + + +::resource flip.js + +::END + +::resource flip.rex + ' 'nl , + ' 'nl +::END + diff --git a/modules/windows/ole/oleinfo/readme.txt b/modules/windows/ole/oleinfo/readme.txt new file mode 100644 index 0000000..8fac3fb --- /dev/null +++ b/modules/windows/ole/oleinfo/readme.txt @@ -0,0 +1,149 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +"oleinfo" +========= + +ooRexx set of Window programs for analyzing and documenting registered Windows +OLE/COM components. + +Please note: Windows will expose only those ProgIDs that match the bitness of + the program (ooRexx). Therefore running these little utilities with + 32-bit and 64-bit versions of the ooRexx interpreter may yield + different ProgIDs. (ooRexx 5 allows 32-bit and 64-bit versions to run + in parallel on the same Windows computer.) + + +- listProgIds.rex ... program lists all registered Windows OLE/COM components + + - optional argument 1: supplying the digit 1 adds CLSID to the output + - optional argument "needle": lists only ProgIDs containing the needle + + - examples: + + rexx listProgIds.rex + rexx listProgIds.rex policy + rexx listProgIds.rex 1 + rexx listProgIds.rex 1 policy + +- createOleInfo.rex ... program to create the documentation on the fly, if a + typelib got installed with the OLE/COM component + + - argument 1: ProgID or CLSID + - optional argument 2: 0 (default) long, 1 short (reference) documentation + - optional argument 3: 0 no display, 1 (default) display documentation + + - examples: + + rexx createOleInfo.rex InternetExplorer.Application + rexx createOleInfo.rex InternetExplorer.Application 1 + rexx createOleInfo.rex InternetExplorer.Application 1 0 + rexx createOleInfo.rex {0002DF01-0000-0000-C000-000000000046} + rexx createOleInfo.rex {0002DF01-0000-0000-C000-000000000046} 1 0 + rexx createOleInfo.rex {0002DF01-0000-0000-C000-000000000046} 0 1 + + + +- getOleConstants.rex ... program creates a Rexx program that puts all constant values + into .local~ole.const; requiring or calling that created + Rexx program makes all constants of that OLE/COM component + available to the programmer. To retrieve a specific constant + send the constant name to ".ole.const" which will return its + value. + + - argument 1: ProgID or CLSID + - optional argument 2: name of the file the generated generated Rexx code + should be saved to; if omitted output goes to stdout (the screen) + ... if file gets generated incorporate it either with the + "::requires file.rex" or "call file.rex" statement; therafter + fetch any constant sending its name .ole.const + + - examples: + + rexx getOleConstants.rex Excel.Application excel_constants.rex + ... inspect "excel_constants.rex", use in Rexx program: + ... + say .ole.const~xlColumnHeader -- access Excel constant "xlColumnHeader" + ... + ::requires excel_constants.rex -- incorporate all Excel constants + + rexx getOleConstants.rex Word.Application word_constants.rex + ... inspect "word_constants.rex", use in Rexx program: call word_constants.rex + ... + call word_constants.rex -- incorporate all Word constants + ... + say .ole.const~wdReadingView -- access Word constant "wdReadingView" + ... + +--- supporting programs + + - oleinfo.css ... the cascading stylesheet for the generated documentation + + - oleinfo.cls ... support package for these utilities representing each OLE/COM component + with the most important information about it + + - oleinfo.properties ... a property (text) file defining the CSS file name and whether its + content should be incorporated into the head elelment of the generated + HTML documentation + + - oleinfo2html.frm ... program to create the long and short/reference HTML documentation + + - reg_classids4ole.cls ... support package to analyze the registry for OLE/COM components + +--- NOTE: you can invoke createOleInfo as a subroutine, function from an ooRexx program with the + following arguments: + + - argument 1: an OleObject or a string with the ProgID or CLSID; this way + it becomes possible to have the documentation created of an OLE/COM + object returned by a windows method or property + + - optional argument 2: title to use for the HTML rendering and filename + + - optional argument 3: 0 (default) long, 1 short (reference) documentation + + - optional argument 4: 0 no display, 1 (default) display documentation + + - example: + + ... cut ... + oleobject = winapp~getSomething(...) -- returns an OLE object + -- document the returned OLE object as HTML with a supplied title + call createOleInfo oleobject, "From winapp~getSomething(..)" + ... cut ... + + Cf. the accompanying test.rex program diff --git a/modules/windows/ole/oleinfo/reg_classids4ole.cls b/modules/windows/ole/oleinfo/reg_classids4ole.cls new file mode 100644 index 0000000..07b87dc --- /dev/null +++ b/modules/windows/ole/oleinfo/reg_classids4ole.cls @@ -0,0 +1,367 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*********************************************************************** + + program: reg_classids4ole.rex + + purpose: analyzes the Windows registry for CLSID-->PROGIDs, defines a class and collections + + usage: use the "::requires" directive to incorporate classes and routines +***********************************************************************/ + +.local~rgf.debug=0 -- set debug level + +-- initialization +.local ~ rgf.registry = .WindowsRegistry~new -- create a registry object save it in .local +.local ~ rgf.hKey_classes_root = .rgf.registry~classes_root -- save handle to root of classes + + -- get handle to key "CLSID" located in top level key "HKEY_CLASSES_ROOT" +.local~rgf.hKey_CLSID_root = .rgf.registry~open(.rgf.hkey_classes_root, "CLSID", "READ") + + +::requires winsystm.cls -- get access to the Windows registry + + +/** Returns .true if argument (a PROGID or CLSID) exists in HKEY_CLASSES_ROOT or HKEY_CLASSES_ROOT\CLSID, .false else. +*/ +::routine reg_exists public + parse arg reg_name + + -- query key (case insensitive lookup by Windows), if not available "0" will be returned as the handle + hKey = .rgf.registry~open(.rgf.hkey_classes_root, reg_name, "READ") + if hKey=0 then + do + hKey = .rgf.registry~open(.rgf.hkey_classes_root, "CLSID\" || reg_name, "READ") + if .rgf.debug > 1 then say "reg_exists(): not found in root, looking in CLSID\ ..." + end + + if .rgf.debug > 1 then say "reg_exists(): reg_name="pp(reg_name) "hKey="pp(hKey) + if .rgf.debug > 2 then call dump_handle hKey + + .rgf.registry~close(hKey) -- close (free) handle + return hKey <> 0 + + + + +/** Dumps the values and subkey names of the key referred to by the received handle */ +::routine dump_handle + use arg hKey + + say + s. = .rgf.registry~query(hKey) -- query key via its handle + tmp="class name="pp(s.class) "subkeys="pp(s.subkeys) "values="pp(s.values) , + "last changed on:" pp(s.date) pp(s.time) + say tmp + + ind=" " -- leadin for text-output + + if s.values>0 then -- show all values of the key, if any + do + say; say ind "listing all values for this key:" + .rgf.registry~listvalues(hKey, stem.) -- get a list of all values for this key + + do i=1 to s.values + tmp=ind ind "name:" pp(stem.i.name) "type:" pp(stem.i.type) "data:" pp(stem.i.data) + say tmp + end + end + + if s.subkeys>0 then -- show names of all subkeys of the key, if any + do + say; say ind "listing all subkeys of this key:" + .rgf.registry~list(hKey, stem.) -- get a list of all subkeys of this key + do i=1 to s.subkeys + tmp=ind ind "subkey name:" pp(stem.i) + say tmp + end + end + say copies("-", 30) + + return + + + /** Returns string value of given argument, enclosed in square brackets: "PrettyPrint" ;) . */ +::routine pp + return "[" || arg(1)~string || "]" + + + +/** Routine expands environment variables in the data. */ +::routine expand public + use arg data + + tmp="" + do while data <> "" + parse var data before "%" v "%" data + tmp = tmp || before || value(v, , "ENVIRONMENT") -- replace environment variable with its value + end + return tmp + + +/** Routine to get the 'CLSID'-object from a given progid or clsid. */ +::routine get_clsid_object public + use arg prog_or_clsid + + clsid2progid=.clsid~clsid2progid -- get access to clsid2porgid[clsid]=progid + + o=clsid2progid[prog_or_clsid] -- assume CLSID in hand + if o=.nil then + do + o=clsid2progid~allat(prog_or_clsid)[1] -- oops, maybe a PROGID ? + + if o=.nil then o=create_clsid_object(prog_or_clsid) -- does not exist as of yet, create it ! + end + else return .clsid~all_clsid[o] + + return o + + +/** Routine either gets a PROGID or a CLSID, analyzes it and returns an instance of class CLSID + or .nil, if PROGID or CLSID not found. */ +::routine create_clsid_object public + use arg clsid, bCLSID -- it's either a PROGID or a CLSID + + bClsid=(bClsid=.true) -- determine if already CLSID given + if \bClsid then -- undetermined, could be PROGID or CLSID + do + -- a PROGID? + hKey = .rgf.registry~open(.rgf.hkey_classes_root, clsid, "READ") + if hKey\=0 then -- a PROGID, get CLSID + do + hKey2=.rgf.registry~open(.rgf.hkey_classes_root, clsid"\CLSID") -- get handle to subkey + -- 2002-12-29, ---rgf + if hkey2=0 then -- subkey "CLSID" not found, maybe "CurVer" pointing to actual PROGID ? + do + hKey3=.rgf.registry~open(.rgf.hkey_classes_root, clsid"\CurVer") -- get handle to subkey + if hKey3 <> 0 then -- o.k. such a subkey was found, now use it to find CLSID + do + s. = .rgf.registry~getValue(hkey3, "") -- get default value = PROGID + curVerPROGID=s.data -- get default value = PROGID + .rgf.registry~close(hKey3) -- close hKey3 + drop s. + .rgf.registry~close(hkey2) -- close hkey2 + hKey2=.rgf.registry~open(.rgf.hkey_classes_root, curVerPROGID"\CLSID") -- get CLSID of "CurVer"-PROGID + end + end + + s. = .rgf.registry~getValue(hKey2, "") -- get default value + + -- if .rgf.debug > 1 then say "create_c_o(): hkey="pp(hkey) "progid="pp(clsid) to "clssid="pp(s.data) "s.type="pp(s.type) + clsid = s.data -- extract value from stem + .rgf.registry~close(hKey2) -- close (free) handle + .rgf.registry~close(hKey) -- close (free) handle + end + end + + -- get a handle to subkey + hClsidKey = .rgf.registry~open(.rgf.hkey_classes_root, "CLSID\"clsid, "READ") + if hClsidKey=0 then + do + msg=clsid": not found!" + if window <> "WINDOW" then nop -- call alert msg + else .error~say(msg) + return .nil -- do return nothing + end + + o=.clsid~new(clsid) -- create instance to store relevant information + odir=o~keys -- get access to directory to contain the keys and values + + s. = .rgf.registry~query(hClsidKey) -- query infos on key (number of subkeys, values; value of: date, time, class (name)) + o~datetime=changestr("/", s.date, "") s.time + if s.values>0 then -- show all values of the key, if any + do + .rgf.registry~listvalues(hClsidKey, stem.) -- get a list of all values for this key + -- show values of CLSID + do i=1 to s.values + if stem.i.name="" then -- default value in hand ? + do + o~description=stem.i.data -- save value with object + leave i -- leave loop + end + end + end + + -- process subkeys + .rgf.registry~list(hClsidKey, list2.) -- get all subkeys + keysDir=.clsid~keysDir -- get directory of interesting subkeys from class CLSID + do idx2=1 to s.subkeys -- iterate over subkeys and their values + if \ keysDir~hasentry(list2.idx2) then iterate -- if subkey-name is not of interest, iterate + -- get a handle to the subkey in hand + keyName=list2.idx2 + hSubKey2=.rgf.registry~open(hClsidKey, keyName, "READ") + if hSubKey2 \= 0 then + do + s2. = .rgf.registry~query(hSubKey2) -- query various infos + if s2.values>0 then -- if values available, iterate over them + do + .rgf.registry~listvalues(hSubKey2, stem2.) -- get a list of all values for this key + do i=1 to s2.values + if stem2.i.name="" then -- default string value in hand, if so save + do + tmp="" + if stem2.i.type="EXPAND" then tmp = expand(stem2.i.data) -- expand environment variable in string + else tmp = stem2.i.data + odir~setentry(keyName, tmp) -- save key with object + leave i + end + end + end + .rgf.registry~close(hSubKey2) -- close (return) handle + end + end -- idx2 + + if o=.nil then return .nil -- iterate -- no entry found, iterate + + if \ odir~hasentry("PROGID") then return .nil -- iterate -- do not process a CLSID which has no value given for PROGID + + -- set up collections for administrating objects of this class + .clsid~clsid_list~insert(clsid) -- save CLSID in list + .clsid~all_clsid~setentry(clsid, o) -- save instance in collection + + -- set up relation between CLSID and PROGID + .clsid~clsid2progid[clsid]=odir~progid + + -- all_progid~setentry(odir~progid, o) + if odir~hasentry("VERSIONINDEPENDENTPROGID") then + do + .clsid~clsid2progid[clsid]=odir~versionIndependentProgid + + -- all_progid~setentry(odir~versionIndependentProgid, o) + .clsid~all_progid[odir~versionIndependentProgid] = o +-- say "versionIndependentProgId:" pp(odir~versionIndependentProgid) "-> o:" pp(o) "CLSID:" pp(o~clsid) + end + -- else +do + .clsid~all_progid[odir~progid] = o -- o.k., then use PROGID +-- say " ProgId:" pp(odir~progId) "-> o:" pp(o) "CLSID:" pp(o~clsid) +end + + if odir~hasentry("TREATAS") then + do + .clsid~clsid2progid[clsid]=odir~treatAs + .clsid~treatAsSrc~put(clsid) -- save CLSID, which needs to be treated as defined in another CLSID + .clsid~treatAsTgt~put(odir~treatAs) -- save target CLSID + end + + return o + +/* ================================================================================= */ +/* class to represent all interesting information about CLSID's */ +::class clsid public + + /* ------------------------- class methods ----------------------------------- */ +::method init class + expose all_clsid all_progid clsid_list clsid2progid keysList keysDir treatAsSrc treatAsTgt + all_clsid = .directory~new -- collects all instances, indexed by CLSID + all_progid= .directory~new -- collects all instances, indexed by PROGID+VERSIONINDEPENDENTPROGID + clsid_list= .list~new + clsid2progid = .relation~new -- maps clsids to ProgID, VersionIndependentProgID and TreatAs + treatAsSrc = .set~new + treatAsTgt = .set~new + keysList = .list~of( "VersionIndependentProgID", , + "ProgID", , + "Version", , + "TreatAs", , -- points to CLSID which contains definitions + "LocalServer", , -- binary program + "LocalServer32", , -- binary program + "ScriptletURL", , -- script-program (instead of LocalServer32) + "InProcHandler", , -- handler being used + "InProcHandler32", , -- handler being used + "InProcServer", , -- server for handler being used + "InProcServer32" ) -- server for handler being used + keysDir=.directory~new + do item over keysList + keysDir~setentry(item, item) -- add name of key into directory + end + +::method all_clsid attribute class -- directory containing clsid as key to instance of this class +::method all_progid attribute class -- directory containing versionindependent/progid as key to instance of this class +::method clsid_list attribute class -- list: containing CLSIDs in order of appearence +::method clsid2progid attribute class -- relation: maps class-ids (idx) to progids, independent progids, treat-as progids +::method keysList attribute class -- list: denotes the key-names regarded to be interesting +::method keysDir attribute class -- directory: allow case-independent look-up of interesting keys +::method treatAsSrc attribute class -- set: contains CLSIDs which depend on other CLSID for operation +::method treatAsTgt attribute class -- set: contains CLSID pointed to + + + -- analyze and build classes +::method analyze_and_build class + expose all_clsid all_progid clsid_list clsid2progid keysList keysDir treatAsSrc treatAsTgt + + handle = .rgf.registry~open(.rgf.hKey_classes_root, "CLSID", "READ") + clslist. = .rgf.registry~query(handle) -- query number of subkeys, values, value of: class (name), date, time + + .rgf.registry~list(handle, subKeyList.) -- get the subkeys (i.e. class-ids in UUID-format + + do idx =1 to clslist.subkeys -- iterate over subkeys + clsid=subKeyList.idx + o=create_clsid_object( clsid, .true ) -- indicate that CLSID-value in hand + + if .rgf.debug>0 then if idx > 200 then leave -- on debug, just process the first 50 entries + end +-- .rgf.registry~close(hSubKey) +-- end + .rgf.registry~close(handle) + + + /* ------------------------- instance methods -------------------------------- */ +::method init + expose clsid description keys + use arg clsid + keys=.directory~new + +::method clsid attribute -- stores the CLSID as found in registry +::method description attribute -- stores the default value of CLSID (describing it) +::method keys attribute -- directory possessing the values of found keys +::method datetime attribute -- date and time of entry in registry + + -- this defines the default string value for this object +::method makestring + expose clsid description datetime + return clsid pp(description) pp(datetime) + + -- this dumps the keys +::method dumpkeys + expose keys + indent=copies(" ", 8) + do item over self~class~keysList + if keys~hasentry(item) then say indent item"="pp(keys~entry(item)) + end + diff --git a/modules/windows/ole/oleinfo/test.rex b/modules/windows/ole/oleinfo/test.rex new file mode 100644 index 0000000..bc0361a --- /dev/null +++ b/modules/windows/ole/oleinfo/test.rex @@ -0,0 +1,113 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2002-2022 Rony G. Flatscher. All rights reserved. */ +/* Copyright (c) 2023 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +-- Note: OLE objects do not always publish everything they offer! + +line="-"~copies(79) -- used as output delimiter + +ProgID = "WScript.Network" +say "ProgID:" ProgId +network= .OleObject~new(ProgID) + -- full documentation (with constants), show in browser +call createOleInfo network, ProgID "(OLE-Object)", .false, .true + -- reference sheet style documentation, show in browser +call createOleInfo network, ProgID "(OLE-Object)", .true, .true + +fn = "WScript_Constants.rex" +say "creating a Rexx program with the published OLE constants named:" fn +call getOleConstants ProgID fn +say "... to access all the constants from your program, require it like:" +say " ::requires" fn +say "... to get the value for any of those OLE constants code like:" +say " value=.ole.const~nameOfOleConstant " +------------------------------------------------------------------------------ + +say line +ProgID = "WScript.Shell" +say "ProgID:" ProgId +shell = .OleObject~new(ProgID) + -- full documentation (with constants), show in browser +call createOleInfo shell, ProgID "(OLE-Object)", .false, .true + -- reference sheet style documentation, show in browser +call createOleInfo shell, ProgID "(OLE-Object)", .true, .true + + -- create a ShortCut object (do not save it) and document its OLE interfaces +shortCut=shell~createShortcut(shell~specialFolders("Desktop")"\Link By ooRexx Via OLE.lnk") +say "shortCut:" shortCut + -- full documentation (with constants), show in browser +call createOleInfo shortCut, "Shortcut (OLE-Object)", .false, .true + -- reference sheet style documentation, show in browser +call createOleInfo shortCut, "Shortcut (OLE-Object)", .true, .true +------------------------------------------------------------------------------ + +say line +ProgId="InternetExplorer.Application" +say "ProgID:" ProgId +say +say "please note: Microsoft tries hard to pull the InternetExplorer from Windows" +say " (in favor of Edge which has no OLE interfaces), such that" +say " eventually the following statements may not work anymore" +say +ie=.oleObject~new(progID) -- create an instance of IE, returns an OLEObject +ie~visible=.true -- make IE window visible + + -- full documentation (with constants), show in browser +call createOleInfo ie, progID, .false, .true + -- reference sheet style documentation, show in browser +call createOleInfo ie, progID, .true, .true + +fn = "InternetExplorer_Constants.rex" +say "creating a Rexx program with the published OLE constants named:" fn +call getOleConstants ProgID fn +say "... to access all the constants from your program, require it like:" +say " ::requires" fn +say "... to get the value for any of those OLE constants code like:" +say " value=.ole.const~nameOfOleConstant " + + -- create documentation for object "document": full documentation, show in browser +url="https://www.RexxLA.org" +say '... now doing a: ie~navigate("'url'")' +ie~navigate(url) +do while ie~busy -- wait until page got fully loaded + call sysSleep 0.001 +end +doc=ie~document -- get document object from IE +say "ie~document:" doc +call createOleInfo doc, "ie~document", .false, .true + +ie~quit -- quit (close) this IE instance diff --git a/modules/windows/ole/wmi/accounts.rex b/modules/windows/ole/wmi/accounts.rex new file mode 100755 index 0000000..1a95bc8 --- /dev/null +++ b/modules/windows/ole/wmi/accounts.rex @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: accounts.rex */ +/* Type: ooRexx script using OLE interface */ +/* */ +/* Description: */ +/* Demo application for displaying all accounts of the windows system with */ +/* WMI (also shows how to display all properties of a WMI object in general)*/ +/* */ +/* An overview of the used Win32_Account class is available at: */ +/* https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-account */ +/* */ +/****************************************************************************/ + +WMIObject = .OLEObject~GetObject("WinMgmts:{impersonationLevel=impersonate}") +userAccounts = WMIObject~InstancesOf("Win32_Account") + +do instance over userAccounts + say + say "="~copies(16) instance~name "="~copies(16) + do i over instance~properties_ + say left(i~name":",20,' ') i~value + end +end + +exit + + diff --git a/modules/windows/ole/wmi/osinfo.rex b/modules/windows/ole/wmi/osinfo.rex new file mode 100755 index 0000000..7260a09 --- /dev/null +++ b/modules/windows/ole/wmi/osinfo.rex @@ -0,0 +1,238 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: osinfo.rex */ +/* Type: ooRexx script using OLE interface */ +/* */ +/* Description: */ +/* A sample script that is using a Windows Management Instrumentation (WMI) */ +/* object ("Win32_OperatingSystem") to obtain information about the */ +/* installed operating system(s) */ +/* */ +/* An overview of the used Win32_OperatingSystem class is available at: */ +/* https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem */ +/* */ +/****************************************************************************/ + +-- prepare a few arrays for more human-readable output +boolArray = "no", "yes" +boostArray = "None", "Minimum", "Maximum" +ostypeArray = .resources~ostype + +-- obtain a WMI object +WMIObject = .OLEObject~GetObject("WinMgmts:{impersonationLevel=impersonate}") + +-- obtain a collection of all Win32_OperatingSystem objects +objects = WMIObject~InstancesOf("Win32_OperatingSystem") + +-- process each OperatingSystem object in the collection +do object over objects + call head object~Description, "=" + + /************* General Information *************/ + call head "General information" + + call print "Build number:", object~BuildNumber + call print "Build type:", object~BuildType + call print "Primary OS:", object~Primary, boolArray + call print "Debug version:", object~Debug, boolArray + call print "Distributed:", object~Distributed, boolArray + call print "Manufacturer:", object~Manufacturer + call print "Version:", object~Version + + sp = object~ServicePackMajorVersion + if sp \= .nil then + if object~ServicePackMinorVersion \= .nil then + sp = sp"."object~ServicePackMinorVersion + call print "Service Pack:", sp + + call print "OS Status:", object~Status + call print "Number of users:", object~NumberOfUsers + call print "Number of licensed users:", object~NumberOfLicensedUsers + call print "Serial Number:", object~SerialNumber + call print "Install Date:", object~InstallDate, "DATE" + call print "Last BootUp Time:", object~LastBootUpTime, "DATE" + + /************* Setup *************/ + call head "Setup" + + call print "Local Date Time:", object~LocalDateTime, "DATE" + call print "Locale:", object~Locale + call print "Boot device:", object~BootDevice + call print "Windows Directory:", object~WindowsDirectory + call print "CodeSet (CP):", object~CodeSet + call print "Country Code:", object~CountryCode + call print "Current Timezone:", object~CurrentTimeZone + call print "System device:", object~SystemDevice + call print "System directory:", object~SystemDirectory + + /************* Memory *************/ + call head "Memory" + + call print "Free physical memory:", object~FreePhysicalMemory, "MEMORY" + call print "Free space in paging files:", object~FreeSpaceInPagingFiles, "MEMORY" + call print "Size stored in paging files:", object~SizeStoredInPagingFiles, "MEMORY" + call print "Free virtual memory:", object~FreeVirtualMemory, "MEMORY" + call print "Total swap space:", object~TotalSwapSpaceSize, "MEMORY" + call print "Total virtual memory:", object~TotalVirtualMemorySize, "MEMORY" + call print "Total visible memory:", object~TotalVisibleMemorySize, "MEMORY" + + /************* System Settings *************/ + call head "System Settings" + + call print "Foreground Application Boost:", object~ForegroundApplicationBoost, boostArray + call print "Maximum number of processes:", object~MaxNumberOfProcesses + call print "Numer of processes:", object~NumberOfProcesses + call print "Maximal process memory size:", object~MaxProcessMemorySize, "MEMORY" + call print "Organization:", object~Organization + call print "Registered User:", object~RegisteredUser + call print "OS language:", object~OSLanguage + call print "OS type:", object~OSType, ostypeArray + +end + + +-- print a header +::routine head + use arg title + title = " " title " " + + if arg(2, "omitted") then do + say + say title~center(78, "-") + say + end + else do + say arg(2)~copies(78) + say title~center(78, arg(2)) + say arg(2)~copies(78) + end + +-- display retrieved information +::routine print + use arg desc, content + + if content == .nil then + return + + -- see if the information needs to be processed or simply displayed + if arg(3, "exists") then + -- we can process some information display a more human-readable form + select case arg(3) + when "MEMORY" then do + -- memory sizes are returned in units of kilobytes + content = content % 1024 "MB" + end + when "DATE" then do + -- e. g. 20201004184321.000000+060 + parse var content yyyy +4 mm +2 dd +2 hh +2 min +2 ss +2 dot +1 usec +6 offset + content = .DateTime~new(yyyy, mm, dd, hh, min, ss, usec, offset)~toLocalTime + end + otherwise -- use array to translate information + content = arg(3)[content + 1] + end + say left(desc, 30) content + + +::options digits 20 -- memory sizes can be very large + +::resource ostype +Unknown +Other +MACOS +ATTUNIX +DGUX +DECNT +Digital Unix +OpenVMS +HPUX +AIX +MVS +OS400 +OS/2 +JavaVM +MSDOS +WIN3x +WIN95 +WIN98 +WINNT +WINCE +NCR3000 +NetWare +OSF +DC/OS +Reliant UNIX +SCO UnixWare +SCO OpenServer +Sequent +IRIX +Solaris +SunOS +U6000 +ASERIES +TandemNSK +TandemNT +BS2000 +LINUX +Lynx +XENIX +VM/ESA +Interactive UNIX +BSDUNIX +FreeBSD +NetBSD +GNU Hurd +OS9 +MACH Kernel +Inferno +QNX +EPOC +IxWorks +VxWorks +MiNT +BeOS +HP MPE +NextStep +PalmPilot +Rhapsody +Windows 2000 +Dedicated +OS/390 +VSE +TPF +::END diff --git a/modules/windows/ole/wmi/process.rex b/modules/windows/ole/wmi/process.rex new file mode 100755 index 0000000..fde958f --- /dev/null +++ b/modules/windows/ole/wmi/process.rex @@ -0,0 +1,61 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: process.rex */ +/* Type: ooRexx script using OLE interface */ +/* */ +/* Description: */ +/* Demo application for displaying running processes of a windows system */ +/* with WMI. */ +/* */ +/* An overview of the used Win32_Process class is available at: */ +/* https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-process */ +/* */ +/****************************************************************************/ + +WMIObject = .OLEObject~GetObject("winmgmts:{impersonationLevel=impersonate}") + +say "Here is a list of currently running processes" + +do process over WMIObject~InstancesOf("win32_process") + say process~processid process~name +end + +exit + + diff --git a/modules/windows/ole/wmi/services.rex b/modules/windows/ole/wmi/services.rex new file mode 100755 index 0000000..e5de7bc --- /dev/null +++ b/modules/windows/ole/wmi/services.rex @@ -0,0 +1,163 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: services.rex */ +/* Type: ooRexx script using OLE interface */ +/* */ +/* Description: */ +/* List, start, stop, pause or resume windows services with WMI. */ +/* */ +/* An overview of the used Win32_Service class is available at: */ +/* https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service */ +/* */ +/****************************************************************************/ + +WMIObject = .OLEObject~GetObject("WinMgmts:{impersonationLevel=impersonate}") + +/* use Win32_BaseService to get a complete list! */ +services = WMIObject~InstancesOf("Win32_Service") + +boolArray = .array~of("no ","yes") +serviceArray = .array~new(10) + + +j = 0 +/* collect service objects in REXX array */ +do instance over services + j = j + 1 + serviceArray[j] = instance +end + +/* main loop */ +do while input \= "Q" + say "Here is a list of windows services:" + say + say " No. " left("Name",37,' ') "pausable" "stoppable" "Status" + say "-"~copies(76) + do i = 1 to j + say "["right(i,3,' ')"]" left(serviceArray[i]~description,40,' '), + left(boolArray[1+serviceArray[i]~AcceptPause],8,' '), + left(boolArray[1+serviceArray[i]~AcceptStop],6,' '), + serviceArray[i]~State + end + say + say "Enter a command: start|stop|pause|resume , or enter Q to quit" + parse upper pull input number + select + when input = "START" then do + if number < 0 | number > j then say "Illegal service number specified!" + else do + rc = serviceArray[number]~StartService + call SysSleep 1 + /* get updated object */ + serviceArray[number] = .OLEObject~GetObject(serviceArray[number]~Path_~displayname) + select + when rc = 0 then say "The request was accepted." + when rc = 1 then say "The request is not supported." + when rc = 2 then say "The user did not have the necessary access." + when rc = 3 then say "The service cannot be stopped because other services that are running are dependent on it." + when rc = 4 then say "The requested control code is not valid, or it is unacceptable to the service." + when rc = 5 then say "The requested control code cannot be sent to the service because the state of the service is equal to 0, 1, or 2." + when rc = 6 then say "The service has not been started." + when rc = 7 then say "The service did not respond to the start request in a timely fashion." + when rc = 8 then say "Unknown failure when starting the service." + when rc = 9 then say "The directory path to the service executable file was not found." + when rc = 10 then say "The service is already running." + when rc = 11 then say "The database to add a new service is locked." + when rc = 12 then say "A dependency for which this service relies on has been removed from the system." + when rc = 13 then say "The service failed to find the service needed from a dependent service." + when rc = 14 then say "The service has been disabled from the system." + when rc = 15 then say "The service does not have the correct authentication to run on the system." + when rc = 16 then say "This service is being removed from the system." + when rc = 17 then say "There is no execution thread for the service." + when rc = 18 then say "There are circular dependencies when starting the service." + when rc = 19 then say "There is a service running under the same name." + when rc = 20 then say "There are invalid characters in the name of the service." + when rc = 21 then say "Invalid parameters have been passed to the service." + when rc = 22 then say "The account which this service is to run under is either invalid or lacks the permissions to run the service." + when rc = 23 then say "The service exists in the database of services available from the system." + when rc = 24 then say "The service is currently paused in the system." + otherwise say "unknown error!" + end + end + end + when input = "STOP" then do + if number < 0 | number > j then say "Illegal service number specified!" + else do + rc = serviceArray[number]~StopService + call SysSleep 1 + /* get updated object */ + serviceArray[number] = .OLEObject~GetObject(serviceArray[number]~Path_~displayname) + if rc = 0 then say "The request was accepted." + else if rc = 1 then say "The request is not supported." + else say "An error occured." + end + end + when input = "PAUSE" then do + if number < 0 | number > j then say "Illegal service number specified!" + else do + rc = serviceArray[number]~PauseService + call SysSleep 1 + /* get updated object */ + serviceArray[number] = .OLEObject~GetObject(serviceArray[number]~Path_~displayname) + if rc = 0 then say "The request was accepted." + else if rc = 1 then say "The request is not supported." + else say "An error occured." + end + end + when input = "RESUME" then do + if number < 0 | number > j then say "Illegal service number specified!" + else do + rc = serviceArray[number]~ResumeService + call SysSleep 1 + /* get updated object */ + serviceArray[number] = .OLEObject~GetObject(serviceArray[number]~Path_~displayname) + if rc = 0 then say "The request was accepted." + else if rc = 1 then say "The request is not supported." + else say "An error occured." + end + end + + otherwise + if input = "Q" then say "Quitting..." + end +end + +exit + + diff --git a/modules/windows/oodialog/AnimalGame.rex b/modules/windows/oodialog/AnimalGame.rex new file mode 100755 index 0000000..c49ab84 --- /dev/null +++ b/modules/windows/oodialog/AnimalGame.rex @@ -0,0 +1,290 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * samples\oodialog\AnimalGame.rex Animal Riddles (bitmaps come from a DLL.) + * + * This example is based on the original oopet1.rex example. However, rather + * than use the installBitmapButton() method it uses a Windows feature that + * allows the programmer to assign an image list to a button. The images in the + * image list are bitmaps that the operating system uses to paint the button + * face. + * + * This is a better way to get the same effect as installBitmapButton() because + * the OS draws the button with the same look and feel of other buttons. On + * Windows 7, the buttons look like Windows 7 buttons. Whereas with + * installBitmapButton() the buttons look like Windows 95 buttons. + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + -- Ensure this program can be executed from any directory. + prgDir = locate() + + -- Use the global .constDir for symbolic IDs and the symbol definitions are in + -- AnimalGame.h + .application~useGlobalConstDir('O', prgDir'rc\AnimalGame.h') + + firstEditID = .constDir[IDC_EDIT_RHINO] + lastEditID = .constDir[IDC_EDIT_HORSE] + do i = firstEditID to lastEditID + b.i = "unknown animal" + end + + dlg = .AnimalDialog~new(prgDir"res\AnimalGame.dll", IDD_ANIMALS, b., firstEditID, lastEditID) + + if dlg~initCode \= 0 then do + msg = 'Failed to create dialog, aborting' + title = 'Unexpected Error' + ret = MessageDialog(msg, , title, 'OK', 'WARNING') + mgr~goBack + return 99 + end + + dlg~execute("SHOWTOP") + + return 0 + +/*------------------------------- requires ---------------------------*/ + +::requires "ooDialog.cls" +::requires "samplesSetup.rex" -- Sets up the sound path + +/*------------------------------- dialog class -----------------------*/ + +::class 'AnimalDialog' subclass Resdialog + +-- This constant is the diffence between the firstEditID edit control resource ID +-- and 1. +::constant EDIT_CONTROL_ID_OFFSET 2020 + +-- The pixel width and height of our bitmaps. +::constant BITMAP_WIDTH 152 +::constant BITMAP_HEIGHT 178 + +::method init + expose firstEditID lastEditID bitmaps buttonIDs + use arg resFile, id, dataStem., firstEditID, lastEditID + + self~init:super(resFile, id, dataStem.) + + imageIDs = .array~of(IDBMP_RHINO, IDBMP_TIGER, IDBMP_ELEPHANT, IDBMP_MOOSE, - + IDBMP_GOAT, IDBMP_DOG, IDBMP_SEAL, IDBMP_HORSE, - + IDBMP_KANGURU) + + buttonIDs = .array~of(IDC_PB_RHINO, IDC_PB_TIGER, IDC_PB_ELEPHANT, IDC_PB_MOOSE, - + IDC_PB_GOAT, IDC_PB_DOG, IDC_PB_SEAL, IDC_PB_HORSE) + + -- Load all our bitmaps from a resource only DLL. Since the .Size argument is + -- omitted from the getImages() method, the operating system uses the actual + -- size of the bitmap. + sd = locate() + res = .ResourceImage~new(sd'res\AnimalGame.dll') + bitmaps = res~getImages(imageIDs) + + -- Connect each button to a method with the same name as the symbolic ID of + -- the button + do i = 1 to buttonIDs~items + self~connectButtonEvent(buttonIDs[i], 'CLICKED', buttonIDs[i]) + end + + +::method initDialog + expose correct beenHelped bitmaps buttonIDs + + ret = Play("guess.wav", yes) + + self~configButtons(bitmaps, buttonIDs) + + correct = .array~of("rhinoceros", "tiger", "elephant", "moose", "goat", "chihuahua", "seal", "horse") + beenHelped = .false + + +::method configButtons private + use strict arg bitmaps, buttonIDs + + size = .Size~new(self~BITMAP_WIDTH, self~BITMAP_HEIGHT) + flags = 'COLOR8 MASK' + margin = .Rect~new(2) + cRef = .Image~colorRef(255, 255, 153) + + do i = 1 to buttonIDs~items + if i = 6 then do + il = .ImageList~create(size, flags, 6) + normal = bitMaps[i] + press = bitMaps[9] + whiteCRef = .Image~colorRef(255, 255, 255) + + ret = il~addMasked(normal, cRef) + ret = il~addMasked(normal, cRef) + ret = il~addMasked(press, whiteCRef) + ret = il~addMasked(normal, cRef) + ret = il~addMasked(normal, cRef) + + self~newPushButton(buttonIDs[i])~setImageList(il, margin) + end + else do + il = .ImageList~create(size, flags, 1) + ret = il~addMasked(bitmaps[i], cRef) + self~newPushButton(buttonIDs[i])~setImageList(il, margin) + end + end + + +::method validate + expose correct beenHelped firstEditID lastEditID + + -- Get the edit control ID offset: + eos = self~EDIT_CONTROL_ID_OFFSET + + -- Disable the Ok button until we are through. + self~newPushButton(IDOK)~disable + + self~getDataStem(A.) + wrongstr = '' + + do i = firstEditID to lastEditID + if \ A.i~strip~caseLessEquals(correct[i - eos]) then do + wrongstr ||= '09'x || i - eos": "A.i || .endOfLine + end + end + if wrongstr = '' then do + if \ beenHelped then ret = Play("clap.wav") + + ret = Play("yourgood.wav", "YES") + + -- Put the timed message in the center of the dialog. + p = self~getRealPos + s = self~getRealSize + p~incr(s~width % 2, s~height % 2) + + if beenHelped then + ret = TimedMessage("You got them all right.... with my help ","E N D", 3000, , p) + else + ret = TimedMessage("You got them all right","B R A V O", 3000, , p) + return .true + end + else do + ret = Play("nope.wav") + + msg = "The following answer(s) is/are incorrect:" || .endOfLine~copies(2) || wrongstr + title = "Incorrect Answers for the ooRexx Animal Game" + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING', 'DEFBUTTON1') + + -- We are through + self~newPushButton(IDOK)~enable + + return .false + end + + +::method IDC_PB_RHINO unguarded + ret = Play("RHINO.WAV","YES") + return self~giveHint("I only fear the 2 guys on my right", "I am strong", 2000) + + +::method IDC_PB_TIGER unguarded + ret = Play("TIGER.WAV","YES") + return self~giveHint("Hold that t...., hold that .i...", "A song about me", 2000) + + +::method IDC_PB_ELEPHANT unguarded + ret = Play("ELEPHANT.WAV","YES") + return self~giveHint("I blow my nose like a trumpet", "African Heavy Weight", 2000) + + +::method IDC_PB_MOOSE unguarded + ret = Play("MOOSE.WAV","YES") + return self~giveHint("My name rhymes with a sweet brown dessert", "Chocolate ......", 2000) + + +::method IDC_PB_GOAT unguarded + ret = Play("GOAT.WAV","YES") + return self~giveHint("My relatives climb the Matterhorn", "Mountain ....", 2000) + + +::method IDC_PB_DOG unguarded + ret = Play("TAKE.WAV","YES") + + +::method IDC_PB_SEAL unguarded + ret = Play("SEALION.WAV","YES") + return self~giveHint("I am slick in the water","Hint 4 you",2000) + + +::method IDC_PB_HORSE unguarded + ret = Play("HORSE.WAV","YES") + return self~giveHint("My son won the Kentucky Derby", "Giddyup 'N Go Pony", 2000) + + +::method giveHint unguarded private + use strict arg msg, title, ms + + pos = .Mouse~new(self)~getCursorPos + pos~incr(10, 10) + ret = TimedMessage(msg, title, ms, .true, pos) + return 0 + + +::method help unguarded + expose correct beenHelped firstEditID lastEditID + + -- Disable the help button so that it can not be clicked until we are through + -- here. + self~newPushButton(IDHELP)~disable + + beenHelped = .true + ret = Play("help.wav") + + -- Get the edit control ID offset: + eos = self~EDIT_CONTROL_ID_OFFSET + + do i = firstEditID to lastEditID + A.i = correct[i - eos] + end + + self~setDataStem(A.) + + -- Now enable Help again. + self~newPushButton(IDHELP)~enable + + diff --git a/modules/windows/oodialog/GUI_Template.rex b/modules/windows/oodialog/GUI_Template.rex new file mode 100755 index 0000000..c266523 --- /dev/null +++ b/modules/windows/oodialog/GUI_Template.rex @@ -0,0 +1,382 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2006-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------*/ +/* How to use this template: */ +/* */ +/* This template allows you to create dialogs with ooDialog without need */ +/* for the resource workshop. */ +/* */ +/* It sets out the class directive and the basic methods for a dialog */ +/* */ +/* ooDialog is very fully featured and it would not be useful to try to */ +/* anticipate and include every possible activity. */ +/* */ +/* Not all Dialogs require all the methods listed in the template. */ +/* If you are not adding any control through a particular method then you */ +/* can delete that method and let the superclass handle it */ +/* */ +/* ========================================================================= */ + +/* FIRST - Use Save As to give the template it's new filename */ + +signal on any name any /* error handling if you want */ + + /* ------------------------------------------------- */ + /* Code that you want to execute before creating */ + /* the dialog goes here. */ + /* ------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* You can pre-define dialog object default values */ + /* here by setting them in the a. stem */ + /* */ + /* For instance if you have an entry box with ID 20 */ + /* a.20=[default] presets it */ + /* ------------------------------------------------- */ + +MyDialog=.MyDlgClass~new /*(a.)*/ /* Create ooDialog Class instance */ + + /* ------------------------------------------------- */ + /* Here you can initialise attributes that you */ + /* associate with your controls below */ + /* ------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* If you want to create a non-modal dialog or have */ + /* it start minimised etc. then change the following */ + /* clause. See Show, Execute, ExecuteAsync, Popup& */ + /* PopupasChild in the ooDialog Reference */ +MyDialog~execute('ShowTop') /* Create, show and run the Windows Object */ + /* ------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* Here you have access to methods & Attributes of */ + /* the ooDialog Object after OK/Cancel has been */ + /* pressed. ie: MyDialog~Attribute */ + /* ------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* Code that you want to execute after the Dialog */ + /* has been cleared goes here. */ + /* */ + /* The stem a. can be used to pass values back from */ + /* the dialog. */ + /* ------------------------------------------------- */ + +exit +/* ========================================================================= */ +/* Error Handling routine - returns full information to console */ +/* */ +/* All error information available is written to STDOUT (usually the console)*/ +/* As this may not be present (running a GUI with REXXHIDE) a ooDialog */ +/* errorDialog popup is also presented */ +/* */ +/* While this type of error handling is useful to some people, it also will */ +/* mask the print out of many syntax errors that happen while your dialog */ +/* is executing. */ +/* */ +/* If you are having trouble debugging problems in your dialog, 1.) Comment */ +/* out the 'signal on any' line above. 2.) Execute your dialog from a */ +/* console window so that you will see any syntax messages printed out by */ +/* the interpreter. */ +/* */ +/* Those two steps will solve many of your debugging problems. */ +/* ========================================================================= */ +any: + + signal off any + + errObj=condition("o") /* get exception object */ + errObj~"_SIGL_"= SIGL /* add value of SIGL and sourceline */ + errObj~"_sourceline_"= sourceline(SIGL) + errQ=.queue~new + Say "******************* An Error has occurred *******************" + do err.val over errObj + if errObj~at(err.val)~hasMethod('HasIndex') + then do /* display them after the single liners */ + errq~queue(err.val~right(13,'-')||':') + do err.line over errObj~at(err.val) + errq~queue(" :" err.line) + end /* DO */ + errq~queue("---") + end /* DO */ + else say err.val~Right(13)||':['errObj~at(err.val)||']' + end + + do while errq~items>0 + say errq~pull + end /* DO */ + + Say "****************** End of error diagnostics ***************" + /* in case there is no console - show error message */ + + call errorDialog 'Error' errObj~rc errObj~errortext '0a'x , + 'occurred on line' errObj~_sigl_ 'of' , + errObj~program '0a'x , + errObj~Message '0a'x + +exit -1 +/* ========================================================================= */ +::requires "ooDialog.cls" +/* ========================================================================= */ +::class MyDlgClass subclass userdialog +/* */ +/* The class directive */ +/* Rename your object from MyDlgClass to something that makes sense to you */ +/* you will need to change the reference to it in the main program above */ +/* */ +/* If you are going to be calling this object from other programs using a */ +/* REQUIRES directive then add the keyword PUBLIC to the class directive */ +/* */ +/* ---------------------- */ +/* */ +/* ------------------------------------------------------------------------- */ + + +/* ------------------------------------------------------------------------- */ +/* The init method is called when the dialog is instantiated (by ~new above) */ +::method init +/* ------------------------------------------------------------------------- */ +/* expose a. */ /* Give these variables scope of the Object */ +/* use arg a. */ /* Uncomment if you passed a. as a stem */ + +/*if you do not want to define initial values with a. do not pass it to super*/ +/* otherwise rogue default values may appear in your dialog */ + self~init:super /*(a.)*/ /* we call the Super Class (userdialog) */ + width=300 ; height=200 /* Set the Width and height of dialog */ + + /* Now we create the Windows Object */ + success=self~createCenter(width,height, - + 'This text appears in the Dialog Title',,, - + 'MS Sans Serif',8) + /* The above line creates a dialog in the centre of the screen, if you */ + /* Would rather specify values for x & y use the line below instead */ + /* success=self~create(x,y,width,height,Title) */ + + if \success then do + self~initCode=1 + return + end + /* ------------------------------------------------- */ + /* Here we can initialise any attributes of our */ + /* dialog. */ + /* ------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* Here we can 'connect' dialog item events to */ + /* Methods or Attributes. */ + /* i.e.: self~connectListViewEvent(id,"Changed",, */ + /* "ItemSelectedMethod") */ + /* */ + /* NB: Many createXXX Methods (which appear in the */ + /* defineDialog method below) also provide a way to */ + /* define connections. */ + /* ------------------------------------------------- */ + +/* ------------------------------------------------------------------------- */ +::method defineDialog +/* expose menuBar */ /* Perhaps save a menu object if you create */ + /* one below. */ +/* ------------------------------------------------------------------------- */ +/* This is where we lay out the controls (widgets) in our dialog */ +/* Refer to the ooDialog manual for the create methods and their parameters */ +/* ------------------------------------------------------------------------- */ +/* ------------------------------------------------------------------------- */ +/* DlgArea is a class of imaginary rectangles with an inner margin that */ +/* allows you to reference coordinates within them by dialog units or */ +/* percentages. */ +/* ------------------------------------------------------------------------- */ +/* u = .DlgAreaU~new(self) -- Whole dialog */ +/* a = .DlgArea~new(u~x(''),u~y(''),u~w(''),u~h('')) */ + + /* ------------------------------------------------- */ + /* Here we add the control objects to our dialog */ + /* Dialog Width is available to us as self~sizeX & */ + /* Dialog Height is available to us as self~sizeY */ + /* ------------------------------------------------- */ + + self~createPushButton(IDOK,self~sizeX-60 ,self~sizeY-20,50,15,'DEFAULT','OK') + self~createPushButton(IDCANCEL,self~sizeX-120,self~sizeY-20,50,15,,'Cancel') + +/* examples to cut & paste: */ +/* self~createPushButton(id,x,y,cx,cy,'options','text','method') */ +/* self~createCheckBox(id,x,y,cx,cy,'options',text,'attribute') */ +/* self~createComboBox(id,x,y,cx,cy,'options','attribute') */ +/* self~createEdit(id,x,y,cx,cy,'options','attribute') */ +/* self~createListView(id,x,y,cx,cy,'options','attribute') */ +/* self~createTreeView(id,x,y,cx,cy,'options','attribute') */ +/* self~createStaticText(id, x,y,cx,cy,'options','text') */ +/* self~create[Black|White|Gray]Rect(id,x,y,cx,cy,'options') */ +/* etc. etc. ... */ +/* other controls should have unique ids over 100 (or -1 for static text) */ + + /* ------------------------------------------------- */ + /* You could create a menu here, or really anywhere, */ + /* using one of the menu classes such as the */ + /* .UserMenuBar, and the menu methods. */ + /* */ + /* Save the menu and have it attach to the dialog in */ + /* the initDialog() method. It could be saved in an */ + /* exposed variable for instance. */ + /* ------------------------------------------------- */ + +/* menuBar = .UserMenuBar~new(200, self, ...) */ +/* menuBar~addPopUp(id, 'text', options, ...) */ +/* menuBar~addItem(id, 'someText', options, ...) */ +/* menuBar~addSeparator */ +/* menuBar~complete */ +/* ------------------------------------------------------------------------- */ +::method initDialog +/* expose menuBar */ /* If you are adding a menu perhaps. */ +/* ------------------------------------------------------------------------- */ +/* If you have no need to initialise/populate items delete this method */ + + /* ------------------------------------------------- */ + /* Code here is run after the underlying windows */ + /* dialog object has been created. Whether the */ + /* dialog is displayed depends on the style keywords */ + /* used in the createCenter(), (or create()) method. */ + /* By default the dialog will be created invisible. */ + /* If you use the VISIBLE keyword, the dialog will */ + /* be visisble at this point. */ + /* ------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* Here we can populate list viws etc. */ + /* ------------------------------------------------- */ + +/* for example: */ +/* List = self~newListView([id]) */ +/* if List \= .Nil then do */ +/* list~setImageList(imageList, SMALL) */ +/* list~addStyle("[Style1 style2...]") */ +/* list~insertColumn(0,"[Title]",[width],[style]) */ +/* list~insertColumn(1,"[Title]",[width],[style]) */ +/* do data over dataset */ +/* ordinal=list~addrow(,[icon_no],[column 0 text],[column 1 text]...) */ +/* end */ +/* end */ + + /* ------------------------------------------------- */ + /* If you created a menu in defineDialog(), attach */ + /* it: */ + /* ------------------------------------------------- */ + +/* menuBar~attachTo(self) */ + +/* ------------------------------------------------------------------------- */ +::method ok +/* ------------------------------------------------------------------------- */ +/* The ok() method is invoked automatically by the ooDialog framework when */ +/* the user pushes or clicks a button, or a menu item, with the resource ID */ +/* of IDOK (1). If you do not need to do, or do not want to do, any */ +/* processing here, you can delete this method. The ooDialog framework */ +/* provides the correct implementation for you. The framework also provides */ +/* a default implementation of the validate method. By default validate() */ +/* returns true. If you want to have a chance to validate the user's input, */ +/* and perhaps prevent the dialog from closing, then over-ride the validate */ +/* method. From validate() return true to close the dialog, or false to */ +/* prevent the dialog from closing. */ + + /* ------------------------------------------------- */ + /* If you want to do your validation here, you can */ + /* add the valdiation code here. Then, if you want */ + /* to allow the dialog to close normally, invoke the */ + /* super class's ok() method. If you want to */ + /* prevent dialog from closing, simply return 0 with */ + /* out invoking the super class ok. */ + /* */ + /* By invoking the super class ok() method you */ + /* ensure the dialog is closed properly. That is */ + /* really the best way to end the dialog. The best */ + /* way to not end the dialog at this point is to */ + /* simply return 0. */ + /* ------------------------------------------------- */ + +return self~oK:super + +/* ------------------------------------------------------------------------- */ +::method cancel +/* ------------------------------------------------------------------------- */ +/* The cancel() method is invoked automatically by the ooDialog framework */ +/* when the user pushes or clicks a button, or a menu item, with the */ +/* resource ID of IDCANCEL (2), or the user hits the escape key. If you do */ +/* not need to do, or do not want to do, any processing here, you can delete */ +/* this method. The ooDialog framework provides the correct implementation */ +/* of the cancel method for you. */ + + /* ------------------------------------------------- */ + /* You can add code for closing with cancel here, if */ + /* you want to. Then, to prevent the dialog from */ + /* closing at this point, simply return 0. To */ + /* continue with the normal closing of the dialog, */ + /* invoke the super class's cancel method. */ + /* */ + /* By invoking the super class cancel() method you */ + /* ensure the dialog is closed properly. That is */ + /* really the best way to end the dialog. The best */ + /* to not end the dialog at this point is to simply */ + /* return 0. */ + /* ------------------------------------------------- */ +return self~cancel:super + +/* ------------------------------------------------------------------------- */ +::method validate +/* ------------------------------------------------------------------------- */ +/* This is called by the ok:super method. Returning .false stops the dialog */ +/* from closing. Returning .true allows the dialog to close. If you do not */ +/* need this method - delete it */ +valid=.true + +/* + valid=.false + select + when [error_condition] then call errorDialog [error_condition_message] + when [error_condition] then call errorDialog [error_condition_message] + otherwise + valid=.true + end /* select */ +*/ + +return valid +/* ------------------------------------------------------------------------- */ + + /* ------------------------------------------------- */ + /* here we can define other attributes and methods */ + /* ------------------------------------------------- */ + diff --git a/modules/windows/oodialog/bmp/bigpiece.bmp b/modules/windows/oodialog/bmp/bigpiece.bmp new file mode 100644 index 0000000..805d5dc Binary files /dev/null and b/modules/windows/oodialog/bmp/bigpiece.bmp differ diff --git a/modules/windows/oodialog/bmp/blank.bmp b/modules/windows/oodialog/bmp/blank.bmp new file mode 100644 index 0000000..da66d9b Binary files /dev/null and b/modules/windows/oodialog/bmp/blank.bmp differ diff --git a/modules/windows/oodialog/bmp/blanks.bmp b/modules/windows/oodialog/bmp/blanks.bmp new file mode 100644 index 0000000..f669ba5 Binary files /dev/null and b/modules/windows/oodialog/bmp/blanks.bmp differ diff --git a/modules/windows/oodialog/bmp/cake.bmp b/modules/windows/oodialog/bmp/cake.bmp new file mode 100644 index 0000000..1fbd725 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake.bmp differ diff --git a/modules/windows/oodialog/bmp/cake1.bmp b/modules/windows/oodialog/bmp/cake1.bmp new file mode 100644 index 0000000..d63cfb2 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake1.bmp differ diff --git a/modules/windows/oodialog/bmp/cake10.bmp b/modules/windows/oodialog/bmp/cake10.bmp new file mode 100644 index 0000000..7c9fda1 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake10.bmp differ diff --git a/modules/windows/oodialog/bmp/cake11.bmp b/modules/windows/oodialog/bmp/cake11.bmp new file mode 100644 index 0000000..ab056c1 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake11.bmp differ diff --git a/modules/windows/oodialog/bmp/cake2.bmp b/modules/windows/oodialog/bmp/cake2.bmp new file mode 100644 index 0000000..905e7ef Binary files /dev/null and b/modules/windows/oodialog/bmp/cake2.bmp differ diff --git a/modules/windows/oodialog/bmp/cake3.bmp b/modules/windows/oodialog/bmp/cake3.bmp new file mode 100644 index 0000000..522b9c9 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake3.bmp differ diff --git a/modules/windows/oodialog/bmp/cake4.bmp b/modules/windows/oodialog/bmp/cake4.bmp new file mode 100644 index 0000000..d24259e Binary files /dev/null and b/modules/windows/oodialog/bmp/cake4.bmp differ diff --git a/modules/windows/oodialog/bmp/cake5.bmp b/modules/windows/oodialog/bmp/cake5.bmp new file mode 100644 index 0000000..cdebd2e Binary files /dev/null and b/modules/windows/oodialog/bmp/cake5.bmp differ diff --git a/modules/windows/oodialog/bmp/cake6.bmp b/modules/windows/oodialog/bmp/cake6.bmp new file mode 100644 index 0000000..72de0e1 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake6.bmp differ diff --git a/modules/windows/oodialog/bmp/cake7.bmp b/modules/windows/oodialog/bmp/cake7.bmp new file mode 100644 index 0000000..119f1fe Binary files /dev/null and b/modules/windows/oodialog/bmp/cake7.bmp differ diff --git a/modules/windows/oodialog/bmp/cake8.bmp b/modules/windows/oodialog/bmp/cake8.bmp new file mode 100644 index 0000000..1db7d33 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake8.bmp differ diff --git a/modules/windows/oodialog/bmp/cake9.bmp b/modules/windows/oodialog/bmp/cake9.bmp new file mode 100644 index 0000000..c2baaa2 Binary files /dev/null and b/modules/windows/oodialog/bmp/cake9.bmp differ diff --git a/modules/windows/oodialog/bmp/cakepiec.bmp b/modules/windows/oodialog/bmp/cakepiec.bmp new file mode 100644 index 0000000..2d25370 Binary files /dev/null and b/modules/windows/oodialog/bmp/cakepiec.bmp differ diff --git a/modules/windows/oodialog/bmp/chihuahu.bmp b/modules/windows/oodialog/bmp/chihuahu.bmp new file mode 100644 index 0000000..bb01ed5 Binary files /dev/null and b/modules/windows/oodialog/bmp/chihuahu.bmp differ diff --git a/modules/windows/oodialog/bmp/eleph2.bmp b/modules/windows/oodialog/bmp/eleph2.bmp new file mode 100644 index 0000000..bae5983 Binary files /dev/null and b/modules/windows/oodialog/bmp/eleph2.bmp differ diff --git a/modules/windows/oodialog/bmp/fork.bmp b/modules/windows/oodialog/bmp/fork.bmp new file mode 100644 index 0000000..20d1f1e Binary files /dev/null and b/modules/windows/oodialog/bmp/fork.bmp differ diff --git a/modules/windows/oodialog/bmp/goat.bmp b/modules/windows/oodialog/bmp/goat.bmp new file mode 100644 index 0000000..969f5a8 Binary files /dev/null and b/modules/windows/oodialog/bmp/goat.bmp differ diff --git a/modules/windows/oodialog/bmp/handfkle.bmp b/modules/windows/oodialog/bmp/handfkle.bmp new file mode 100644 index 0000000..1e80f86 Binary files /dev/null and b/modules/windows/oodialog/bmp/handfkle.bmp differ diff --git a/modules/windows/oodialog/bmp/handfkri.bmp b/modules/windows/oodialog/bmp/handfkri.bmp new file mode 100644 index 0000000..afd90c2 Binary files /dev/null and b/modules/windows/oodialog/bmp/handfkri.bmp differ diff --git a/modules/windows/oodialog/bmp/handleft.bmp b/modules/windows/oodialog/bmp/handleft.bmp new file mode 100644 index 0000000..cef6d4e Binary files /dev/null and b/modules/windows/oodialog/bmp/handleft.bmp differ diff --git a/modules/windows/oodialog/bmp/handrite.bmp b/modules/windows/oodialog/bmp/handrite.bmp new file mode 100644 index 0000000..ff473f0 Binary files /dev/null and b/modules/windows/oodialog/bmp/handrite.bmp differ diff --git a/modules/windows/oodialog/bmp/horse.bmp b/modules/windows/oodialog/bmp/horse.bmp new file mode 100644 index 0000000..e89fa0a Binary files /dev/null and b/modules/windows/oodialog/bmp/horse.bmp differ diff --git a/modules/windows/oodialog/bmp/install.bmp b/modules/windows/oodialog/bmp/install.bmp new file mode 100644 index 0000000..f8dd7b0 Binary files /dev/null and b/modules/windows/oodialog/bmp/install.bmp differ diff --git a/modules/windows/oodialog/bmp/install2.bmp b/modules/windows/oodialog/bmp/install2.bmp new file mode 100644 index 0000000..f1c6fe4 Binary files /dev/null and b/modules/windows/oodialog/bmp/install2.bmp differ diff --git a/modules/windows/oodialog/bmp/kanguru.bmp b/modules/windows/oodialog/bmp/kanguru.bmp new file mode 100644 index 0000000..323d0f4 Binary files /dev/null and b/modules/windows/oodialog/bmp/kanguru.bmp differ diff --git a/modules/windows/oodialog/bmp/moose.bmp b/modules/windows/oodialog/bmp/moose.bmp new file mode 100644 index 0000000..e0e801d Binary files /dev/null and b/modules/windows/oodialog/bmp/moose.bmp differ diff --git a/modules/windows/oodialog/bmp/oodStandardDialogs.ico b/modules/windows/oodialog/bmp/oodStandardDialogs.ico new file mode 100644 index 0000000..7d2519e Binary files /dev/null and b/modules/windows/oodialog/bmp/oodStandardDialogs.ico differ diff --git a/modules/windows/oodialog/bmp/oodStandardRoutines.ico b/modules/windows/oodialog/bmp/oodStandardRoutines.ico new file mode 100644 index 0000000..c113d8d Binary files /dev/null and b/modules/windows/oodialog/bmp/oodStandardRoutines.ico differ diff --git a/modules/windows/oodialog/bmp/phileat.bmp b/modules/windows/oodialog/bmp/phileat.bmp new file mode 100644 index 0000000..322edfa Binary files /dev/null and b/modules/windows/oodialog/bmp/phileat.bmp differ diff --git a/modules/windows/oodialog/bmp/phileat2.bmp b/modules/windows/oodialog/bmp/phileat2.bmp new file mode 100644 index 0000000..5e4ded1 Binary files /dev/null and b/modules/windows/oodialog/bmp/phileat2.bmp differ diff --git a/modules/windows/oodialog/bmp/phileata.bmp b/modules/windows/oodialog/bmp/phileata.bmp new file mode 100644 index 0000000..90a38e1 Binary files /dev/null and b/modules/windows/oodialog/bmp/phileata.bmp differ diff --git a/modules/windows/oodialog/bmp/philouch.bmp b/modules/windows/oodialog/bmp/philouch.bmp new file mode 100644 index 0000000..c494e65 Binary files /dev/null and b/modules/windows/oodialog/bmp/philouch.bmp differ diff --git a/modules/windows/oodialog/bmp/philphil.bmp b/modules/windows/oodialog/bmp/philphil.bmp new file mode 100644 index 0000000..dc8888c Binary files /dev/null and b/modules/windows/oodialog/bmp/philphil.bmp differ diff --git a/modules/windows/oodialog/bmp/philslep.bmp b/modules/windows/oodialog/bmp/philslep.bmp new file mode 100644 index 0000000..f919d3e Binary files /dev/null and b/modules/windows/oodialog/bmp/philslep.bmp differ diff --git a/modules/windows/oodialog/bmp/philtest.bmp b/modules/windows/oodialog/bmp/philtest.bmp new file mode 100644 index 0000000..86ea546 Binary files /dev/null and b/modules/windows/oodialog/bmp/philtest.bmp differ diff --git a/modules/windows/oodialog/bmp/philwait.bmp b/modules/windows/oodialog/bmp/philwait.bmp new file mode 100644 index 0000000..a8f6aa1 Binary files /dev/null and b/modules/windows/oodialog/bmp/philwait.bmp differ diff --git a/modules/windows/oodialog/bmp/rhinoce.bmp b/modules/windows/oodialog/bmp/rhinoce.bmp new file mode 100644 index 0000000..f6a8a89 Binary files /dev/null and b/modules/windows/oodialog/bmp/rhinoce.bmp differ diff --git a/modules/windows/oodialog/bmp/s2anim.bmp b/modules/windows/oodialog/bmp/s2anim.bmp new file mode 100644 index 0000000..7fd65c5 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2anim.bmp differ diff --git a/modules/windows/oodialog/bmp/s2arch.bmp b/modules/windows/oodialog/bmp/s2arch.bmp new file mode 100644 index 0000000..24b3851 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2arch.bmp differ diff --git a/modules/windows/oodialog/bmp/s2backg.bmp b/modules/windows/oodialog/bmp/s2backg.bmp new file mode 100644 index 0000000..c84ef9e Binary files /dev/null and b/modules/windows/oodialog/bmp/s2backg.bmp differ diff --git a/modules/windows/oodialog/bmp/s2input.bmp b/modules/windows/oodialog/bmp/s2input.bmp new file mode 100644 index 0000000..9493991 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2input.bmp differ diff --git a/modules/windows/oodialog/bmp/s2jack.bmp b/modules/windows/oodialog/bmp/s2jack.bmp new file mode 100644 index 0000000..2bc8aa9 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2jack.bmp differ diff --git a/modules/windows/oodialog/bmp/s2list.bmp b/modules/windows/oodialog/bmp/s2list.bmp new file mode 100644 index 0000000..c68ffc1 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2list.bmp differ diff --git a/modules/windows/oodialog/bmp/s2mov.bmp b/modules/windows/oodialog/bmp/s2mov.bmp new file mode 100644 index 0000000..a3b5c15 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2mov.bmp differ diff --git a/modules/windows/oodialog/bmp/s2philf.bmp b/modules/windows/oodialog/bmp/s2philf.bmp new file mode 100644 index 0000000..f813828 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2philf.bmp differ diff --git a/modules/windows/oodialog/bmp/s2prog.bmp b/modules/windows/oodialog/bmp/s2prog.bmp new file mode 100644 index 0000000..c8c4af7 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2prog.bmp differ diff --git a/modules/windows/oodialog/bmp/s2prop.bmp b/modules/windows/oodialog/bmp/s2prop.bmp new file mode 100644 index 0000000..fd8ae1d Binary files /dev/null and b/modules/windows/oodialog/bmp/s2prop.bmp differ diff --git a/modules/windows/oodialog/bmp/s2scroll.bmp b/modules/windows/oodialog/bmp/s2scroll.bmp new file mode 100644 index 0000000..0d65830 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2scroll.bmp differ diff --git a/modules/windows/oodialog/bmp/s2tree.bmp b/modules/windows/oodialog/bmp/s2tree.bmp new file mode 100644 index 0000000..b42c075 Binary files /dev/null and b/modules/windows/oodialog/bmp/s2tree.bmp differ diff --git a/modules/windows/oodialog/bmp/s2walker.bmp b/modules/windows/oodialog/bmp/s2walker.bmp new file mode 100644 index 0000000..3134cac Binary files /dev/null and b/modules/windows/oodialog/bmp/s2walker.bmp differ diff --git a/modules/windows/oodialog/bmp/sealion.bmp b/modules/windows/oodialog/bmp/sealion.bmp new file mode 100644 index 0000000..a1e09f6 Binary files /dev/null and b/modules/windows/oodialog/bmp/sealion.bmp differ diff --git a/modules/windows/oodialog/bmp/tiger.bmp b/modules/windows/oodialog/bmp/tiger.bmp new file mode 100644 index 0000000..f7207d4 Binary files /dev/null and b/modules/windows/oodialog/bmp/tiger.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig1.bmp b/modules/windows/oodialog/bmp/wlkfig1.bmp new file mode 100644 index 0000000..7db68cb Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig1.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig2.bmp b/modules/windows/oodialog/bmp/wlkfig2.bmp new file mode 100644 index 0000000..b580160 Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig2.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig3.bmp b/modules/windows/oodialog/bmp/wlkfig3.bmp new file mode 100644 index 0000000..ac8bb3c Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig3.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig4.bmp b/modules/windows/oodialog/bmp/wlkfig4.bmp new file mode 100644 index 0000000..b580160 Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig4.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig5.bmp b/modules/windows/oodialog/bmp/wlkfig5.bmp new file mode 100644 index 0000000..7db68cb Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig5.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig6.bmp b/modules/windows/oodialog/bmp/wlkfig6.bmp new file mode 100644 index 0000000..9fa9652 Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig6.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig7.bmp b/modules/windows/oodialog/bmp/wlkfig7.bmp new file mode 100644 index 0000000..6dbcf3c Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig7.bmp differ diff --git a/modules/windows/oodialog/bmp/wlkfig8.bmp b/modules/windows/oodialog/bmp/wlkfig8.bmp new file mode 100644 index 0000000..9fa9652 Binary files /dev/null and b/modules/windows/oodialog/bmp/wlkfig8.bmp differ diff --git a/modules/windows/oodialog/calculator.rex b/modules/windows/oodialog/calculator.rex new file mode 100755 index 0000000..83a4851 --- /dev/null +++ b/modules/windows/oodialog/calculator.rex @@ -0,0 +1,299 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: calculator.rex */ +/* Type: ooRexx Script */ +/* Resource: CALCULATOR */ +/* */ +/* Description: */ +/* Sample that demonstrates the usage of RxMath and ooDialog */ +/* */ +/****************************************************************************/ + +/* Find our installation directory */ + +j = locate() + +/* create the dialog */ +calcDlg = .Calculator~new + +/* Set the defaults for arithmetic operations (optional) */ +NUMERIC DIGITS 16 /* precision can be up to 16 digits for RxMath */ +NUMERIC FORM SCIENTIFIC /* controls exponential notation */ +NUMERIC FUZZ 0 /* number of digits ignored for numeric comparison */ + +/* Display the dialog */ +if calcDlg~initCode = 0 then do + rc = calcDlg~execute("SHOWTOP") +end + +exit /* leave program */ + +::requires "ooDialog.cls" + +/* This requires loads the RxMath functions. */ +::requires "rxmath" library + +/* The Calculator dialog class */ +::class 'Calculator' subclass UserDialog + +::method init + forward class (super) continue /* call parent constructor */ + InitRet = Result + + if self~load(.application~srcDir"rc\CALCULATOR.RC", ) \= 0 then do + self~initCode = 1 + return 1 + end + + /* Connect dialog control items to class methods */ + self~connectButtonEvent("BNO1", "CLICKED", "BNO1") + self~connectButtonEvent("BNO2", "CLICKED", "BNO2") + self~connectButtonEvent("BNO3", "CLICKED", "BNO3") + self~connectButtonEvent("BNO4", "CLICKED", "BNO4") + self~connectButtonEvent("BNO5", "CLICKED", "BNO5") + self~connectButtonEvent("BNO6", "CLICKED", "BNO6") + self~connectButtonEvent("BNO7", "CLICKED", "BNO7") + self~connectButtonEvent("BNO8", "CLICKED", "BNO8") + self~connectButtonEvent("BNO9", "CLICKED", "BNO9") + self~connectButtonEvent("BNO0", "CLICKED", "BNO0") + self~connectButtonEvent("BSIGN", "CLICKED", "BSIGN") + self~connectButtonEvent("BPOINT", "CLICKED", "BPOINT") + self~connectButtonEvent("BDIVIDE", "CLICKED", "BDIVIDE") + self~connectButtonEvent("BTIMES", "CLICKED", "BTIMES") + self~connectButtonEvent("BMINUS", "CLICKED", "BMINUS") + self~connectButtonEvent("BPLUS", "CLICKED", "BPLUS") + self~connectButtonEvent("BSQRT", "CLICKED", "BSQRT") + self~connectButtonEvent("BLOG", "CLICKED", "BLOG") + self~connectButtonEvent("BLOG10", "CLICKED", "BLOG10") + self~connectButtonEvent("BPI", "CLICKED", "BPI") + self~connectButtonEvent("BBACKSPACE", "CLICKED", "BBACKSPACE") + self~connectButtonEvent("BCLEAR", "CLICKED", "BCLEAR") + self~connectButtonEvent("BCALC", "CLICKED", "BCALC") + self~connectButtonEvent("BSINUS", "CLICKED", "BSINUS") + self~connectButtonEvent("BCOSINUS", "CLICKED", "BCOSINUS") + self~connectButtonEvent("BTANGENS", "CLICKED", "BTANGENS") + self~connectButtonEvent("BARCSIN", "CLICKED", "BARCSIN") + self~connectButtonEvent("BARCCOS", "CLICKED", "BARCCOS") + self~connectButtonEvent("BARCTAN", "CLICKED", "BARCTAN") + + /* Initial values that are assigned to the object attributes */ + self~TLine= '0' /* set text-line to 0 initially */ + + /* Add your initialization code here */ + return InitRet + +::method initDialog + expose tl + tl = self~newEdit(TLine) /* get the EditControl object */ + +::method getLine + /* Return the current text-line content, */ + /* or 0 if infinity has been reached. */ + + expose tl + if tl~getText~Left(5) = 'ERROR' then + return 0 + return tl~getText + +::method setLine + /* Set the argument as new text-line. If this is ERROR raise an */ + /* errorDialog with additional information. */ + + expose tl + use arg line, merror + if line~left(5) = 'ERROR' then + call errorDialog "RxCalc returned an error:" merror + tl~setText(line) + +::method justZero + /* Return true if the current text-line is only one 0. */ + /* Most functions will then ignore the current text-line */ + + line = self~getLine + if line~Length = 1 & line = 0 then + return 1 + return 0 + +::method getCheckedLine + /* Return the result of the current calculation or the line */ + /* if it is only a number. DataType will not return NUM */ + /* if any operators are present. */ + + line = self~getLine + if DataType(line) = 'NUM' then + return line + else do + interpret 'calcResult =' line + return calcResult + end + +/* --------------------- message handler -----------------------------------*/ + +::method UNKNOWN + /* The UNKNOWN-method is called, whenever the defined message for a */ + /* button cannot be found. This is a good way to roll all the methods for */ + /* the 10 digits into one. The last character of the argument is the */ + /* number that was pressed. */ + + use arg message + number = message~SubStr(4) + if self~justZero then + self~setLine(number) + else self~setLine(self~getLine||number) + +::method BSIGN + /* Toggles the sign of the leading number on the text line. */ + + if self~justZero then + self~setLine('-') + else do + select + when left(self~getLine,1)='-' then + self~setLine('+'||substr(self~getLine,2)) + when left(self~getLine,1)='+' then + self~setLine('-'||substr(self~getLine,2)) + otherwise + self~setLine('-'||self~getLine) + end + end + +::method BPOINT + /* Append a point.. */ + self~setLine(self~getLine||'.') + +::method BDIVIDE + /* Appends a 'divide' symbol to the checked line. */ + self~setLine(self~GetCheckedLine||'/') + +::method BTIMES + /* Append a 'multiply' symbol to the checked line. */ + self~setLine(self~GetCheckedLine||'*') + +::method BMINUS + /* Appends a 'minus' symbol to the checked line. */ + self~setLine(self~GetCheckedLine||'-') + +::method BPLUS + /* Appends a 'plus' symbol to the checked line. */ + self~setLine(self~GetCheckedLine||'+') + +::method BSQRT + /* Displays the square root of the checked line. */ + /* MATHERRNO is filled with additional information if the */ + /* RxMath-funtion detects an error. */ + self~setLine(RxCalcSqrt(self~GetCheckedLine), MATHERRNO) + +::method BLOG + /* Displays the natural logarithm of the checked line */ + self~setLine(RxCalcLog(self~GetCheckedLine), MATHERRNO) + +::method BLOG10 + /* Displays the 10-base logarithm of the checked line */ + self~setLine(RxCalcLog10(self~GetCheckedLine), MATHERRNO) + +::method BPI + /* Displays the number Pi */ + if self~justZero then + self~setLine(RxCalcPi(), MATHERRNO) + else self~setLine(self~getLine||RxCalcPi(), MATHERRNO) + +::method BBACKSPACE + /* Delete the last character of the line */ + line = self~getLine + line = line~Left(line~Length - 1) + if line = '' then /* if the line is empty set it to 0 */ + self~setLine(0) + else self~setLine(line) + +::method BCLEAR + /* Set the line to 0 */ + self~setLine(0) + +::method BCALC + /* Interpret the current line = calculate the result */ + interpret 'calcResult =' self~getLine + self~setLine(calcResult) + +::method BSINUS + /* Display the sine of the checked line */ + self~setLine(RxCalcSin(self~getCheckedLine), MATHERRNO) + +::method BCOSINUS + /* Display the cosine of the checked line */ + self~setLine(RxCalcCos(self~GetCheckedLine), MATHERRNO) + +::method BTANGENS + /* Display the tangent of the checked line */ + self~setLine(RxCalcTan(self~GetCheckedLine), MATHERRNO) + +::method BARCSIN + /* Display the arc sine of the checked line */ + self~setLine(RxCalcArcSin(self~GetCheckedLine), MATHERRNO) + +::method BARCCOS + /* Display the arc cosine of the checked line */ + self~setLine(RxCalcArcCos(self~GetCheckedLine), MATHERRNO) + +::method BARCTAN + /* Display the arc tangent of the checked line */ + self~setLine(RxCalcArcTan(self~GetCheckedLine), MATHERRNO) + +::method Ok + /* + This is the method connected to our exit-button. You don't have to implement it, + ooDialog supplies a default implementation of the ok method. Note that the ok + method is always connected to the button with resource ID 1. Note also, that + once you invoke the superclass ok method, if validate() returns true, the dialog + will close. + + This is what the default implementation of ok does: it invokes the validate() + method. If validate() returns false, then ok() does nothing and just returns. + If validate() returns true then ok() sets self~initCode to 1 and ends the + dialog. To end a dialog programatically, the superclass ok or cancel + methods should always be used. + + This over-ride sets the calculator display to 0 before ending the dialog. Again, + this is not necessary, it is just done to demonstrate how to over-ride the ok + method + */ + if \ self~validate then return 0 + + self~setLine(0) + + return self~ok:super diff --git a/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.h b/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.h new file mode 100644 index 0000000..d943763 --- /dev/null +++ b/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.h @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_COMBOBOX_TYPES 100 +#define IDC_GB_SCHEME 1000 +#define IDC_CB_SIMPLE 1001 +#define IDC_CB_DROPDOWN 1003 +#define IDC_PB_DROP 1004 +#define IDC_CB_DROPDOWNLIST 1005 +#define IDC_PB_CLOSE 1007 +#define IDC_RB_NONE 1009 +#define IDC_RB_RAINBOW 1011 +#define IDC_RB_TEXTONLY 1014 +#define IDC_RB_FIREBRICK 1015 diff --git a/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.rc b/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.rc new file mode 100644 index 0000000..285270e --- /dev/null +++ b/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.rc @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#include +#include +#include +#include "comboBoxTypes.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_COMBOBOX_TYPES DIALOGEX 0, 0, 289, 169 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP +CAPTION "Combo Box Types" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "Simple", IDC_STATIC, WC_STATIC, SS_CENTER, 10, 10, 69, 11 + CONTROL "Drop-down", IDC_STATIC, WC_STATIC, SS_CENTER, 110, 10, 69, 11 + CONTROL "Drop-down list", IDC_STATIC, WC_STATIC, SS_CENTER, 210, 10, 69, 11 + CONTROL "", IDC_CB_SIMPLE, WC_COMBOBOX, WS_TABSTOP | CBS_SIMPLE | CBS_HASSTRINGS, 12, 29, 69, 71 + CONTROL "", IDC_CB_DROPDOWN, WC_COMBOBOX, WS_TABSTOP | CBS_DROPDOWN | CBS_HASSTRINGS, 110, 29, 69, 71 + CONTROL "", IDC_CB_DROPDOWNLIST, WC_COMBOBOX, WS_TABSTOP | CBS_DROPDOWNLIST | CBS_HASSTRINGS, 210, 29, 69, 71 + CONTROL "Color Scheme", IDC_GB_SCHEME, WC_BUTTON, WS_GROUP | BS_GROUPBOX, 10, 107, 214, 52 + CONTROL "None (default appearance)", IDC_RB_NONE, WC_BUTTON, WS_TABSTOP | BS_AUTORADIOBUTTON, 17, 123, 100, 8 + CONTROL "Rainbow (Bk and Fg)", IDC_RB_RAINBOW, WC_BUTTON, BS_AUTORADIOBUTTON, 17, 140, 100, 8 + CONTROL "Rainbow (text only)", IDC_RB_TEXTONLY, WC_BUTTON, BS_AUTORADIOBUTTON, 136, 123, 82, 8 + CONTROL "Firebrick Red", IDC_RB_FIREBRICK, WC_BUTTON, BS_AUTORADIOBUTTON, 136, 140, 82, 8 + CONTROL "Drop Down", IDC_PB_DROP, WC_BUTTON, WS_TABSTOP | BS_PUSHBUTTON, 229, 107, 50, 14 + CONTROL "Close Up", IDC_PB_CLOSE, WC_BUTTON, WS_TABSTOP | BS_PUSHBUTTON, 229, 126, 50, 14 + CONTROL "Done", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON, 229, 145, 50, 14 +} diff --git a/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.rex b/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.rex new file mode 100755 index 0000000..30b7940 --- /dev/null +++ b/modules/windows/oodialog/controls/ComboBox/comboBoxTypes.rex @@ -0,0 +1,194 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * There are 3 types of combo boxes: simple, drop down, and drop down list. + * This example shows a dialog with 3 combo boxes, one of each kind. It is + * mostly meant to show the difference in the 3 types to allow an ooDialog + * programmer to pick the type to use for a program. + * + * One thing about combo boxes is that a combo box is not a single control. It + * is a mix of several controls, an edit control and a listbox and a button. + * Because of this, the normal setColor() method does not work well for the + * programmer that wants to set the color of dialog controls. For the combo + * box, ooDialog provides the setFullColor() method which sets the color for + * the entire combo box. This example also demonstrates that method, along + * with the removeFullColor() method. + */ + + sd = locate() + .application~setDefaults('O', sd'comboBoxTypes.h', .false) + + dlg = .ComboBoxTypes~new(sd"comboBoxTypes.rc", IDD_COMBOBOX_TYPES) + + if dlg~initCode = 0 then do + dlg~execute("SHOWTOP") + end + else do + say "Problem creating the dialog. Init code:" dlg~initCode + return 99 + end + + return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'ComboBoxTypes' subclass RcDialog + +-- Normally an init() method for a RcDialog subclass is not used, it is really +-- not needed. Here though it is used to do some set up stuff. Everything done +-- here could just as well have been done in initDialog() +::method init + expose mediumSpringGreen gold midnightBlue fireBrickRed colors animals fruits + + forward class (super) continue + + -- The setFullColor() method takes a COLORREF as input. Be sure to use the + -- colorRef() class method of the .Image class to properly construct a + -- COLORREF from the RGB values. + -- + -- Create the color values to be used by the setFullColor() + mediumSpringGreen = .Image~colorRef(0, 238, 118) + gold = .Image~colorRef(255, 215, 0) + midnightBlue = .Image~colorRef(47, 47, 79) + fireBrickRed = .Image~colorRef(205, 38, 38) + + -- Connect the button clicks + self~connectButtonEvent(IDC_PB_DROP, 'CLICKED', onDrop, sync) + self~connectButtonEvent(IDC_PB_CLOSE, 'CLICKED', onClose, sync) + + self~connectButtonEvent(IDC_RB_NONE, 'CLICKED', onSchemeChange, .true) + self~connectButtonEvent(IDC_RB_RAINBOW, 'CLICKED', onSchemeChange, .false) + self~connectButtonEvent(IDC_RB_TEXTONLY, 'CLICKED', onSchemeChange, sync) + self~connectButtonEvent(IDC_RB_FIREBRICK, 'CLICKED', onSchemeChange, .true) + + -- Create arrays of the items to be inserted into each combo box. + colors = .array~of("Green", "Blue", "Yellow", "Orange", "Red", "Pink") + animals = .array~of("Horse", "Cow", "Dog", "Pig", "Cat", "Sheep") + fruits = .array~of("Apple", "Peach", "Pear", "Cherry", "Raspberry", "Banna") + + +-- Typical initDialog() method. We just populate the combo boxes and check the +-- radio button that matches how we start up, no colors set for the combo boxes. +::method initDialog + expose cbSimple cbDropDown cbDropDownList colors animals fruits + + cbSimple = self~getComboBox(IDC_CB_SIMPLE) + do c over colors + cbSimple~add(c) + end + cbSimple~selectIndex(1) + + cbDropDown = self~getComboBox(IDC_CB_DROPDOWN) + do a over animals + cbDropDown~add(a) + end + cbDropDown~selectIndex(1) + + cbDropDownList = self~getComboBox(IDC_CB_DROPDOWNLIST) + do f over fruits + cbDropDownList~add(f) + end + cbDropDownList~selectIndex(1) + + self~newRadioButton(IDC_RB_NONE)~check + + +-- This is the event handler for the radio buttons that select the color scheme. +-- We just check which radio button was clicked and do the appropriate thing. +-- Note that we can set the color for the combo boxes back to their default by +-- using the removeColor() method. +::method onSchemeChange unguarded + expose mediumSpringGreen gold midnightBlue fireBrickRed cbSimple cbDropDown cbDropDownList + use arg id + + select + when id == .constDir[IDC_RB_NONE] then do + cbSimple~removeFullColor + cbDropDown~removeFullColor + cbDropDownList~removeFullColor + end + + when id == .constDir[IDC_RB_RAINBOW] then do + cbSimple~setFullColor(midnightBlue, gold) + cbDropDown~setFullColor(mediumSpringGreen, fireBrickRed) + cbDropDownList~setFullColor(fireBrickRed, gold) + end + + when id == .constDir[IDC_RB_TEXTONLY] then do + cbSimple~setFullColor( , gold) + cbDropDown~setFullColor( , mediumSpringGreen) + cbDropDownList~setFullColor( , fireBrickRed) + end + + when id == .constDir[IDC_RB_FIREBRICK] then do + cbSimple~setFullColor(fireBrickRed, gold) + cbDropDown~setFullColor(fireBrickRed, gold) + cbDropDownList~setFullColor(fireBrickRed, gold) + end + + otherwise nop + end + -- End select + + self~redraw + return 0 + + +-- This is the event handler for the Close Up push button. It is meant to close +-- the opened combo boxes. The reality is, as soon as a combo box loses the +-- focus it closes up. The act of pushing the Close button will close the +-- opened combo box with out any further action. +::method onClose + expose cbDropDown cbDropDownList + + cbDropDown~closeDropDown + cbDropDownList~closedropDown + return 0 + +-- This is the event handler for th Drop Down push button. It is meant to drop +-- down both combo boxes. The reality is, as soon as a combo box loses the +-- focus it closes up. Since only 1 dialog at a time can have the focuse, you +-- can only have one combo box dropped down at any time. Only the drop down +-- list combo box will remain open after the user pushes the button. +::method onDrop + expose cbDropDown cbDropDownList + + cbDropDown~openDropDown + cbDropDownList~openDropDown + return 0 diff --git a/modules/windows/oodialog/controls/ListBox/incrementalSearch.rex b/modules/windows/oodialog/controls/ListBox/incrementalSearch.rex new file mode 100755 index 0000000..c0f4b1a --- /dev/null +++ b/modules/windows/oodialog/controls/ListBox/incrementalSearch.rex @@ -0,0 +1,257 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +/** + * An example of a custom implmentation of an incremental search in a ListBox. + * + * The list box has its own function that does an incremental search of the + * items in the list box. When a character is typed, the list box: + * + * "Moves the selection to the first item that begins with the character the + * user typed. Multiple characters typed within a short interval are treated as + * a group, and the first item that begins with that series of characters is + * selected." + * + * One common problem is that the "short interval" is too short. + * + * This example makes that short interval longer. It also adds some custom + * features. The user can reset the search by typing the Del key. The user + * can also back up the search by one character by using the BackSpace key. + * + * We use a UserDialog here, although really an ResDialog or an RcDialog is + * much better. + */ + + symbolMap = .table~new + symbolMap[IDC_LB_FILEs] = 200 + symbolMap[IDC_ST_SEARCHSTR] = 210 + + .application~setDefaults('O', symbolMap, .false, 'Courier New', 10) + + dlg = .SimpleDialog~new + if dlg~initCode = 0 then do + if dlg~execute("SHOWTOP") == dlg~IDOK then do + say 'User searched for and found:' dlg~searchAndFound + end + else do + say 'User canceled' + end + end + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'SimpleDialog' subclass UserDialog + +::constant expiration 7 -- Time between keystrokes before the search string is + -- reset. If the user does not type any keys within + -- this amount of time, in seconds, the search string + -- is set back to blank. + +::attribute searchAndFound get + expose selectedText + return selectedText + +::method init + expose selectedText searchStr curIndex timer + + forward class (super) continue + self~create(30, 30, 186, 124, "Directory Listing with Search", "CENTER") + + selectedText = '' + searchStr = '' + curIndex = 1 + timer = .nil + +::method defineDialog + + self~createListBox(IDC_LB_FILES, 10, 10, 166, 90, 'VSCROLL HSCROLL PARTIAL SORT NOTIFY') + self~createStaticText(IDC_ST_SEARCHSTR, 10, 102, 64, 11, , '') + self~createPushButton(IDCANCEL, 74, 105, 50, 14, ,"Cancel") + self~createPushButton(IDOK, 126, 105, 50, 14, 'DEFAUT', "Ok") + +::method initDialog + expose lb stSearchStr + + lb = self~newListBox(IDC_LB_FILES) + lb~addDirectory("C:\Windows\System32\*", "READWRITE READONLY HIDDEN SYSTEM DIRECTORY ARCHIVE") + + lb~connectCharEvent + stSearchStr = self~newStatic(IDC_ST_SEARCHSTR) + + self~setHorizontalExtent(lb) + +::method onChar unguarded + expose searchStr curIndex + use arg char, isShift, isCtrl, isAlt, misc, lBox + + if self~isDel(char, isCtrl, misc) then do + self~resetSearch + return .true + end + + if self~isBkSpc(char, isCtrl, misc) then do + len = searchStr~length + if len > 0 then searchStr = searchStr~substr(1, searchStr~length - 1) + curIndex = 1 + end + else do + if isShift | isCtrl | isAlt | (misc~pos('extended') <> 0) then return .true + searchStr ||= char~d2c + end + + self~incrementalSearch(lBox) + return .false + +::method incrementalSearch private unguarded + expose searchStr curIndex + use strict arg lBox + + self~setStatusBar + self~resetTimer + + newIndex = lBox~find(searchStr, curIndex) + if newIndex <> curIndex then do + if newIndex == 0 then do + -- Setting the selected index to 0 has the effect of removing + -- the selection from all items. This gives the user the + -- hint that there is no next item with the current search + -- string. We leave the current index unchanged. + lBox~selectIndex(0) + end + else do + len = searchStr~length + prefix = lBox~getText(curIndex)~left(len) + newPrefix = lBox~getText(newIndex)~left(len) + + -- Only move if the new item is a better match then the + -- current item. In other words if the prefixes match, + -- don't do anything + if prefix \== newPrefix then do + lBox~selectIndex(newIndex) + lBox~makeFirstVisible(newIndex) + curIndex = newIndex + end + end + end + +-- When this method is invoked, the user has not typed a key for whatever +-- the timer period is, we abandon the search string. +::method expired unguarded + expose searchStr curIndex timer stSearchStr + searchStr = '' + curIndex = 1 + timer = .nil + self~setStatusBar + +-- Set the timer to the expiration time. Be sure to cancel the +-- existing timer if it exists or we will get a goofy thing going. +::method resetTimer private unguarded + expose timer + + reply 0 + + if timer \== .nil then timer~cancel + + waitPeriod = .TimeSpan~fromSeconds(self~expiration) + msgObj = .Message~new(self, 'expired') + timer = .Alarm~new(waitPeriod, msgObj) + +-- Reset the incremental search +::method resetSearch private unguarded + expose searchStr curIndex timer stSearchStr + + if timer \== .nil then timer~cancel + + searchStr = '' + curIndex = 1 + timer = .nil + self~setStatusBar + +-- Test for a Backspace keypress +::method isBkSpc private unguarded + use strict arg char, isCtrl, misc + + if char == .VK~back then return .true + return .false + +-- Test for a Del keypress +::method isDel private unguarded + use strict arg char, isCtrl, misc + + if \ isCtrl & misc~pos('extended') <> 0 & char == .VK~delete then return .true + return .false + +-- Show the search string under the list box. There is a StatuBar control +-- that is a possible future enhancement to ooDialog. That is where I would +-- really like to display this. +::method setStatusBar private unguarded + expose stSearchStr searchStr + stSearchStr~setText(searchStr) + +-- If the internal width of the list box is less than the width of an item, +-- not all of the item will be shown. By default the internal width of the +-- list box is 0. Here we measure the width of each string and set the internal +-- width of the list box to the width of the widest string, plus 4 for a margin. +::method setHorizontalExtent private + use strict arg lb + + max = 0 + do i = 1 to lb~items + s = lb~getTextSizePx(lb~getText(i)) + if s~width > max then max = s~width + end + lb~setWidthPx(max + 4) + +::method ok unguarded + expose lb selectedText timer + + -- Be sure to cancel the timer or the dialog won't close until it + -- does expire. + if timer \== .nil then timer~cancel + selectedText = lb~selected + return self~ok:super + +::method cancel unguarded + expose timer selectedText + + if timer \== .nil then timer~cancel + selectedText = '' + return self~cancel:super diff --git a/modules/windows/oodialog/controls/ListView/ReadMe.txt b/modules/windows/oodialog/controls/ListView/ReadMe.txt new file mode 100644 index 0000000..0b25511 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/ReadMe.txt @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Dialog Control Example Programs + ----------------------------------------------- + + This directory contains example programs that demonstrate how to use the + list-view control in ooDialog. The examples range from simple to medium + complex. + + - columnClickListView.rex + + An example program that shows how to determine which row and which + column in a list view control the user has clicked on. + + - customDrawListView.rex + + Shows how to use a list-view with emphasis on custom draw. Custom + draw with a list-view allows you set the text color, background color, + and font for individuals list-view items. And when the list-view is + in report view, this can be done for individual subitems of each row. + + - columnIcons.rex + + This example shows how to use icons for all columns in a list-view, + how to use LvFullRow objects to populate a list-view, and how to use + the internal sorting feature of the ooDialog framework. In report + view, the columns can be drag and droppred to arrange the order. + Clicking on a column sorts the column. + + The subitem.editing subdirectory contains several examples of embedding + dialog controls within the list-view to allow in-place editing of the + subitems in report view. diff --git a/modules/windows/oodialog/controls/ListView/columnClickListView.rex b/modules/windows/oodialog/controls/ListView/columnClickListView.rex new file mode 100755 index 0000000..b9e61b7 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/columnClickListView.rex @@ -0,0 +1,98 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple List View control using ooDialog. Demonstrates how to determine + * which column within a row the user has clicked on. + * + * Note that you must add the FULLROWSELECT extended style to the list view in + * order to get the correct row number. If the list view does not have this + * style, Windows only reports the row number if the text label in the left- + * most column is clicked on. + * + * Each time the user clicks on the list view control, the row and column + * clicked are reported. This is done using "say" so the program is best + * run from a command prompt window. + */ + + dlg = .SimpleLV~new + if dlg~initCode = 0 then do + -- Add a symbolic resource ID for the list view. + dlg~constDir[IDC_LISTVIEW] = 200 + + dlg~create(30, 30, 325, 200, "A Simple List View", "VISIBLE") + dlg~execute("SHOWTOP") + end + +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'SimpleLV' subclass UserDialog + +::method defineDialog + + self~createListView(IDC_LISTVIEW, 10, 20, 305, 145, "REPORT SHOWSELALWAYS") + self~createPushButton(IDOK, 280, 175, 35, 15, "DEFAULT", "Close") + + self~connectListViewEvent(IDC_LISTVIEW, "CLICK", onClick, .true) + +::method initDialog + + -- Get a reference to the list view. + list = self~newListView(IDC_LISTVIEW) + + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~insertColumn(0, "Row (Column 1)", 75) + list~insertColumn(1, "Column 2", 70) + list~insertColumn(2, "Column 3", 70) + + do i = 1 to 200 + list~addRow(i, , "Line" i, "Line / Col ("i", 2)", "Line / Col ("i", 3)") + end + +::method onClick + use arg id, itemIndex, columnIndex, keyState, nCode, listView + + -- Compensate for zero-based indexes ;-( + itemIndex += 1 + columnIndex += 1 + + say 'onClick() row:' itemIndex 'column:' columnIndex 'key state:' keyState 'lv:' listView + return 0 + diff --git a/modules/windows/oodialog/controls/ListView/columnIcons.rex b/modules/windows/oodialog/controls/ListView/columnIcons.rex new file mode 100755 index 0000000..d21d548 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/columnIcons.rex @@ -0,0 +1,223 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to add icons to the invidual columns of a list-view + * when it is in report view. + * + */ + + sd = locate() + .application~useGlobalConstDir('O', sd"rc\columnIcons.h") + + dlg = .ListViews~new(sd"rc\columnIcons.dll", IDD_DIALOG) + if dlg~initCode == 0 then do + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + end + else do + say 'Dialog failed to initialize, aborting.' + return 99 + end + + return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'ListViews' subclass ResDialog + +::method initDialog + expose list itemColumns + + list = self~newListView(IDC_LV_VIEWS) + self~newRadioButton(IDC_RB_ICON)~check + + itemColumns = .array~of(-1, -1, -1, -1) + + self~connectEvents + self~setImageLists + self~populateList(list) + + +::method onReport + expose list + list~setView("REPORT") + return 0 + +::method onList + expose list + list~setView("LIST") + +::method onIcon + expose list + list~setView("ICON") + +::method onSmallIcon + expose list + list~setView("SMALLICON") + +::method onColClick unguarded + expose itemColumns + use arg id, colIndex, listView + + -- Adjust for 0-based indexes + i = colIndex + 1 + + d = .directory~new + d~column = colIndex + d~caseless = .false + + if itemColumns[i] == -1 then do + d~ascending = .true + itemColumns[i] = 0 + end + else if itemColumns[i] == 0 then do + d~ascending = .false + itemColumns[i] = 1 + end + else do + d~ascending = .true + itemColumns[i] = 0 + end + + listView~sortItems('InternalListViewSort', d) + return 0 + + +::method connectEvents private + + self~connectButtonEvent(IDC_RB_REPORT, "CLICKED", onReport, .true) + self~connectButtonEvent(IDC_RB_LIST, "CLICKED", onList, sync) + self~connectButtonEvent(IDC_RB_ICON, "CLICKED", onIcon) + self~connectButtonEvent(IDC_RB_SMALL_ICON, "CLICKED", onSmallIcon, .false) + self~connectListViewEvent(IDC_LV_VIEWS, "COLUMNCLICK", onColClick, .true) + self~connectListViewEvent(IDC_LV_VIEWS, "BEGINDRAG", defListDragHandler) + + +::method setImageLists private + expose list + + resourceImage = .ResourceImage~new(self) + smIcons = resourceImage~getImage(IDB_SMALL_ICONS) + normalIcons = resourceImage~getImage(IDB_NORMAL_ICONS) + + flags = .Image~toId(ILC_COLOR24) + imageList = .ImageList~create(.Size~new(16), flags, 28, 0) + imageList~add(smIcons) + + list~setImageList(imageList, SMALL) + + imageList = .ImageList~create(.Size~new(32), flags, 9, 0) + imageList~add(normalIcons) + + list~setImageList(imageList, NORMAL) + + +::method populateList private + use strict arg list + + list~InsertColumnPx(0, "Title", 150) + list~InsertColumnPx(1, "Name", 75) + list~InsertColumnPx(2, "Last", 100) + list~InsertColumnPx(3, "e-mail", 150) + + style = "FULLROWSELECT UNDERLINEHOT ONECLICKACTIVATE SUBITEMIMAGES HEADERDRAGDROP" + list~addExtendedStyle(style) + + lvItem = .LvItem~new(0, "Business manager", 6) + lvSub1 = .LvSubItem~new(0, 1, "Tom", 14) + lvSub2 = .LvSubItem~new(0, 2, "Sawyer", 26) + lvSub3 = .LvSubItem~new(0, 3, "ts@google.com", 11) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(1, "Software Developer", 1) + lvSub1 = .LvSubItem~new(1, 1, "Sam", 14) + lvSub2 = .LvSubItem~new(1, 2, "Frank", 15) + lvSub3 = .LvSubItem~new(1, 3, "boo@gmail.com", 12) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(2, "Mechanical Engineer", 0) + lvSub1 = .LvSubItem~new(2, 1, "Tamara", 13) + lvSub2 = .LvSubItem~new(2, 2, "Ecclestone", 16) + lvSub3 = .LvSubItem~new(2, 3, "tameccle@yahoo.com", 9) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(3, "Lawyer", 5) + lvSub1 = .LvSubItem~new(3, 1, "Mary", 13) + lvSub2 = .LvSubItem~new(3, 2, "Tyler", 17) + lvSub3 = .LvSubItem~new(3, 3, "fkan@qualcom.com", 10) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(4, "Doctor", 2) + lvSub1 = .LvSubItem~new(4, 1, "Cienna", 13) + lvSub2 = .LvSubItem~new(4, 2, "Acer", 18) + lvSub3 = .LvSubItem~new(4, 3, "ca@sharp.org", 11) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(5, "Clerk", 3) + lvSub1 = .LvSubItem~new(5, 1, "Harry", 14) + lvSub2 = .LvSubItem~new(5, 2, "Houdini", 19) + lvSub3 = .LvSubItem~new(5, 3, "HH@magic.net", 12) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(6, "Nurse", 4) + lvSub1 = .LvSubItem~new(6, 1, "Mike", 14) + lvSub2 = .LvSubItem~new(6, 2, "Thompson", 18) + lvSub3 = .LvSubItem~new(6, 3, "mike@microsoft.com", 10) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(7, "Drywall Finisher", 7) + lvSub1 = .LvSubItem~new(7, 1, "Larry", 14) + lvSub2 = .LvSubItem~new(7, 2, "Goodell", 20) + lvSub3 = .LvSubItem~new(7, 3, "walls49@yahoo.com", 9) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + + lvItem = .LvItem~new(8, "Biochemist", 8) + lvSub1 = .LvSubItem~new(8, 1, "Kumar", 14) + lvSub2 = .LvSubItem~new(8, 2, "Patel", 18) + lvSub3 = .LvSubItem~new(8, 3, "kpatel@sequenom.com", 10) + lvFullRow = .LvFullRow~new(lvItem, lvSub1, lvSub2, lvSub3, .true) + list~addFullRow(lvFullRow) + diff --git a/modules/windows/oodialog/controls/ListView/customDrawListview.rex b/modules/windows/oodialog/controls/ListView/customDrawListview.rex new file mode 100755 index 0000000..5ab5b15 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/customDrawListview.rex @@ -0,0 +1,267 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to work with a simple ListView control in report + * view. + * + * The main points of the example are: + * + * 1.) It shows how to use the LvFullRow, LvItem, and LvSubItem objects to add + * items to list-views + * + * 2.) It shows how to use custom draw with a list-view change the text and + * background color of a single list-view item, and / or change the font + * for a single item. + * + * Note that in the .rc file, the resource script file, for this example, the + * dialog is created *not* visible. Thus, while the dialog is being + * initialized, it is not visible on the screen. This eliminates flicker while + * the items are being inserted into the list-view. Some people like the users + * of their applications to see the list-view being filled, some people dislike + * flicker. So, it is mostly a matter of preference how you create the dialog, + * initially visible, or initially invisible. But, it is good to be aware of + * the option. + */ + + -- Determine which directory our source code files are in: + sd = locate() + + -- Set the defaults for this application. Use the global .constDir 'O'nly, + -- Read the 'customDrawListview.h' file for symbolic resource ID + -- definitions. And, turn automatica data detection off (.false.) + .application~setDefaults('O', sd'rc\customDrawListview.h', .false) + + dlg = .CustomDrawDlg~new(sd'rc\customDrawListview.rc', IDD_CUSTOMDRAW) + if dlg~initCode = 0 then do + dlg~execute("SHOWTOP") + end + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +/** CustomDrawDlg + * + * Our dialog subclass. To use custom draw, you need to inherit the CustomDraw + * mixin class. + */ +::class 'CustomDrawDlg' subclass RcDialog inherit CustomDraw + +/** init() + * + * To recieve the custom draw event notifications, you need to: 1.) Init the + * custom draw interface, 2.) name the control you want the custom draw + * notifications for. + * + * 1.) You must init the custom draw interface before invoking any of the custom + * draw methods. This is done by invoking the customDraw() method. + * + * 2.) You name the control you want the custom draw notifications for by + * invoking the forControl() method with: the resource ID of the control, the + * string name of the control, and the name of the method to be invoked. + * + * At this time, only ListView controls are supported. Future versions of + * ooDialog may support more dialog controls. + * + * Note that we created the colors and font one time here, rather than create + * them each time the onCustomDraw() method is invoked. + * + * We also create our LvFullRows objects here rather than in initDialog(). This + * helps allow the dialog to open with everything appearing at once. The full + * rows are inserted into the list-view in initDialog(). The rows can only be + * inserted after the underlying Windows dialog exists. + */ +::method init + expose textRed textBlack textBlue rowGreen rowLiteBlue rowYellow rows checkedFont + + forward class (super) continue + + self~customDraw + self~customDrawControl(IDC_LV_CUSTOM, 'ListView', onCustomDraw) + + textBlack = self~RGB( 0, 0, 0) + textRed = self~RGB(247, 7, 59) + textBlue = self~RGB( 17, 5, 250) + rowYellow = self~RGB(245, 245, 127) + rowLiteBlue = self~RGB(115, 245, 186) + rowGreen = self~RGB(188, 237, 102) + + checkedFont = self~createFontEx("Courier New", 10) + + rows = self~createRows + +/** initDialog() + * + * initDialog is the place to do any initialization that requires the underlying + * dialog to exist. Here we add some extended list-view styles and fill the + * list-view with its items. + */ +::method initDialog + expose list rows + + list = self~newListView(IDC_LV_CUSTOM) + + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~InsertColumn(0, "Line text", 75) + list~InsertColumn(1, "Line number", 55) + list~InsertColumn(2, "Numbers", 50) + list~InsertColumn(3, "Characters", 55) + + list~prepare4nItems(rows~items) + do r over rows + list~addFullRow(r) + end + + +/** onCustomDraw() + * + * This is the event handler that is invoked whenever the list-view needs to + * draw any item in the list. + * + * We are passed a LvCustomDrawSimple object to us. This object's attributes + * contain information concerning which item the list-view needs to draw, and + * other information related to doing custom drawing. Other attributes of the + * object need to be set by us in order to control the drawing. + * + * You must return true or false from this event handler. Failure to do so will + * terminate the dialog and raise a condition. Returning false basically says + * you do not want to do any custom drawing for this item. + * + * You can change the text color, the background color, and the font by setting + * those attributes of the LvCustomDrawSimple object. You also need to set the + * reply attribute. This attribute is the reply sent back to the list-view. + * + * For this example, we return CDRF_NEWFONT to tell the list-view that either + * colors, or fonts, were changed and that we do not want to recieve subitem + * notifications. Other possible replies are not discussed here as they are not + * pertinent to this example. The ooDialog documentation describes the other + * possible replies. + * + * The logic of what we are doing is relatively simple. We color every other + * row with a different color, if the user has not checked the row. All checked + * rows use a differnt color and font than the unchecked rows. + */ +::method onCustomDraw unguarded + expose list textRed textBlack textBlue rowGreen rowLiteBlue rowYellow checkedFont + use arg lvcds + + item = lvcds~item + + if (item // 2) == 0 then do + if list~isChecked(item) then do + lvcds~clrText = textBlue + lvcds~clrTextBk = rowLiteBlue + lvcds~font = checkedFont + end + else do + lvcds~clrText = textRed + lvcds~clrTextBk = rowYellow + end + end + else do + if list~isChecked(item) then do + lvcds~clrText = textBlue + lvcds~clrTextBk = rowLiteBlue + lvcds~font = checkedFont + end + else do + lvcds~clrText = textBlack + lvcds~clrTextBk = rowGreen + end + end + + lvcds~reply = self~CDRF_NEWFONT + return .true + + +/** createRows() + * + * Here we create LvFullRow objects for every list-view item. LvItem objects + * represent the list-view item and LvSubItem objects represent each column in + * the list-view item. + * + * All the full row objects are put into an array. The array is later used to + * insert all the items into the list-view. + */ +::method createRows private + + rows = .array~new(10) + + do i = 1 to 1000 + j = i - 1 + lvi = .LvItem~new(j, 'Line' i, , p) + lvsi1 = .LvSubItem~new(j, 1, i) + lvsi2 = .LvSubItem~new(j, 2, random(1, 200)) + lvsi3 = .LvSubItem~new(j, 3, self~randomChars) + + rows[i] = .LvFullRow~new(lvi, lvsi1, lvsi2, lvsi3, .false) + end + + return rows + + +/** randomChars() + * + * Simple method to generate some random string of characters. + */ +::method randomChars private + + len = random(1, 7) + chars = '' + + do i = 1 to len + chars || = random(97, 122)~d2c + end + + return chars + + +/** leaving() + * + * This method is invoked automatically be the ooDialog framework when the + * dialog is closed. It should be used to do any needed clean up. Here we + * delete the font we created. + * + * Note that the colors we created are just numbers and do not represent any + * system resource. + */ +::method leaving unguarded + expose checkedFont + self~deleteFont(checkedFont) diff --git a/modules/windows/oodialog/controls/ListView/rc/columnIcons.dll b/modules/windows/oodialog/controls/ListView/rc/columnIcons.dll new file mode 100644 index 0000000..12c5bf9 Binary files /dev/null and b/modules/windows/oodialog/controls/ListView/rc/columnIcons.dll differ diff --git a/modules/windows/oodialog/controls/ListView/rc/columnIcons.h b/modules/windows/oodialog/controls/ListView/rc/columnIcons.h new file mode 100644 index 0000000..4cd0ca2 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/rc/columnIcons.h @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG 100 +#define IDB_NORMAL_ICONS 104 +#define IDB_SMALL_ICONS 105 +#define IDC_ST_VIEW 1003 +#define IDC_RB_REPORT 1005 +#define IDC_RB_LIST 1007 +#define IDC_RB_ICON 1009 +#define IDC_RB_SMALL_ICON 1011 +#define IDC_LV_VIEWS 1012 diff --git a/modules/windows/oodialog/controls/ListView/rc/columnIcons.rc b/modules/windows/oodialog/controls/ListView/rc/columnIcons.rc new file mode 100644 index 0000000..99242a9 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/rc/columnIcons.rc @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "columnIcons.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_SMALL_ICONS BITMAP ".\\columnIcons_16.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_NORMAL_ICONS BITMAP ".\\columnIcons_32.bmp" + + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +IDD_DIALOG DIALOGEX 0, 0, 342, 249 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Views of the List-view Control" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +{ + CONTROL "", IDC_LV_VIEWS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_ICON, 10, 10, 322, 171 + GROUPBOX "View", IDC_ST_VIEW, 10, 186, 153, 53, WS_GROUP + AUTORADIOBUTTON "Report View", IDC_RB_REPORT, 21, 201, 55, 10, WS_TABSTOP + AUTORADIOBUTTON "List View", IDC_RB_LIST, 21, 221, 55, 10 + AUTORADIOBUTTON "Icon View", IDC_RB_ICON, 96, 201, 55, 10 + AUTORADIOBUTTON "Small Icon View", IDC_RB_SMALL_ICON, 96, 221, 65, 10 + DEFPUSHBUTTON "OK", IDOK, 282, 225, 50, 14, WS_GROUP +} diff --git a/modules/windows/oodialog/controls/ListView/rc/columnIcons_16.bmp b/modules/windows/oodialog/controls/ListView/rc/columnIcons_16.bmp new file mode 100644 index 0000000..fbe1bbf Binary files /dev/null and b/modules/windows/oodialog/controls/ListView/rc/columnIcons_16.bmp differ diff --git a/modules/windows/oodialog/controls/ListView/rc/columnIcons_32.bmp b/modules/windows/oodialog/controls/ListView/rc/columnIcons_32.bmp new file mode 100644 index 0000000..2777909 Binary files /dev/null and b/modules/windows/oodialog/controls/ListView/rc/columnIcons_32.bmp differ diff --git a/modules/windows/oodialog/controls/ListView/rc/customDrawListView.h b/modules/windows/oodialog/controls/ListView/rc/customDrawListView.h new file mode 100644 index 0000000..18cda84 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/rc/customDrawListView.h @@ -0,0 +1,43 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_CUSTOMDRAW 101 +#define IDC_LV_CUSTOM 1002 diff --git a/modules/windows/oodialog/controls/ListView/rc/customDrawListView.rc b/modules/windows/oodialog/controls/ListView/rc/customDrawListView.rc new file mode 100644 index 0000000..b8857a8 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/rc/customDrawListView.rc @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "customDraw.h" + + +LANGUAGE 0, SUBLANG_NEUTRAL +IDD_CUSTOMDRAW DIALOGEX 0, 0, 350, 200 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Custom Draw List View" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_LV_CUSTOM, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT, 10, 10, 328, 153 + DEFPUSHBUTTON "OK", IDOK, 290, 176, 50, 14 +} diff --git a/modules/windows/oodialog/controls/ListView/rc/res.mak b/modules/windows/oodialog/controls/ListView/rc/res.mak new file mode 100644 index 0000000..bdb044c --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/rc/res.mak @@ -0,0 +1,50 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file for ooDialog resource DLLs + +rcflags_common = /DWIN32 /v + +all: columnIcons.dll + +columnIcons.dll: columnIcons.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:$(@B).dll + + +# Create .res from .rc +columnIcons.res: columnIcons.rc + rc $(rcflags_common) -r -fo$(@B).res columnIcons.rc + diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/ReadMe.txt b/modules/windows/oodialog/controls/ListView/subitem.editing/ReadMe.txt new file mode 100644 index 0000000..bc47926 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/ReadMe.txt @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - List-view Example Programs + ----------------------------------------------- + + This directory contains several, similar, example programs that + demonstrate how to embedd a dialog control within the the list-view. + The embedded controls allow the user to do in-place editing of the + subitems in the list-view when in report mode. + + For these first 3 examples, to activate subitem editing, the user first + selects a row by clicking on it with the mouse. If the user then clicks + one more time, the embedded control becomes active. The user enters the + value desired. At that point, hitting enter makes the change. If the + user hits the escape key, or clicks somewhere else on the list-view, the + change is abandoned. + + - dropDownComboBox.rex + + Embeds a drop down combo box in the list-view. + + - dropDownListComboBox.rex + + Embeds a drop down list combo box in the list-view. + + - editControl.rex + + Embeds an edit control in the list-view. + + The importList.rex example use a slightly different UI. The first + column of the list view has an embedded combo box. To activate the + control the user single clicks on the first column of an item. The + third column has an embedded edit control. To activate the edit + control, the user double clicks on the third column of an item. For + both controls if the user clicks anywhere else in the application, or + hits the enter or tab key, the current text in the control is saved. + The Esc key cancels any change. The example also shows how to use the + ResizingAdmin class and the BrowseForFolder class. + + - importList.rex diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/dropDownComboBox.rex b/modules/windows/oodialog/controls/ListView/subitem.editing/dropDownComboBox.rex new file mode 100755 index 0000000..86eaf31 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/dropDownComboBox.rex @@ -0,0 +1,271 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to embedd a drop down combo box in a list-view, to + * allow the user to edit the subitems in the list-view. + * + * To activate the editing, the user clicks once on a subitem, then clicks one + * more time to activate the editing. A drop down combo box takes the place of + * the subitem in the list-view. With a drop down combo box the user can + * either enter text directly in the edit part of the combo box, or select an + * item from the list. + * + * When the user is in the editing mode, hitting enter, escape, or clicking the + * mouse any where else on the scren, ends the editing. If enter is hit, the + * changes are accepted, otherwise, the changes are abandoned. + * + * The key to how this works is creating an invisible combo box, which is then + * made a child of the list-view. When editing mode is entered, the combo box + * positioned over the subitem, sized to the size of the subitem, and made + * visible. When editing is over, the combo box is made invisible again. + * + * The Rexx combo box, after it is made a child of the list-view, can be used + * as normal, with one caveat: Since it is a child of the list-view, the combo + * box no longer sends its event nofications to the dialog. They are sent to + * the list-view. This means that connecting the combo box events will have no + * effect. + */ + + -- Set the defaults for this application. Use the global .constDir 'O'nly, + -- turn automatic data detection off (.false.) Then we add a few symbols + -- to the global .constDir: + .application~setDefaults('O', , .false) + .constDir[IDC_LISTVIEW] = 200 + .constDir[IDC_CB] = 201 + + dlg = .SimpleLV~new + if dlg~initCode = 0 then do + dlg~create(30, 30, 325, 200, "In-place Editing List View", "VISIBLE") + dlg~execute("SHOWTOP") + end + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'SimpleLV' subclass UserDialog + +/** defineDialog() + * + * Standard defineDialog. We create a combo box, list-view, and ok button in + * the dialog template. Note the combo box is created invisible. + * + * We add a flag to keep track of whether the combo box is visisble or not. We + * also connect the events we need to monitor. + */ +::method defineDialog + expose cbVisible + + cbVisible = .false + + self~createComboBox(IDC_CB, 10, 20, 40, 12, 'PARTIAL HIDDEN') + self~createListView(IDC_LISTVIEW, 10, 20, 305, 145, "REPORT SHOWSELALWAYS") + self~createPushButton(IDOK, 280, 175, 35, 15, "DEFAULT", "Close") + + self~connectListViewEvent(IDC_LISTVIEW, "CLICK", onClick, .true) + self~connectListViewEvent(IDC_LISTVIEW, "BEGINSCROLL", onBeginScroll, sync) + self~connectListViewEvent(IDC_LISTVIEW, "ENDSCROLL", onBeginScroll, .false) + + +/** initDialog() + * + * Here we do 2 normal things, populate the list-view and populate the combo + * box. + * + * The rest is what makes this work. Drop down combo boxes create a child edit + * control. When the combo box gets the focus, the focus is actually set to + * the edit control. + * + * We get a Rexx edit object that represents the underlying edit control of the + * combo box. The isGrandchild() method sets up a connection to some of the + * event notifications sent by the grandchild control, to a Rexx method in this + * dialog. We need that event connection to monitor the Esc, Enter key events, + * and the lost focus event. + * + * The other key thing we do is set the parent of the combo box to be the list + * view. This parent / child relation is what keeps the combo box drawn + * correctly, it ensures that the combo box is drawn over the top of the list + * view. + */ +::method initDialog + expose list cb edit + + list = self~newListView(IDC_LISTVIEW) + cb = self~newComboBox(IDC_CB) + + cb~add('One') + cb~add('Two') + cb~add('Three') + + edit = cb~getEditControl + edit~isGrandchild + + cb~setParent(list) + + self~setUpListView(list) + + +/** onClick() + * + * This is the event handler for a click on the list-view. We track the clicks + * and when we see that the user has clicked twice in a row on the same subitem + * we enter editing mode. + * + * When we enter editing mode, we get the rectangle of the subitem we are going + * to edit, size the combo box to that size, position the combo box over the + * subitem, and make the combo box visible. + * + * We set our flag so that we know the combo box is now visible, and assign the + * focus to the combo box. And that's it. + * + * Notice that we set the height of the combo box to 4 times the height of the + * subitem. This allows space for the drop down. + */ +::method onClick unguarded + expose cb cbVisible lastIdx lastCol + use arg id, itemIndex, columnIndex, keyState, , lv + + if lastIdx == itemIndex & lastCol == columnIndex then do + if columnIndex > 0 then do + r = lv~getSubitemRect(itemIndex, columnIndex, 'LABEL') + ret = cb~setWindowPos(lv~hwnd, r~left, r~top, r~right - r~left, 4 * (r~bottom - r~top), "SHOWWINDOW NOZORDERCHANGE") + cbVisible = .true + cb~assignFocus + end + else do + r = lv~getItemRect(itemIndex, 'LABEL') + ret = cb~setWindowPos(lv~hwnd, r~left, r~top, r~right - r~left, 4 * (r~bottom - r~top), "SHOWWINDOW NOZORDERCHANGE") + cbVisible = .true + cb~assignFocus + end + end + + lastIdx = itemIndex; lastCol = columnIndex + + return 0 + + +/** onBeginScroll() + * + * This is the event handler for the begin and end scroll events. When the + * user is in the editing mode and then moves a way from the combo box, we + * interpret that as canceling the edit. + * + * This works fine if the user tabs out of the combo box, used the mouse to + * click outside the combo box, brings somer other application to the fore- + * ground. But, for some reason, clicking on the scroll bars fro the list-view + * does not trigger the onEditGrandChildEvent() handler. This seriously messes + * up the logic. + * + * The begin and / or end scroll event is sent as soon as the user clicks on + * the scroll bars. So, we connect that event and use the event handler to + * hide the combo box if it is visible. + */ +::method onBeginScroll unguarded + expose cbVisible edit + use arg ctrlID, dx, dy, lv, isBegin + + if cbVisible then self~hideComboBox(edit) + return 0 + + +/** onEditGrandChildEvent() + * + * This is the event handler for events that happen in a grandchild control. + * There are 4 events that get forwarded on to the grandfathe dialog. The Esc, + * Tab, and Enter key events, and the lost focus event. Which event is + * specified by the 2nd argument, which uses a keyword to denote the event. + * + * The isGrandChild() method automatically sets up the connection to the 4 + * events. Since we did request the tab key event be connected, we won't get + * that notification. The other 3 notifications, all signal the end of the + * editing mode. On enter, we need to update the subitem text with the new + * text. + */ +::method onEditGrandChildEvent unguarded + expose list lastIdx lastCol + use arg id, key, editCtrl + + if key == 'enter' then do + text = editCtrl~getText~strip + if text \== '' then list~setItemText(lastIdx, lastCol, text) + self~hideComboBox(editCtrl) + end + else if key == 'escape' then self~hideComboBox(editCtrl) + else if key == 'killfocus' then self~hideComboBox(editCtrl, .false) + + return 0 + + +/** hideComboBox() + * + * Makes the combo box invisible, removes its state, and assign the focus back + * to the list-view. This is done each time the editing mode is ended. + */ +::method hideComboBox private unguarded + expose cb cbVisible list + use strict arg editCtrl, assignFocus = .true + + cb~hide + cbVisible = .false + cb~selectIndex + editCtrl~setText("") + + if assignFocus then list~assignFocus + + +/** setUpListView() + * + * Sets up the list view by adding the columns and populating the list with + * rows. + */ +::method setUpListView private + use strict arg list + + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~insertColumn(0, "Row (List-view item)", 75) + list~insertColumn(1, "Column 2 (subitem 1)", 70) + list~insertColumn(2, "Column 3 (subitem 2)", 70) + + do i = 1 to 200 + list~addRow(i, , "Row" i, "Row / Col ("i", 2)", "Row / Col ("i", 3)") + end + + diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/dropDownListComboBox.rex b/modules/windows/oodialog/controls/ListView/subitem.editing/dropDownListComboBox.rex new file mode 100755 index 0000000..dbd0d43 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/dropDownListComboBox.rex @@ -0,0 +1,262 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to embedd a drop down list combo box in a list-view, + * to allow the user to edit the subitems in the list-view. + * + * To activate the editing, the user clicks once on a subitem, then clicks one + * more time to activate the editing. A drop down list combo box takes the + * place of the subitem in the list-view. With a drop down list combo box the + * user can only select an item from the list. + * + * When the user is in the editing mode, hitting enter, escape, or clicking the + * mouse any where else on the scren, ends the editing. If enter is hit, the + * changes are accepted, otherwise, the changes are abandoned. + * + * The key to how this works is creating an invisible combo box, which is then + * made a child of the list-view. When editing mode is entered, the combo box + * positioned over the subitem, sized to the size of the subitem, and made + * visible. When editing is over, the combo box is made invisible again. + * + * The Rexx combo box, after it is made a child of the list-view, can be used + * as normal, with one caveat: Since it is a child of the list-view, the combo + * box no longer sends its event nofications to the dialog. They are sent to + * the list-view. This means that connecting the combo box events will have no + * effect. + */ + + -- Set the defaults for this application. Use the global .constDir 'O'nly, + -- turn automatic data detection off (.false.) Then we add a few symbols + -- to the global .constDir: + .application~setDefaults('O', , .false) + .constDir[IDC_LISTVIEW] = 200 + .constDir[IDC_CB] = 201 + + dlg = .SimpleLV~new + if dlg~initCode = 0 then do + dlg~create(30, 30, 325, 200, "In-place Editing List View", "VISIBLE") + dlg~execute("SHOWTOP") + end + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'SimpleLV' subclass UserDialog + +/** defineDialog() + * + * Standard defineDialog. We create a combo box, list-view, and ok button in + * the dialog template. Note the combo box is created invisible. + * + * We add a flag to keep track of whether the combo box is visisble or not. We + * also connect the events we need to monitor. + */ +::method defineDialog + expose cbVisible + + cbVisible = .false + + self~createComboBox(IDC_CB, 10, 20, 40, 12, 'PARTIAL HIDDEN LIST') + self~createListView(IDC_LISTVIEW, 10, 20, 305, 145, "REPORT SHOWSELALWAYS") + self~createPushButton(IDOK, 280, 175, 35, 15, "DEFAULT", "Close") + + self~connectListViewEvent(IDC_LISTVIEW, "CLICK", onClick) + self~connectListViewEvent(IDC_LISTVIEW, "BEGINSCROLL", onBeginScroll) + self~connectListViewEvent(IDC_LISTVIEW, "ENDSCROLL", onBeginScroll) + + +/** initDialog() + * + * Here we do 2 normal things, populate the list-view and populate the combo + * box. + * + * The rest is what makes this work. The isGrandchild() method sets up a + * connection to some of the event notifications sent by the grandchild + * control, to a Rexx method in this dialog. We need that event connection to + * monitor the Esc, Enter key events, and the lost focus event. + * + * The other key thing we do is set the parent of the combo box to be the list + * view. This parent / child relation is what keeps the combo box drawn + * correctly, it ensures that the combo box is drawn over the top of the list + * view. + */ +::method initDialog + expose list cb edit + + list = self~newListView(IDC_LISTVIEW) + cb = self~newComboBox(IDC_CB) + + cb~add('One') + cb~add('Two') + cb~add('Three') + + cb~setParent(list) + cb~isGrandChild + + self~setUpListView(list) + + +/** onClick() + * + * This is the event handler for a click on the list-view. We track the clicks + * and when we see that the user has clicked twice in a row on the same subitem + * we enter editing mode. + * + * When we enter editing mode, we get the rectangle of the subitem we are going + * to edit, size the combo box to that size, position the combo box over the + * subitem, and make the combo box visible. + * + * We set our flag so that we know the combo box is now visible, and assign the + * focus to the combo box. And that's it. + * + * Notice that we set the height of the combo box to 4 times the height of the + * subitem. This allows space for the drop down. + */ +::method onClick unguarded + expose cb cbVisible lastIdx lastCol + use arg id, itemIndex, columnIndex, keyState, , lv + + if lastIdx == itemIndex & lastCol == columnIndex then do + if columnIndex > 0 then do + r = lv~getSubitemRect(itemIndex, columnIndex, 'LABEL') + ret = cb~setWindowPos(lv~hwnd, r~left, r~top - 2, r~right - r~left, 4 * (r~bottom - r~top), "SHOWWINDOW NOZORDERCHANGE") + cbVisible = .true + cb~assignFocus + end + else do + r = lv~getItemRect(itemIndex, 'LABEL') + ret = cb~setWindowPos(lv~hwnd, r~left, r~top, r~right - r~left, 4 * (r~bottom - r~top), "SHOWWINDOW NOZORDERCHANGE") + cbVisible = .true + cb~assignFocus + end + end + + lastIdx = itemIndex; lastCol = columnIndex + + return 0 + + +/** onBeginScroll() + * + * This is the event handler for the begin and end scroll events. When the + * user is in the editing mode and then moves a way from the combo box, we + * interpret that as canceling the edit. + * + * This works fine if the user tabs out of the combo box, used the mouse to + * click outside the combo box, brings somer other application to the fore- + * ground. But, for some reason, clicking on the scroll bars fro the list-view + * does not trigger the onEditGrandChildEvent() handler. This seriously messes + * up the logic. + * + * The begin and / or end scroll event is sent as soon as the user clicks on + * the scroll bars. So, we connect that event and use the event handler to + * hide the combo box if it is visible. + */ +::method onBeginScroll unguarded + expose cbVisible + use arg ctrlID, dx, dy, lv, isBegin + + if cbVisible then self~hideComboBox + return 0 + + +/** onEditGrandChildEvent() + * + * This is the event handler for events that happen in a grandchild control. + * There are 4 events that get forwarded on to the grandfathe dialog. The Esc, + * Tab, and Enter key events, and the lost focus event. Which event is + * specified by the 2nd argument, which uses a keyword to denote the event. + * + * The isGrandChild() method automatically sets up the connection to the 4 + * events. Since we did not request the tab key event be connected, we won't + * get that notification. The other 3 notifications, all signal the end of the + * editing mode. On enter, we need to update the subitem text with the new + * text. + */ +::method onComboBoxGrandChildEvent unguarded + expose list lastIdx lastCol + use arg id, key, cbCtrl + + if key == 'enter' then do + text = cbCtrl~selected~strip + if text \== '' then list~setItemText(lastIdx, lastCol, text) + self~hideComboBox + end + else if key == 'escape' then self~hideComboBox + else if key == 'killfocus' then self~hideComboBox(.false) + + return 0 + + +/** hideComboBox() + * + * Makes the combo box invisible, removes its state, and assign the focus back + * to the list-view. This is done each time the editing mode is ended. + */ +::method hideComboBox private unguarded + expose cb cbVisible list + use strict arg assignFocus = .true + + cb~hide + cbVisible = .false + cb~selectIndex + + if assignFocus then list~assignFocus + + +/** setUpListView() + * + * Sets up the list view by adding the columns and populating the list with + * rows. + */ +::method setUpListView private + use strict arg list + + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~insertColumn(0, "Row (List-view item)", 75) + list~insertColumn(1, "Column 2 (subitem 1)", 70) + list~insertColumn(2, "Column 3 (subitem 2)", 70) + + do i = 1 to 200 + list~addRow(i, , "Row" i, "Row / Col ("i", 2)", "Row / Col ("i", 3)") + end + + diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/editControl.rex b/modules/windows/oodialog/controls/ListView/subitem.editing/editControl.rex new file mode 100755 index 0000000..df09d31 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/editControl.rex @@ -0,0 +1,254 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to embedd an edit control in a list-view, to allow + * the user to edit the subitems in the list-view. + * + * To activate the editing, the user clicks once on a subitem, then clicks one + * more time to activate the editing. An edit control takes the place of the + * subitem in the list-view. + * + * When the user is in the editing mode, hitting enter, escape, or clicking the + * mouse any where else on the scren, ends the editing. If enter is hit, the + * changes are accepted, otherwise, the changes are abandoned. + * + * The key to how this works is creating an invisible edit control, which is + * then made a child of the list-view. When editing mode is entered, the edit + * control is positioned over the subitem, sized to the size of the subitem, + * and made visible. When editing is over, the edit control is made invisible + * again. + * + * The Rexx edit control, after it is made a child of the list-view, can be + * used as normal, with one caveat: Since it is a child of the list-view, the + * edit control no longer sends its event nofications to the dialog. They are + * sent to the list-view. This means that connecting the edit control events + * will have no effect. + */ + + -- Set the defaults for this application. Use the global .constDir 'O'nly, + -- turn automatic data detection off (.false.) Then we add a few symbols + -- to the global .constDir: + .application~setDefaults('O', , .false) + .constDir[IDC_LISTVIEW] = 200 + .constDir[IDC_EDIT] = 201 + + dlg = .SimpleLV~new + if dlg~initCode = 0 then do + dlg~create(30, 30, 325, 200, "In-place Editing List View", "VISIBLE") + dlg~execute("SHOWTOP") + end + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'SimpleLV' subclass UserDialog + +/** defineDialog() + * + * Standard defineDialog. We create an edit control, list-view, and ok button in + * the dialog template. Note the edit control is created invisible. + * + * We add a flag to keep track of whether the edit control is visisble or not. + * We also connect the events we need to monitor. + */ +::method defineDialog + expose editVisible + + editVisible = .false + + self~createListView(IDC_LISTVIEW, 10, 20, 305, 145, "REPORT SHOWSELALWAYS") + self~createEdit(IDC_EDIT, 10, 10, 40, 11, 'AUTHSCROLLH NOTAB HIDDEN') + self~createPushButton(IDOK, 280, 175, 35, 15, "DEFAULT", "Close") + + self~connectListViewEvent(IDC_LISTVIEW, "CLICK", onClick, sync) + self~connectListViewEvent(IDC_LISTVIEW, "BEGINSCROLL", onBeginScroll, .true) + self~connectListViewEvent(IDC_LISTVIEW, "ENDSCROLL", onBeginScroll) + + +/** initDialog() + * + * Here we do 1 normal thing, populate the list-view. + * + * The rest is what makes this work. The isGrandchild() method sets up a + * connection to some of the event notifications sent by the grandchild + * control, to a Rexx method in this dialog. We need that event connection to + * monitor the Esc, Enter key events, and the lost focus event. + * + * The other key thing we do is set the parent of the edit control to be the + * list view. This parent / child relation is what keeps the edit control + * drawn correctly, it ensures that the edit control is drawn over the top of + * the list view. + */ +::method initDialog + expose list edit + + list = self~newListView(IDC_LISTVIEW) + + edit = self~newEdit(IDC_EDIT) + edit~setParent(list) + edit~isGrandChild + + self~setUpListView(list) + + +/** onClick() + * + * This is the event handler for a click on the list-view. We track the clicks + * and when we see that the user has clicked twice in a row on the same subitem + * we enter editing mode. + * + * When we enter editing mode, we get the rectangle of the subitem we are going + * to edit, size the edit control to that size, position the edit control over + * the subitem, and make the edit control visible. + * + * We set our flag so that we know the edit control is now visible, and assign + * the focus to the edti control. And that's it. + */ +::method onClick unguarded + expose edit editVisible lastIdx lastCol + use arg id, itemIndex, columnIndex, keyState, , lv + + if lastIdx == itemIndex & lastCol == columnIndex then do + if columnIndex > 0 then do + r = lv~getSubitemRect(itemIndex, columnIndex, 'LABEL') + + r~right -= r~left + r~bottom -= r~top + flags = "SHOWWINDOW NOZORDERCHANGE" + + edit~setWindowPos(lv~hwnd, r, flags) + + editVisible = .true + edit~assignFocus + end + end + + lastIdx = itemIndex; lastCol = columnIndex + + return 0 + + +/** onBeginScroll() + * + * This is the event handler for the begin and end scroll events. When the + * user is in the editing mode and then moves away from the edit control, we + * interpret that as canceling the edit. + * + * This works fine if the user tabs out of the edit control, used the mouse to + * click outside the edit control, brings some other application to the fore- + * ground. But, for some reason, clicking on the scroll bars for the list-view + * does not trigger the onEditGrandChildEvent() handler. This seriously messes + * up the logic. + * + * The begin and / or end scroll event is sent as soon as the user clicks on + * the scroll bars. So, we connect that event and use the event handler to + * hide the edit control if it is visible. + */ +::method onBeginScroll unguarded + expose editVisible edit + use arg ctrlID, dx, dy, lv, isBegin + + if editVisible then self~hideEdit(edit) + return 0 + + +/** onEditGrandChildEvent() + * + * This is the event handler for events that happen in a grandchild control. + * There are 4 events that get forwarded on to the grandfathe dialog. The Esc, + * Tab, and Enter key events, and the lost focus event. Which event, is + * specified by the 2nd argument, which uses a keyword to denote the event. + * + * The isGrandChild() method automatically sets up the connection to the 4 + * events. Since we did not request the tab key event be connected, we won't + * get that notification. The other 3 notifications, all signal the end of the + * editing mode. On enter, we need to update the subitem text with the new + * text. + */ +::method onEditGrandChildEvent unguarded + expose list lastIdx lastCol + use arg id, key, editCtrl + + if key == 'enter' then do + text = editCtrl~getText~strip + if text \== '' then list~setItemText(lastIdx, lastCol, text) + self~hideEdit(editCtrl) + end + else if key == 'escape' then self~hideEdit(editCtrl) + else if key == 'killfocus' then self~hideEdit(editCtrl, .false) + + return 0 + + +/** hideEdit() + * + * Makes the edit control invisible, removes its text, and, maybe, assigns the + * focus back to the list-view. This is done each time the editing mode is + * ended. + */ +::method hideEdit private unguarded + expose editVisible list + use strict arg editCtrl, assignFocus = .true + + if assignFocus then list~assignFocus + + editCtrl~setText("") + editCtrl~hide + editVisible = .false + + +/** setUpListView() + * + * Sets up the list view by adding the columns and populating the list with + * rows. + */ +::method setUpListView private + use strict arg list + + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~insertColumn(0, "Row (List-view item)", 75) + list~insertColumn(1, "Column 2 (subitem 1)", 70) + list~insertColumn(2, "Column 3 (subitem 2)", 70) + + do i = 1 to 200 + list~addRow(i, , "Row" i, "Row / Col ("i", 2)", "Row / Col ("i", 3)") + end + diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/importList.h b/modules/windows/oodialog/controls/ListView/subitem.editing/importList.h new file mode 100644 index 0000000..4509d67 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/importList.h @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_IMPORTER 401 +#define IDM_MENUBAR 403 +#define IDD_RESULTS 405 +#define IDC_HEADER 1000 +#define IDC_CB 1001 +#define IDC_LV_RESULTS 1001 +#define IDC_EDIT 1002 +#define IDC_LV 1003 +#define IDC_ST_DIRECTORY 1004 +#define IDC_PB_IMPORT 1005 +#define IDC_PB_PROCESS 1006 +#define IDC_ST_DIR_LABEL 1007 +#define IDM_RESET_DIRECTORY 40000 +#define IDM_IMPORT_DIRECTORY 40001 +#define IDM_PROCESS_VIEW 40002 diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/importList.rc b/modules/windows/oodialog/controls/ListView/subitem.editing/importList.rc new file mode 100644 index 0000000..48c81b5 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/importList.rc @@ -0,0 +1,82 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "importList.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDM_MENUBAR MENUEX +{ + POPUP "File", 0, 0, 0 + { + MENUITEM "Reset Directory", IDM_RESET_DIRECTORY, 0, 0 + MENUITEM "Process Current View", IDM_PROCESS_VIEW, 0, 0 + MENUITEM "Import Current Directory", IDM_IMPORT_DIRECTORY, 0, 0 + MENUITEM "Exit", IDOK, 0, 0 + } +} + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_IMPORTER DIALOG 40, 60, 412, 330 +STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_GROUP | WS_MAXIMIZEBOX | WS_POPUP | WS_SYSMENU +CAPTION "Import File Manager - Preview Verison 1.00.04" +FONT 9, "Tahoma" +{ + CONTROL "Review Import File Options, change if necessary, then click Import to import and continue working, Ok to import and quit, Cancel to abort.", IDC_HEADER, WC_STATIC, NOT WS_GROUP | SS_LEFT, 10, 10, 392, 29 + CONTROL "", IDC_LV, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_SHOWSELALWAYS | LVS_REPORT, 10, 44, 392, 250 + CONTROL "", IDC_CB, WC_COMBOBOX, NOT WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST, 10, 265, 40, 12 + CONTROL "", IDC_EDIT, WC_EDIT, NOT WS_VISIBLE | NOT WS_BORDER | NOT WS_TABSTOP | ES_AUTOHSCROLL, 55, 265, 40, 12 + CONTROL "Import Directory:", IDC_ST_DIR_LABEL, WC_STATIC, NOT WS_GROUP | SS_RIGHT | SS_CENTERIMAGE, 11, 306, 59, 14 + CONTROL "C:\Rexx\ooRexx", IDC_ST_DIRECTORY, WC_STATIC, NOT WS_GROUP | SS_LEFT | SS_CENTERIMAGE | SS_NOTIFY | SS_PATHELLIPSIS, 75, 306, 110, 14 + CONTROL "Process", IDC_PB_PROCESS, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON | BS_CENTER | BS_VCENTER, 245, 306, 50, 14 + CONTROL "Import", IDC_PB_IMPORT, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON | BS_CENTER | BS_VCENTER, 191, 306, 50, 14 + CONTROL "OK", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON | BS_CENTER | BS_VCENTER, 300, 306, 50, 14 + CONTROL "Cancel", IDCANCEL, WC_BUTTON, WS_TABSTOP | BS_PUSHBUTTON | BS_CENTER | BS_VCENTER, 352, 306, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_RESULTS DIALOGEX 0, 0, 412, 335 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Processing Results" +FONT 9, "Tahoma", 400, 0, 0 +{ + CONTROL "", IDC_LV_RESULTS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT, 11, 10, 391, 291 + CONTROL "Close", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON, 352, 311, 50, 14 +} diff --git a/modules/windows/oodialog/controls/ListView/subitem.editing/importList.rex b/modules/windows/oodialog/controls/ListView/subitem.editing/importList.rex new file mode 100755 index 0000000..0382141 --- /dev/null +++ b/modules/windows/oodialog/controls/ListView/subitem.editing/importList.rex @@ -0,0 +1,615 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** importList.rex + * + */ + + sd = locate() + .application~setDefaults("O", sd"importList.h", .false) + + files = getInitialFiles() + if files == .nil then return 99 + + if files~items == 0 then initDir = 'C:\' + else initDir = filespec("location", files[1]) + + dlg = .ImporterList~new(sd"importList.rc", IDD_IMPORTER) + if dlg~initCode = 0 then do + dlg~fileList = files + dlg~fileListDirectory = initDir + dlg~Execute("SHOWTOP") + end + +return 0 + +::requires "ooDialog.cls" + +::class 'ImporterList' subclass RcDialog inherit ResizingAdmin + +::constant NORMAL_HTEXT 'Review the import file Options, change if necessary, then click the "Process" button or use the "Process Current View" menu item to process the import files and continue working, click the "Ok" button to process the files and quit, or click the "Cancel" button to quit without processing.' +::constant EMPTY_LIST_HTEXT 'Click the "Import" button to poplulate the list view with the import files.' +::constant EMPTY_ONIMPORT_HTEXT 'The import file list is empty. Reset the import directory and retry the import operation.' +::constant POST_PROCESS_HTEXT 'Double-click on the Import Directory text or use the Reset Dirctory menu item to set up a new import.' + +::attribute fileList +::attribute fileListDirectory + +::method defineSizing + + self~defaultLeft('STATIONARY', 'LEFT') + self~defaultRight('STATIONARY', 'RIGHT') + self~defaultTop('STATIONARY', 'TOP') + self~defaultBottom('STATIONARY', 'BOTTOM') + + self~controlBottom(IDC_HEADER, 'MYTOP', 'TOP') + + self~controlLeft(IDCANCEL, 'STATIONARY', 'RIGHT') + self~controlTop(IDCANCEL, 'STATIONARY', 'BOTTOM') + self~controlRight(IDCANCEL, 'MYLEFT', 'LEFT') + self~controlBottom(IDCANCEL, 'MYTOP', 'TOP') + + self~controlLeft(IDOK, 'STATIONARY', 'LEFT', IDCANCEL) + self~controlTop(IDOK, 'STATIONARY', 'BOTTOM') + self~controlRight(IDOK, 'MYLEFT', 'LEFT') + self~controlBottom(IDOK, 'MYTOP', 'TOP') + + self~controlLeft(IDC_PB_IMPORT, 'STATIONARY', 'LEFT', IDOK) + self~controlTop(IDC_PB_IMPORT, 'STATIONARY', 'BOTTOM') + self~controlRight(IDC_PB_IMPORT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_PB_IMPORT, 'MYTOP', 'TOP') + + self~controlLeft(IDC_PB_PROCESS, 'STATIONARY', 'LEFT', IDC_PB_IMPORT) + self~controlTop(IDC_PB_PROCESS, 'STATIONARY', 'BOTTOM') + self~controlRight(IDC_PB_PROCESS, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_PB_PROCESS, 'MYTOP', 'TOP') + + --self~controlLeft(IDC_ST_DIR_LABEL, 'STATIONARY', 'LEFT', IDC_PB_IMPORT) + self~controlTop(IDC_ST_DIR_LABEL, 'STATIONARY', 'BOTTOM') + self~controlRight(IDC_ST_DIR_LABEL, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_DIR_LABEL, 'MYTOP', 'TOP') + + self~controlLeft(IDC_ST_DIRECTORY, 'STATIONARY', 'RIGHT', IDC_ST_DIR_LABEL) + self~controlTop(IDC_ST_DIRECTORY, 'STATIONARY', 'BOTTOM') + self~controlRight(IDC_ST_DIRECTORY, 'STATIONARY', 'LEFT', IDC_PB_PROCESS) + self~controlBottom(IDC_ST_DIRECTORY, 'MYTOP', 'TOP') + + + return 0 + +::method initDialog + expose hText edit comboBox listView mouse pbProcess pbImport textDir fileListDirectory menuBar + + menuBar = .ScriptMenuBar~new(.application~srcDir"importList.rc", IDM_MENUBAR) + menuBar~attachTo(self) + + hText = self~newStatic(IDC_HEADER) + comboBox = self~newComboBox(IDC_CB) + listView = self~newListView(IDC_LV) + edit = self~newEdit(IDC_EDIT) + + pbProcess = self~newPushButton(IDC_PB_PROCESS) + pbImport = self~newPushButton(IDC_PB_IMPORT) + textDir = self~newStatic(IDC_ST_DIRECTORY) + + self~connectListViewEvent(IDC_LV, "DBLCLK", onLVDClick, .true) + self~connectListViewEvent(IDC_LV, "CLICK", onLVSClick, .true) + self~connectListViewEvent(IDC_LV, "BEGINSCROLL", onLVScroll) + self~connectListViewEvent(IDC_LV, "ENDSCROLL", onLVScroll) + + self~connectButtonEvent(IDC_PB_PROCESS, 'CLICKED', onProcess) + self~connectButtonEvent(IDC_PB_IMPORT, 'CLICKED', onImport) + ret = self~connectStaticEvent(IDC_ST_DIRECTORY, 'DBLCLK', onDirectory) + + menuBar~connectCommandEvent(IDM_PROCESS_VIEW, onProcess) + menuBar~connectCommandEvent(IDM_IMPORT_DIRECTORY, onImport) + menuBar~connectCommandEvent(IDM_RESET_DIRECTORY, onDirectory) + + comboBox~setParent(listView) + comboBox~isGrandchild(onEditGrandChildEvent) + + edit~setParent(listView) + edit~isGrandchild(onEditGrandChildEvent) + + --comboBox~hide + --edit~hide + + textDir~setText(fileListDirectory) + + mouse = .Mouse~new(listView) + + self~initListView + self~onImport + + +::method onDirectory unguarded + expose fileListDirectory fileList pbProcess pbImport textDir listView hText menuBar + + newDir = getNewDirectory(fileListDirectory, self) + if newDir == .nil | newDir == '' then return 0 + + fileListDirectory = newDir + fileList = .nil + textDir~setText(fileListDirectory) + listView~deleteAll + + pbProcess~disable + menuBar~disable(IDM_PROCESS_VIEW) + pbImport~enable + menuBar~enable(IDM_IMPORT_DIRECTORY) + + hText~setText(self~EMPTY_LIST_HTEXT) + +::method onImport unguarded + expose hText listView pbProcess pbImport fileList fileListDirectory menuBar + + if fileList == .nil then do + fileList = getFileList(fileListDirectory) + if fileList == .nil then fileList = onErrorGetFiles(fileListDirectory) + if fileList == .nil then return self~cancel:super + end + + listView~deleteAll + call mssleep(500) -- delay to allow ListView to display before content added + + do i = 1 to fileList~items + buName = 'Z:' || filespec('PATH', fileList[i]) || filespec('NAME', fileList[i]) + listView~addRow(i, , 'Import', buName, fileList[i]) + end + + if fileList~items == 0 then do + hText~setText(self~EMPTY_ONIMPORT_HTEXT) + pbProcess~disable + menuBar~disable(IDM_PROCESS_VIEW) + end + else do + hText~setText(self~getNormalHText) + + pbImport~disable + menuBar~disable(IDM_IMPORT_DIRECTORY) + pbProcess~enable + menuBar~enable(IDM_PROCESS_VIEW) + end + + +::method onProcess unguarded + expose listView pbProcess pbImport hText menuBar + + buNamesImport = .array~new + buNamesReplace = .array~new + importNames = .array~new + replaceNames = .array~new + count = listView~items + skipCount = 0 + + do i = 0 to count - 1 + verb = listView~itemText(i, 0) + select + when verb == 'Skip' then do + skipCount += 1 + end + when verb == 'Import' then do + buNamesImport~append(listView~itemText(i, 1)) + importNames~append(listView~itemText(i, 2)) + end + when verb == 'Replace' then do + buNamesReplace~append(listView~itemText(i, 1)) + replaceNames~append(listView~itemText(i, 2)) + end + end + -- End select + end + + title = 'Import Manager' + msg = 'Projected Import Processing Statistics:' || .endOfLine~copies(2) + msg ||= 'Skipping files:' || '09'x || skipCount || .endOfLine + msg ||= 'Importing files:' || '09'x || importNames~items || .endOfLine + msg ||= 'Replacing files:' || '09'x || replaceNames~items || .endOfLine~copies(2) + msg ||= 'Process files?' + + if messageDialog(msg, self~hwnd, title, 'YESNO', 'INFORMATION') == self~IDNO then return 0 + + col1width = 0 + col4width = 0 + do i = 1 to buNamesImport~items + s = listView~getTextSizePx(buNamesImport[i]) + if s~width > col1width then col1width = s~width + + s = listView~getTextSizePx(importNames[i]) + if s~width > col4width then col4width = s~width + end + + do i = 1 to buNamesReplace~items + s = listView~getTextSizePx(buNamesReplace[i]) + if s~width > col1width then col1width = s~width + + s = listView~getTextSizePx(replaceNames[i]) + if s~width > col4width then col4width = s~width + end + + dlg = .ResultList~new("importList.rc", IDD_RESULTS) + if dlg~initCode = 0 then do + dlg~buNamesImport = buNamesImport + dlg~buNamesReplace = buNamesReplace + dlg~importNames = importNames + dlg~replaceNames = replaceNames + dlg~col1width = col1width + dlg~col4width = col4width + dlg~execute("SHOWTOP") + end + + listView~deleteAll + + pbImport~disable + pbProcess~disable + menuBar~disable(IDM_IMPORT_DIRECTORY) + menuBar~disable(IDM_PROCESS_VIEW) + + hText~setText(self~POST_PROCESS_HTEXT) + + return 0 + + +::method initListView private + expose hText listView comboBox cbVisible editVisible + + baksize = 25 + impsize = 25 + optsize = 10 * 8 + impsize = (impsize + 3) * 8 + baksize = (baksize + 3) * 8 + + listView~addExtendedStyle("FULLROWSELECT GRIDLINES HEADERDRAGDROP") + listView~insertColumnPX(0, "Option", optsize, "LEFT") + listView~insertColumnPX(1, "Backup Filename to Import", impsize, "LEFT") + listView~insertColumnPX(2, "Import To:", baksize, "LEFT") + + comboBox~add("Import") + comboBox~add("Replace") + comboBox~add("Skip") + comboBox~selectIndex(1) + cbVisible = .false + editVisible = .false + + +::method ok unguarded + expose pbProcess + + if pbProcess~isEnabled then self~onProcess + return self~ok:super + +-- Used to process double click, and modify the list view if the double click +-- was on column 2 +::method onLVDClick unguarded + expose currentIndex currentColumn comboBox edit cbVisible editVisible + use arg id, itemIndex, columnIndex, keyState, , lv + + currentIndex = itemIndex + currentColumn = columnIndex + + if columnIndex == 2 then do + text = lv~itemText(itemIndex, columnIndex) + + r = lv~getSubitemRect(itemIndex, columnIndex, "BOUNDS") + edit~setWindowPos(lv~hwnd, r~left, r~top, r~right - r~left, - + r~bottom - r~top, "SHOWWINDOW NOZORDERCHANGE") + + edit~setText(text) + edit~assignFocus + edit~show + editVisible = .true + end + + return 0 + +-- Used to process single click, and modify the list view if the single click +-- was on column 0 +::method onLVSClick unguarded + expose currentIndex currentColumn comboBox edit cbVisible editVisible + use arg id, itemIndex, columnIndex, keyState, , lv + + currentIndex = itemIndex + currentColumn = columnIndex + + if editVisible, columnIndex <> 2 then do + -- This is not needed, lost focus event happens first. + editVisible = .false + edit~hide + end + + if self~goodColumn0(itemIndex, columnIndex, lv) then do + -- Set the combo box selection to match the current text of the list view + -- item before it is shown. + curText = lv~itemText(itemIndex) + comboBox~select(curText) + + r = lv~getSubitemRect(itemIndex, columnIndex, "LABEL") + comboBox~setWindowPos(lv~hwnd, r~left, r~top - 3, r~right - r~left, - + 4 * (r~bottom - r~top), "SHOWWINDOW NOZORDERCHANGE") + + cbVisible = .true + comboBox~assignFocus + comboBox~show + end + return 0 + + +-- Used to detect when focus is on/off scroll +::method onLVScroll unguarded + expose comboBox edit cbVisible editVisible + use arg ctrlID, dx, dy, listView, isBeginScroll + + return self~acceptUserInput('none') + +-- The event handler for both the grandchild edit and comob box controls. +-- Invoked when the grandchild receives an enter, esc, or lost focus event. +::method onEditGrandChildEvent unguarded + expose comboBox edit listView cbVisible editVisible currentIndex currentColumn + use arg id, keyEvent, p3, p4, p5 + + return self~acceptUserInput(keyEvent) + +::method acceptUserInput private unguarded + expose comboBox edit listView cbVisible editVisible currentIndex currentColumn + use arg keyEvent + + if cbVisible then do + text = comboBox~selected + cbVisible = .false + comboBox~hide + if keyEvent <> 'escape' then listView~modify(currentIndex, currentColumn, text) + if keyEvent == 'none' then do + listView~redrawItems(currentIndex - 1, currentIndex + 1) + listView~updateWindow + end + end + else if editVisible = .true then do + text = edit~getText~strip + editVisible = .false + edit~hide + if keyEvent <> 'escape' then listView~modify(currentIndex, currentColumn, text) + end + + return 0 + + +-- Determines if a reported single click is a valid click for opening the combo +-- box. Clicks that are below the last item in the view can have column == 0, +-- but the item index will be -1. In addition, if the list view has more items +-- than fit on a single page, click to the right of the last column can return +-- 0 for the column index. The only way to detect this situation is to check +-- the mouse postion and use hitTestInfo() to have the list view tell us whern +-- the mouse is. +::method goodColumn0 unguarded private + expose mouse + use strict arg index, colIndex, listView + + if colIndex == 0, index <> -1 then do + pos = mouse~getCursorPos + listView~screen2client(pos) + info = .directory~new + listView~hitTestInfo(pos, info) + if info~info == 'OnLabel' then return .true + end + + return .false + +::method getNormalHText private + + return 'Review the import file Options, change if necessary, then click ' || - + 'the "Process" button or use the "Process Current View" menu item ' || - + 'to process the import files and continue working, click the "Ok" ' || - + 'button to process the files and quit, or click the "Cancel" button ' || - + 'to quit without processing. The "Exit" menu item also quits without' || - + 'processing.' + + +::class 'ResultList' subclass RcDialog inherit ResizingAdmin + +::attribute buNamesImport +::attribute buNamesReplace +::attribute importNames +::attribute replaceNames +::attribute col1width +::attribute col4width + +::method defineSizing + + self~defaultLeft('STATIONARY', 'LEFT') + self~defaultRight('STATIONARY', 'RIGHT') + self~defaultTop('STATIONARY', 'TOP') + self~defaultBottom('STATIONARY', 'BOTTOM') + + self~controlLeft(IDOK, 'STATIONARY', 'RIGHT') + self~controlTop(IDOK, 'STATIONARY', 'BOTTOM') + self~controlRight(IDOK, 'MYLEFT', 'LEFT') + self~controlBottom(IDOK, 'MYTOP', 'TOP') + + return 0 + +::method initDialog + + listView = self~newListView(IDC_LV_RESULTS) + + s = listView~getTextSizePx("Importing") + col0width = s~width + + s = listView~getTextSizePx("Replacing") + if s~width > col0width then col0widt = s~width + + s = listView~getTextSizePx("-->") + col2width = s~width + + -- Need some margins + col0width += 12 + col2width += 12 + self~col1width += 12 + self~col4width += 12 + + listView~addExtendedStyle("FULLROWSELECT GRIDLINES HEADERDRAGDROP") + + listView~insertColumnPX(0, "Action", col0width, "LEFT") + listView~insertColumnPX(1, "Source File", self~col1width, "LEFT") + listView~insertColumnPX(2, "To", col2width, "CENTER") + listView~insertColumnPX(3, "Destination File", self~col4width, "LEFT") + + + do i = 1 to self~buNamesImport~items + listView~addRow(i, , 'Importing', self~buNamesImport[i], '-->', self~importNames[i]) + end + + k = i + do i = 1 to self~buNamesReplace~items + k += 1 + listView~addRow(k, , 'Replacing', self~buNamesReplace[i], '-->', self~replaceNames[i]) + end + + + +-- Try to get a list of the files in the ooRexx installation to use for the list +::routine getInitialFiles + + initDir = value('REXX_HOME', , 'ENVIRONMENT') + if initDir == '' then do + title = 'Importer File Location Error' + msg = 'Could not locate the default importer file list' || .endOfLine || - + 'directory.' || .endOfLine~copies(2) || - + 'Do you wish to pick an alternative directory?' || .endOfLine~copies(2) || - + 'Yes to select an alternative directory for the initial' || .endOfLine || - + 'file list. No to open the importer with an empty' || .endOfLine || - + 'file list. Cancel to end the importer application.' + + ret = MessageDialog(msg, 0, title, 'YESNOCANCEL', 'WARNING') + select + when ret == .PlainBaseDialog~IDNO then return .array~new + when ret == .PlainBaseDialog~IDCANCEL then return .nil + otherwise nop + end + -- End select + + banner = 'Normally the importer opens with the default importer files, ' || - + 'but the default files can not be located. Select the folder ' || - + 'to use for the initial import file list.' + hint = 'If this dialog is canceled, the importer will open with an empty file list.' + + bff = .BrowseForFolder~new('Locate Importer Files', banner, hint, 'C:\') + bff~root = 'CSIDL_DRIVES' + bff~options = bff~options 'NONEWFOLDERBUTTON' + + initDir = bff~getFolder + if initDir == .nil then return .array~new + end + + files = getFileList(initDir) + if files == .nil then files = onErrorGetFiles() + + return files + +::routine getFileList + use strict arg directory + + fileSpec = directory'\*' + ret = SysFileTree(fileSpec, f., 'FO') + if ret <> 0 then do + title = 'Operating System Error' + msg = 'Operating system error searching for files' || .endOfLine~copies(2) || - + 'Directory:' || '09'x~copies(2) || directory || .endOfLine || - + 'Error code:' || '09'x || ret || .endOfLine || - + 'Error text:' || '09'x~copies(2) || SysGetErrorText(ret) + + ret = MessageDialog(msg, 0, title, 'OK', 'WARNING') + return .nil + end + + files = .array~new(f.0) + do i = 1 to f.0 + files[i] = f.i + end + + return files + +::routine onErrorGetFiles + use strict arg initialDir = 'C:\' + + title = 'Importer File Location Error' + msg = 'An operating system error occurred trying to get' || .endOfLine || - + 'the file list.' || .endOfLine~copies(2) || - + 'Do you wish to try again?' || .endOfLine~copies(2) || - + 'Abort closes the importer application.' + + ret = MessageDialog(msg, 0, title, 'ABORTRETRYIGNORE', 'ERROR') + select + when ret == .PlainBaseDialog~IDIGNORE then return .array~new + when ret == .PlainBaseDialog~IDABORT then return .nil + otherwise nop + end + -- End select + + banner = 'Select the directory containing the importer files.' + hint = 'If this dialog is canceled, the importer will use an empty file list.' + + bff = .BrowseForFolder~new('Locate Importer Files', banner, hint, initialDir) + bff~root = 'CSIDL_DRIVES' + bff~options = bff~options 'NONEWFOLDERBUTTON' + + initDir = bff~getFolder + if initDir == .nil then return .array~new + + files = getFileList(initDir) + if files == .nil then files = onErrorGetFiles() + + return files + + +-- Use the BrowseForFolder class to prompted the user for a directory. +::routine getNewDirectory + use strict arg initialDir = 'C:\', owner = .nil + + banner = 'Select a new import file directory. The Import File Manager ' || - + 'will display the import files, allowing the import operation ' || - + 'to be configured and then processed.' + hint = 'If this dialog is canceled, the import file list will remain unchanged.' + + bff = .BrowseForFolder~new('Locate Importer Files', banner, hint, initialDir) + bff~root = 'CSIDL_DRIVES' + bff~options = bff~options 'NONEWFOLDERBUTTON' + bff~owner = owner + + return bff~getFolder + + + diff --git a/modules/windows/oodialog/controls/PaidHolidays.rex b/modules/windows/oodialog/controls/PaidHolidays.rex new file mode 100755 index 0000000..409c02e --- /dev/null +++ b/modules/windows/oodialog/controls/PaidHolidays.rex @@ -0,0 +1,251 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Simple example of using the month calendar control. + * + * Although this example is relatively simple, it shows how to use a number of + * features of the month calendar: + * + * * How to size a month calendar to its optimal size. + * * How to restrict the range of months the calendar displays. + * * How to determine which month(s) are currently displayed in the control. + * * How to customize the calendar and display certain dates in bold. + * * How to connect and respond to the GETDAYSTATE event. + * + * The application is for a hypothetical company, used to show the paid holidays + * for the current year. The dialog displays a month calendar for the current + * year and as the user pages through the months, the paid holidays are high- + * lighted in the calendar by bolding the dates. + * + * Note that to keep this simple, the "current" year is rather hard-coded. + * However, it would not be too hard to enhance the program to calculate the + * paid holidays dynamically. + * + * To fully understand this program, please read the ooDialog doc. + */ + + sd = locate() + .application~useGlobalConstDir("O", sd"paidHolidays.h") + + dlg = .HolidayCalendarDlg~new(sd"paidHolidays.rc", IDD_HOLIDAY_DLG) + + if dlg~initCode == 0 then do + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + end + else do + say + say "Error creating dialog, aborting." + return 99 + end + +return 0 + +::requires "ooDialog.cls" + +::class 'HolidayCalendarDlg' subclass RcDialog + +::method initDialog + expose calendar + + -- Connect the GETDAYSTATE event. + self~connectMonthCalendarEvent(IDC_MC_HOLIDAYS, "GETDAYSTATE", onGetDayState) + + calendar = self~newMonthCalendar(IDC_MC_HOLIDAYS) + + -- Size the calendar to its optimal size + self~sizeCalendar(calendar) + + -- Restrict the calendar so that it only displays the year 2011. + start = .DateTime~fromStandardDate("20110101") + end = .DateTime~fromStandardDate("20111231") + + calendar~setRange(.array~of(start, end)) + + -- Determine which months are currently displayed in the calendar. The first + -- and last months showing are returned in the passed in array as .DateTime + -- objects. The return from getMonthRange() is the number of months + -- displayed. The 'P' argument means to include Partially shown months. + monthsShowing = .array~new + count = calendar~getMonthRange(monthsShowing, 'P') + + -- Bold the appropriate days in the month(s) currently showing. To do that, + -- we need an array of .DayState objects. + dayStates = self~getDayStateArray(monthsShowing[1], count) + calendar~setDayState(dayStates) + + +-- This is the GETDAYSTATE event handler. The underlying month calendar sends +-- this notification whenever it needs to refresh the calendar display for a +-- new month. The arguments are a .DateTime object that specifies the first +-- month to get the day state for and the second argument is the count of months +-- needed. To reply to this notification we need to return a buffer containing +-- the required day states. Creating the buffer correctly needs to be done +-- through the .DayStates class, where a class method is provided to create the +-- buffer. +::method onGetDayState unguarded + expose calendar + use arg startDate, count + + dayStates = self~getDayStateArray(startDate, count) + + buffer = .DayStates~makeDayStateBuffer(dayStates) + return buffer + + +-- This function resizes the calendar to its optimal size. The getMinRect() +-- method of the MonthCalendar returns the minimum required size to completely +-- display a full month. The method fills in the .Rect object with the correct +-- size. The top and left attributes in the returned .Rect are always set to 0, +-- so the right and bottom attributes are the width and height, in pixels, +-- needed for the calendar. We then use the return to adjust the size of the +-- calendar, while leaving the postion of the top, left corner of the calendar +-- at the same spot. +-- +-- The dialog was originally designed on XP using a resource editor, and looked +-- great. But, on Vista and Windows 7, the calendar takes up more room and +-- overlaps the static text and Ok button controls. So, if it is Vista or +-- later, we adjust the size of the dialog and the position of those controls. +-- The adjustment is really just a matter of getting some data, (sizes and +-- current positions,) and doing the math. +-- +-- The same relative positioning of the controls is done. I.e., in the original +-- dialog template the top of the Ok button is placed at the bottom edge of the +-- month calendar control. The static text control is placed 1/2 the margin to +-- the right of calendar, etc.. +::method sizeCalendar private + use strict arg calendar + + r = .Rect~new + if \ calendar~getMinRect(r) then return 0 + + calendar~resizeTo(.Size~new(r~right, r~bottom)) + + if .OS~isAtLeastVista then do + static = self~newStatic(IDC_ST_MSG) + button = self~newPushButton(IDOK) + + -- Get the current window rectangles of the controls and mapped them to the + -- client area of the dialog. + mcRect = calendar~windowRect + self~screen2client(mcRect) + + stRect = static~windowRect + self~screen2client(stRect) + + okRect = button~windowRect + self~screen2client(okRect) + + -- The position of the top left corner of the month calendar control defines + -- the margins + marginLeft = mcRect~left + marginTop = mcRect~top + + -- Calculate what the new size of the dialog will need to be to contain the + -- moved controls and resize the dialog to that. + newWidth = (marginLeft * 2) + (marginLeft % 2) + (mcRect~right - mcRect~left) + (stRect~right - stRect~left) + newHeight = (marginTop * 2) + (mcRect~bottom - mcRect~top) + (okRect~bottom - okRect~top) + + -- The new size of the dialog has to take into account the size of the + -- window frame and the caption bar. + newWidth += .SM~cxFixedFrame * 2 + newHeight += (.SM~cyFixedFrame * 2) + .SM~cyCaption + self~resizeTo(newWidth, newHeight) + + -- Move the static control to the right of the month calendar with a space + -- 1/2 the width of the marging between them + newX = mcRect~right + (marginLeft % 2) + static~moveTo(newX, stRect~top) + + -- Move the Ok button so that the top edge of the button aligns with the + -- bottom edge of the month calendar and the right edge of the button is + -- even with the margin on the right. (Left and right margins are equal.) + clRect = self~clientRect + newX = clRect~right - marginLeft - (okRect~right - okRect~left) + button~moveTo(newX, mcRect~bottom) + end + + +-- This function returns an array of .DayState objects for the specified months. +-- A day state object specifies which days in a month should be bolded. +::method getDayStateArray private unguarded + use strict arg startMonth, count + + -- Create the array to hold the .DayState objects. + d = .array~new(count) + + -- We know that the month calendar always asks for any partially displayed + -- months. We also know that our calendar only displays 1 month completely, + -- and displays the partial month preceding and the partial month following. + -- Therefore, if the complete month is January 2011, the preceding month will + -- be December 2010. Likewise we know that the range set for the calendar is + -- January 2011 through December 2011, January 2012 can never be shown, so + -- December 2011 can never be a preceding month. Therefore, if the start + -- month is 12, it must be December 2010. We give that month a 0 number so + -- that getDayState() will return an empty .DayState object. + month = startMonth~month + if month == 12 then month = 0 + + do i = 1 to count + d[i] = self~getDayState(month + i - 1) + end + + return d + +-- This function initalizes a .DayState object to the proper value depending on +-- the month specified. +::method getDayState private unguarded + use strict arg month + + select + when month == 1 then ds = .DayState~new(17) + when month == 2 then ds = .DayState~new(21) + when month == 3 then ds = .DayState~new + when month == 4 then ds = .DayState~new + when month == 5 then ds = .DayState~new(30) + when month == 6 then ds = .DayState~new + when month == 7 then ds = .DayState~new(4) + when month == 8 then ds = .DayState~new + when month == 9 then ds = .DayState~new(5) + when month == 10 then ds = .DayState~new + when month == 11 then ds = .DayState~new(24, 25) + when month == 12 then ds = .DayState~new(23, 30) + otherwise ds = .DayState~new() + end + -- End select + + return ds diff --git a/modules/windows/oodialog/controls/ReadMe.txt b/modules/windows/oodialog/controls/ReadMe.txt new file mode 100644 index 0000000..c5698a1 --- /dev/null +++ b/modules/windows/oodialog/controls/ReadMe.txt @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Dialog Control Example Programs + ----------------------------------------------- + + This directory and subdirectory contain example programs that demonstrate + how to use the various dialog control objects in ooDialog. It is intended + that, eventually there will be an example of all the control objects. The + programs are intended to show several of the methods of the control + objects. This will probably cause them to be medium complex. + + Many of the example programs are in dialog control subdirectories to make + it easy to find examples of a specific control. List-view examples in the + ListView subdirectory, ToolTip examples in the ToolTip subdirectory, etc.. + + - fiscalReports.rex + + Demonstrates how to use the DateTimePicker control. This example + focuses on how to use call back fields in the format string for the + DateTimePicker control and how to respond to the FORMATQUERY, FORMAT, + and KEYDOWN notifications. + + - paidHolidays.rex + + Shows how to use a MonthCalendar control, including responding to the + GETDAYSTATE event. Also shows how to: restrict the time span shown in + the calendar, resize the calendar to the optimal size, and determine + which months are currently displayed. + + - upDown.rex + + Demonstrates how to use the UpDown class. An up down control is a pair + of arrow buttons that the user can click to increment or decrement a + value, such as a scroll position or a number displayed in a companion + control. + + - userStringDTP.rex + + Demonstrates how to use the DateTimePicker control. This example + focuses on the USERSTRING notification. The USERSTRING notification is + sent when the user finishes editing in the DTP control. Only DTP + controls with the CANPARSE style send this notification. It allows the + program to provide the user with the capability of typing within the DTP + control. The program can then provide a custom response when the user + has finished typing. + diff --git a/modules/windows/oodialog/controls/ToolBar/customizeToolBar.rex b/modules/windows/oodialog/controls/ToolBar/customizeToolBar.rex new file mode 100755 index 0000000..dcab798 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/customizeToolBar.rex @@ -0,0 +1,312 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** customizeToolBar.rex + * + * The main purpose of this example is to show how to make the built-in + * customization features of the toolbar available to the users of your + * application. It also shows how to connect many of the event notifications of + * the toolbar. + * + * + * + */ + + sd = locate() + .application~useGlobalConstDir('O') + + dlg = .CustomizableToolBar~new(sd'rc\customizeToolBar.dll', IDD_TBAR, , sd'rc\customizeToolBar.h') + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'CustomizableToolBar' subclass ResDialog + +::method init + expose buttons + forward class (super) continue + + self~connectButtonEvent(IDB_ARROW_LEFT, 'CLICKED', onArrowLeft) + self~connectButtonEvent(IDB_ARROW_RIGHT, 'CLICKED', onArrowRight) + self~connectButtonEvent(IDB_COPY_CLIPBOARD, 'CLICKED', onCopyClipBoard) + self~connectButtonEvent(IDB_COPY_TO_FOLDER , 'CLICKED', onCopyToFolder) + self~connectButtonEvent(IDB_CUT_CLIPBOARD, 'CLICKED', onCutClipBoard) + self~connectButtonEvent(IDB_DELETE , 'CLICKED', onDelete) + self~connectButtonEvent(IDB_FAVORITES , 'CLICKED', onFavorites) + self~connectButtonEvent(IDB_FOLDER_CLOSED , 'CLICKED', onFolderClosed) + self~connectButtonEvent(IDB_MOVE_TO_FOLDER , 'CLICKED', onMoveToFolder) + self~connectButtonEvent(IDB_PASTE_CLIPBOARD, 'CLICKED', onPasteClipboard) + self~connectButtonEvent(IDB_SEARCH , 'CLICKED', onSearch) + + self~connectToolBarEvent(IDC_TOOLBAR, 'BEGINADJUST') + self~connectToolBarEvent(IDC_TOOLBAR, 'ENDADJUST') + self~connectToolBarEvent(IDC_TOOLBAR, 'CUSTHELP') + self~connectToolBarEvent(IDC_TOOLBAR, 'DELETINGBUTTON') + self~connectToolBarEvent(IDC_TOOLBAR, 'GETBUTTONINFO') + self~connectToolBarEvent(IDC_TOOLBAR, 'INITCUSTOMIZE') + self~connectToolBarEvent(IDC_TOOLBAR, 'QUERYDELETE') + self~connectToolBarEvent(IDC_TOOLBAR, 'QUERYINSERT') + self~connectToolBarEvent(IDC_TOOLBAR, 'RELEASEDCAPTURE') + self~connectToolBarEvent(IDC_TOOLBAR, 'TOOLBARCHANGE') + + tbb1 = .TbButton~new(IDB_ARROW_LEFT , "Previous" , "BUTTON", "ENABLED", , 1) + tbb2 = .TbButton~new(IDB_ARROW_RIGHT , "Next" , "BUTTON", "ENABLED", , 2) + tbb3 = .TbButton~new(IDB_COPY_CLIPBOARD , "Copy to clipboard" , "BUTTON", "ENABLED", , 3) + tbb5 = .TbButton~new(IDB_COPY_TO_FOLDER , "Copy to folder" , "BUTTON", "ENABLED", , 4) + tbb4 = .TbButton~new(IDB_CUT_CLIPBOARD , "Cut to clipboard" , "BUTTON", "ENABLED", , 5) + tbb6 = .TbButton~new(IDB_DELETE , "Delete" , "BUTTON", "ENABLED", , 6) + tbb7 = .TbButton~new(IDB_FAVORITES , "Favorites" , "BUTTON", "ENABLED", , 7) + tbb8 = .TbButton~new(IDB_FOLDER_CLOSED , "Close folder" , "BUTTON", "ENABLED", , 8) + tbb9 = .TbButton~new(IDB_MOVE_TO_FOLDER , "Move to folder" , "BUTTON", "ENABLED", , 9) + tbb10 = .TbButton~new(IDB_PASTE_CLIPBOARD, "Paste from clipboard" , "BUTTON", "ENABLED", , 10) + tbb11 = .TbButton~new(IDB_SEARCH , "Search, for something", "BUTTON", "ENABLED", , 11) + + self~storeButtonText + buttons = .array~of(tbb1, tbb2, tbb3, tbb4, tbb5, tbb6, tbb7, tbb8, tbb9, tbb10, tbb11) + + +::method initDialog + expose tb buttons listBox + + tb = self~newToolBar(IDC_TOOLBAR) + + ret = tb~setExtendedStyle('DOUBLEBUFFER MIXEDBUTTONS') + ret = tb~setBitmapSize(.Size~new(24, 24)) + + self~loadImageList(tb) + self~setupListBox + + -- We only add the first 3 buttons here. + btns = .array~of(buttons[1], buttons[2], buttons[3]) + ret = tb~addButtons(btns) + + ret = tb~setButtonText("Previous", IDB_ARROW_LEFT) + ret = tb~setButtonText("Next", IDB_ARROW_RIGHT) + ret = tb~setButtonText("Copy to clipboard", IDB_COPY_CLIPBOARD) + + -- Now that the tool bar has its buttons, tell it to recalculate its size. + tb~autoSize + + -- And show the tool bar. + tb~show + tb~assignFocus + + +::method onArrowLeft unguarded + expose tb listBox + self~add('Current text:' tb~getButtonTextEx(IDB_ARROW_LEFT)) + +::method onArrowRight unguarded + expose tb listBox + self~add('Current text:' tb~getButtonTextEx(IDB_ARROW_RIGHT)) + +::method onCopyClipboard unguarded + expose tb listBox + self~add('Current text:' tb~getButtonTextEx(IDB_COPY_CLIPBOARD)) + +::method onCopyToFolder unguarded + expose tb listBox + self~add('Current text:' tb~getButtonTextEx(IDB_COPY_TO_FOLDER)) + + +::method onGetButtonInfo unguarded + expose buttons listBox + use arg id, index, textLen, tbb, toobar + + self~add('TBN_GETBUTTONINFO buttonindex:' index) + if index > buttons~items then return .false + + self~mergeButtons(tbb, buttons[index]) + return .true + +::method onQueryDelete unguarded + expose listBox + use arg id, index, tbb, toolbar + + self~add('TBN_QUERYDELETE buttonindex:' index 'cmdID:' tbb~cmdID) + return .true + +::method onQueryInsert unguarded + expose listBox + use arg id, index, tbb, toolbar + + self~add('TBN_QUERYINSERT buttonindex:' index 'cmdID:' tbb~cmdID) + return .true + + +::method onReleasedCapture unguarded + expose listBox + use arg id, toolBar + self~add('NM_RELEASEDCAPTURE') + + return 0 + +::method onBeginAdjust unguarded + expose listBox + + self~add('TBN_BEGINADJUST') + return .true + +::method onCustHelp unguarded + expose listBox + + self~add('TBN_CUSTHELP') + return .true + +::method onDeletingButton unguarded + expose listBox + use arg id, cmdID, toolbar + + self~add('TNB_DELETINGBUTTON cmdID:' cmdID) + return 0 + +::method onInitCustomize unguarded + expose listBox + + self~add('TBN_INITCUSTOMIZE') + return .true + +::method onEndAdjust unguarded + expose listBox + use arg id, tb + self~add('TBN_ENDADJUST') + + count = tb~buttonCount + do i = 1 to count + cmdID = tb~indexToCommand(i) + if cmdID <> 0, cmdID <> .nil then self~resetText(cmdID) + end + return 0 + +::method onToolBarChange unguarded + expose buttonTextSet listBox + use arg id, tb + self~add('TBN_TOOLBARCHANGE') + + return 0 + +::method leaving + expose font imageList + imageList~release + self~deleteFont(font) + +::method mergeButtons unguarded private + use strict arg button1, button2 + + button1~bitmapID = button2~bitmapID + button1~cmdID = button2~cmdID + button1~itemData = button2~itemData + button1~state = button2~state + button1~style = button2~style + button1~text = button2~text + +::method printTbb unguarded private + use arg tbb + + say 'bitmapID:' tbb~bitmapID + say 'cmdID: ' tbb~cmdID + say 'itemData:' tbb~itemData + say 'state: ' tbb~state + say 'style: ' tbb~style + say 'text: ' tbb~text + say + +::method loadImageList private + expose imageList + use strict arg tb + + flags = 'COLOR32 MASK' + cRef = .Image~colorRef(255, 0, 255) + + ri = .ResourceImage~new(self) + imageBMP = ri~getImage(IDB_BUTTONS_IL) + + imageList = .ImageList~create(.Size~new(24, 24), flags, 20, 0) + + index = imageList~addMasked(imageBMP, cRef) + old = tb~setImageList(imageList) + + imageBMP~release + +::method setupListBox private + expose listBox font maxItems + + font = self~createFontEx('Courier New') + size = self~getTextSizePX('A'~copies(50)) + + listBox = self~newListBox(IDC_LB_EVENTS) + listBox~setFont(font) + listBox~setWidthPX(size~width) + + maxItems = listBox~clientRect~bottom % listBox~itemHeightPX + +::method add unguarded private + expose listBox maxItems + use strict arg text + + index = listBox~add(text) + if index + listBox~getFirstVisible >= maxItems then listBox~makeFirstVisible(index - maxItems + 1) + +::method storeButtonText private + expose buttonTextTable + + table = .table~new + table[.constDir[IDB_ARROW_LEFT]] = "Previous" + table[.constDir[IDB_ARROW_RIGHT]] = "Next" + table[.constDir[IDB_COPY_CLIPBOARD]] = "Copy to clipboard" + table[.constDir[IDB_COPY_TO_FOLDER]] = "Copy to folder" + table[.constDir[IDB_CUT_CLIPBOARD]] = "Cut to clipboard" + table[.constDir[IDB_DELETE]] = "Delete" + table[.constDir[IDB_FAVORITES]] = "Favorites" + table[.constDir[IDB_FOLDER_CLOSED]] = "Close folder" + table[.constDir[IDB_MOVE_TO_FOLDER]] = "Move to folder" + table[.constDir[IDB_PASTE_CLIPBOARD]] = "Paste from clipboard" + table[.constDir[IDB_SEARCH]] = "Search, for something" + + buttonTextTable = table + +::method resetText unguarded private + expose tb buttonTextTable + use arg cmdID + + ret = tb~setButtonText(buttonTextTable[cmdID], cmdID) diff --git a/modules/windows/oodialog/controls/ToolBar/rc/ToolBar11IL.bmp b/modules/windows/oodialog/controls/ToolBar/rc/ToolBar11IL.bmp new file mode 100644 index 0000000..723d3c4 Binary files /dev/null and b/modules/windows/oodialog/controls/ToolBar/rc/ToolBar11IL.bmp differ diff --git a/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.dll b/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.dll new file mode 100644 index 0000000..b20baa7 Binary files /dev/null and b/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.dll differ diff --git a/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.h b/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.h new file mode 100644 index 0000000..2eb5de1 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.h @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_TBAR 101 +#define IDB_BUTTONS_IL 411 +#define IDC_LB_EVENTS 1001 +#define IDC_TOOLBAR 1003 + + +#define IDB_ARROW_LEFT 200 +#define IDB_ARROW_RIGHT 201 +#define IDB_COPY_CLIPBOARD 202 +#define IDB_COPY_TO_FOLDER 203 +#define IDB_CUT_CLIPBOARD 204 +#define IDB_DELETE 205 +#define IDB_FAVORITES 206 +#define IDB_FOLDER_CLOSED 207 +#define IDB_MOVE_TO_FOLDER 208 +#define IDB_PASTE_CLIPBOARD 209 +#define IDB_SEARCH 210 diff --git a/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.rc b/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.rc new file mode 100644 index 0000000..ab8dcf6 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/rc/customizeToolBar.rc @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "customizeToolBar.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_BUTTONS_IL BITMAP ".\\ToolBar11IL.bmp" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TBAR DIALOGEX 0, 0, 256, 166 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Customizable ToolBar Example" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_TOOLBAR, "ToolbarWindow32", WS_TABSTOP | WS_BORDER | TBSTYLE_TOOLTIPS | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_ALTDRAG | CCS_ADJUSTABLE, 1, 1, 238, 20 + CONTROL "Event Notifications:", IDC_STATIC, WC_STATIC, NOT WS_GROUP | SS_LEFT, 11, 25, 69, 10 + CONTROL "", IDC_LB_EVENTS, WC_LISTBOX, WS_TABSTOP | WS_BORDER | WS_HSCROLL | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_NOTIFY, 11, 37, 235, 100 + CONTROL "OK", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON, 144, 142, 50, 14 + CONTROL "Cancel", IDCANCEL, WC_BUTTON, WS_TABSTOP | BS_PUSHBUTTON, 196, 142, 50, 14 +} diff --git a/modules/windows/oodialog/controls/ToolBar/rc/res.mak b/modules/windows/oodialog/controls/ToolBar/rc/res.mak new file mode 100644 index 0000000..3ca8c99 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/rc/res.mak @@ -0,0 +1,55 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file for ooDialog resource DLLs + +rcflags_common = /DWIN32 /v + +all: toolBar.dll customizeToolBar.dll + +toolBar.dll: toolBar.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:$(@B).dll + +customizeToolBar.dll: customizeToolBar.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:$(@B).dll + + +# Create .res from .rc +toolBar.res: toolBar.rc + rc $(rcflags_common) -r -fo$(@B).res toolBar.rc + +customizeToolBar.res: customizeToolBar.rc + rc $(rcflags_common) -r -fo$(@B).res customizeToolBar.rc diff --git a/modules/windows/oodialog/controls/ToolBar/rc/toolBar.dll b/modules/windows/oodialog/controls/ToolBar/rc/toolBar.dll new file mode 100644 index 0000000..d982c48 Binary files /dev/null and b/modules/windows/oodialog/controls/ToolBar/rc/toolBar.dll differ diff --git a/modules/windows/oodialog/controls/ToolBar/rc/toolBar.h b/modules/windows/oodialog/controls/ToolBar/rc/toolBar.h new file mode 100644 index 0000000..2ac0366 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/rc/toolBar.h @@ -0,0 +1,47 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_TBAR 101 +#define IDC_TOOLBAR 1003 + +#define IDB_PRESS 200 +#define IDB_PUSH 201 +#define IDB_WHERE 202 diff --git a/modules/windows/oodialog/controls/ToolBar/rc/toolBar.rc b/modules/windows/oodialog/controls/ToolBar/rc/toolBar.rc new file mode 100644 index 0000000..b13911b --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/rc/toolBar.rc @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "toolBar.h" + + +LANGUAGE 0, SUBLANG_NEUTRAL +IDD_TBAR DIALOGEX 0, 0, 235, 107 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "ToolBar Example" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_TOOLBAR, TOOLBARCLASSNAME, WS_TABSTOP | WS_BORDER | TBSTYLE_TOOLTIPS | TBSTYLE_LIST | NOT WS_VISIBLE, 0, 1, 235, 21 + CONTROL "OK", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON, 123, 83, 50, 14 + CONTROL "Cancel", IDCANCEL, WC_BUTTON, WS_TABSTOP | BS_PUSHBUTTON, 175, 83, 50, 14 +} diff --git a/modules/windows/oodialog/controls/ToolBar/toolBar.rex b/modules/windows/oodialog/controls/ToolBar/toolBar.rex new file mode 100755 index 0000000..d2643cc --- /dev/null +++ b/modules/windows/oodialog/controls/ToolBar/toolBar.rex @@ -0,0 +1,126 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** toolBar.rex + * + * Very simple ToolBar example. Just does the very minimum to show a tool bar. + * + * Note that most dialog editors do not have an option to add a tool bar. This + * can be overcome by editing the .rc file and manually adding the tool bar + * control. Which was done for this example. + * + * MSDN says that with some of the tool bar functionality there can be problems + * painting the tool bar. The suggestion is to create the tool bar not visible + * and then show the tool bar after it has been set up. That is what is done in + * this example. + */ + + sd = locate() + .application~setDefaults('O', sd'rc\toolBar.h', .false) + + dlg = .ToolBarDlg~new(sd"rc\toolBar.dll", IDD_TBAR) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'ToolBarDlg' subclass ResDialog + +::method initDialog + expose tb + + -- The buttons in a tool bar are just that, buttons. We can connect the + -- clicked event just as we would for a regular button. Or we could use the + -- connectToolBarEvent() method. + self~connectButtonEvent(IDB_PRESS, 'CLICKED', onPress) + self~connectButtonEvent(IDB_WHERE, 'CLICKED', onWhere) + self~connectButtonEvent(IDB_PUSH, 'CLICKED', onPush) + + tb = self~newToolBar(IDC_TOOLBAR) + + tbb1 = .TbButton~new(IDB_PRESS, "Press Me Please", "BUTTON", "ENABLED") + tbb2 = .TbButton~new(IDB_WHERE, "Where Am I?", "BUTTON", "ENABLED") + tbb3 = .TbButton~new(IDB_PUSH, "Please Push Me", "BUTTON", "ENABLED") + + -- addButtons() takes an array of TbButton objects: + buttons = .array~of(tbb1, tbb2) + ret = tb~addButtons(buttons) -- Returns true on success, othewise false + + -- indsertButton() takes a single TbButton object and inserts the button to + -- the left of the button index specified in argument 2. In this case the + -- button with the index of 2: + ret = tb~insertButton(tbb3, 2) -- Returns true on success, othewise false + + -- Now that the tool bar has its buttons, tell it to recalculate its size. + tb~autoSize + + -- And show the tool bar. + tb~show + tb~assignFocus + + +::method onPress unguarded + title = 'ToolBar Example "Press Button"' + msg = 'Thanks for pressing me ' + + r = MessageDialog(msg, self~hwnd, title, 'OK', 'INFORMATION') + return 0 + + +::method onPush unguarded + title = 'ToolBar Example "Push Button"' + msg = 'Glad you pushed me. ' + + r = MessageDialog(msg, self~hwnd, title, 'OK', 'INFORMATION') + return 0 + + +::method onWhere unguarded + expose tb + + count = tb~buttonCount + title = 'ToolBar Example "Where Button"' + msg = 'I am here, the button on the far right.' || .endOfLine~copies(2) || - + 'There are' count 'buttons. I am button 3.' + + r = MessageDialog(msg, self~hwnd, title, 'OK', 'INFORMATION') + return 0 diff --git a/modules/windows/oodialog/controls/ToolTip/ReadMe.txt b/modules/windows/oodialog/controls/ToolTip/ReadMe.txt new file mode 100644 index 0000000..db5d287 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/ReadMe.txt @@ -0,0 +1,80 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - ToolTip Example Programs + --------------------------------------- + + This directory contains example programs that demonstrate how to use the + ToolTip control in ooDialog. It is intended that the examples range from + simple programs to medium complex programs, and cover most of the + important methods of the ToolTip class. + + + - toolTip.rex + + Shows how to use a ToolTip control, including responding to the SHOW + event to position the ToolTip where desired. Also shows how to: + enumerate the tools contained in the ToolTip, add a tool simply to the + ToolTip, add a tool as a rectangular area, create a multiline ToolTip, + and create a balloon ToolTip + + - comboBoxToolTip.rex + + Shows how to add tool tips to a combo box. When the list items in a + combo box are longer than the combo box is wide, it is difficult for + the user to know what they say. The tool tip control is an elegant + solution to this problem. But, adding tool tips and getting them to + work is a little more difficult than one might think. This example + shows how to do it. + + + - customPositionToolTip.rex + + Demonstrates how to do custom positioning of the info tip in a + tree-view control. If the program is just displayed, it appears to be + exactly the same as the manageControlTool.rex example. The source + code for both examples needs to be examined to see the differences. + + - manageControlTool.rex + + Demonstrates how create a completely custom ToolTip for a dialog + control. If the program is just displayed, it appears to be exactly + the same as the manageControlTool.rex example. The source code for + both examples needs to be examined to see the differences. + diff --git a/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.h b/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.h new file mode 100644 index 0000000..b23ad83 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_MAJOR_CITIES 101 +#define IDC_COMBOBOX 1003 +#define IDC_RB_DEFAULT 1005 +#define IDC_RB_CUSTOM 1007 + +#define IDC_TT_CB_MAIN 500 +#define IDC_TT_CB_EDIT 502 +#define IDC_TT_CB_LISTBOX 503 +#define IDC_TT_EDIT_TRACK 504 +#define IDC_TT_BUTTON_TRACK 505 +#define IDC_TI_EDITRECT 506 +#define IDC_TI_BUTTONRECT 507 +#define IDC_TI_LISTBOX 508 diff --git a/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.rc b/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.rc new file mode 100644 index 0000000..0319e2e --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.rc @@ -0,0 +1,55 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "comboBoxToolTip.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_MAJOR_CITIES DIALOGEX 0, 0, 241, 128 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Major Cities of the World" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + COMBOBOX IDC_COMBOBOX, 10, 10, 80, 70, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST + GROUPBOX "Tool Tip - Tip Positioning", IDC_STATIC, 111, 10, 120, 74, WS_GROUP + AUTORADIOBUTTON "Tool Tip positions the tips", IDC_RB_DEFAULT, 122, 32, 104, 9, WS_TABSTOP + AUTORADIOBUTTON "Application positions the tips", IDC_RB_CUSTOM, 122, 58, 104, 9 + PUSHBUTTON "Done", IDCANCEL, 181, 104, 50, 14 +} diff --git a/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.rex b/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.rex new file mode 100755 index 0000000..e28c15c --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/comboBoxToolTip.rex @@ -0,0 +1,663 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to add tool tips to a combo box. + * + * When the items in a combo box are longer than the width of the combo box, + * they can be difficult for the user to read. Tool tips are a good solution + * to this, but combo boxes do not have built in support for tool tips like + * list-views or tree-views. + * + * Adding the support to a combo box is doable, but it takes a little work. + * This example shows how it is done. The example also shows how to custom + * position the tool tips. To see the difference in where the tool tip + * positions the tips by default and where this program positions them, the + * dialog has 2 radio buttons that allow switching between the default + * positioning and the custom positioning. + * + * One approach to adding tool tips to a combo box would be to just have the + * tool tips display for the items in the drop down list. This example goes + * beyond that to also show tool tips for the selection field and the drop down + * button. + * + * When the drop down is closed, adding tool tips to the selection field and + * the button is relatively easy. But, when the drop down is open, it is hard + * because the list box has the mouse captured. This prevents tool tips from + * activating when the mouse goes over the selection field or the button. What + * we do here is create tracking tool tips for the selection field and the + * button to use when the drop down is open. Tracking tool tips need to be + * shown and hidden manually, which is what is done in this program. + */ + + sd = locate() + .application~setDefaults('O', sd'comboBoxToolTip.h', .false) + + dlg = .CitiesOfTheWorldDlg~new(sd'comboBoxToolTip.rc', IDD_MAJOR_CITIES) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + return 0 + +::requires "ooDialog.cls" + +::class 'CitiesOfTheWorldDlg' subclass RcDialog + +/** init() + * + * Normally for RcDialog dialogs there is no need for an init() method. Here, + * we use the init() method to set up our state varialbes and to connect a + * combo box event. + * + * There is no real need to do it here, it could just as well been done in the + * initDialog() method. + */ +::method init + expose currentItem currentText currentOnClient ttEditActive ttButtonActive doCustomPositioning + + forward class (super) continue + + -- These variables are used to help track which tool needs to be shown. + currentItem = 0 + currentText = '' + currentOnClient = .false + ttEditActive = .false + ttButtonActive = .false + + doCustomPositioning = .true + + self~connectComboBoxEvent(IDC_COMBOBOX, 'CLOSEUP', onCloseUP) + + self~connectButtonEvent(IDC_RB_DEFAULT, 'CLICKED', doDefault) + self~connectButtonEvent(IDC_RB_CUSTOM, 'CLICKED', doCustom) + + +/** initDialog() + * + * This is a busy initDialog(). We need to set up and configure the combo box + * and create and configure the tool tips. + */ +::method initDialog + expose comboBox cbEdit cbListBox lbRect editRect buttonRect ttEditTrack ttButtonTrack itemHeight + + comboBox = self~newComboBox(IDC_COMBOBOX) + + -- The tool tips are slightly higher than the default height of the combo box + -- items. So, when we position the tool tip over an item, it does not quite + -- fit. Making the item height slightly bigger makes things look a lot + -- better. + -- + -- If the item height is to be changed, be sure to do it before the items + -- are inserted. Otherwise when we get the client rect for the list box, its + -- vertical height will be incorrect. + itemHeight = comboBox~getItemHeight + itemHeight += 2 + comboBox~setItemHeight(itemHeight) + + entries = self~getComboItems + do e over entries + comboBox~add(e) + end + + comboBox~setCue("Select a city") + comboBox~setMinVisible(10) + + d = comboBox~getComboBoxInfo + cbEdit = d~textObj + cbListBox = d~listBoxObj + + self~calcRects(d) + + self~newRadioButton(IDC_RB_CUSTOM)~check + + -- Create a tracking tool tip for the selection field of the combo box. For a + -- drop-down list combo box this is actually the combo box itself. We still + -- use cbEdit, even though we know cbEdit and comboBox are the same. + -- + -- 1.) This tool tip is used for the selection field when the dropdown is open + ttEditTrack = self~createToolTip(IDC_TT_EDIT_TRACK) + + toolInfo = .ToolInfo~new(self, cbEdit, '', 'ABSOLUTE TRACK IDISHWND', .Rect~new) + ttEditTrack~addToolEx(toolInfo) + + self~connectToolTipEvent(IDC_TT_EDIT_TRACK, 'NEEDTEXT', onEditTrackNeedText) + self~connectToolTipEvent(IDC_TT_EDIT_TRACK, 'SHOW', onEditTrackShow) + + -- Create a tracking tool tip for the button portion of the combo box. + -- + -- 2.) This tool tip is used for the button when the dropdown is open. + ttButtonTrack = self~createToolTip(IDC_TT_BUTTON_TRACK) + + text = 'Press the button to close the drop down' + toolInfo = .ToolInfo~new(self, comboBox, text, 'ABSOLUTE TRACK IDISHWND', .Rect~new) + ttButtonTrack~addToolEx(toolInfo) + + self~connectToolTipEvent(IDC_TT_BUTTON_TRACK, 'SHOW', onButtonTrackShow) + + -- Create a tool tip for the combo box itself. + -- + -- 3.) This tool tip is used for the selection and button components when the + -- dropdown is closed. + ttComboBox = self~createToolTip(IDC_TT_CB_MAIN) + + toolInfo = .ToolInfo~new(comboBox, IDC_TI_EDITRECT, '', 'TRANSPARENT', editRect, IDC_TI_EDITRECT) + ret = ttComboBox~addToolEx(toolInfo) + + text = 'Press the button to open the drop down' + toolInfo = .ToolInfo~new(comboBox, IDC_TI_BUTTONRECT, text, 'TRANSPARENT', buttonRect, IDC_TI_BUTTONRECT) + ttComboBox~addToolEx(toolInfo) + + ttComboBox~manageAtypicalTool(comboBox, .array~of('NEEDTEXT', 'SHOW'), .array~of('ONCBNEEDTEXT', 'ONCBSHOW')) + + -- Create tool tip for the items of the combo box. + -- + -- 4.) This tool tip is for the individual items when the dropdown is open. + ttList = self~createToolTip(IDC_TT_CB_LISTBOX) + + toolInfo = .ToolInfo~new(cbListBox, IDC_TI_LISTBOX, '', 'TRANSPARENT', lbRect) + ttList~addToolEx(toolInfo) + + -- Now start the monitoring process for the list box tool. + ttList~manageAtypicalTool(cbListBox, .array~of('RELAY', 'NEEDTEXT', 'SHOW')) + + +/** onRelay() + * + * The onRelay() event handler is invoked by the monitor that the + * manageAtypicalTool() method sets up. It is invoked for every mouse message + * that is sent to the list box control. + * + * The monitor first informs us of the mouse message. This gives us a chance to + * examine the message *before* the tool tip sees it. + * + * This event handler here is the key to how this whole program works. + * + * All the rest of the code in the program is simply busy work, keeping track of + * what state we are in. In this method we determine where the mouse is and + * then determine how we have to configure all the tool tips we are using. + * + * We need to know, or to take into account, some facts about the combo box. 1 + * fact is that when the list box is dropped down, it captures the mouse. All + * mouse messages are then sent to the list box until it releases the capture + * when it closes up. This means that the pos argument can be anywhere on the + * screen. + * + * Fact number 2 is that the combo box will always tell us the index of the item + * that is *closest* to the mouse position. So, even if the mouse is on the + * other side of the screen, the combo box will still return a valid item index. + * It will be what ever item is closest to that mouse position, even if it is + * 500 pixels away. + * + * We need to track what item the mouse is over, and whether the mouse is over + * the client area of the combo box. Every time the location changes from over + * the clien to not over the client, and every time the item the mouse is over + * changes, the tool tips need to be updated. + * + * To handle the selection field and the button, we treat them a pseudo list box + * item. When the mouse is over either of them, it will not be over the list + * box client area. We *pretend* that it is by changing the value in the + * directory object returned by the hit test info method. We do a similar thing + * for the item index. We *pretend* that the selection field has an item index + * of 0 and that the button has an item index of -1. + * + * If we are, newly, over the selection field or button, we need to manually + * activate the tracking tool tip and send it the mouse position. In screen + * coordinates, not client coordinates. Other code in this program is + * responsible for hiding the tracking tool tips at the proper time. + * + * The monitor will pass all mouse messages on to the tool tip after we return + * from this method. This allows the tool tip to 'do its thing.' + */ +::method onRelay unguarded + expose currentItem currentText currentOnClient editOffsetRect buttonOffsetRect - + ttEditTrack ttEditActive cbEdit ttButtonTrack ttButtonActive comboBox + use arg toolTip, pos, mouseMsg, listBox + + -- Determine which, if any, item the mouse is over. + d = .directory~new + ret = listBox~hitTestInfo(pos, d) + + -- Treat the edit and button rects as though they are in the client area of + -- the list box and assign them a, fake, item index. + if pos~inRect(editOffsetRect) then do + d~inClientArea = .true + d~itemIndex = 0 + end + else if pos~inRect(buttonOffsetRect) then do + d~inClientArea = .true + d~itemIndex = -1 + end + + -- Save the old item and location and sent the current item and location to + -- where the mouse is at this moment. + oldItem = currentItem + oldOnClient = currentOnClient + currentItem = d~itemIndex + currentOnClient = d~inClientArea + + -- If mouse is over a new item or location, hide the ToolTip. Set our + -- current text to the text for the item we are now over. If we are not + -- on the client area, set the current text to the empty string. + if oldItem \== currentItem | oldOnClient \== currentOnClient then do + if currentOnClient then do + if d~itemIndex == -1 then do + p = pos~copy + listBox~client2Screen(p) + ttButtonTrack~trackActivate(self, comboBox, .true) + ttButtonActive = .true + turnTTEditActiveOff = .true + turnTTButtonActiveOff = .false + ttEditTrack~trackPosition(p) + end + else if d~itemIndex == 0 then do + p = pos~copy + listBox~client2Screen(p) + ttEditTrack~trackActivate(self, cbEdit, .true) + ttEditActive = .true + turnTTEditActiveOff = .false + turnTTButtonActiveOff = .true + ttEditTrack~trackPosition(p) + end + else do + turnTTButtonActiveOff = .true + turnTTEditActiveOff = .true + currentText = listBox~getText(d~itemIndex) + end + end + else do + turnTTButtonActiveOff = .true + turnTTEditActiveOff = .true + currentText = '' + end + + -- Each time we have a change, we close the current tool tip. The tool + -- tips are now configured for the *new* item the mouse is over. Which + -- may be not over an item at all, of course. When we return from this + -- handler, the mouse message will be relayed on to the tool tip, and it + -- will do its tool tip thing. + toolTip~pop + + if turnTTEditActiveOff, ttEditActive then do + ttEditTrack~trackActivate(self, cbEdit, .false) + ttEditActive = .false + end + + if turnTTButtonActiveOff, ttButtonActive then do + ttButtonTrack~trackActivate(self, comboBox, .false) + ttButtonActive = .false + end + end + + return 0 + + +/** onNeedText() + * + * The event handler for the NEEDTEXT event. This method is invoked by the + * monitor for the list box tool when that tool is requesting the text it should + * display. + * + * We set the text to the text of the current item the mouse is over. + */ +::method onNeedText unguarded + expose currentItem currentText + use arg toolTip, listBox, info + + info~text = currentText + + -- Return false so that the ToolTip does not store the text. We want it to + -- always ask us for the text because the mouse could be over any item. + return .false + + +/** onShow() + * + * The event handler for the SHOW event. This method is invoked by the monitor + * for the list box tool when that tool is notifiying the list box that it is + * about to show the tip. This gives us the chance to do a custom positioning + * of the tip. + * + * If we are not doing custom positioning we just return false. False tells the + * tool tip that it should position the tip itself. + * + * If we are doing the positioning, we set the postion we want and return true. + * True tells the tool tip that we already positioned the tip and it should not + * change its postion. + * + * To get the position we determine which item the mouse is over, in list box + * client coordinates and convert the client coordinates to screen coordinates. + * The position we want is the top left corner of the list box item. But, the + * tool tip tips are slightly taller than a list box item, so we shift the + * position up 3 pixels, which gives us a position that does not obscure either + * the item above or the item below. + */ +::method onShow unguarded + expose currentItem comboBox lbRect itemHeight doCustomPositioning + use arg toolTip, listBox, toolID + + if \ doCustomPositioning then return .false + + if currentItem > 0 then do + topIndex = comboBox~getFirstVisible + r = lbRect~copy + r~top = (currentItem - topIndex) * itemHeight + r~top -= 3 + listBox~client2screen(r) + + toolTip~setWindowPos(0, r~left, r~top, 0, 0, "NOACTIVATE NOSIZE") + return .true + end + + return .false + + +/** onCBNeetText() + * + * The event handler for the NEEDTEXT event. This method is invoked when the + * combo box tool tip is requesting the text for the tip. + * + * The combo box tool tip is a normal tool tip, there is no manageAtypicalTool + * monitor for this tool tip. Recall, that we set this tool tip up with 2 + * tools. One for the rectangle of the selection field and one for the + * rectangle of the button. We use the tool ID to detemine which tool we are + * invoked for. If it is the selection field, we return the selected item text. + * If it is the button, we return the button tip. + * + * We can only be invoked when the drop down is closed. + */ +::method onCBNeedText unguarded + use arg toolTip, comboBox, info + + if info~toolID == .constDir[IDC_TI_EDITRECT] then do + info~text = comboBox~selected + end + else if info~toolID == .constDir[IDC_TI_BUTTONRECT] then do + info~text = 'Press the button to open the drop down' + end + else do + -- Can not happen + info~text = '' + return .true + end + + return .false + + +/** onCBShow() + * + * The event handler for the SHOW event. This method is invoked when the + * combo box tool tip is about to show the tip. This gives us a chance to do + * custom positiong. If we are not doing custom positioning, we simple return + * false, telling the tool tip to position the tip itself. + * + * The combo box tool tip is a normal tool tip, there is no manageAtypicalTool + * monitor for this tool tip. Recall, that we set this tool tip up with 2 + * tools. One for the rectangle of the selection field and one for the + * rectangle of the button. We use the tool ID to detemine which tool we are + * invoked for. If it is the selection field, we use the postion of the + * selection field rectangle, convert it to screen coordinates and position the + * tip at the top left corner. + * + * If it is the button, we do the same thing, but position the tip immediately + * to right of the button. + * + * We can only be invoked when the drop down is closed. + */ +::method onCBShow unguarded + expose editRect buttonRect doCustomPositioning + use arg toolTip, comboBox, toolID + + if \ doCustomPositioning then return .false + + if toolID == .constDir[IDC_TI_EDITRECT] then do + r = editRect~copy + + comboBox~client2screen(r) + toolTip~setWindowPos(0, r~left, r~top, 0, 0, "NOACTIVATE NOSIZE NOZORDER") + return .true + end + else if toolID == .constDir[IDC_TI_BUTTONRECT] then do + r = buttonRect~copy + + comboBox~client2screen(r) + toolTip~setWindowPos(0, r~right, r~top, 0, 0, "NOACTIVATE NOSIZE NOZORDER") + return .true + end + + return .false + + +/** onEditTrackNeedText() + * + * This is the event handler for the NEEDTEXT event. It is invoked when the + * edit tracking tool tip needs the text to display for the selection field. + * + * We simply send it the text of the currently selected item. + */ +::method onEditTrackNeedText unguarded + use arg comboBox, toolTip, info + + info~text = comboBox~selected + return .false + + +/** onEditTrackShow + * + * This is the event handler for the SHOW event. It is invoked when the edit + * tracking tool tip is about to show the tip. It gives us the chance to do + * custom positioning of the tip. If we are not doing custom positioning of the + * tip we simply return false to tell the tool tip to position the tip itself. + * + * If we are positioing the tip, we place it directly over the selection field. + */ +::method onEditTrackShow unguarded + expose editRect doCustomPositioning + use arg comboBox, toolTip + + if \ doCustomPositioning then return .false + + r = editRect~copy + + comboBox~client2screen(r) + toolTip~setWindowPos(0, r~left, r~top, 0, 0, "NOACTIVATE NOSIZE NOZORDER") + return .true + + + +/** onButtonTrackShow + * + * This is the event handler for the SHOW event. It is invoked when the button + * tracking tool tip is about to show the tip. It gives us the chance to do + * custom positioning of the tip. If we are not doing custom positioning of the + * tip we simply return false to tell the tool tip to position the tip itself. + * + * If we are positioing the tip, we place it directly to the right of the + * button. + */ +::method onButtonTrackShow unguarded + expose buttonRect doCustomPositioning + use arg comboBox, toolTip + + if \ doCustomPositioning then return .false + + r = buttonRect~copy + + comboBox~client2screen(r) + toolTip~setWindowPos(0, r~right, r~top, 0, 0, "NOACTIVATE NOSIZE NOZORDER") + return .true + + +/** onCloseUp() + * + * Event handler for the CLOSEUP event. This method is invoked when the drop + * down list is closed. + * + * We have 2 tracking tool tips in this program. They must be manually shown + * and hidden. If one or the other is visble and the drop down is closed, it + * will remain on the screen. So, here we hide the tool tip if it is currently + * visible. + */ +::method onCloseup unguarded + expose ttEditTrack ttEditActive cbEdit ttButtonTrack ttButtonActive comboBox + + if ttEditActive then do + ttEditTrack~trackActivate(self, cbEdit, .false) + ttEditActive = .false + end + + if ttButtonActive then do + ttButtonTrack~trackActivate(self, comboBox, .false) + ttButtonActive = .false + end + + return 0 + + +/** doDefault() + * + * The event handler for the 'Tool Tip positions the tool tips' radio button + * click event. We just need to flip our flag. + */ +::method doDefault unguarded + expose doCustomPositioning + doCustomPositioning = .false + return 0 + + +/** doCustom() + * + * The event handler for the 'Application positions the tool tips' radio button + * click event. We just need to flip our flag. + */ +::method doCustom unguarded + expose doCustomPositioning + doCustomPositioning = .true + return 0 + + +/** getComboItems() + * + * Simple convenience method, returns an array of the items we will add to the + * combo box. + */ +::method getComboItems private + + entries = .array~of("New York, United States of America, North America", - + "Johannesburg, South Africa, Africa", - + "Cape Town, South Africa, Africa", - + "Saint Petersburg, Russia, Europe", - + "Mexico City, Mexico, North America", - + "Los Angles, United States of America, North America", - + "Casablanca, Morocco, Africa", - + "Pyongyang, North Korea, Asia", - + "New Taipei, Republic of China (Taiwan), Asia", - + "Addis Ababa, Ethiopia, Africa", - + "Moscow, Russia, Europe", - + "Yokohama, Japan, Asia", - + "Chongqing, China, Asia", - + "Berlin, Germany, Europe", - + "Rio de Janeiro, Brazil, South America", - + "Guangzhou, China, Asia", - + "São Paulo, Brazil, South America", - + "Karachi, Pakistan, Asia", - + "Istanbul, Turkey, Europe / Asia", - + ) + + return entries + + +/** calcRects() + * + * To properly set the tool info for our tool tips, and to properly position + * the tool tips when we do custom positioning, we need to calculate and save + * a number of rectangles. + * + * We start off with the client rectangles of the combo box, the drop down list + * box, the selection field, and the button. The client rects within the combo + * box do not include the borders of the controls. We want to adjust those + * rects so that they do include the borders. + * + * The other problem is that when the list box is dropped down, the list box + * has the mouse captured, so all mouse messages go to the list box and all + * mouse positions are relative to the client area of the list box. So, we + * need to calculate a rectangle for the selection field and the button that is + * in client coordinates of the list box. + * + * The 'd' argument passed in here is the .Directory object returned from + * getComboBoxInfo(). This directory object contains both the selection field + * client rect and the button client rect. + */ +::method calcRects private + expose comboBox cbEdit cbListBox lbRect editRect buttonRect editOffsetRect buttonOffsetRect + use arg d + + -- The button rect, edit rect, and lb rect do not include borders. We + -- basically want to adjust them to the combo box width and height. + cbRect = comboBox~clientRect + + lbRect = cbListBox~clientRect + editRect = d~textRect + buttonRect = d~buttonRect + + lbRect~left = cbRect~left + lbRect~right = cbRect~right + + -- The top and bottom coordinates of both the text and button rects have to + -- be in relationship to the client rect of the list box. I.e. the + -- bottoms are at the 0 coordinate of the list box client area and the tops + -- are at 0 - the height of the combo box. + height = cbRect~bottom - cbRect~top + + editRect~left = cbRect~left + editRect~top = cbRect~top + editRect~right = buttonRect~left + editRect~bottom = cbRect~bottom + + -- Button rect left stays the same. + buttonRect~top = cbRect~top + buttonRect~right = cbRect~right + buttonRect~bottom = cbRect~bottom + + editOffsetRect = editRect~copy + editOffsetRect~top -= height + editOffSetRect~bottom -= height + + buttonOffsetRect = buttonRect~copy + buttonOffsetRect~top -= height + buttonOffsetRect~bottom -= height + + + diff --git a/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.h b/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.h new file mode 100644 index 0000000..3b1f729 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_TREEVIEW 100 +#define IDC_TREE 1003 +#define IDC_TT 1000 diff --git a/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.rc b/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.rc new file mode 100644 index 0000000..aba97fa --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.rc @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "customPositionToolTip.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TREEVIEW DIALOGEX 30, 30, 176, 234 +STYLE DS_3DLOOK | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Tree View Dialog" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "OK", IDOK, 61, 210, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 116, 210, 50, 14 + CONTROL "", IDC_TREE, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | TVS_INFOTIP, 10, 10, 156, 192 +} diff --git a/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.rex b/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.rex new file mode 100755 index 0000000..d112c5f --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/customPositionToolTip.rex @@ -0,0 +1,202 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * ToolTip control example. + * + * This example demonstrates use info tips with a tree-view and do custom + * positiong of the tool tip. + * + * The appearance and functionality of the dialog in this example is exactly the + * same as that produced by the manageControlTool.rex example. It simple shows + * an easier way to achieve the same effect as that example. + * + * Here we use a simple application of the manageAtypicalTool() method. The + * manageControlTool.rex example is provided to better help the ooDialog + * programmer understand the manageAtypicalTool() method. The programmer should + * really examine both example programs. + * + * To customize the positioning of the info tip, we need to write an event + * handler for the ToolTips SHOW event. However, the ToolTip for the tree-views + * info tips is owned by the tree-view. Event notifications are sent to the + * tree-view and our dialog has no knowledge of them. + * + * To fix that, we use the getToolTips() method to get the tree-views ToolTip. + * We then use the manageAtypicalTool() method to monitor the event + * notifications sent to the tree-view and send the SHOW notification to our + * dialog instead of to the tree-view. All other events, including the mouse + * relay event, are left to go to the tree-view. This gives us the same + * functionality as the custom ToolTip that is set up in the manageControlToo + * example, with less work. + */ + + sd = locate() + .application~setDefaults('O', sd'customPositionToolTip.h', .false) + + dlg = .TreeViewDialog~new(sd'customPositionToolTip.rc', IDD_TREEVIEW) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + +::requires "ooDialog.cls" + +::class 'TreeViewDialog' subclass RcDialog + +::method initDialog + expose currentItem + + tv = self~newTreeView(IDC_TREE) + tv~setItemHeight(20) + + self~connectTreeViewEvent(IDC_TREE, 'GETINFOTIP') + self~populateTree(tv) + + -- Get the ToolTip the tree-view has created and is using. + toolTip = tv~getToolTips + + -- Set up the monitoring of the ToolTip notifications sent to the tree-view. + -- We only want to intercept the SHOW notification. Also, we do not want the + -- automatic monitoring and relaying of the mouse messages. In this way we + -- achieve what we want with minimal interference with the tree-view's + -- ToolTip. + -- + -- We have to use the NORELAY keyword to turn off the automatic + -- relaying of the mouse messages. NORELAY does not connect an event handler, + -- it simply turns relaying off. + + toolTip~manageAtypicalTool(tv, .array~of('NORELAY', 'SHOW')) + + +/** onGetInfoTip() + * + * This is the event handler for the tree-view's GETINFOTIP notification. It is + * invoked when the tree-view wants the text to display for a ToolTip. + * + * Note that we are sent the handle of the tree-view item that the ToolTip is + * for and the user data (item data) for that item. We set the item data for + * each item to the text to display for the ToolTip for that item. Which makes + * this very easy. We just return the userData sent to us. + * + * Note this also. Our onShow() event handler is invoked by our monitoring of + * the ToolTip notifications. That monitor has no knowledge of which item the + * ToolTip is going to be displayed for. So, we use the exposed currentItem + * variable to pass on our knowledge here of which item the ToolTip is going to + * display for. + */ +::method onGetInfoTip unguarded + expose currentItem + use arg id, hItem, text, maxLen, userData + + currentItem = hItem + return userData + + +/** onShow() + * + * This is our event handler for the tree-view's ToolTip SHOW event + * notification. The method is invoked when our process monitoring the + * notifications sent to the tree-view, intercepts the SHOW notification. + * + * Normally the ToolTip window is placed below the item. This often over-laps + * and obscures the other items. What we want is to place the ToolTip window to + * the right and centered with the item. This way nothing is obscured. + * + * The custom positioning of the ToolTip window is straight-forward. We get the + * bounding rectangle of the tree-view item's label, convert the point to client + * coordinates, and then reposition the ToolTip window to where we want it. + * + * Note that we must return .true then so that the ToolTip is informed not to + * position the window in its default position. + */ +::method onShow unguarded + expose currentItem + use arg toolTip, treeView + + r = .Rect~new + if treeView~getItemRect(currentItem, r) then do + treeView~client2screen(r) + + toolTip~setWindowPos(0, r~right + 5, r~top, 0, 0, "NOACTIVATE NOSIZE NOZORDER") + return .true + end + + return .false + + +/** populateTree() + * + * This is a private method used to populate the tree-view control with our + * items. + * + * Note that each item has an item data object assigned to it. In this case the + * object is a string. The string is the text to display for the tool tip for + * that item. + */ +::method populateTree private + use strict arg tv + + hItem = tv~add("Peter", , ,"BOLD EXPANDED", , 'Data unique to Peter.') + + hItem = tv~add(,"Mike", , ,"EXPANDED", , 'Mike talks a lot.') + + data = 'George was famous once.'.endOfLine'He is unknown to my'.endOfLine'niece.' + hItem = tv~add(, ,"George", , , , , data) + + hItem = tv~add(, ,"Monique", , , , , 'Monique has never been to France.') + + hItem = tv~add(, , ,"John", , , , , 'John owns 4 dogs.') + + hItem = tv~add(, ,"Chris", , , , , 'Chris will never be president.') + + hItem = tv~add( , "Maud", , , , , 'Maud likes to bake.') + + hItem = tv~add( , "Ringo", , , , , 'Ringo has a LOT of money.') + + hItem = tv~add("Paul", , ,"BOLD EXPANDED", , "Two roads lead to Paul's house.") + + hItem = tv~add( , "Dave", , , , , 'No one lives with Dave.') + + hItem = tv~add( , "Sam", , , , , 'Sam loves pizza.') + + hItem = tv~add( , "Jeff", , , , , 'Jeff rides his bike to work.') + + hItem = tv~add("Mary", , ,"BOLD EXPANDED", , 'Mary owes $49.50 to her dentist.') + + hItem = tv~add( , "Helen", , , , , 'A closer look at Helen is warranted.') + + hItem = tv~add( , "Michelle", , , , , 'The Toyota Camray belongs to Michelle.') + + hItem = tv~add( , "Diana", , , , , 'Go go Chargers.') diff --git a/modules/windows/oodialog/controls/ToolTip/manageControlTool.h b/modules/windows/oodialog/controls/ToolTip/manageControlTool.h new file mode 100644 index 0000000..3b1f729 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/manageControlTool.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_TREEVIEW 100 +#define IDC_TREE 1003 +#define IDC_TT 1000 diff --git a/modules/windows/oodialog/controls/ToolTip/manageControlTool.rc b/modules/windows/oodialog/controls/ToolTip/manageControlTool.rc new file mode 100644 index 0000000..3a0184a --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/manageControlTool.rc @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "manageControlTool.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TREEVIEW DIALOGEX 30, 30, 176, 234 +STYLE DS_3DLOOK | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Tree View Dialog" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "OK", IDOK, 61, 210, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 116, 210, 50, 14 + CONTROL "", IDC_TREE, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS | TVS_NOTOOLTIPS, 10, 10, 156, 192 +} diff --git a/modules/windows/oodialog/controls/ToolTip/manageControlTool.rex b/modules/windows/oodialog/controls/ToolTip/manageControlTool.rex new file mode 100755 index 0000000..6926a1b --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/manageControlTool.rex @@ -0,0 +1,293 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * ToolTip control example. + * + * This example demonstrates several advanced techniques in using ToolTips. + * + * Typically a single tool is created for a dialog control. This works fine + * for creating tools for, say, buttons. Even if you have 20 buttons, it is + * pretty reasonable to create 20 tools in a ToolTip. + * + * But, what if you want to display a tip for each item in a tree-view? What if + * the tree-view has hundreds, or even thousands, of items. Creating several + * thousand tools is no longer reasonable. One technique is to create one tool + * and dynamically make it appear to be multiple tools. + * + * That technique is demonstrated in this example. We use a tree-view control + * to show the technique. The basic principle is to track where the mouse is, + * and dynamically update the tool each time it moves from one item to another. + * + * Normally you would program this by monitoring the mouse moves and updating + * the tool when the mouse moves require it. To do this, you can not use the + * SUBCLASS flag for the tool, because you need to dynamically update tool + * _before_ the tool sees the mouse move. You would monitor the mouse moves, + * decide whether to update or not the tool, and then forward every mouse move + * on to the tool. For the puposes of discussion, we will refer to the + * forwarding of the mouse moves as 'relaying' the moves. And, actually for the + * ToolTip to work correctly it needs to see all the mouse related messages. + * So, the relaying is really relaying all mouse messages, not just the mouse + * move message. + * + * This presents a problem in ooDialog because mouse messages are sent to the + * window under the mouse, in this case the tree-view. In addition, if we set + * up a tool for the tree-view, but can not use the SUBCLASS flags, the ToolTip + * event notifications are sent to the tree-view, not to our dialog. + * + * In this case, we need a way to monitor the mouse messages sent to the + * tree-view and a way to intercept the ToolTip event notifications that would + * be sent to the tree-view. For ToolTips, ooDialog provides a method, the + * manageAtypicalTool() method, that provides this functionality. + * + * This method monitors all mouse messages and relays the messages to the tool. + * Before it relays the mouse messages to the took, it will invoke a method in + * the Rexx dialog for the relay event. In addition, it intercepts all the + * ToolTip event notifications sent to the dialog control and invokes a method + * in the Rexx dialog for each event. + * + * Of course, the application may not need to have an event handler for all the + * events, or even for the relay event. So, manageAtypicalTool() allows the + * programmer to just connect the events it needs. + * + * Although this example just focuses on a specific use of manageAtypicalTool(), + * the method can be used in any situation where custom ToolTips are needed for + * dialog controls. The same principles that necessitate its use here, will be + * found in many situations. + * + * Note that in this specific case, there is an easier way to produce the same + * results as this example does. The customPositionToolTip.rex example shows + * how to use the easier method. However, this example is very useful in + * showing how the manageAtypicalToo() works. The principles here can be used + * in other situations. + */ + + sd = locate() + .application~setDefaults('O', sd'manageControlTool.h', .false) + + dlg = .TreeViewDialog~new(sd'manageControlTool.rc', IDD_TREEVIEW) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + +::requires "ooDialog.cls" + +::class 'TreeViewDialog' subclass RcDialog + +::method initDialog + expose currentItem currentLocation currentText + + -- These variables are used to help track which tool needs to be shown. + currentItem = 0 + currentText = '' + currentLocation = 'NOWHERE' + + tv = self~newTreeView(IDC_TREE) + + -- Set up our ToolTip + tt = self~createToolTip(IDC_TT) + + rect = tv~clientRect + + -- We need to specify very precisely the attributes of the tool we are going + -- to add. We can not do that using the addTool() or addToolRect() + -- convenience methods. So we need a ToolInfo object and to use the + -- addToolEx() method. + + toolInfo = .ToolInfo~new(tv, 10, '', 'TRANSPARENT', rect) + tt~addToolEx(toolInfo) + + tt~setMaxTipWidth(250) + + -- Set up our tree-view and populate it. + tv~setItemHeight(20) + self~populateTree(tv) + + -- Now start the monitoring process. + tt~manageAtypicalTool(tv, .array~of('RELAY', 'NEEDTEXT', 'SHOW')) + + +/** onRelay() + * + * This is the event handler for the mouse message relaying event. It is + * invoked by our monitoring process for every mouse message. The method is + * invoked _before_ the monitor relays the mouse message to the ToolTip. + * + * This method is crucial to how this example works. For every mouse message, + * we calculate if the mouse is still over the label of the same item it was + * over previously. If it is not, we hide the ToolTip window by invoking the + * pop(). + * + * After we return form this method, the mouse message is forwarded on to the + * ToolTip to let it do its ToolTip thing. When the ToolTip decides the mouse + * has hovered long enough in one spot, it displays its window. Since we have + * set the current text to the string for the tree-view item when the mouse + * first moved over the item, the correct "tool" text is displayed. + * + * The text to display is actually passed on to the ToolTip from our onNeedTex() + * method. + */ +::method onRelay unguarded + expose currentItem currentText currentLocation + use arg toolTip, pos, mouseMsg, treeView + + -- Determine which, if any, item the mouse is over. + d = treeView~hitTestInfo(pos) + + -- Save the old item and location and sent the current item and location to + -- where the mouse is at this moment. + oldItem = currentItem + oldLocation = currentLocation + currentItem = d~hItem + currentLocation = d~location + + -- If mouse is over a new item or location, hide the ToolTip. Set our + -- current text to the text for the item we are now over. If we are not + -- over the label of an item, set the current text to the empty string. + if oldItem \== currentItem | oldLocation \== currentLocation then do + if currentItem <> 0, currentLocation~wordPos('ONLABEL') <> 0 then do + currentText = treeView~getItemData(currentItem) + end + else do + currentText = '' + end + toolTip~pop + end + + return 0 + + +/** onNeedText() + * + * This is the event handler for the ToolTip's NEEDTEXT event notification. + * + * The notification was actually sent to the tree-view, but, our monitor process + * has intercepted the notification and sent it to us instead of the tree-view. + * + * The real work was already done in the onRelay() method. All we need to do is + * set the TEXT index in the info .Directory object to what the onRelay() method + * set the current text to. + */ +::method onNeedText unguarded + expose currentItem currentText + use arg toolTip, treeView, info, userData, flags + + info~text = currentText + + -- Return false so that the ToolTip does not store the text. We want it to + -- always ask us for the text because the mouse could be over any item. + return .false + + + +/** onShow() + * + * This is our event handler for the ToolTip's SHOW event notification. + * + * The notification was actually sent to the tree-view, but our monitor process + * has intercepted the notificatio and sent it to us instead of the tree-view. + * + * Normally the ToolTip places its window below the tree-view item. This often + * over-laps and obscures the other items. What we want is to place the ToolTip + * window to the right and centered with the item. This way nothing is + * obscured. + * + * The custom positioning of the ToolTip window is straight-forward. We get the + * bounding rectangle of the tree-view item's label, convert the point to client + * coordinates, and then reposition the ToolTip window to where we want it. + * + * Note that we must return .true then so that the ToolTip is informed not to + * position the window in its default position. + */ +::method onShow unguarded + expose currentItem + use arg toolTip, treeView + + r = .Rect~new + if treeView~getItemRect(currentItem, r) then do + treeView~client2screen(r) + + toolTip~setWindowPos(0, r~right + 5, r~top, 0, 0, "NOACTIVATE NOSIZE NOZORDER") + return .true + end + + return .false + + +/** populateTree() + * + * This is a private method used to populate the tree-view control with our + * items. + * + * Note that each item has an item data object assigned to it. In this case the + * object is a string. The string is the text to display for the tool tip for + * that item. + */ +::method populateTree private + use strict arg tv + + hItem = tv~add("Peter", , ,"BOLD EXPANDED", , 'Data unique to Peter.') + + hItem = tv~add(,"Mike", , ,"EXPANDED", , 'Mike talks a lot.') + + data = 'George was famous once.'.endOfLine'He is unknown to my'.endOfLine'niece.' + hItem = tv~add(, ,"George", , , , , data) + + hItem = tv~add(, ,"Monique", , , , , 'Monique has never been to France.') + + hItem = tv~add(, , ,"John", , , , , 'John owns 4 dogs.') + + hItem = tv~add(, ,"Chris", , , , , 'Chris will never be president.') + + hItem = tv~add( , "Maud", , , , , 'Maud likes to bake.') + + hItem = tv~add( , "Ringo", , , , , 'Ringo has a LOT of money.') + + hItem = tv~add("Paul", , ,"BOLD EXPANDED", , "Two roads lead to Paul's house.") + + hItem = tv~add( , "Dave", , , , , 'No one lives with Dave.') + + hItem = tv~add( , "Sam", , , , , 'Sam loves pizza.') + + hItem = tv~add( , "Jeff", , , , , 'Jeff rides his bike to work.') + + hItem = tv~add("Mary", , ,"BOLD EXPANDED", , 'Mary owes $49.50 to her dentist.') + + hItem = tv~add( , "Helen", , , , , 'A closer look at Helen is warranted.') + + hItem = tv~add( , "Michelle", , , , , 'The Toyota Camray belongs to Michelle.') + + hItem = tv~add( , "Diana", , , , , 'Go go Chargers.') diff --git a/modules/windows/oodialog/controls/ToolTip/musicNote.ico b/modules/windows/oodialog/controls/ToolTip/musicNote.ico new file mode 100644 index 0000000..dfc5da3 Binary files /dev/null and b/modules/windows/oodialog/controls/ToolTip/musicNote.ico differ diff --git a/modules/windows/oodialog/controls/ToolTip/toolTip.rex b/modules/windows/oodialog/controls/ToolTip/toolTip.rex new file mode 100755 index 0000000..9abdcb0 --- /dev/null +++ b/modules/windows/oodialog/controls/ToolTip/toolTip.rex @@ -0,0 +1,327 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * ToolTip control example. + * + * This example demonstrates some fundemental use of the TooTip control. It + * creates a tool tip for each push button in the dialog and tool tips for some + * rectangular areas in the dialog itself. + * + * There is a 'Test' push button in the dialog. When this button is pushed, + * several short demonstrations are executed that show some of the additional + * ToolTip methods at work. These demonstrations print to the screen using say + * statements. Therefore it is best to run this example program from a standard + * console window so that the output can be seen. + * + */ + + -- Set this application to use the global .constDir Only. Then add our + -- symbolic IDs to the .constDir. + .application~setDefaults('O', , .false) + + .constDir[IDC_TT_MAIN ] = 500 + .constDir[IDC_TT_OK] = 501 + .constDir[IDC_TT_CANCEL] = 502 + .constDir[IDC_TT_TEST] = 503 + .constDir[IDTOOL_DLG_RECT1] = 774 + .constDir[IDTOOL_DLG_RECT2] = 775 + .constDir[IDTOOL_DLG_RECT3] = 776 + .constDir[IDTOOL_DLG_RECT4] = 777 + .constDir[IDC_PB_TEST] = 600 + + -- Instantiate our dialog and execute it. + dlg = .ToolTipDialog~new + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + return 0 + + +::requires "ooDialog.cls" + +::class 'ToolTipDialog' subclass UserDialog + + +/** init() + * + * Usual init() method for a UserDialog subclass. We initialize the super class + * and then create the dialog frame to get things started. + * + * We also use this method to create an icon image. This image is used for the + * balloon ToolTip. + */ +::method init + expose icon + forward class (super) continue + + -- Locate our icon file + srcDir = locate() + icon = .Image~getImage(srcDir"musicNote.ico", ICON, .size~new(16, 16)) + + self~create(30, 30, 257, 123, "ToolTip Example Dialog", "CENTER") + + +/** defineDialog() + * + * Usual defineDialog() method. We add 3 push buttons to the dialog template. + */ +::method defineDialog + + self~createPushButton(IDC_PB_TEST, 10, 99, 50, 14, , "Test", onTest) + self~createPushButton(IDOK, 142, 99, 50, 14, "DEFAULT", "Ok") + self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Cancel") + + +/** initDialog() + * + * Usual initDialog() method. + * + * However, note that ToolTip controls can not be added to the dialog template. + * They *have* to be created *after* the underlying dialog exists. Typically, + * ToolTips would always be created in the initDialog() method. + */ +::method initDialog unguarded + expose icon pbTest count ttTest + + -- The main tool tip is set up in a private method, so that the code for it + -- can be inspected without distraction. + self~createMainToolTip + + -- Creat a somewhat fancy balloon tool tip for the Ok button. + ttOk = self~createToolTip(IDC_TT_OK, 'BALLOON CLOSE') + ttOk~setTitle("Important Message", icon) + + text = 'Push the'.endOfLine'Ok button'.endOfLine'to end this'.endOfLine'foolishness' + ttOk~addTool(self~newPushButton(IDOK), text) + + -- Create a simple multiline tool tip for the Cancel push button. The tool + -- tip is turned into a multiline tool tip by seeting the max tool tip + -- width. + ttEsc = self~createToolTip(IDC_TT_CANCEL) + ttEsc~addTool(self~newPushButton(IDCANCEL), 'Press Cancel to end the dialog') + + margins = 2 * 4 + s = self~getTextSizePX('Press Cancel') + ttEsc~setMaxTipWidth(s~width + margins) + + -- Create a tool tip for the Test push button. + pbTest = self~newPushButton(IDC_PB_TEST) + + ttTest = self~createToolTip(IDC_TT_TEST) + ttTest~addTool(pbTest) + self~connectToolTipEvent(IDC_TT_TEST, 'NEEDTEXT') + + count = 0 + + +/** createMainToolTip() + * + * This is a private method we use to set up the main ToolTip. We do the set + * up here so that the code for the set up can be studied without any other + * distractions. + */ +::method createMainToolTip private + expose tt clRect1 clRect2 clRect3 clRect4 + + tt = self~createToolTip(IDC_TT_MAIN) + + -- We divide the client area of the dialog into 4 quadrants and then add a + -- tool for each quandrant to the main tool tip. + + clRect = self~clientRect + hMidpoint = trunc((clRect~right - clRect~left) / 2) + clRect~left + vMidpoint = trunc((clRect~bottom - clRect~top) / 2) + clRect~top + + clRect1 = .Rect~new(clRect~left, clRect~top, hMidpoint, vMidpoint) + clRect2 = .Rect~new(hMidpoint + 1, clRect~top, clRect~right, vMidpoint + 1) + clRect3 = .Rect~new(clRect~left, vMidpoint + 1, hMidpoint + 1, clRect~bottom) + clRect4 = .Rect~new(hMidpoint + 1, vMidpoint + 1, clRect~right, clRect~bottom) + + ret = tt~addToolRect(self, IDTOOL_DLG_RECT1, clRect1, 'Over main dialog, top left quadrant', 'TRANSPARENT') + ret = tt~addToolRect(self, IDTOOL_DLG_RECT2, clRect2, 'Over main dialog, top right quadrant', 'TRANSPARENT') + ret = tt~addToolRect(self, IDTOOL_DLG_RECT3, clRect3, 'Over main dialog, bottom left quadrant', 'TRANSPARENT') + ret = tt~addToolRect(self, IDTOOL_DLG_RECT4, clRect4, 'Over main dialog, bottom right quadrant', 'TRANSPARENT') + + -- Connect the SHOW event so that we can position the tool tip text where + -- we want it. The SHOW notification is sent right before the tool tip is + -- going to display its window. + self~connectToolTipEvent(IDC_TT_MAIN, 'SHOW') + + +/** onShow() + * + * This is the event handler for the ToolTip SHOW event. It is invoked right + * before the ToolTip is about to show its display window. + * + * One of the uses for this event is to customize the position of the window. + * To customize the window position, the programmer calculates where he wants + * the window to be position and then uses the setWindowPos() method to place + * the window. When the position is set by the programmer, the event handler + * needs to return .true to inform the ToolTip not to position the window in its + * default position. If .false is returned, then the ToolTip positions its + * window where it normally would. + * + * We use this event handler to place the text for each tool in the main ToolTip + * at the top left-hand corner of its rectangle. + */ +::method onShow unguarded + expose clRect1 clRect2 clRect3 clRect4 + use arg toolID, toolTip + + -- Determine the position for the tool about to be displayed: + select + when toolID == .constDir[IDTOOL_DLG_RECT1] then pos = .Point~new(clRect1~left, clRect1~top) + when toolID == .constDir[IDTOOL_DLG_RECT2] then pos = .Point~new(clRect2~left, clRect2~top) + when toolID == .constDir[IDTOOL_DLG_RECT3] then pos = .Point~new(clRect3~left, clRect3~top) + when toolID == .constDir[IDTOOL_DLG_RECT4] then pos = .Point~new(clRect4~left, clRect4~top) + otherwise pos = .Point~new + end + -- End select + + -- Position the ToolTip window where we want it: + self~client2screen(pos) + toolTip~setWindowPos(TOPMOST, pos, .Size~new(0, 0), "NOACTIVATE NOSIZE NOZORDER") + + -- Return .true so that the ToolTip knows not to position the window itself. + return .true + + +/** onNeedText() + * + * This is the event handler for the ToolTip NEEDTEXT event. It is invoked when + * a ToolTip control needs the text to display in its window. + * + * The notification is generated when there is no text assigned to a tool, of if + * the special string: "TextCallBack" is assigned as the text of a tool. + * + * The event handler must return .true or .false. It .true is returned, that + * tells the ToolTip to store the returned text and not ask for it again. If + * .false is returned, then the ToolTip will ask for the text each time the + * window is about to be displayed. + * + * The text itself is returned in the info object. This is a .Directory object. + * The returned text is placed at the TEXT index. + */ +::method onNeedText unguarded + use arg id, toolTip, info + + info~text = 'Press Test to execute a ToolTip test' + return .true + + +/** onTest() + * + * This is the event handler for the button CLICK event. It is invoked when the + * 'Test' push button is pressed or clicked. + * + * We use this to demonstrate some of the methods of the ToolTip class. + */ +::method onTest unguarded + expose tt ttTest pbTest count + + reply 0 + count += 1 + + select + when count == 1 then do + do i = 1 to tt~getToolCount + toolInfo = tt~enumTools(i) + say 'Tool info hwnd: ' toolInfo~rexxHwnd + say 'Tool info id: ' toolInfo~rexxID + say 'Tool info text: ' toolInfo~text + say 'Tool info flags: ' toolInfo~flags + say 'Tool info rect: ' toolInfo~rect + say 'Tool info userData:' toolInfo~userData + say 'Tool info resource:' toolInfo~resource + say + end + end + + when count == 2 then do + time = tt~getDelayTime + say 'Time for autopop:' time + say + + time = tt~getDelayTime('AUTOPOP') + say 'Time for autopop:' time + say + + time = tt~getDelayTime('INITIAL') + say 'Time for initial:' time + say + + time = tt~getDelayTime('RESHOW') + say 'Time for reshow:' time + say + end + + when count == 3 then do + mouse = .Mouse~new(self) + pos = mouse~getCursorPos + pbTest~screen2client(pos) + + hitTool = .ToolInfo~forHitTest(pbTest) + + if ttTest~hitTestInfo(hitTool, pos) then do + say 'Got hit' + say 'Tool info hwnd: ' hitTool~rexxHwnd + say 'Tool info id: ' hitTool~rexxID + say 'Tool info text: ' hitTool~text + say 'Tool info flags: ' hitTool~flags + say 'Tool info rect: ' hitTool~rect + say 'Tool info userData:' hitTool~userData + say 'Tool info resource:' hitTool~resource + say + end + else do + say 'NO hit' + say 'Tool info hwnd: ' hitTool~rexxHwnd~hwnd + say 'Test push button hwnd:' pbTest~hwnd + say + end + end + + otherwise do + count = 0 + say 'No test for this push. Going to recycle.' + say + end + end + -- End select + + return + diff --git a/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.bmp b/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.bmp new file mode 100644 index 0000000..7b4686a Binary files /dev/null and b/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.bmp differ diff --git a/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.h b/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.h new file mode 100644 index 0000000..5fc8e93 --- /dev/null +++ b/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.h @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_TREE_DLG 100 +#define IDD_ADD_TREE_ITEM 101 +#define IDC_PB_NEW 110 +#define IDC_PB_DELETE 111 +#define IDC_PB_EXP_ALL 112 +#define IDC_PB_COL_ALL 113 +#define IDC_PB_INFO 114 +#define IDC_TREE 120 +#define IDC_CHK_FOLDER 1001 +#define IDC_PB_SORT 1002 +#define IDC_RB_SIBLING 1004 +#define IDC_RB_CHILD 1006 +#define IDC_EDIT_NAME 1007 diff --git a/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.rc b/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.rc new file mode 100644 index 0000000..2ac5868 --- /dev/null +++ b/modules/windows/oodialog/controls/TreeView/rc/treeViewCustomDraw.rc @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "treeViewCustomDraw.h" + + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +IDD_ADD_TREE_ITEM DIALOG 0, 0, 209, 91 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Add New Item" +FONT 10, "MS Shell Dlg" +{ + LTEXT "Name:", IDC_STATIC, 10, 13, 20, 8, SS_LEFT, WS_EX_RIGHT + EDITTEXT IDC_EDIT_NAME, 34, 11, 106, 14, ES_AUTOHSCROLL + GROUPBOX "Add new item as:", IDC_STATIC, 15, 32, 123, 49 + AUTORADIOBUTTON "Sibling", IDC_RB_SIBLING, 23, 46, 32, 10, WS_TABSTOP + AUTORADIOBUTTON "Child", IDC_RB_CHILD, 23, 63, 32, 10, WS_TABSTOP + AUTOCHECKBOX "Folder", IDC_CHK_FOLDER, 85, 46, 41, 10 + DEFPUSHBUTTON "OK", IDOK, 149, 47, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 149, 67, 50, 14 +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TREE_DLG DIALOG 40, 60, 274, 311 +STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_GROUP | WS_MAXIMIZEBOX | WS_POPUP | WS_SYSMENU +CAPTION "Crazy Sam's Emporium - Inventory" +FONT 10, "MS Shell Dlg" +{ + CONTROL "Tree", IDC_TREE, WC_TREEVIEW, WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | TVS_DISABLEDRAGDROP | TVS_INFOTIP, 10, 10, 254, 231 + PUSHBUTTON "New Item", IDC_PB_NEW, 10, 250, 62, 14, WS_GROUP + PUSHBUTTON "Delete Item", IDC_PB_DELETE, 10, 268, 62, 14 + PUSHBUTTON "Item Information", IDC_PB_INFO, 10, 287, 62, 14 + PUSHBUTTON "Reverse Sort", IDC_PB_SORT, 89, 250, 62, 14, WS_GROUP + PUSHBUTTON "Expand All", IDC_PB_EXP_ALL, 89, 268, 62, 14 + PUSHBUTTON "Collapse All", IDC_PB_COL_ALL, 89, 287, 62, 14 + PUSHBUTTON "Help", IDHELP, 202, 268, 62, 14 + PUSHBUTTON "Close", IDCANCEL, 202, 287, 62, 14 +} diff --git a/modules/windows/oodialog/controls/TreeView/treeViewCustomDraw.inp b/modules/windows/oodialog/controls/TreeView/treeViewCustomDraw.inp new file mode 100644 index 0000000..ebf79ea --- /dev/null +++ b/modules/windows/oodialog/controls/TreeView/treeViewCustomDraw.inp @@ -0,0 +1,105 @@ +"Products",0,1,"EXPANDED", ,"Products" +,"Computers",0,1,,,"Computers" +,,"Motherboards",0,1,,,"Motherboards" +,,,"SCSI Motherboards",0,1,,,"SCSI Motherboards" +,,,,"Motherboard A",2,3,,,"Motherboard A" +,,,,"Motherboard B",2,3,,,"Motherboard B" +,,,,"...",2,3,,,"..." +,,,"IDE Motherboards",0,1,,,"IDE Motherboards" +,,,,"Motherboard A",2,3,,,"Motherboard A" +,,,,"Motherboard B",2,3,,,"Motherboard B" +,,,,"...",2,3,,,"..." +,,"PC Drives",0,1,,,"PC Drives" +,,,"IDE Drives",0,1,,,"IDE Drives" +,,,,"Drive A",2,3,,,"Drive A" +,,,,"Drive B",2,3,,,"Drive B" +,,,,"...",2,3,,,"..." +,,,"SCSI Drives",0,1,,,"SCSI Drives" +,,,,"Drive A",2,3,,,"Drive A" +,,,,"Drive B",2,3,,,"Drive B" +,,,,"...",2,3,,,"..." +,,,"CD ROM Drives",0,1,,,"CD ROM Drives" +,,,,"Internal CD ROM Drives",0,1,,,"Internal CD ROM Drives" +,,,,,"Drive A",2,3,,,"Drive A" +,,,,,"Drive B",2,3,,,"Drive B" +,,,,,"...",2,3,,,"..." +,,,,"External CD ROM Drives",0,1,,,"External CD ROM Drives" +,,,,,"Drive A",2,3,,,"Drive A" +,,,,,"Drive B",2,3,,,"Drive B" +,,,,,"...",2,3,,,"..." +,,,,,"Housings for External CD ROM Drives",0,1,,,"Housings for External CD ROM Drives" +,,,,,,"Housing A",2,3,,,"Housing A" +,,,,,,"Housing B",2,3,,,"Housing B" +,,,,,,"...",2,3,,,"..." +,,,"CD Recorders",0,1,,,"CD Recorders" +,,,,"CD Recorder A",2,3,,,"CD Recorder A" +,,,,"CD Recorder B",2,3,,,"CD Recorder B" +,,,,"...",2,3,,,"..." +,,"Graphic Cards & Monitors",0,1,,,"Graphic Cards & Monitors" +,,,"Graphic Cards",0,1,,,"Graphic Cards" +,,,"Monitors",0,1,,,"Monitors" +,,,,"17 inch Monitors",0,1,,,"17 inch Monitors" +,,,,,"Monitor A",2,3,,,"Monitor A" +,,,,,"Monitor B",2,3,,,"Monitor B" +,,,,,"...",2,3,,,"..." +,,,,"19 inch Monitors",0,1,,, +,,,,,"Monitor A",2,3,,,"Monitor A" +,,,,,"Monitor B",2,3,,,"Monitor B" +,,,,,"...",2,3,,,"..." +,,"Modems & Fax",0,1,,,"Modems & Fax" +,,"Software",0,1,,,"Software" +,,,"Office Software",0,1,,,"Office Software" +,,,"Graphic Software",0,1,,,"Graphic Software" +,,,"Games",0,1,,,"Games" +,,"Printers",0,1,,,"Printers" +,,,"Ink Jet Printers",0,1,,,"Ink Jet Printers" +,,,"Laser Printers",0,1,,,"Laser Printers" +,"Audio Video and Home Entertainment",0,1,,,"Audio Video and Home Entertainment" +,,"Hi-Fi Components",0,1,,,"Hi-Fi Components" +,,"Loudspeakers",0,1,,,"Loudspeakers" +,,"Microphones",0,1,,,"Microphones" +,,"Video and Accessories",0,1,,,"Video and Accessories" +,"Home Electronics",0,1,,,"Home Electronics" +,,"Alarm Systems",0,1,,,"Alarm Systems" +,,,"Alarm Sensors",0,1,,,"Alarm Sensors" +,,,"Security Lights",0,1,,,"Security Lights" +,,"Weather Monitoring",0,1,,,"Weather Monitoring" +,,"Analogue and Digital Clocks",0,1,,,"Analogue and Digital Clocks" +,,"Ventilation Equipment",0,1,,,"Ventilation Equipment" +,,"Halogen Lighting",0,1,,,"Halogen Lighting" +,"Communications",0,1,,,"Communications" +,"Car Audio and Car Products",0,1,,,"Car Audio and Car Products" +,"Books",0,1,,,"Books" +,,"Software",0,1,,,"Software" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Hardware",0,1,,,"Hardware" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Introduction to Electronic",0,1,,,"Introduction to Electronic" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Solar and Alternative Energy",0,1,,,"Solar and Alternative Energy" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Batteries/Chargers and Power Supplies",0,1,,,"Batteries/Chargers and Power Supplies" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Car Mechanics",0,1,,,"Car Mechanics" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Audio / Video & Home Entertainment",0,1,,,"Audio / Video & Home Entertainment" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,,"Satellite Technology",0,1,,,"Satellite Technology" +,,,"Book A",2,3,,,"Book A" +,,,"Book B",2,3,,,"Book B" +,,,"...",2,3,,,"..." +,"Special Offers",0,1, ,"1","Special Offers" diff --git a/modules/windows/oodialog/controls/TreeView/treeViewCustomDraw.rex b/modules/windows/oodialog/controls/TreeView/treeViewCustomDraw.rex new file mode 100755 index 0000000..ce3390e --- /dev/null +++ b/modules/windows/oodialog/controls/TreeView/treeViewCustomDraw.rex @@ -0,0 +1,850 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * treeViewCustomDraw.rex + * + * This example demonstrates many of the features of a tree-view control. + * Including, but not limited to: label editing of items, custom draw, using + * image lists to supply the icons for tree-view items, using a custom compare + * function in the Rexx dialog to sort the tree-view items, displaying info + * tips, etc.. + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + -- Get our source code file location. + srcDir = locate() + + -- Use the global .constDir for symbolic IDs and turn automatic data + -- detection off. + .application~setDefaults('O', srcDir'rc\treeViewCustomDraw.h', .false) + + dlg = .InventoryDlg~new(srcDir"rc\treeViewCustomDraw.rc", IDD_TREE_DLG) + if dlg~initCode = 0 then do + ret = dlg~execute("SHOWTOP") + end + +return 0 + +::requires "ooDialog.cls" -- Require the ooDialog framework. + + +/*- TreeViewConstants - Class - - - - - - - - - - - - - - - - - - - - - - - - *\ + + This mixin class defines some constant values and is inherited by the two + dialog classes in this example. + +\*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +::class 'TreeViewConstants' mixinclass Object +::attribute BMP_FILE get + sd = locate() + return sd"rc\treeViewCustomDraw.bmp" -- Icons for selected/not-selected items. +::attribute TREE_FILE get + sd = locate() + return sd"treeViewCustomDraw.inp" -- Input file with the items to build the tree. +::attribute ITEM_FILE get + sd = locate() + return sd"treeViewCustomDrawi.inp" -- Input file with dynamically added items. + +::constant APPLICATION_TITLE "Crazy Sam's Emporium - Inventory" + +::constant UNSELECTED_FOLDER 0 -- Index for the icon of an unselected folder item +::constant SELECTED_FOLDER 1 -- Index for the icon of a selected folder item +::constant UNSELECTED_LEAF 2 -- Index for the icon of an unselected leaf item +::constant SELECTED_LEAF 3 -- Index for the icon of a selected leaf item + + +/*- InventoryDlg - Class- - - - - - - - - - - - - - - - - - - - - - - - - - - *\ + + This is the main dialog class for this example. It contains the tree-view + control that the example is all about. + +\*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +::class 'InventoryDlg' subclass RcDialog inherit CustomDraw TreeViewConstants + +/** isLeafItem() [class method] + * + * The isLeafItem() method provides a convenient way to test if any tree-view + * item is a leaf item rather than a folder item. Leaf items and folder items + * in this example use different icon images, so we just test which icon is set + * for the item. + */ +::method isLeafItem class + use strict arg treeView, item + + info. = treeView~itemInfo(item) + +return info.!Image == self~UNSELECTED_LEAF + + +/** init() + * + * Initialization of the Rexx dialog object. We do several things here. + * + * 1.) Initialize the super class. Never invoke any method on a dialog class + * before the super class is initialized. + * + * 2.) So a sanity check to ensure the data files needed can be found. + * + * 3.) Connect the event handlers for the tree-view. + * + * 4.) Create custom colors to draw the individual items in the tree-view. + * + * 5.) Initialize the custom draw interface and register the tree-view control + * to use custom draw. + */ +::method init + expose bkClr oddLevelClr evenLevelClr selectedClr leafClr + use arg rcFile, idDlg + + self~init:super(rcFile, idDlg) + if self~initCode <> 0 then return self~initCode + + if self~checkForRequiredFiles == .false then do + self~initCode = 17 + return self~initCode + end + + -- Connect dialog control events to methods in the Rexx dialog. + self~connectTreeViewEvent(IDC_TREE, "EXPANDING", "onExpanding", .true) + self~connectTreeViewEvent(IDC_TREE, "DEFAULTEDIT") + self~connectTreeViewEvent(IDC_TREE, "KEYDOWN", "onKeyDown") + self~connectTreeViewEvent(IDC_TREE, "GETINFOTIP", "onGetInfoTip") + + self~connectButtonEvent(IDC_PB_NEW, "CLICKED", "onNewItem") + self~connectButtonEvent(IDC_PB_DELETE, "CLICKED", "onDeleteItem") + self~connectButtonEvent(IDC_PB_SORT, "CLICKED", "onSortChildren") + self~connectButtonEvent(IDC_PB_EXP_ALL, "CLICKED", "onExpandAll") + self~connectButtonEvent(IDC_PB_COL_ALL, "CLICKED", "onCollapseAll") + self~connectButtonEvent(IDC_PB_INFO, "CLICKED", "onItemInfo") + + -- Create the custom colors use to draw the tree-view items + bkClr = self~RGB(250, 250, 250) + oddLevelClr = self~RGB( 82, 61, 0) + evenLevelClr = self~RGB( 0, 20, 82) + selectedClr = self~RGB( 82, 0, 20) + leafClr = self~RGB( 0, 82, 20) + + -- Initialize the custom draw interface and register the tree-view control + -- to use custom draw. + self~customDraw + self~customDrawControl(IDC_TREE, 'TreeView') + +return 0 + +/** initDialog() + * + * Just as the init() method is for initializing the Rexx dialog object, the + * initDialog() method is used to initialize the underlying Windows dialog. + * Some things, like inserting the items into a tree-view, can only be done + * after the Windows dialog exists. Those types of things are done here. + */ +::method initDialog + expose tv + + tv = self~newTreeView("IDC_TREE") + + -- Set the image list for the tree-vies + image = .Image~getImage(self~BMP_FILE) + imageList = .ImageList~create(.Size~new(16, 12), 'COLOR8', 5, 2) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + tv~setImageList(imageList, 'NORMAL') + image~release + end + + -- Read the file containing the tree input data and build the tree. + do while lines(self~TREE_FILE) + args = self~makeArgs(linein(self~TREE_FILE)) + tv~sendWith('add', args) + end + + -- Select the item with the text of Computers. + hItem = tv~find('Computers') + if hItem \== 0 then tv~select(hItem) + +return 0 + + +/*- - - - - - - - - - Event handler(s) - - - - - - - - - - - - - - - - - - - -*/ + +/** onCustomDraw() + * + * This is the event handler for the custom draw event. Certain of the dialog + * controls in Windows support custom draw. Those controls send custom draw + * event notifications through out the paint cycle when the control is drawing + * or redrawing itself + * + * Please read the custom draw documentation in the ooDialog reference manual to + * fully understand the details. + * + * We take advantage of custom draw here to paint each individual tree-view item + * a custom color depending on exactly which item is about to be drawn. + * + * Our scheme is relatively simple. Every other level of the tree is painted an + * alternating color. If an item is selected, it is painted a reddish color to + * match the reddish selected icon. If not selected and a leaf node, we paint + * it a greenish color to match the non-folder, non-selected greenish icon. + */ +::method onCustomDraw unguarded + expose tv bkClr oddLevelClr evenLevelClr selectedClr leafClr + use arg tvcds + + if tvcds~drawStage == self~CDDS_ITEMPREPAINT then do + tvcds~reply = self~CDRF_NEWFONT + + selected = tv~selected + isLeaf = .InventoryDlg~isLeafItem(tv, tvcds~item) + + if selected == tvcds~item then do + tvcds~clrText = selectedClr + tvcds~clrTextBk = bkClr + end + else if isLeaf then do + tvcds~clrText = leafClr + tvcds~clrTextBk = bkClr + end + else if tvcds~level // 2 == 1 then do + tvcds~clrText = oddLevelClr + tvcds~clrTextBk = bkClr + end + else do + tvcds~clrText = evenLevelClr + tvcds~clrTextBk = bkClr + end + + return .true + end + + return .false + + +/** onExpanding() + * + * This is the event handler for the EXPANDING event. The method is invoked + * when a tree-view item is about to be expanded or collapsed. The method is + * invoked before the item is expanded or collapsed. + * + * This method demonstrates dynamically adding items to the tree. The node, + * 'Special Offers' is initially added to the tree during initDialog with no + * children. + * + * When the user expands the node, the child items for the node are dynamically + * added here. The items are loaded from a file in the same manner as the + * original items are loaded from a file to build the tree. + * + * Note that the fourth argument to connectTreeViewEvent() was used for the + * EXPANDING event and set to true. This causes the interpreter to wait for the + * reply from this event handler, before it replies to the operating system. If + * the interpreter were to not wait for the reply, the tree-view control would + * immediately expand the item before the children were added. + * + * When the user collapses the node, all its children items are removed. This + * is done through the collapseAndReset method, which collapse the item and also + * tells the tree-view control to deallocate the children. + */ +::method onExpanding unguarded + expose tv + use arg tree, item, what, extra + + itemInfo. = tv~itemInfo(item) + + if itemInfo.!TEXT = "Special Offers" then do + if what == "EXPANDED", tv~child(item) == 0 then do + do while lines(self~ITEM_FILE) + args = self~makeArgs(item, , linein(self~ITEM_FILE)) + newItem = tv~sendWith('insert', args) + end + end + else if what == "COLLAPSED", tv~child(item) \== 0 then do + tv~collapseAndReset(item) + end + end + +return .true + + +/** onKeyDown() + * + * This is the event handler for the key down event. It is invoked each time + * the user presses a key when the tree-view has the focus. + * + * We examime the key pressed to see if it is the insert or delete key. + * + * On the insert key we simulate pushing the 'New Item' push button by invoking + * the event handler for that button. This allows the user to add a new tree- + * view item. + * + * On the delete key, we delete the selected item. + */ +::method onKeyDown unguarded + expose tv + use arg treeId, key + + if key == .VK~DELETE then + tv~delete(tv~Selected) + else if key == .VK~INSERT then + self~onNewItem + +return 0 + +/** onNewItem() + * + * This is the event handler for the 'New Item' push button. It is invoked when + * the user clicks that button. + * + * We put up a dialog that allows the user to fill out the details for a new + * tree-view item and insert it into the tree-view. + */ +::method onNewItem unguarded + expose tv + + sd = locate() + dlg = .NewTreeItemDlg~new(sd"rc\treeViewCustomDraw.rc", IDD_ADD_TREE_ITEM, tv) + dlg~execute + +return 0 + + +/** onDeleteItem() + * + * This is the event handler for the 'Delete Item' push button. This method is + * invoked when the user clicks that button. + * + * We expand the selected item and all its children recursively. + */ +::method onDeleteItem unguarded + expose tv + + selected = tv~selected + if selected == 0 then do + title = self~APPLICATION_TITLE~subword(1, 3) '- Warning' + msg = "There is no tree-view item selected. If you" || .endOfLine ||- + "continue, all items will be deleted." || .endOfLine~copies(2) ||- + "Do you want to continue and delete all items?" + + ret = MessageDialog(msg, self~hwnd, title, 'YESNO', 'WARNING', 'DEFBUTTON2') + if ret == self~IDNO then return 0 + end + + tv~delete(selected) +return 0 + + +/** onGetInfoTip() + * + * This is the event handler for the INFOTIP event. It is invoked when the + * tree-view wants the text to display in the info tip. + * + * If we return the empty string, then no info tip is displayed. Otherwise, the + * text returned is displayed. Here, we only return text when the itemData is + * the string: '...' In that case we return some text. In all other cases we + * return the empty string and no info tip is displayed. + */ +::method onGetInfoTip unguarded + expose tv + use arg id, hItem, text, maxLen, itemData + + if itemData == '...' then return 'There are too many books to list' + else return '' + + +/** onSortChildre() + * + * This is the event handler for the 'Reverse Sort' push button. This method is + * invoked when the user pushes that button. + * + * Note that the tree-view provides a function to sort the children of an item, + * but it only sorts in ascending alphabetical order of the item text. The + * ooDialog TreeView class provides that function in the sortChildren() method. + * + * To sort in any other order requires using the sortChildrenCB() method. With + * this method, the programmer names a 'call back' method in the Rexx dialog. + * This method is then invoked by the tree-view for each item it needs to + * determine the order of. + * + * This is what we do here, we use the sortChildrenCB method and provide on own + * comparsion method, rexxSort(). + * + * We sort the children of the selected item. If no item is selected we sort + * the children of the root item. Note that only the direct children of the + * parent item are sorted. To sort all items, the programmer would need to + * implement a recursive function, similar to the expandAll() or collapseAll() + * functions. + */ +::method onSortChildren unguarded + expose tv + + selectedItem = tv~selected + if selectedItem == 0 then selectedItem = tv~root + + ret = tv~sortChildrenCB(selectedItem, rexxSort) + + +/** rexxSort() + * + * This is our comparison callback function. We are passed the user item data + * for the first tree-view item and the user item data for the second tree-view + * item. The method needs to return a positive number if the first item is + * greater than the second, a negative number if the first item is less than the + * second, and 0 if the two items are equivalent. + * + * In this program, for every tree-view item inserted, we set the item data for + * that item to be the text of the item. Then, in our comparison function here, + * we just do a reverse comparison of that text. This orders the items in + * descending order rather than ascending order. The userParam argument is + * ignored here. + */ +::method rexxSort unguarded + use arg itemData1, itemData2, userParam + + -- Reverse sort: + return itemData2~compareTo(itemData1) + + +/** onExpandAll() + * + * This is the event handler for the 'Expand All' push button. This method is + * invoked when the user clicks that button. + * + * We expand the selected item and all its children recursively. + */ +::method onExpandAll unguarded + expose tv + + if tv~selected == 0 then do + title = self~APPLICATION_TITLE~subword(1, 3) '- Error' + msg = "There is no tree-view item selected. Before" || .endOfLine ||- + "you can expand all items you must first" || .endOfLine ||- + "select an item" + + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING') + return 0 + end + + if self~isFullyExpanded(tv~selected) then do + title = self~APPLICATION_TITLE~subword(1, 3) '- Information' + msg = "The selected tree-view item is already fully" || .endOfLine ||- + "expanded. Expanding will take place, but it" || .endOfLine ||- + "have no visile effect." + + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING') + end + + self~expandAll(tv~selected) + +return 0 + +/** onCollapseAll() + * + * This is the event handler for the 'Collapse All' push button. This method is + * invoked when the user clicks that button. + * + * We collapse the selected item and all its children recursively. + */ +::method onCollapseAll unguarded + expose tv + + if tv~selected == 0 then do + title = self~APPLICATION_TITLE~subword(1, 3) '- Error' + msg = "There is no tree-view item selected. Before" || .endOfLine ||- + "you can collapse all items you must first" || .endOfLine ||- + "select an item" + + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING') + return 0 + end + + itemInfo. = tv~itemInfo(tv~selected) + if itemInfo.!State~wordPos('EXPANDED') == 0 then do + title = self~APPLICATION_TITLE~subword(1, 3) '- Information' + msg = "The selected tree-view item is already collapsed. You" || .endOfLine || - + "may not see anything, but all children of the selected" || .endOfLine || - + "item will be collapsed." + + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'INFORMATION') + end + + self~collapseAll(tv~selected) + +return 0 + +/** onItemInfo + * + * This is the event handler for the 'Item Info' push button. It iw invoked + * when the button is clicked. + * + * We get the selected tree-view item and display information about it. + */ +::method onItemInfo unguarded + expose tv + + selected = tv~selected + + if selected == 0 then do + title = self~APPLICATION_TITLE~subword(1, 3) '- Error' + msg = "There is no tree-view item selected. Before" || .endOfLine ||- + "you can display information on an item you" || .endOfLine ||- + "must first select an item" + + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING') + return 0 + end + + itemInfo. = tv~itemInfo(selected) + tab1 = '09'x + tab2 = tab1~copies(2) + + hasChildren = self~logicalToString(itemInfo.!Children) + + title = self~APPLICATION_TITLE~changeStr('-', '') '- Item Information' + msg = 'The Selected Item is:' || tab1 || '"'itemInfo.!Text'"' || .endOfLine~copies(2) || - + ' Contains children:' || tab2 || hasChildren || .endOfLine || - + ' Unselected icon index:' || tab1 || itemInfo.!Image || .endOfLine || - + ' Selected icon index:' || tab2 || itemInfo.!SelectedImage || .endOfLine || - + ' Item state:' || tab2 || itemInfo.!State || .endOfLine || - + ' Is leaf node:' || tab2 || self~logicalToString(.InventoryDlg~isLeafItem(tv, selected)) + + ret = MessageDialog(msg, self~hwnd, title 'OK', 'INFORMATION') + +return 0 + +/** help() + * + * The help command event handler is connected automatically by the ooDialog + * framework to the command with ID of 9. The default help event handler + * provided by ooDialog does nothing. + * + * In this example, the Help push button is given the resource ID of 9, and + * therefore the help event handler is invoked when the user clicks on the Help + * button. Rather than do noting when the button is clicked, we over-ride the + * help method here. We still do not do much, just inform the user that there + * is no help. + */ +::method help unguarded + title = self~APPLICATION_TITLE + msg = "There is no help available for this example program." + ret = MessageDialog(msg, self~hwnd, title, "OK", "INFORMATION") +return 0 + + +/*- - - - - - - - - - Helper Methods - - - - - - - - - - - - - - - - - - - - -*/ + + +/** expandAll() + * + * This helper method recursively expands all children nodes of the specified + * tree-view item. + */ +::method expandAll private unguarded + expose tv + use strict arg item + + if item == 0 then return 0 + + tv~expand(item) + + nextItem = tv~child(item) + do while nextItem \== 0 + self~expandAll(nextItem) + nextItem = tv~next(nextItem) + end + +return 0 + +/** collapseAll() + * + * This helper method recursively collapse the specified tree-view item and all + * its children. + */ +::method collapseAll private unguarded + expose tv + use strict arg item + + if item == 0 then return 0 + + nextItem = tv~child(item) + do while nextItem \== 0 + self~collapseAll(nextItem) + nextItem = tv~next(nextItem) + end + + tv~collapse(item) + +return 0 + + +/** isFullyExpanded() + * + * This helper method checks if the specified item is fully expanded by + * recursively descending though the children of the item and checking that each + * item is expanded. + * + * Returns .true if the item is fully expanded, otherwise .false. + */ +::method isFullyExpanded private unguarded + expose tv + use strict arg item + + if item == 0 then return .true + if .InventoryDlg~isLeafItem(tv, item) then return .true + + itemInfo. = tv~itemInfo(item) + if itemInfo.!State~wordPos('EXPANDED') == 0 then return .false + + nextItem = tv~child(item) + do while nextItem \== 0 + if \ self~isFullyExpanded(nextItem) then return .false + nextItem = tv~next(nextItem) + end + +return .true + +/** checkForRequiredFiles() + * + * This helper method is used to check that the bitmap and input files are + * available. It returns .true if they are found and .false if they are not + * found. + */ +::method checkForRequiredFiles private + + haveError = .false + file = '' + + if stream(self~BMP_FILE, "C", "QUERY EXISTS") = "" then do + haveError = .true + file = self~BMP_FILE + end + else if stream(self~TREE_FILE, "C", "QUERY EXISTS") = "" then do + haveError = .true + file = self~TREE_FILE + end + else if stream(self~ITEM_FILE, "C", "QUERY EXISTS") = "" then do + haveError = .true + file = self~ITEM_FILE + end + + if haveError then do + title = self~APPLICATION_TITLE~subword(1, 3) '- File Error' + msg = "The required data file" file || .endOfLine || - + "does not exist. Without that file, this progam" || .endOfLine || - + "will not run." || .endOfLine~copies(2) || - + "The program will abort." + + ret = MessageDialog(msg, 0, title, 'OK', 'ERROR') + end + +return \haveError + + +/** makeArgs() + * + * This helper method turns a line of comma separted values into an argument + * array with empty values turned into empty indexes in the array. + */ +::method makeArgs private unguarded + if arg() == 1 then line = arg(1) + else line = arg(3) + + args = line~makeArray(',') + if arg() == 1 then do + newArgs = .array~new(args~items) + do i = 1 to args~items + if args[i]~strip \== "" then newArgs[i] = args[i]~strip('B', '"') + end + end + else do + newArgs = .array~new(args~items + 2) + newArgs[1] = arg(1) + newArgs[2] = 'LAST' + + j = 2 + do i = 1 to args~items + j += 1 + if args[i]~strip \== "" then newArgs[j] = args[i]~strip('B', '"') + end + end + +return newArgs + +/** logicalToString() + * + * This helper method converts and returns a value to true or false if value is + * a logical, otherwise it returns the empty string. + */ +::method logicalToString private + use strict arg logical + if logical == .true then return 'True' + else if logical == .false then return 'False' + else return '' + +/** print() + * + * This helper function is useful in debugging. It prints the label of the + * specified tree-view item to the screen. + */ +::method print private unguarded + expose tv + use strict arg item, indent + + itemInfo. = tv~itemInfo(item); + say indent || itemInfo.!Text + +return 0 + + +/*- NewTreeItemDlg - Class- - - - - - - - - - - - - - - - - - - - - - - - - - *\ + + This dialog class allows the user to add a new item to the tree-view + +\*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +::class 'NewTreeItemDlg' subclass RcDialog inherit TreeViewConstants + +/** init() + * + * The initialization of the Rexx dialog object. We just use this to grab a + * reference to the tree-view control in the parent dialog. + */ +::method init + expose treeControl + use arg scriptFile, dlgID, treeControl + + -- Initialize the super class. + self~init:super(scriptFile, dlgID) + +/** initDialog() + * + * The initialization of the Windows dialog. We use this to set the state of + * the various controls in the dialog. + */ +::method initDialog + expose treeControl editControl childRB folderChk selected + + -- Save a reference to the current selected item + selected = treeControl~selected + + editControl = self~newEdit(IDC_EDIT_NAME) + childRB = self~newRadioButton(IDC_RB_CHILD) + siblingRB = self~newRadioButton(IDC_RB_SIBLING) + folderChk = self~newCheckBox(IDC_CHK_FOLDER) + + -- If the selected is the root of the tree, a new item has to be inserted as + -- a child. So disable the radio buttons that allow the user to choose to + -- insert as a child or sibling. And, pre-check the add as a folder check + -- box. + if selected == treeControl~root then do + childRB~~check~disable + siblingRB~disable + folderChk~check + end + else if .InventoryDlg~isLeafItem(treeControl, selected) then do + siblingRB~~check~disable + childRB~disable + end + else do + siblingRB~check + end + + -- Set a visual cue for the edit control. This will only show when the edit + -- control has no text in it, and does not have the focus. + editControl~setCue("Enter name of new item") + +return 0 + +/** ok() + * + * The is the event handler for the Ok button. It is invoked when the user + * clicks that button. + * + * The ooDialog framework provides a default implementation for this event. It + * is important to always close a dialog, once the underlying Windows dialog has + * been created, through the Ok or Cancel event handlers. This ensures that the + * dialog is ended correctly and that the needed clean up. + * + * Here we over-ride the superclass ok method so that we can check that the user + * entered the correct data for the new item and then insert it into the tree- + * view. If the user did not enter the data correctly, we giver her a chance to + * correct it. We give her a chance to cancel and if she does, we end the + * dialog cancel instead of ok. + * + * Note that we end the dialog by either calling the superclass ok or cancel + * method. We prevent the dialog from closing by *not* invoking one of those + * methods and simply returning. + */ +::method ok + expose treeControl editControl childRB folderChk selected + + -- Make sure the user has given the item a name. + text = editControl~getText~strip + if text == "" then do + msg = "You must enter the name of the new item" + title = self~APPLICATION_TITLE~changestr('-', '') '- Add Item' + + ret = MessageDialog(msg, self~hwnd, title, 'WARNING', 'OKCANCEL') + if ret == self~IDCANCEL then return self~cancel:super + + editControl~assignFocus + return 0 + end + + -- See if the user wants to add this as a folder item, or a regular item. + -- This will determine the image IDs we use when we insert the item + addAsFolder = folderChk~checked + + -- Now insert the item either as a child or a sibling depending on what the + -- user requested. Note that we set the item data on each insert to the text + -- of the inserted item. + if childRB~checked then do + if addAsFolder then newItem = treeControl~insert(selected, , text, self~UNSELECTED_FOLDER, self~SELECTED_FOLDER, , , text) + else newItem = treeControl~insert(selected, , text, self~UNSELECTED_LEAF, self~SELECTED_LEAF, , , text) + treeControl~expand(treeControl~parent(newItem)) + end + else do + if addAsFolder then treeControl~insert(treeControl~Parent(selected), , text, self~UNSELECTED_FOLDER, self~SELECTED_FOLDER, , , text) + else treeControl~insert(treeControl~Parent(selected), , text, self~UNSELECTED_LEAF, self~SELECTED_LEAF, , , text) + end + + -- Finally, quit by invoking the super class ok() method. +return self~ok:super + + diff --git a/modules/windows/oodialog/controls/TreeView/treeViewCustomDrawI.inp b/modules/windows/oodialog/controls/TreeView/treeViewCustomDrawI.inp new file mode 100644 index 0000000..7f17456 --- /dev/null +++ b/modules/windows/oodialog/controls/TreeView/treeViewCustomDrawI.inp @@ -0,0 +1,10 @@ +"Currency Converter with Pocket Calculator Function",2,3,,,"Currency Converter with Pocket Calculator Function" +"Cordless Bicycle Computer with 9 functions",2,3,,,"Cordless Bicycle Computer with 9 functions" +"Digital Watch",2,3,,,"Digital Watch" +"Accu Charger",2,3,,,"Accu Charger" +"Inkjet Printer",2,3,,,"Inkjet Printer" +"Diskettes",2,3,,,"Diskettes" +"Car Radio",2,3,,,"Car Radio" +"The Software Catalog",2,3,,,"The Software Catalog" +"VHS Video Camera",2,3,,,"VHS Video Camera" +"External CD ROM Drive",2,3,,,"External CD ROM Drive" diff --git a/modules/windows/oodialog/controls/fiscalReports.h b/modules/windows/oodialog/controls/fiscalReports.h new file mode 100644 index 0000000..5a29a40 --- /dev/null +++ b/modules/windows/oodialog/controls/fiscalReports.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_FISCAL_REPORTS 101 +#define IDC_PB_PRINT 1002 +#define IDC_GB_REPORTS 1004 +#define IDC_RB_PRE_FIRST 1006 +#define IDC_RB_BAL_SHEET 1007 +#define IDC_RB_PAYROLL 1008 +#define IDC_RB_CASH_FLOW 1009 +#define IDC_RB_INCOME_STMT 1010 +#define IDC_RB_EARNINGS 1011 +#define IDC_RB_ANTE_LAST 1012 +#define IDC_DTP_REPORT 1013 diff --git a/modules/windows/oodialog/controls/fiscalReports.rc b/modules/windows/oodialog/controls/fiscalReports.rc new file mode 100644 index 0000000..d0f5861 --- /dev/null +++ b/modules/windows/oodialog/controls/fiscalReports.rc @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "fiscalReports.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_FISCAL_REPORTS DIALOGEX 0, 0, 333, 122 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Acme Widgets: Fiscal Reports" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + GROUPBOX "Report Type:", IDC_GB_REPORTS, 10, 11, 313, 41 + AUTORADIOBUTTON "Balance Sheet", IDC_RB_BAL_SHEET, 19, 29, 63, 8, WS_TABSTOP + AUTORADIOBUTTON "Payroll", IDC_RB_PAYROLL, 87, 29, 37, 8 + AUTORADIOBUTTON "Cash Flow", IDC_RB_CASH_FLOW, 135, 29, 49, 8 + AUTORADIOBUTTON "Income Statement", IDC_RB_INCOME_STMT, 192, 29, 73, 8 + AUTORADIOBUTTON "Earnings", IDC_RB_EARNINGS, 277, 29, 43, 8 + LTEXT "Period && Start Date:", IDC_STATIC, 10, 61, 94, 8, SS_LEFT + CONTROL "", IDC_DTP_REPORT, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_LONGDATEFORMAT | DTS_RIGHTALIGN, 10, 72, 313, 15 + DEFPUSHBUTTON "Print", IDC_PB_PRINT, 218, 98, 50, 14 + PUSHBUTTON "Done", IDOK, 273, 98, 50, 14 +} diff --git a/modules/windows/oodialog/controls/fiscalReports.rex b/modules/windows/oodialog/controls/fiscalReports.rex new file mode 100755 index 0000000..45441f9 --- /dev/null +++ b/modules/windows/oodialog/controls/fiscalReports.rex @@ -0,0 +1,741 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +/** + * A more advanced example of the date and time picker control. + * + * This is example is intended to show how to use call back fields in the format + * string for the DTP control and how to respond to the FORMAT, FORMATQUERY, and + * KEYDOWN notifications for the call back fields. + * + * What is not explicit in the comments in this program is that there must be + * a custom format string, containing call back fields, set in the DTP control + * in order for the 3 event notifications to occur. + * + * In the program, change the date and time in the DTP control to see how the + * call back fields work. Select a call back field by clicking on it or tabbing + * to it and then use the up or down arrow keys, home, end, page up, or page + * down keys and observe what happens. + */ + + sd = locate() + .application~setDefaults('O', sd'fiscalReports.h', .false) + + dlg = .FiscalReports~new(sd'fiscalReports.rc', IDD_FISCAL_REPORTS) + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'FiscalReports' subclass RcDialog + +::method init + expose haveSizes + + forward class (super) continue + + self~setUpArrays + haveSizes = .false + + self~connectDateTimePickerEvent(IDC_DTP_REPORT, "FORMAT", onFormat) + self~connectDateTimePickerEvent(IDC_DTP_REPORT, "FORMATQUERY", onFormatQuery) + self~connectDateTimePickerEvent(IDC_DTP_REPORT, "KEYDOWN", onKeyDown) + + do i = .constDir[IDC_RB_PRE_FIRST] + 1 to .constDir[IDC_RB_ANTE_LAST] - 1 + self~connectButtonEvent(i, 'CLICKED', onRbClick, .true) + end + + self~connectButtonEvent(IDC_PB_PRINT, 'CLICKED', onPrint) + +::method initDialog + expose dtp currentType + + dtp = self~newDateTimePicker(IDC_DTP_REPORT); + self~newRadioButton(IDC_RB_BAL_SHEET)~check + + -- Set up the range of the DTP control. We say we can't print a report in the + -- future, so the maximum date is set to the current time. We say the company + -- first opened its doors on 3/2/1998 (which happens to be a Monday) at 8 AM, + -- so a report can not start prior to that date. + now = .DateTime~new + start = .DateTime~fromIsoDate('1998-03-02T08:00:00.000000') + dtp~setRange(.Array~of(start, now)) + + -- This is our format string with 3 call back fields in it. Each call back + -- field is designated by using a capital X. The number of X's allow you to + -- uniquely indentify different call back fields. + -- + -- As you see the format string starts with 3 call back fields. The first is + -- the number field, (First, Second, etc.,) the second is the period field, + -- (quarter, half, etc.,) and the third is the report type, (balance, cash + -- flow, etc..) Within the format string, constant strings like: + -- report starts from: + -- need to be put in single quotes. Punctuation and spaces do not need to be + -- quoted, so for example ', ' does not need the single quotes. + dtp~setFormat("XX XXX XXXX 'report starts from: 'hh':'mm tt dddd MMMM dd', 'yyyy") + + +/** onFormatQuery() + * + * This is the format query notification event handler. The DTP control sends + * the notification to request the size of the largest item to be displayed in + * the specified call back field + * + * @param field The identifier of the call back field. In our case it will be + * XX, or XXX, or XXXX. + * + * @param size A .Size object. The size of the largest item to display is + * returned to the DTP by setting this .Size object. + * + * The id and hwnd arguments are not needed here. + * + * Since the largest size for each field is not going to change, we just + * calculate the size for each field 1 time and save a reference to it. To + * accurately calculate the size in pixels, we need to wait until the underlying + * dialog is actually created. We could have done this in initDialog(), but + * I think it is better to wait until the DTP asks for the size. + */ +::method onFormatQuery unguarded + expose dtp haveSizes xxSize xxxSize xxxxSize + use arg field, size, id, hwnd + + if \ haveSizes then do + xxSize = self~calcSize('XX') + xxxSize = self~calcSize('XXX') + xxxxSize = self~calcSize('XXXX') + haveSizes = .true + end + + -- The equateTo() method sets the cx and cy attributes of the receiver .Size + -- object to the cx and cy attributes of the argument .Size object. + select + when field == 'XX' then size~equateTo(xxSize) + when field == 'XXX' then size~equateTo(xxxSize) + otherwise size~equateTo(xxxxSize) + end + -- End select + + return 0 + +/** onFormat() + * + * This is the format notification event handler. The DTP control sends this + * notification to request the text to display in the call back field at this + * point in time. For this application, we base what should be displayed in the + * numbers field on the currently selected date and time. What the other 2 + * fields should display is tracked through the currentType and currentPeriod + * variables. + * + * @param field The identifier of the call back field. In our case it will be + * XX, or XXX, or XXXX. + * + * @param dt A .DateTime object. This is the currently selected date and + * time in the DTP control. + * + * The id and hwnd arguments are not needed here. + * + * The return from this method is what the DTP control will dislpay in the + * specified call back field. + */ +::method onFormat unguarded + expose periods types currentType currentPeriod + use arg field, dt, id, hwnd + + select + when field == 'XX' then do + ret = self~getPeriodNumber(dt) + end + + when field == 'XXX' then do + ret = periods[currentPeriod] + end + + otherwise do + ret = types[currentType] + end + end + -- End select + + return ret + +/** onKeyDown() + * + * This is the event handler for the KEYDOWN notification event handler. The + * DTP control sends this notification when the user types a key in a call back + * field. This allows the programmer to implement some custom behavior for the + * call back fields. + * + * @param field The identifier of the call back field. In our case it will be + * XX, or XXX, or XXXX. + * + * @param dt A .DateTime object. This is the currently selected date and + * time in the DTP control. + * + * @param vKey This is the virtual key the user pressed. + * + * The id and hwnd arguments are not needed here. + * + * The return is the modified date and time information based on the user's + * keystroke. + * + * Each time the date and time in the DTP control is modified, the DTP control + * sends the FORMAT notification. This is what drives our program. When the + * user presses the up or down arrow, home, end, page up, or page down keys in + * one of the call back fields we send a modified date and time back to the DTP + * control. The DTP control generates a FORMAT event, and in our FORMAT event + * handler we return the updated value for the call back field. + */ +::method onKeyDown + use arg field, dt, vKey, idFrom, hwndFrom + + select + when field == 'XX' then do + newDT = self~updatePeriodNumber(dt, vKey) + end + + when field == 'XXX' then do + newDT = self~updatePeriod(dt, vKey) + end + + otherwise do + newDT = self~updateReport(dt, vKey) + end + end + -- End select + + return newDT + + +/** onRbClick() + * + * This is the event handler for the click event of a radio button. We + * connected the event for every radio button to this one method. Each time the + * user clicks on a radio button, it selects a new report type. In our program, + * when a new report type is selected, the initial date for the report is set to + * the first day of the current period. I.e., if the current period is 'month' + * and the date is 7/10/2008, then the first day of the period is 7/1/2008. + * + * As explained in the comments for the onFormat() method above, when the date + * and time is changed in the DTP control, the control generates a FORMAT event. + * Here we update the index to the type of report, and set the new date and + * time. In the FORMAT event handler, the updated report type index causes the + * event handler to return the text for the new report type. And the display in + * the DTP control is automatically updated to reflect the user's report + * selection. + */ +::method onRbClick unguarded + expose dtp currentType + use arg info, hwnd, id + + dt = self~getFirstDayOfPeriod + + select + when id == .constDir[IDC_RB_BAL_SHEET] then do + currentType = 1 + dtp~setDateTime(dt) + end + + when id == .constDir[IDC_RB_PAYROLL] then do + currentType = 2 + dtp~setDateTime(dt) + end + + when id == .constDir[IDC_RB_CASH_FLOW] then do + currentType = 3 + dtp~setDateTime(dt) + end + + when id == .constDir[IDC_RB_INCOME_STMT] then do + currentType = 4 + dtp~setDateTime(dt) + end + + when id == .constDir[IDC_RB_EARNINGS] then do + currentType = 5 + dtp~setDateTime(dt) + end + + otherwise do + -- Should be impossible to get here. + nop + end + end + -- End select + + return 0 + + +/** updatePeriodNumber() + * + * This method is invoked during the event handler for the key down event when + * the call back field is the number, the period number (First, second, third, + * etc..) The user can use the up / down arrows, home, end, page up, and page + * down keys to cycle through the periods. All other keys are simply ignored. + * + * Note that when the number changes, the period (month, quarter, etc.,) stays + * the same. The date changes to the same relative date in the new period. The + * numbers wrap, i.e., if it is the 12 month and the up arrow key is used, the + * number wraps to 1. To determine when to wrap, we have to check the period. + * If the period is half, then we need to wrap at 3, etc.. + */ +::method updatePeriodNumber unguarded private + expose periods currentPeriod + use strict arg dt, vkey + + mn = dt~month + + parse value dt~isoDate with pre 6 j 8 tail + + select + when vKey == .VK~UP then do + + select + when periods[currentPeriod] == 'month' then do + mn += 1 + if mn == 13 then mn = 1 + end + + when periods[currentPeriod] == 'quarter' then do + if mn <= 9 then mn += 3 + else mn -= 9 + end + + otherwise do + if mn <= 6 then mn += 6 + else mn -= 6 + end + end + -- End select + + mn = mn~right(2, 0) + newDT = .DateTime~fromIsoDate(pre || mn || tail) + end + + when vKey == .VK~Down then do + + select + when periods[currentPeriod] == 'month' then do + mn -= 1 + if mn == 0 then mn = 12 + end + + when periods[currentPeriod] == 'quarter' then do + if mn <= 3 then mn += 9 + else mn -= 3 + end + + otherwise do + if mn <= 6 then mn += 6 + else mn -= 6 + end + end + -- End select + + mn = mn~right(2, 0) + newDT = .DateTime~fromIsoDate(pre || mn || tail) + end + + when vKey == .VK~HOME then do + + select + when periods[currentPeriod] == 'month' then do + mn = 1 + end + + when periods[currentPeriod] == 'quarter' then do + if mn <= 3 then nop + else if mn <= 6 then mn -= 3 + else if mn <= 9 then mn -= 6 + else mn -= 9 + end + + otherwise do + if mn > 6 then mn -= 6 + end + end + -- End select + + mn = mn~right(2, 0) + newDT = .DateTime~fromIsoDate(pre || mn || tail) + end + + when vKey == .VK~END then do + + select + when periods[currentPeriod] == 'month' then do + mn = 12 + end + + when periods[currentPeriod] == 'quarter' then do + if mn <= 3 then mn += 9 + else if mn <= 6 then mn += 6 + else if mn <= 9 then mn += 6 + else nop + end + + otherwise do + if mn <= 6 then mn += 6 + end + end + -- End select + + mn = mn~right(2, 0) + newDT = .DateTime~fromIsoDate(pre || mn || tail) + end + + when vKey == .VK~PRIOR then do + -- We want to go half the year back, so it doesn't make any difference + -- what the period is. + if mn <= 6 then mn = 1 + else mn -= 6 + + mn = mn~right(2, 0) + newDT = .DateTime~fromIsoDate(pre || mn || tail) + end + + when vKey == .VK~NEXT then do + -- We want to go half the year ahead, so it doesn't make any difference + -- what the period is. + if mn <= 6 then mn += 6 + else mn = 12 + + mn = mn~right(2, 0) + newDT = .DateTime~fromIsoDate(pre || mn || tail) + end + + otherwise do + newDT = dt + end + end + -- End select + + return newDT + + +/** onPrint() + * + * The event handler for the CLICK event for the 'Print' push button. A real + * program would of course print the report using the details specified by the + * user through the DTP control. This is just an example program, we simply + * put up a message box. + */ +::method onPrint unguarded + expose types currentType dtp + use arg info, hwndFrom + + select + when currentType == 1 then report = 'Balance Sheet' + when currentType == 2 then report = 'Payroll' + when currentType == 3 then report = 'Cash Flow' + when currentType == 4 then report = 'Income Statement' + when currentType == 5 then report = 'Earnings' + otherwise report = 'Error Report NOT Found' + end + -- End select + + dt = dtp~getDateTime + + if report~word(1) == 'Error' then do + title = report + msg = 'An internal software error has occurred preventing'.endOfLine || - + 'the printing of the report.' || .endOfLine~copies(2) || - + 'Please contact IT at "internalsupport@acmewidgets.com"'.endOfLine || - + 'to resolve this issue.' + + icon = 'ERROR' + end + else do + title = "Printing the" report "Report" + msg = 'The' report 'report is being sent to the default'.endOfLine || - + 'printer' || .endOfLine~copies(3) || - + 'Report Start Time:' || '09'x || dt~civilTime || .endOfLine || - + 'Report Start Date:' || '09'x || dt~languageDate + + icon = 'INFORMATION' + end + + j = MessageDialog(msg, self~hwnd, title, 'OK', icon) + + +/** updatePeriod() + * + * This method is invoked during the event handler for the key down event when + * the call back field is the period (month, quarter, half.) The user can use + * the up / down arrows, home, end, page up, and page down keys to cycle through + * the periods. All other keys are simply ignored. + * + * Note that when the period changes, the date stays the same. But, if we simply + * return the same date, the DTP will not update its display. So, we add 1 + * second to the date, which in turn causes the DTP control to update the + * display. + */ +::method updatePeriod unguarded private + expose periods currentPeriod + use strict arg dt, vkey + + select + when vKey == .VK~UP then do + currentPeriod += 1 + if currentPeriod > periods~items then currentPeriod = 1 + newDT = dt~addSeconds(1) + end + + when vKey == .VK~Down then do + currentPeriod -= 1 + if currentPeriod < 1 then currentPeriod = periods~items + newDT = dt~addseconds(1) + end + + -- Since there are only 3 periods, Page Up and Home will act the same. + when vKey == .VK~PRIOR | vKey == .VK~HOME then do + currentPeriod = 1 + newDT = dt~addSeconds(1) + end + + -- Since there are only 3 periods, Page Down and End will act the same. + when vKey == .VK~NEXT | vKey == .VK~END then do + currentPeriod = periods~items + newDT = dt~addseconds(1) + end + + otherwise do + newDT = dt + end + end + -- End select + + return newDT + + +/** updateReport() + * + * This method is invoked during the event handler for the key down event when + * the call back field is the report type (balance, cash flow, etc...) The user + * can use the up / down arrows, home, end, page up, and page down keys to cycle + * through the periods. All other keys are simply ignored. + * + * Note that when the report type changes, the date gets set to the first day of + * the period, and the selected radio button gets changed. For the user, the + * effect of using one of the arrow keys in the report type call back field is + * exactly the same as selecting a report by using the radio buttons. + */ +::method updateReport unguarded private + expose types currentType + use strict arg dt, vkey + + select + when vKey == .VK~UP then do + currentType += 1 + if currentType > types~items then currentType = 1 + + newDT = self~getFirstDayOfPeriod + + .RadioButton~checkInGroup(self, .constDir[IDC_RB_PRE_FIRST] + 1, - + .constDir[IDC_RB_ANTE_LAST] - 1, - + .constDir[IDC_RB_PRE_FIRST] + currentType) + end + + when vKey == .VK~Down then do + currentType -= 1 + if currentType < 1 then currentType = types~items + + newDT = self~getFirstDayOfPeriod + + .RadioButton~checkInGroup(self, .constDir[IDC_RB_PRE_FIRST] + 1, - + .constDir[IDC_RB_ANTE_LAST] - 1, - + .constDir[IDC_RB_PRE_FIRST] + currentType) + end + + otherwise do + newDT = dt + end + end + -- End select + + return newDT + + +/** getFirstDay() + * + * Returns the first day of the current period. I.e., if the current period is + * second half 2010, the first day is 6/1/2010 + */ +::method getFirstDay private + expose periods currentPeriod + use strict arg dtpSelected + + yr = dtpSelected~year + mn = dtpSelected~month + + select + when periods[currentPeriod] == 'month' then do + mn = mn~right(2, 0) + end + + when periods[currentPeriod] == 'quarter' then do + if mn <= 3 then mn = 01 + else if mn <= 6 then mn = 04 + else if mn <= 9 then mn = 07 + else mn = 10 + end + + otherwise do + if mn <= 6 then mn = 01 + else mn = 06 + end + end + -- End select + + return .DateTime~fromISODate(yr'-'mn'-01T08:00:00.000000') + + +/** getPeriod() + * + * Returns the number word (first, second, etc., for the specified date based on + * the current period. I.e., if the date is 7/4/1999 and current period is + * month then the number word is Seventh. + */ +::method getPeriodNumber unguarded private + expose numbers periods currentPeriod + use strict arg dt + + mn = dt~month + + select + when periods[currentPeriod] == 'month' then do + word = numbers[mn] + end + + when periods[currentPeriod] == 'quarter' then do + if mn <= 3 then word = numbers[1] + else if mn <= 6 then word = numbers[2] + else if mn <= 9 then word = numbers[3] + else word = numbers[4] + end + + otherwise do + if mn <= 6 then word = numbers[1] + else word = numbers[2] + end + end + -- End select + + return word + + +/** getFirstDayOfPeriod() + * + * Returns a .DateTime object that represents the first day of the period. The + * first day of the period is based on the currently selected date in the DTP + * control and the setting of the period. I.e., if the date is 5/13/2003 and + * the period is quarter, then the first day of the period is 4/1/2003. + * + * Note that the .DateTime object returned here is used to update the DTP + * control, where we need the DTP control to generate a FORMAT event. If the + * returned date is exactly the same as the currently selected date, the DTP + * control does nothing. So, we check for that possibility and add 1 second to + * the return. This is enough to force the FORMAT event notification we need. + */ +::method getFirstDayOfPeriod private + expose dtp + use strict arg + + current = dtp~getDateTime + dt = self~getFirstDay(current) + + if dt == current then do + dt = dt~addSeconds(1) + end + + return dt + + +/** calcSize() + * + * Calculates the size needed to fully display the largest string in the + * specified call back field. The DTP control uses this size to ensure that + * the display is formatted correctly. + * + * For the specified call back field, we iterate over the items for the field, + * calculate the size in pixels needed for the item, and save the biggest size. + * We could have just eye-balled the biggest item in the field and calculated + * its size. For instance, 'quarter' looks to be the biggest item in the period + * call back. However, doing it this way ensures we get the correct display + * size and allows the program to be enhanced by adding items to any of the call + * back fields without having to change this method. + */ +::method calcSize unguarded private + expose dtp periods numbers types + use strict arg which + + biggest = .Size~new(0, 0) + size = .Size~new + + select + when which == 'XX' then array = numbers + when which == 'XXX' then array = periods + otherwise array = types + end + -- End select + + do text over array + dtp~textSize(text, size) + if biggest < size then biggest~equateTo(size) + end + + return biggest + +/** setUpArrays() + * + * Simple house keeping, initialize an array of items for each call back field. + */ +::method setUpArrays private + expose periods numbers types currentPeriod currentType + + periods = .Array~of('month', 'quarter', 'half') + + numbers = .Array~of('First', 'Second', 'Third', 'Fourth', 'Fifth', - + 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', - + 'Eleventh', 'Twelfth') + + types = .Array~of('balance', 'payroll', 'cash flow', 'income', 'earnings') + + -- Set the starting period, 'quarter', and report, 'balance'. + currentPeriod = 2 + currentType = 1 diff --git a/modules/windows/oodialog/controls/paidHolidays.h b/modules/windows/oodialog/controls/paidHolidays.h new file mode 100644 index 0000000..6c762e5 --- /dev/null +++ b/modules/windows/oodialog/controls/paidHolidays.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_HOLIDAY_DLG 101 +#define IDC_MC_HOLIDAYS 1003 +#define IDC_ST_MSG 1004 diff --git a/modules/windows/oodialog/controls/paidHolidays.rc b/modules/windows/oodialog/controls/paidHolidays.rc new file mode 100644 index 0000000..a93e7a7 --- /dev/null +++ b/modules/windows/oodialog/controls/paidHolidays.rc @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#include +#include +#include "paidHolidays.h" + + +// Dialog resources + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_HOLIDAY_DLG DIALOG 0, 0, 209, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "2011 Calendar - US - Paid Holidays" +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_MC_HOLIDAYS, MONTHCAL_CLASS, WS_TABSTOP | MCS_DAYSTATE, 10, 10, 122, 93 + LTEXT "Holiday calendar for 2011. Paid holidays are in bold.", IDC_ST_MSG, 137, 18, 60, 46, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 152, 103, 50, 14 +} diff --git a/modules/windows/oodialog/controls/upDown.h b/modules/windows/oodialog/controls/upDown.h new file mode 100644 index 0000000..41aefb9 --- /dev/null +++ b/modules/windows/oodialog/controls/upDown.h @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_UP_DOWN 101 +#define IDC_EDIT_DECIMAL 1001 +#define IDC_UD_DECIMAL 1002 +#define IDC_EDIT_HEXADECIMAL 1003 +#define IDC_UD_HEXADECIMAL 1004 +#define IDC_PB_ACCEL 1005 +#define IDC_PB_RANGE 1006 +#define IDC_PB_BASE 1007 +#define IDC_PB_POS 1008 +#define IDC_PB_BUDDY 1009 +#define IDC_EDIT_CLIENT 1010 +#define IDC_UD_CLIENT 1011 +#define IDC_EDIT_AGE 1012 +#define IDC_EDIT_GENDER 1013 +#define IDC_EDIT_PAID 1014 +#define IDC_RB_DECIMAL 1015 +#define IDC_RB_HEXADECIMAL 1016 +#define IDC_ST_DECIMAL 1020 +#define IDC_ST_HEXADECIMAL 1021 diff --git a/modules/windows/oodialog/controls/upDown.rc b/modules/windows/oodialog/controls/upDown.rc new file mode 100644 index 0000000..7d6eaaf --- /dev/null +++ b/modules/windows/oodialog/controls/upDown.rc @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include "upDown.h" +#include +#include + + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +IDD_UP_DOWN DIALOG 0, 0, 296, 159 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Up-down Controls" +FONT 8, "Ms Shell Dlg 2" +{ + RTEXT "Decimal:", IDC_ST_DECIMAL, 10, 13, 45, 8, SS_RIGHT + EDITTEXT IDC_EDIT_DECIMAL, 59, 10, 67, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER, WS_EX_RIGHT + CONTROL "", IDC_UD_DECIMAL, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_WRAP | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 115, 10, 12, 14 + EDITTEXT IDC_EDIT_HEXADECIMAL, 184, 10, 52, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "", IDC_UD_HEXADECIMAL, UPDOWN_CLASS, UDS_ALIGNLEFT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_SETBUDDYINT, 184, 10, 12, 14 + LTEXT ":Hexadecimal", IDC_ST_HEXADECIMAL, 242, 13, 44, 8, SS_LEFT + PUSHBUTTON "Change Acceleration", IDC_PB_ACCEL, 55, 30, 71, 14 + PUSHBUTTON "Change Range", IDC_PB_RANGE, 215, 30, 71, 14 + GROUPBOX "Client Records", IDC_STATIC, 10, 52, 126, 96 + RTEXT "Client:", IDC_STATIC, 20, 70, 22, 8, SS_RIGHT + EDITTEXT IDC_EDIT_CLIENT, 45, 66, 81, 14, ES_AUTOHSCROLL | ES_READONLY + CONTROL "", IDC_UD_CLIENT, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 115, 66, 12, 14 + RTEXT "Age:", IDC_STATIC, 31, 86, 43, 8, SS_RIGHT + EDITTEXT IDC_EDIT_AGE, 77, 84, 49, 14, ES_AUTOHSCROLL | ES_READONLY + RTEXT "Gender:", IDC_STATIC, 31, 105, 43, 8, SS_RIGHT + EDITTEXT IDC_EDIT_GENDER, 77, 103, 49, 14, ES_AUTOHSCROLL | ES_READONLY + RTEXT "Paid to Date:", IDC_STATIC, 31, 125, 43, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PAID, 77, 122, 49, 14, ES_AUTOHSCROLL | ES_READONLY + GROUPBOX "Miscellaneous Operations", IDC_STATIC, 142, 52, 144, 66 + PUSHBUTTON "Change Base", IDC_PB_BASE, 148, 64, 50, 14 + PUSHBUTTON "Get Position", IDC_PB_POS, 148, 82, 50, 14 + PUSHBUTTON "Get Buddy", IDC_PB_BUDDY, 148, 100, 50, 14 + GROUPBOX "Up-down", IDC_STATIC, 205, 64, 72, 48 + AUTORADIOBUTTON "Decimal", IDC_RB_DECIMAL, 219, 76, 40, 10, WS_TABSTOP + AUTORADIOBUTTON "Hexadecimal", IDC_RB_HEXADECIMAL, 219, 95, 56, 10, WS_TABSTOP + DEFPUSHBUTTON "OK", IDOK, 178, 135, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 236, 135, 50, 14 +} diff --git a/modules/windows/oodialog/controls/upDown.rex b/modules/windows/oodialog/controls/upDown.rex new file mode 100755 index 0000000..09304df --- /dev/null +++ b/modules/windows/oodialog/controls/upDown.rex @@ -0,0 +1,592 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * UpDown control example. + * + * The dialog produced by this example contains 3 up down controls. Two of the + * up down controls are integer up down controls. These are commonly referred + * to as 'spinners.' + * + * The third up down control is used to simulate paging through database + * records. It demonstrates how the up down control is useful in non-integer + * situations. + * + * The methods within the dialog class show the usage of mose of the methods of + * the UpDown class. + */ + + sd = locate() + .application~setDefaults("O", sd"upDown.h", .false) + + dlg = .AnUpDownDlg~new(sd"upDown.rc", IDD_UP_DOWN) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'AnUpDownDlg' subclass RcDialog + +-- initDialog() +-- There are many different approaches that can be taken to doing the set up for +-- a dialog. For myself, it seems simplest to just do all the initialization in +-- the initDialog() method, which is what is done here. +-- +-- The initialization for this example falls naturally into 3 steps: +-- * Initialize the 2 integer up down controls and set up the data related to +-- maintaining the state for those controls. +-- * Initalize the 'client records' up down control and data structures related +-- to that up down. +-- * Connect all our button controls. +::method initDialog + + self~setupNumericUpDowns + self~setupClientUpDown + self~connectPushButtons + + +-- onClientChange() +-- Invoked when the client up down's position is changed. I.e., the user clicks +-- on one of the arrows of the up down or uses the up or down arrow keys when +-- the focus is on the client edit control. +-- +-- Four arguments are sent to the method: the current position of the up down, +-- the amount the position is to be changed (which can be negative depending on +-- the direction of the change,) the control ID, and the window handle of the +-- control. We don't need the ID or window handle, so those args are just +-- ignored. +-- +-- Each position of the up down maps to the index of a record in the client +-- database, so we just update the record fields using the new index. +::method onClientChange unguarded + expose clientUPD clientDB + use arg curPos, increment + self~refreshClientDisplay(curPos + increment) + + -- Return a delta position reply. With no arguments the reply essentially + -- says to allow the change. + return .UpDown~deltaPosReply + + +-- onChangeAcceleration() +-- Invoked when the user clicks on the "Change Acceleration" button. We keep +-- track of the origianl acceleration values and then loop through 3 new values +-- each time the button is clicked. Returning to the original values every 4th +-- click. +-- +-- The acceleration values consist of an array of directory objects. Each +-- directory object has a SECONDS index and an INCREMENT index. This +-- essentially says after x seconds, set the increment to this value. Typically +-- the first record is 0 seconds and an increment of 1. +-- +-- To get the current acceleration of an up down control you use the +-- getAcceleration() method and an array as described above is returned. To set +-- a new / different acceleration you construct an array as described above and +-- use the setAcceleration() method. Note that the records (directory objects) +-- in the array have to be sorted by the seconds field, lowest to highest. +-- +-- See the printAccelValues(), getFirstAccelIncrease(), and doubleAccel() +-- methods to see the acceleration array works. +::method onChangeAcceleration unguarded + expose decUpDown originalAccel index + + currentAccel = decUpDown~getAcceleration + reverting = .false + + if \ originalAccel~isA(.array) then do + originalAccel = currentAccel + index = 1 + end + + select + when index == 1 then do + newAccel = self~getFirstAccelIncrease(currentAccel) + index = 2 + end + when index == 2 then do + newAccel = self~doubleAccel(currentAccel) + index = 3 + end + when index == 3 then do + newAccel = self~doubleAccel(currentAccel) + index = 4 + end + otherwise do + index = 1 + reverting = .true + newAccel = originalAccel + end + end + -- End select + + decUpDown~setAcceleration(newAccel) + + self~printAccelValues(currentAccel, newAccel, reverting) + + return 0 + + +-- onChangeRange() +-- Invoked when the "Change Range" button is clicked. The range of the up down +-- control on the right is changed. This up down starts out as base 16, but the +-- base may have been changed by the user. +-- +-- The example program has a set of ranges and we just cycle though them. We +-- keep a different set of ranges for base 10 and base 16. The up down controls +-- seem to behave rather oddly if the base is 16 and the range includes negative +-- numbers. So the decimal set has some ranges using negative numbers, but the +-- set for base 16 has only ranges with all positive positions. +::method onChangeRange unguarded + expose hexUpDown decRanges hexRanges + + -- Get the index of the next range and keep track of the current position in + -- the up down control. + index = self~getNextRange + currentPos = hexUpDown~getPosition + + -- Get the appropriate new range, and then set it. + if hexUpDown~getBase == 10 then range = decRanges[index] + else range = hexRanges[index] + + hexUpDown~setRange(range) + + -- Check if the current position is within the new range. If not, change the + -- current position. + if currentPos < range~min | currentPos > range~max then hexUpDown~setPosition(range~max) + + -- Display to the user what we did. + msg = 'Set new range for up down control on right to:' || .endOfLine || - + ' minimum:' range~min || .endOfLine || - + ' maximum:' range~max + self~information(msg) + + return 0 + + +-- onChangeBase() +-- Invoked when the user pushes the "Change Base" putton. Changes the base for +-- the integer up down control whose radio button is checked. +-- +-- Integer up down controls can be either base 10 or base 16. This method seems +-- to have a lot in it, but changing the base is actually simple. The rest of +-- the code is to keep the user interface consistent and looking "good." +::method onChangeBase unguarded + expose decUpDown hexUpDown leftUpDownDecimalRange leftUpDownHexadecimalRange + + if self~decimalRBSelected then do + upd = decUpDown + static = self~newStatic(IDC_ST_DECIMAL) + side = 'left' + end + else do + upd = hexUpDown + static = self~newStatic(IDC_ST_HEXADECIMAL) + side = 'right' + end + + oldBase = upd~getBase + if oldBase == 10 then do + newBase = 16 + if side == 'right' then newText = ":Hexadecimal" + else newText = "Hexadecimal:" + end + else do + newBase = 10 + if side == 'right' then newText = ":Decimal" + else newText = "Decimal:" + end + + upd~setBase(newBase) + static~setText(newText) + + -- Setting the position twice, is the only reliable way I've found to force + -- the text in the buddy window (the edit control) to update. + upd~setPosition(1) + + -- Read the comments for the setDecimalUpDown() method to see why we treat + -- the range for the left-side up down, (the one that starts out as decimal,) + -- special. + if side == 'left' then do + if base == 10 then upd~setRange(leftUpDownDecimalRange) + else upd~setRange(leftUpDownHexadecimalRange) + end + + upd~setPosition(0) + + msg = 'Changed the base of the up down control' || .endOfLine || - + 'on the' side 'from base' oldBase ' to' || .endOfLine || - + 'base' newBase'.' + self~information(msg) + + return 0 + + +-- onGetPostion() +-- Invoked when the user clicks the 'Get Position' push button. We simply +-- display the value for the integer up down selected by a checked radio button. +::method onGetPosition + expose decUpDown hexUpDown + + if self~decimalRBSelected then do + pos = decUpDown~getPosition + side = 'left' + end + else do + pos = hexUpDown~getPosition + side = 'right' + end + + msg = "The position of the up down control on the" side "is" pos + self~information(msg) + + return 0 + + +-- onGetBuddy() +-- Invoked when the "Get Buddy" push button is clicked. The getBuddy() method +-- is used to get the 'buddy' control of the up down control. The setBuddy() +-- method can be used to set the buddy control for an up down control, but that +-- method is not demonstrated in this example. Here we just display the window +-- handle value. +-- +-- Note that the getBuddy() method can return .nil if there is no buddy control. +-- We do not check for that here, since we know there is a buddy control. The +-- up-downs were created with the AUTOBUDDY style. +::method onGetBuddy + expose decUpDown hexUpDown + + if self~decimalRBSelected then do + buddy = decUpDown~getBuddy + side = 'left' + end + else do + buddy = hexUpDown~getBuddy + side = 'right' + end + + msg = "The window handle of the up down control on the" side "is" buddy~hwnd + self~information(msg) + + return 0 + + +-- connectPushButtons() +-- Convenience method, connects the clicked event of all the push buttons to +-- our corresponding event handling method. +::method connectPushButtons private + + self~connectButtonEvent(IDC_PB_ACCEL, "CLICKED", onChangeAcceleration) + self~connectButtonEvent(IDC_PB_RANGE, "CLICKED", onChangeRange) + self~connectButtonEvent(IDC_PB_BASE, "CLICKED", onChangeBase) + self~connectButtonEvent(IDC_PB_POS, "CLICKED", onGetPosition) + self~connectButtonEvent(IDC_PB_BUDDY, "CLICKED", onGetBuddy) + + -- At start up have the decimal radio button checked. + self~newRadioButton(IDC_RB_DECIMAL)~check + + +-- decimalRBSelected() +-- Returns true if the decimal radio button is checked, otherwise false. +::method decimalRBSelected private + return self~newRadioButton(IDC_RB_DECIMAL)~checked + + +-- setupNumericUpDowns() +-- Does all the initial set up for the two numeric up down controls. The left +-- up down control starts out with base 10 (decimal) and the right up down +-- control starts out with base 16 (hexadecimal.) However, these bases can be +-- changed after the dialog comes up. +::method setupNumericUpDowns private + expose decUpDown hexUpDown + + decUpDown = self~newUpDown(IDC_UD_DECIMAL) + hexUpDown = self~newUpDown(IDC_UD_HEXADECIMAL) + + -- By default an integer up down uses base 10 (deicmal.) We set the other + -- integer up down to base 16. + hexUpDown~setBase(16) + + -- Set the minimum value in the range to 0 and the maximum range to 1024. The + -- range can also be set using a .directory object, see the setDecimalUpDonw() + -- method. + hexUpDown~setRange(0, 1024) + + -- Set the position at the top of the range. + hexUpDown~setPosition(1024) + + -- Invoke some convenience methods to finish the set up. + self~setDecimalUpDown + self~setupRangeChanges + + +-- setDecimalUpDown() +-- Does the set up for the left-side up down. This up down controls starts out +-- with a decimal base, but the user can change the base after the dialog has +-- come up. +-- +-- The behavior of an up down control, when the base is set to 16, and the range +-- includes negative numbers, seems rather bizarre. So, in this example, only +-- the left-hand side up down control uses ranges that include negative numbers. +-- When the left-hand up down has its base changed to base 16, the range is +-- changed to not include negative numbers. +::method setDecimalUpDown private + expose decUpDown leftUpDownDecimalRange leftUpDownHexadecimalRange + + -- The setRange() method of the UpDown class accepts a Direcory object to set + -- the range. The MIN and MAX indexes of the Directory object set the range. + leftUpDownDecimalRange = .directory~new + leftUpDownDecimalRange~min = -200 + leftUpDownDecimalRange~max = 200 + + leftUpDownHexadecimalRange = .directory~new + leftUpDownHexadecimalRange~min = 0 + leftUpDownHexadecimalRange~max = 65536 + + -- Set the range with the values used when the base is 10. + decUpDown~setRange(leftUpDownDecimalRange) + + -- Set the position to -100. + decUpDown~setPosition(-100) + + +-- setupRangeChanges() +-- Creates two arrays that contain different ranges for the integer up down +-- controls. These ranges are used to change the range when the user clicks the +-- "Change Range" button. The rangeIndex is used to keep track of where we are +-- and to select the new range. +::method setupRangeChanges private + expose decRanges hexRanges rangeIndex + + rangeIndex = 1 + + d1 = .directory~new~~setEntry("MIN", -400)~~setEntry("MAX", 400) + d2 = .directory~new~~setEntry("MIN", -5)~~setEntry("MAX", 5000) + d3 = .directory~new~~setEntry("MIN", 600)~~setEntry("MAX", 700) + decRanges = .array~of(d1, d2, d3) + + d1 = .directory~new~~setEntry("MIN", 1024)~~setEntry("MAX", 2048) + d2 = .directory~new~~setEntry("MIN", 0)~~setEntry("MAX", 15) + d3 = .directory~new~~setEntry("MIN", 0)~~setEntry("MAX", 700) + hexRanges = .array~of(d1, d2, d3) + + +-- getNextRange() +-- Produce the next index to use when changing the range of an up down control +::method getNextRange private + expose rangeIndex + rangeIndex += 1 + if rangeIndex > 3 then rangeIndex = 1 + return rangeIndex + + +-- setupClientUpDown() +-- Sets up the third up down control. This up down is meant to demonstrate how +-- the up down control can be used to scroll through things other than integers. +-- +-- The example is for a set of data base records consisting of several fields. +-- The controlling field is the 'client.' Each time the up down control has a +-- position change, the matching data base record is displayed. +::method setupClientUpDown private + expose clientUPD clientDB nameInfo ageInfo genderInfo paidInfo + + clientUPD = self~newUpDown(IDC_UD_CLIENT) + + -- We will use 20 records. + clientDB = .array~new(20) + self~fillClientDB(clientDB) + + -- 20 records, so use a range of 1 to 20. + clientUPD~setRange(1, 20) + + -- Start at record 1. + clientUPD~setPosition(1) + + -- Connect the position change event to our onClientChange() method + self~connectUpDownEvent(IDC_UD_CLIENT, "DELTAPOS", onClientChange) + + nameInfo = self~newEdit(IDC_EDIT_CLIENT) + ageInfo = self~newEdit(IDC_EDIT_AGE) + genderInfo = self~newEdit(IDC_EDIT_GENDER) + paidInfo = self~newEdit(IDC_EDIT_PAID) + + -- Set the initial values for the record. + self~refreshClientDisplay(1) + + +-- getFirstAccelIncrease() +-- Generates new acceleration values using the default values of the up down +-- control. Observation has shown that, on Windows XP, an up down control +-- starts out with an acceleration array of 3 values, the first being 0 seconds, +-- an increment of 1. That is not documented and could not be a hard fast rule, +-- but works well enough for this example. +::method getFirstAccelIncrease private + use strict arg accel + + newAccel = .array~new(4) + newAccel[1] = accel[1] + newAccel[2] = .directory~new~~setEntry("SECONDS", 1)~~setEntry("INCREMENT", 2) + newAccel[3] = .directory~new~~setEntry("SECONDS", accel[2]~seconds)~~setEntry("INCREMENT", accel[2]~increment + 2) + newAccel[4] = .directory~new~~setEntry("SECONDS", accel[3]~seconds)~~setEntry("INCREMENT", accel[3]~increment + 4) + + return newAccel + + +-- doubleAccel() +-- Generates new acceleration values by doubling the increment of the passed in +-- values. +::method doubleAccel private + use strict arg accel + + newAccel = .array~new(accel~items) + newAccel[1] = accel[1] + + do i = 2 to accel~items + d = .directory~new + d~seconds = accel[i]~seconds + d~increment = accel[i]~increment * 2 + newAccel[i] = d + end + + return newAccel + + +-- printAccelValues() +-- Convenience method to display acceleration values +::method printAccelValues private + use strict arg currentAccel, newAccel, reverting + + tab = '09'x + + msg = "The current acceleration values are:" || .endOfLine || - + tab || "Items: " currentAccel~items || .endOfLine + + do a over currentAccel + msg ||= tab || "Seconds:" a~seconds || tab || "Increment:" a~increment || .endOfLine + end + + msg ||= .endOfLine + + if reverting then msg ||= "Reverting to original values of:" || .endOfLine + else msg ||= "Changing acceleration values to:" || .endOfLine + + msg ||= tab || "Items: " newAccel~items || .endOfLine + + do a over newAccel + msg ||= tab || "Seconds:" a~seconds || tab || "Increment:" a~increment || .endOfLine + end + + self~information(msg) + + +-- refreshClientDisplay() +-- Updates the display to show the fields for the specified record. +::method refreshClientDisplay private + expose nameInfo ageInfo genderInfo paidInfo clientDB + use strict arg index + + -- There are numerous ways to handle reaching the end of the range for an up + -- down control. Here we put up a message box when either end of the range is + -- reached. + if index < 1 then do + self~clientEnd("bottom") + return + end + if index > 20 then do + self~clientEnd("top") + return + end + + nameInfo~setText(clientDB[index][1]) + ageInfo~setText(clientDB[index][2]) + genderInfo~setText(clientDB[index][3]) + paidInfo~setText(clientDB[index][4]) + + +-- clientEnd() +-- Put up a message box informing the user that they hit the end of the range of +-- records. +::method clientEnd private + use strict arg whichEnd + + msg = "At the" whichEnd "of the client list." + self~information(msg) + + +-- information() +-- A convenience method to display informational messages to the user. +::method information private + use strict arg msg + + title = "UpDown Controls" + button = "OK" + icon = "INFORMATION" + miscStyles = "APPLMODAL TOPMOST" + j = messageDialog(msg, self~hwnd, title, button, icon, miscStyles) + + +-- fillClientDB() +-- Convenience method for this example. Fills an array with the 'database' +-- records. +::method fillClientDB private + use strict arg db + + db[1] = .array~of("Cathy Smart", 44, "female", "yes") + db[2] = .array~of("Tom Jones", 34, "male", "no") + db[3] = .array~of("Bill Harris", 23, "male", "yes") + db[4] = .array~of("Larry Bonds", 41, "male", "yes") + db[5] = .array~of("Sue Evans", 55, "female", "no") + db[6] = .array~of("Ashley Wright", 17, "female", "yes") + db[7] = .array~of("Deb Newsome", 22, "female", "yes") + db[8] = .array~of("Frank Getts", 22, "male", "yes") + db[9] = .array~of("Betty Boop", 34, "female", "no") + db[10] = .array~of("Fred Aston", 56, "male", "no") + db[11] = .array~of("Cary Thule", 85, "female", "no") + db[12] = .array~of("Brianna Medford", 24, "female", "yes") + db[13] = .array~of("Sol Price", 26, "male", "no") + db[14] = .array~of("Hugh Dentry", 41, "male", "no") + db[15] = .array~of("Tina McGrath", 49, "female", "yes") + db[16] = .array~of("Tom Denard", 26, "female", "yes") + db[17] = .array~of("Crissy Albright", 21, "female", "yes") + db[18] = .array~of("Phil Logan", 19, "male", "no") + db[19] = .array~of("Walter Perkins", 50, "male", "yes") + db[20] = .array~of("Zoe Sharpe", 28, "female", "no") + diff --git a/modules/windows/oodialog/controls/userStringDTP.h b/modules/windows/oodialog/controls/userStringDTP.h new file mode 100644 index 0000000..642c40a --- /dev/null +++ b/modules/windows/oodialog/controls/userStringDTP.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_SYSTEMTIME 100 +#define IDD_HELP 200 +#define IDC_ST_CUR_TIME 1000 +#define IDC_ST_CUR_DATE 1001 +#define IDC_ST_NEW_DATE 1002 +#define IDC_DTP_SYSTIME 1003 +#define IDC_ST_NEW_TIME 1004 +#define IDC_EDIT_CUR_DATE 1006 +#define IDC_ST_INVALID 1007 +#define IDC_EDIT_CUR_TIME 1008 +#define IDC_EDIT_NEW_DATE 1011 +#define IDC_EDIT_NEW_TIME 1012 +#define IDC_HELP_TEXT 1015 diff --git a/modules/windows/oodialog/controls/userStringDTP.hlp b/modules/windows/oodialog/controls/userStringDTP.hlp new file mode 100644 index 0000000..209202a --- /dev/null +++ b/modules/windows/oodialog/controls/userStringDTP.hlp @@ -0,0 +1,77 @@ +'' || .endOfLine || - +'' || .endOfLine || - +' Changing the System Date and Time' || .endOfLine || - +' =================================' || .endOfLine || - +'' || .endOfLine || - +' This program allows you to change the system date and or time by' || .endOfLine || - +' setting the displayed date and time in the date and time picker control' || .endOfLine || - +' in the center of the dialog to the desired new date (and / or new' || .endOfLine || - +' time.)' || .endOfLine || - +'' || .endOfLine || - +' User Interface' || .endOfLine || - +' ==============' || .endOfLine || - +'' || .endOfLine || - +' Two fields on the left of the dialog show the current system date and' || .endOfLine || - +' time.' || .endOfLine || - +'' || .endOfLine || - +' Two fields on the right of the dialog show the date and time the system' || .endOfLine || - +' date and time will be changed to, if the user clicks the okay button at' || .endOfLine || - +' that point. When there is no change to the system date and time, the' || .endOfLine || - +' fields are empty and colored greenish as a visual clue that nothing' || .endOfLine || - +' will change. When there will be a change to the system date and time' || .endOfLine || - +' the fields are colored reddish.' || .endOfLine || - +'' || .endOfLine || - +' The new system date and time are specified by changing the date and /' || .endOfLine || - +' or time in the date and time picker control in the center of the' || .endOfLine || - +' dialog. This is done through the standard date and time picker user' || .endOfLine || - +' interface.' || .endOfLine || - +'' || .endOfLine || - +' This program allows directly entering what are termed 'shortcut'' || .endOfLine || - +' strings.' || .endOfLine || - +'' || .endOfLine || - +' When the program starts, the DTP control is set to the current system' || .endOfLine || - +' date and time. Of course as the dialog executes the system time is' || .endOfLine || - +' advancing. If the DTP is changed to a new date and / or time, but then' || .endOfLine || - +' those changes need to be undone, it would be difficult to manually set' || .endOfLine || - +' the DTP control to the current system date and time. So that operation' || .endOfLine || - +' is one set of shortcuts.' || .endOfLine || - +'' || .endOfLine || - +' The other set of shortcuts allows directly changing the DTP display to' || .endOfLine || - +' some time or date by just typing it in. For instance, to change the' || .endOfLine || - +' date to May 12, 2050, rather than page through the DTP control to get' || .endOfLine || - +' there, 5/12/2050 can be typed directly in the DTP control.' || .endOfLine || - +'' || .endOfLine || - +' To directly type in the DTP control, use either the F2 key, or mouse' || .endOfLine || - +' click on the DTP control's display area when the DTP currently has the' || .endOfLine || - +' focus. This is a (little known?) feature of the DTP control itself.' || .endOfLine || - +'' || .endOfLine || - +' The valid shortcuts are these:' || .endOfLine || - +'' || .endOfLine || - +' Reset shortcut:' || .endOfLine || - +'' || .endOfLine || - +' This shortcut resets any changes to the date and or time to none. It' || .endOfLine || - +' also resets the date and time picker control to the current system' || .endOfLine || - +' date and time.' || .endOfLine || - +'' || .endOfLine || - +' Type 'reset', 'cancel' 'r', or 'c' Case is not significant.' || .endOfLine || - +'' || .endOfLine || - +' New date and or new time shortcut:' || .endOfLine || - +'' || .endOfLine || - +' This shortcut allows directly entering a new date, or a new time,' || .endOfLine || - +' or both.' || .endOfLine || - +'' || .endOfLine || - +' Formats for new date: mm/dd, or mm/dd/yyyy' || .endOfLine || - +'' || .endOfLine || - +' Formats for new time: hh:mm, or hh:mm:ss' || .endOfLine || - +'' || .endOfLine || - +' When both date and time are entered, the date must precede the time.' || .endOfLine || - +' The date and time must be separated by one or more spaces. It is not' || .endOfLine || - +' required to enter both a date and a time. Only a new date can be' || .endOfLine || - +' entered, or only a new time.' || .endOfLine || - +'' || .endOfLine || - +' Months (mm), days (dd), hours (hh), minutes (mm), or seconds(ss) can' || .endOfLine || - +' contain a leading 0, but are not required to. I.e., for June 5th,' || .endOfLine || - +' the new date string can be 06/05, 6/05, 06/5, or 6/5. The year' || .endOfLine || - +' (yyyy) portion of the new date string is required to be the 4 digit' || .endOfLine || - +' year. I.e. 6/5/11 is not valid for June 5th 2011.' || .endOfLine || - +'' || .endOfLine diff --git a/modules/windows/oodialog/controls/userStringDTP.rc b/modules/windows/oodialog/controls/userStringDTP.rc new file mode 100644 index 0000000..bc76e09 --- /dev/null +++ b/modules/windows/oodialog/controls/userStringDTP.rc @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "userStringDTP.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SYSTEMTIME DIALOGEX 0, 0, 247, 150 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Adjust System Date & Time" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + GROUPBOX "Change the System Date and / or the Time", IDC_STATIC, 11, 10, 226, 101, WS_GROUP + LTEXT "Current Date:", IDC_ST_CUR_DATE, 23, 27, 45, 8, SS_LEFT + EDITTEXT IDC_EDIT_CUR_DATE, 71, 25, 48, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Current Time:", IDC_ST_CUR_TIME, 23, 46, 45, 8, SS_LEFT + EDITTEXT IDC_EDIT_CUR_TIME, 71, 44, 48, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + LTEXT "New Date:", IDC_ST_NEW_DATE, 143, 27, 35, 8, SS_LEFT + EDITTEXT IDC_EDIT_NEW_DATE, 181, 25, 48, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + LTEXT "New Time:", IDC_ST_NEW_TIME, 143, 46, 35, 8, SS_LEFT + EDITTEXT IDC_EDIT_NEW_TIME, 181, 44, 48, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + CONTROL "", IDC_DTP_SYSTIME, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_LONGDATEFORMAT | DTS_APPCANPARSE, 11, 69, 226, 15 + LTEXT "Invalid shortcut string: 05/12/3011 08:09:22", IDC_ST_INVALID, 23, 93, 206, 8, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 82, 126, 50, 14, WS_GROUP + PUSHBUTTON "Cancel", IDCANCEL, 135, 126, 50, 14 + PUSHBUTTON "Help", IDHELP, 187, 126, 50, 14 +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_HELP DIALOGEX 0, 0, 409, 305 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Help for Setting the System Date and Time " +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + EDITTEXT IDC_HELP_TEXT, 10, 10, 389, 271, WS_VSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY | ES_WANTRETURN + DEFPUSHBUTTON "Close", IDOK, 350, 281, 49, 14 +} + diff --git a/modules/windows/oodialog/controls/userStringDTP.rex b/modules/windows/oodialog/controls/userStringDTP.rex new file mode 100755 index 0000000..edd25f2 --- /dev/null +++ b/modules/windows/oodialog/controls/userStringDTP.rex @@ -0,0 +1,646 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +/** + * An example of a date and time picker control and how to handle the USERSTRING + * event notification. + * + * This program mimics an application that could be used to change the system + * date and time. It allows the user to enter a new system date and or time + * through a DTP control. Once a new date and / or new time are displayed in + * the DTP control, if the user clicks the ok button the system date and time + * is updated to the date and time displayed in the control. + * + * When a DTP control has the CANPARSE style, it allows the user to directly + * enter text in the display area of the DTP. When the user is done editing, + * a USERSTRING event notification is sent. The programmer connects this event + * and then handles the notification by updating the DTP control based on the + * text the user entered. + * + * This program allows the user to directly enter what are termed 'shortcut' + * strings. + * + * When the program starts, the DTP control is set to the current system date + * and time. Of course as the dialog executes the system time is advancing. If + * the user has changed the DTP to a new date and / or time, but then wants to + * undo those changes, it would be difficult to manually set the DTP control to + * the current system date and time. So that operation is one set of shortcuts. + * + * The other set of shortcuts allows the user to directly go to some time or + * date by just typing it in. For instance, if the user wanted to change the + * date to May 12, 2050, rather than page through the DTP control to get there, + * the user can just type 5/12/2050 directly in the DTP control. + * + * To directly type in the DTP control, the user can either use the F2 key, or + * mouse click on the DTP control's display area when the DTP currently has the + * focus. This is a (little known?) feature of the DTP control itself. It is + * not something that the ooDialog framework provides. + * + * The valid shortcuts are these: + * + * Reset shortcut: + * + * This shortcut resets any changes to the date and or time to none. It also + * resets the date and time picker control to the current systeme date and + * time. + * + * Type 'reset', 'cancel' 'r', or 'c' Case is not significant. + * + * New date and or new time shortcut: + * + * This shortcut allows directly entering a new date, or a new time, or both. + * + * Formats for new date: mm/dd, or mm/dd/yyyy + * + * Formats for new time: hh:mm, or hh:mm:ss + * + * When both date and time are entered, the date must precede the time. The + * date and time must be separated by one or more spaces. It is not required + * to enter a date and a time. Only a new date can be entered or only a new + * time. + * + * Months (mm), days (dd), hours (hh), minutes (mm), or seconds(ss) can + * contain a leading 0, but are not required to. I.e., for June 5th, the new + * date string can be 06/05, 6/05, 06/5, or 6/5. The year (yyyy) portion of + * the new date string is required to be the 4 digit year. I.e. 6/5/11 is not + * valid for June 5th 2011. + */ + + sd = locate() + .application~setDefaults('O', sd'userStringDTP.h', .false) + + dlg = .SystemTimeDlg~new(sd'userStringDTP.rc', IDD_SYSTEMTIME) + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'SystemTimeDlg' subclass RcDialog + +/** initDialog() + * + * initDialog() is automatically invoked by the ooDialog framework when the + * underlying Windows dialog is created. It is used to do initialization that + * can only be done when the underlying dialog and dialog controls exist. + * + * This is a typical dialog initialization. + */ +::method initDialog + expose curDate curTime dtp newDate newTime resetting colorIsSet stInvalid + + -- We need to be sure the Rexx stInvalid object exists before we connect the + -- events to onFocus(). Otherwise, the events can fire with stInvalid being + -- .nil. + stInvalid = self~newStatic(IDC_ST_INVALID)~~setText("") + + self~connectDateTimePickerEvent(IDC_DTP_SYSTIME, "SETFOCUS", onFocus) + self~connectDateTimePickerEvent(IDC_DTP_SYSTIME, "KILLFOCUS", onFocus) + self~connectDateTimePickerEvent(IDC_DTP_SYSTIME, "DROPDOWN", onFocus) + + -- Connect the help key event to our onHelp() method. + self~connectHelp(onHelp) + + -- Connect the other DTP control event notifications and initialize the DTP. + self~connectDateTimePickerEvent(IDC_DTP_SYSTIME, "USERSTRING", onUserString) + self~connectDateTimePickerEvent(IDC_DTP_SYSTIME, "DATETIMECHANGE", onDateTime) + + dtp = self~newDateTimePicker(IDC_DTP_SYSTIME); + dtp~setFormat("'Today is:' dddd MMMM dd, yyyy 'at' hh':'mm':'ss tt") + + -- Save references to the read only edit controls. + curDate = self~newEdit(IDC_EDIT_CUR_DATE) + curTime = self~newEdit(IDC_EDIT_CUR_TIME) + newDate = self~newEdit(IDC_EDIT_NEW_DATE) + newTime = self~newEdit(IDC_EDIT_NEW_TIME) + + -- Set the new date and new time fields to 'no change at present.' + self~resetNewDateTime + + -- Begin updating the current date and time fields with the current system + -- date and time. + self~start('updateSysTime') + + +/** resetNewDateTime() + * + * The new date and new time fields display the date and time that the user has + * selected to set the system date and time to. The fields are updated every + * time the user changes the date and time in the DTP control. + * + * However, once the user has changed the DTP time and date, one of the + * shortcuts can be used to reset the DTP to the current system date and time. + * At this point the new date and new time fields are set to blank and the color + * of the fields is set to green, to indicate that no change will be made if the + * user clicks the ok button a this time. + */ +::method resetNewDateTime unguarded private + expose newDate newTime resetting colorIsSet + + newDate~setText('') + newTime~setText('') + + self~setControlColor(IDC_EDIT_NEW_DATE, 3) + self~setControlColor(IDC_EDIT_NEW_TIME, 3) + newDate~redraw + newTime~redraw + + resetting = .false + colorIsSet = .false + + +/** onDateTime() + * + * This is the event handler for the DATETIMECHANGE event. This method is + * invoked each time there is a change in the DTP control. + * + * There are 2 cases here we need to check for. Either, the user is changing + * the date and / or time to set the system to a new time, or the user has used + * the short cut to set the DTP control to the current system data and time. + * + * When the user is resetting the DTP control to the current system time, we + * need to set new date and new time back to blank - in effect undo any changes + * that may have selected a new data and time. + * + * Otherwise, the user has changed the DTP control to reflect the date and time + * she wants to change the system date and time to. In this case we update the + * new date and time fields to show what the system time will be set to if the + * ok button is clicked. + */ +::method onDateTime unguarded + expose dtp newDate newTime resetting colorIsSet stInvalid + + stInvalid~setText('') + + if resetting then do + self~resetNewDateTime + end + else do + parse value dtp~getDateTime with yy '-' mm '-' dd 'T' time '.' junk + + if \ colorIsSet then do + self~setControlColor(IDC_EDIT_NEW_DATE, 13) + self~setControlColor(IDC_EDIT_NEW_TIME, 13) + colorIsSet = .true + end + + newDate~setText(mm'/'dd'/'yy) + newTime~setText(time) + end + + return 0 + +/** onUserString() + * + * This is the event handler for the USERSTRING event. It is invoked when the + * user has elected to type a shortcut in the DTP control and has finished + * editing. + * + * This is the main point of this example, to show how to handle the user string + * event. We examine what the user typed and determine if it is a valid + * 'shortcut' string. When it is valid, we return a .DateTime object with the + * date and time we want the DTP control to update its display to. If it is not + * valid we return the same .DateTime object we received. + * + * When the returned date and time is different from the DTP control's current + * date an it, the control updates its display to the returned date and time. + * When the returned date and time is the same as the DTP controls current date + * and time, the DTP does nothing. + * + * When users type a shortcut string, they will expect the DTP control's display + * to change. However, typos are common. Without a clue as to what they did + * wrong, it is hard for users to know what happened. So, it the user string is + * not valid, we display a clue to the problem by setting the IDC_ST_INVALID + * static control's text to an error message. + * + * Other than those basic principles, it is merely a matter of determining if + * the user typed a valid shortcut, or not. + */ +::method onUserString unguarded + expose resetting stInvalid + use arg dt, userStr, id, hwnd + + stInvalid~setText('') + + -- Check for the shortcut to set the DTP to the current date and time. + upStr = userStr~upper + if upStr == 'C' | upStr == 'R' | upStr == 'CANCEL' | upStr == 'RESET' then do + resetting = .true + return .DateTime~new + end + + -- The rest is just mechanics. There is no attempt to be clever, this is just + -- a rather brute force approach. Check for things that can't possibly be + -- valid and return invalid for them. Continue doing that until we can parse + -- out month, day, year, hour, minutes, seconds. Check that the parsed values + -- are valid numbers, the return a new .DateTime object based on those values. + + dateStr = '' + timeStr = '' + + if userStr~words == 2 then do + dateStr = userStr~word(1) + timeStr = userStr~word(2) + end + else if userStr~words == 1 then do + if userStr~pos('/') <> 0 then dateStr = userStr + else if userStr~pos(':') <> 0 then timeStr = userStr + end + else do + return self~invalid(userStr, dt) + end + + slashes = dateStr~countStr('/') + colons = timeStr~countStr(':') + + if slashes == 0, colons == 0 then return self~invalid(userStr, dt) + if slashes > 2 | colons > 2 then return self~invalid(userStr, dt) + + parse value dt~isoDate with yy '-' mm '-' dd 'T' hh ':' min ':' ss '.' junk + + nYY = -1; nMM = -1; nDD = -1; nHH = -1; nMin = -1; nSS = -1 + + if slashes == 1 then do + parse var dateStr nMM '/' nDD . + nMM = nMM~strip~strip( , '0') + nDD = nDD~strip~strip( , '0') + + if \ nMM~dataType('W') | \ nDD~dataType('W') then return self~invalid(userStr, dt) + if nMM < 1 | nMM > 12 then return self~invalid(userStr, dt) + if nDD < 1 | nDD > 31 then return self~invalid(userStr, dt) + end + else if slashes == 2 then do + parse var dateStr nMM '/' nDD '/' nYY . + nMM = nMM~strip~strip( , '0') + nDD = nDD~strip~strip( , '0') + nYY = nYY~strip~strip( , '0') + + if \ nMM~dataType('W') | \ nDD~dataType('W') | \ nYY~dataType('W') then return self~invalid(userStr, dt) + if nMM < 1 | nMM > 12 then return self~invalid(userStr, dt) + if nDD < 1 | nDD > 31 then return self~invalid(userStr, dt) + if nYY < 1601 | nYY > 9999 then return self~invalid(userStr, dt) + end + + if colons == 1 then do + parse var timeStr nHH ':' nMin . + nHH = nHH~strip~strip( , '0') + nMin = nMin~strip~strip( , '0') + + if \ nHH~dataType('W') | \ nMin~dataType('W') then return self~invalid(userStr, dt) + if nHH < 0 | nHH > 23 then return self~invalid(userStr, dt) + if nMin < 0 | nMin > 59 then return self~invalid(userStr, dt) + end + else if colons == 2 then do + parse var timeStr nHH ':' nMin ':' nSS . + nHH = nHH~strip~strip( , '0') + nMin = nMin~strip~strip( , '0') + nSS = nSS~strip~strip( , '0') + + if \ nHH~dataType('W') | \ nMin~dataType('W') | \ nSS~dataType('W') then return self~invalid(userStr, dt) + if nHH < 0 | nHH > 23 then return self~invalid(userStr, dt) + if nMin < 0 | nMin > 59 then return self~invalid(userStr, dt) + if nSS < 0 | nSS > 59 then return self~invalid(userStr, dt) + end + + if nYY <> -1 then yy = nYY + if nMM <> -1 then mm = nMM~right(2, 0) + if nDD <> -1 then dd = nDD~right(2, 0) + if nHH <> -1 then hh = nHH~right(2, 0) + if nMin <> -1 then min = nMin~right(2, 0) + if nSS <> -1 then ss = nSS~right(2, 0) + + -- Okay, things should be good, but we haven't checked for something like + -- February 30, or June 31. Construct our ISO string and then check it is + -- valid. + isoStr = yy'-'mm'-'dd'T'hh':'min':'ss'.000000' + + if \ self~validIso(isoStr) then return self~invalid(userStr, dt) + + nDT = .DateTime~fromIsoDate(isoStr) + return nDT + + +/** updateSysTime() + * + * This method is started and runs asynchronously to the rest of the dialog. It + * updates the current System date and time as the dialog is running. + * + * When the dialog is started the current date and the current time read only + * edit controls are set to the system date and time. Of course, the correct + * system date and time is constantly incrementing. This method updates the + * edit with the correct current time approximately every second. We do this by + * setting an alarm to fire every second that re-invokes this method. + * + * To get the current date and time, we instantiate a new .DateTime object each + * time this method is inovked. This makes things very easy for us, and auto- + * matically takes care of any 'drift' in the time. For instance, if we just + * added a second, to the last time, each time we are invoked, we would slowly + * drift away from the correct time. This is due to the fact that the timer + * can not be 100% accurate. Also there is some time taken up in processing + * each time we are invoked. + */ +::method updateSysTime unguarded + expose curDate curTime updateAlarm + + -- If the dialog is ended, quit. + if \ self~isDialogActive then return + + parse value .DateTime~new with yy '-' mm '-' dd 'T' time '.' junk + curDate~setText(mm'/'dd'/'yy) + curTime~setText(time) + + timerMsg = .Message~new(self, updateSysTime) + updateAlarm = .Alarm~new(1, timerMsg) + + +/** onFocus + * + * This event handler is connected to several of the DTP control's event + * notifications. Its only purpose is to erase the 'Invalid shortcut string' + * text. + */ +::method onFocus unguarded + expose stInvalid + + stInvalid~setText("") + return 0 + + +/** invalid() + * + * Convenience method called from onUserString() when the user typed an invalid + * shortcut. It sets a static control to message showing the invalid shortcut. + * This gives the user a visual clue as to why the time was not updated. + */ +::method invalid unguarded private + expose stInvalid + use strict arg userStr, dt + + stInvalid~setText('Invalid shortcut string:' userStr) + return dt + + +/** validIso() + * + * This convenience method is called from onUserString() when the method gets to + * the point where it thinks it has a valid shortcut to update to a new date and + * time. + * + * But, it hasn't checked for things like June 31 or February 29. + * + * Here, rather than do an elaborate table lookup to check for invalid days, we + * take a simple approach. We trap a syntax condition and then just try to + * instantiate a .DateTime object with the string. If a condition is raised, we + * say - no the string is not valid. If no condition is raised we say - yes the + * string is valid. + */ +::method validIso unguarded private + use strict arg str + + signal on syntax + + .DateTime~fromIsoDate(str) + return .true + + syntax: + return .false + + +/** cancel() + * + * The event handler for the cancel event. This is invoked when the user closes + * the dialog, either through the cancel button or the escape key. + * + * We intercept the event to cancel the 'current' time updating, and then + * forward the message on to let the superclass handle the ending of the dialog + * prorperly. + * + * This is probably not really needed. If the alarm was not canceled, then the + * next time the alarm went off, updatesysTime() would see that the dialog was + * ended and quit on its own. + */ +::method cancel unguarded + expose updateAlarm + + updateAlarm~cancel + return self~cancel:super + +/** ok() + * + * The event handler for the OK event. This is invoked when the user clicks the + * ok button. + * + * In a real application, this is where the system date and time would be + * reset, if the user actually had a new date and time selected. Here we just + * put up a message box 'saying' we reset the date and time. + * + * Note that the newDate and newTime will not contain any text, *unless*, the + * user has actually changed the date or time in the DTP control. This makes a + * convenient check to see if we need to do anthing. + */ +::method ok unguarded + expose updateAlarm dtp newDate newTime + + updateAlarm~cancel + + nDate = newDate~getText + if nDate \== "" then do + nTime = newTime~getText + msg = "Set new system date and time to" nDate nTime + title = "System Date Time Reset" + j = MessageDialog(msg, self~hwnd, title) + end + + return self~ok:super + + +/** help() + * + * This is the event handler for the IDHELP command. Any button or menu item + * with the resource ID of IDHELP will generate the HELP command event. The + * ooDialog framework automatically connects the IDOK, IDCANCEL, and IDHELP + * commands to the ok(), cancel(), and help() methods in the dialog object. + * + * The default help() method does nothing. To do something the programmer over- + * rides the method in her subclass. Here we simply invoke the onHelp() method + * to do the work. + * + * Do not confuse the HELP command event with the help key (F1) event. + */ +::method help + self~onHelp + +/** onHelp() + * + * This is the event handler for the help key (F1) event. The event is + * generated when the user presses the F1 key. + * + * The programmer connects this event to a method in the Rexx dialog by using + * the connectHelp() method. Here in this event handler, we show a modal dialog + * with some help text. + * + * Do not confuse the help key (F1) event with the HELP command event. + */ +::method onHelp + .SystemTimeHelp~new(.application~srcDir'userStringDTP.rc', IDD_HELP)~execute("SHOWTOP") + + +::class 'SystemTimeHelp' subclass RcDialog + +::method initDialog + expose newFont e visibleLines + + e = self~newEdit(IDC_HELP_TEXT) + + -- Create a mono-spaced font for the edit control that displays the help text. + newFont = self~createFontEx('Courier New', 9) + + -- Set the font of the edit control to our custom font, set the text of the + -- edit control to our help text. + e~setFont(newFont) + e~setText(getHelpText()) + + +/** leaving() + * + * The leaving method is invoked automatically by the ooDialog framework + * immediately before the dialog is destroyed. + * + * At this point, the underlying Windows dialog still exists. This makes the + * leaving method the proper place to do clean up. Especially if some of the + * clean up, as does deleteFont(), requires the underlying dialog to exist. + * + * Here we delete the mono-spaced font created for the help text display. + */ +::method leaving + expose newFont + + self~deleteFont(newFont) + + +/** routine::getHelpText() + * + * This is convenience routine that returns the help text for the examp program. + * + * The help text is constructed here as a single string. + * + * The text could be contained in a file and read in when needed. To reduce the + * nubmer of files needed for the program, the text was just typed into the + * program file. + */ +::routine getHelpText + + txt = - + "" || .endOfLine || - + "" || .endOfLine || - + " Changing the System Date and Time" || .endOfLine || - + " =================================" || .endOfLine || - + "" || .endOfLine || - + " This program allows you to change the system date and or time by" || .endOfLine || - + " setting the displayed date and time in the date and time picker control" || .endOfLine || - + " in the center of the dialog to the desired new date (and / or new" || .endOfLine || - + " time.)" || .endOfLine || - + "" || .endOfLine || - + " User Interface" || .endOfLine || - + " ==============" || .endOfLine || - + "" || .endOfLine || - + " Two fields on the left of the dialog show the current system date and" || .endOfLine || - + " time." || .endOfLine || - + "" || .endOfLine || - + " Two fields on the right of the dialog show the date and time the system" || .endOfLine || - + " date and time will be changed to, if the user clicks the okay button at" || .endOfLine || - + " that point. When there is no change to the system date and time, the" || .endOfLine || - + " fields are empty and colored greenish as a visual clue that nothing" || .endOfLine || - + " will change. When there will be a change to the system date and time" || .endOfLine || - + " the fields are colored reddish." || .endOfLine || - + "" || .endOfLine || - + " The new system date and time are specified by changing the date and /" || .endOfLine || - + " or time in the date and time picker control in the center of the" || .endOfLine || - + " dialog. This is done through the standard date and time picker user" || .endOfLine || - + " interface." || .endOfLine || - + "" || .endOfLine || - + " This program allows directly entering what are termed 'shortcut'" || .endOfLine || - + " strings." || .endOfLine || - + "" || .endOfLine || - + " When the program starts, the DTP control is set to the current system" || .endOfLine || - + " date and time. Of course as the dialog executes the system time is" || .endOfLine || - + " advancing. If the DTP is changed to a new date and / or time, but then" || .endOfLine || - + " those changes need to be undone, it would be difficult to manually set" || .endOfLine || - + " the DTP control to the current system date and time. So that operation" || .endOfLine || - + " is one set of shortcuts." || .endOfLine || - + "" || .endOfLine || - + " The other set of shortcuts allows directly changing the DTP display to" || .endOfLine || - + " some time or date by just typing it in. For instance, to change the" || .endOfLine || - + " date to May 12, 2050, rather than page through the DTP control to get" || .endOfLine || - + " there, 5/12/2050 can be typed directly in the DTP control." || .endOfLine || - + "" || .endOfLine || - + " To directly type in the DTP control, use either the F2 key, or mouse" || .endOfLine || - + " click on the DTP control's display area when the DTP currently has the" || .endOfLine || - + " focus. This is a (little known?) feature of the DTP control itself." || .endOfLine || - + "" || .endOfLine || - + " The valid shortcuts are these:" || .endOfLine || - + "" || .endOfLine || - + " Reset shortcut:" || .endOfLine || - + "" || .endOfLine || - + " This shortcut resets any changes to the date and or time to none. It" || .endOfLine || - + " also resets the date and time picker control to the current system" || .endOfLine || - + " date and time." || .endOfLine || - + "" || .endOfLine || - + " Type 'reset', 'cancel' 'r', or 'c' Case is not significant." || .endOfLine || - + "" || .endOfLine || - + " New date and or new time shortcut:" || .endOfLine || - + "" || .endOfLine || - + " This shortcut allows directly entering a new date, or a new time," || .endOfLine || - + " or both." || .endOfLine || - + "" || .endOfLine || - + " Formats for new date: mm/dd, or mm/dd/yyyy" || .endOfLine || - + "" || .endOfLine || - + " Formats for new time: hh:mm, or hh:mm:ss" || .endOfLine || - + "" || .endOfLine || - + " When both date and time are entered, the date must precede the time." || .endOfLine || - + " The date and time must be separated by one or more spaces. It is not" || .endOfLine || - + " required to enter both a date and a time. Only a new date can be" || .endOfLine || - + " entered, or only a new time." || .endOfLine || - + "" || .endOfLine || - + " Months (mm), days (dd), hours (hh), minutes (mm), or seconds(ss) can" || .endOfLine || - + " contain a leading 0, but are not required to. I.e., for June 5th," || .endOfLine || - + " the new date string can be 06/05, 6/05, 06/5, or 6/5. The year" || .endOfLine || - + " (yyyy) portion of the new date string is required to be the 4 digit" || .endOfLine || - + " year. I.e. 6/5/11 is not valid for June 5th 2011." || .endOfLine || - + "" || .endOfLine + return txt diff --git a/modules/windows/oodialog/editrex.rex b/modules/windows/oodialog/editrex.rex new file mode 100755 index 0000000..67afced --- /dev/null +++ b/modules/windows/oodialog/editrex.rex @@ -0,0 +1,185 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: EditRex.rex */ +/* Type: Open Object Rexx ooDialog Script */ +/* */ +/* Description: */ +/* This script reads the registry entries for the ftype REXXScript EDIT */ +/* type and allows to change it between Notepad.EXE and any */ +/* given EDITOR */ +/* */ +/* It uses the WindowsRegistry Class and classes from the ooDialog */ +/* framework. */ +/* */ +/* */ +/****************************************************************************/ + +/* See if user gave directions */ +parse arg Interface + +/* The user may decide between Console or ooDialog Version */ +/* Default is ooDialog Version */ +/* If the ftype Open Command Setting is to rexxhide, the Console Version will NOT work */ +/* Verify if the given parm starts with "C", TRANSLATE changes it to UPPER CASE */ +if Interface~LEFT(1)~TRANSLATE = "C" then Interface = "CONSOLE" +else Interface = "ooDialog" + +/* create a new registry object */ +r = .WindowsRegistry~new + +/* leave if init failed */ +if r~InitCode \= 0 then do + call errorDialog 'Error open the registry. Program aborted.' + exit +end + +/* Set from default HKEY_LOCAL_MACHINE to HKEY_CLASSES_ROOT */ +r~Current_Key = r~CLASSES_ROOT + +/* Open the Key with Options QUERY and WRITE */ +if r~open(,"REXXScript\Shell\Edit\Command","QUERY WRITE") == 0 then do + call errorDialog 'Error opening the registry key with write access.' || '0d0a0d0a'x || - + 'If you are on Vista you must run this program with' || '0d0a'x || - + 'elevated privileges to see it work.' + exit +end + +/* Retrieves information about a given key in a compound variable */ +/* q.values holds the number of value entries. */ +q. = r~Query + +/* Retrieves all value entries of a given key into a compound variable */ +if r~ListValues(,vals.) = 0 then do + /* There are 3 possible values for each entry: + vals.i.name the Name of the value + vals.i.data the data of the entry + vals.i.type the type : NORMAL for alphabetic values, + EXPAND for expandable strings such as a path, + NONE for no specified type, + MULTI for multiple strings, + NUMBER for a 4-byte value, and + BINARY for any data format. + */ + /* get the current program only. Do not show the "%1" parameter */ + /* TRANSLATE it to UPPER CASE */ + program = vals.1.data~word(1)~TRANSLATE +end +else do + call errorDialog 'Error reading the registry. Program aborted.' + exit +end + +/* Ask user what to do */ +if Interface = "CONSOLE" then do + /* The next lines use an plain text interface */ + /* Show the curent content */ + say 'Current Edit Setting is : ' || program + say 'Please enter a number + to set it to :' + say '1 to EDIT it with NOTEPAD.EXE' + say '2 to EDIT with another program' + say 'Any other number to leave without changes' + say + /* Get selection */ + pull answer +end +else do + /* Get the current state, to make preselection in the dialog */ + if program~LASTPOS('NOTEPAD.EXE') > 0 then answer = '1' + else answer = '2' + /* The next lines use an "Single Selection Dialog" as interface to the user */ + sel.1 = "EDIT it with NOTEPAD.EXE" + sel.2 = "SELECT another program, currently set to : " || program + /* prepare the dialog */ + --dlg = .SingleSelection~new("Please select what to do","Ftype EDIT setting for ooRexx",sel.,answer,,answer) + dlg = .SingleSelection~new("Please select what to do","Ftype EDIT setting for ooRexx",sel.,answer) + /* show the dialog */ + answer = dlg~execute + + /* end of user interaction */ +end + +/* verify what to do */ +select + + when answer = '1' then do + newval = 'notepad.exe "%1"' + end + + when answer = '2' then do + if Interface = "CONSOLE" then do + say + say 'Please enter Path and name of the wanted editor ' + pull program + end + else do + /* Use the FilenameDialog to let the user select an other program */ + program = FilenameDialog('',,'Executables (*.EXE)'||'0'x||'*.EXE'||'0'x||'All Files (*.*)'||'0'x||'*.*','LOAD','Select program to use','EXE') + end + if program = '0' then exit /* Canceled by user */ + newval = program || ' "%1"' + end + otherwise exit +end + +/* Set the new value */ +/* Sets a named value of a given key */ +/* If name is blank or omitted, the default value is set */ +r~SetValue(r~Current_Key,"",newval,NORMAL) + +/* Forces the system to write the cache buffer of a given key to disk */ +/* If key_handle is omitted, CURRENT_KEY is flushed */ +r~flush(r~Current_Key) + +/* Closes a previously opened key specified by its handle */ +/* Since it can take several seconds before all data is written to disk,*/ +/* FLUSH was used before to empty the cache */ +/* If key_handle is omitted, CURRENT_KEY is closed */ +r~close(r~Current_Key) + +msg = 'The EDIT setting for ooRexx should now be' newVal + +if Interface = "CONSOLE" then do + say msg +end +else do + call InfoDialog msg +end + +::requires "winsystm.cls" -- required for the registry class +::requires "ooDialog.cls" -- required for the dialog class diff --git a/modules/windows/oodialog/examples/ReadMe.txt b/modules/windows/oodialog/examples/ReadMe.txt new file mode 100644 index 0000000..1021770 --- /dev/null +++ b/modules/windows/oodialog/examples/ReadMe.txt @@ -0,0 +1,96 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog Example Programs + ------------------------------- + + This directory contains example ooDialog programs. They are intended to + be relatively short and simple programs that demonstrate how to use some + feature of ooDialog. + + - addManyRows.rex + + This example's main purpose is to show how to use the ProgressDialog + class. It allows the user to select how many list-view items are to be + added to the list-view before it starts. It also does some interesting + timings and displays the times in the dialog + + - browsePrinters.rex + + Shows how to use the BrowseForFolder class and how to customize the + browse dialog so that the user can select a printer. + + - fileNameDialog_demo.rex + + The FileNameDialog public routine allows a programmer to present the + user with the standard Windows Open or Save file dialog. The + fileNameDialog_demo program demonstrates how to use this routine. + + - imageButton.rex + + This example program demonstrates some of the new features introduced + in ooRexx 4.0.0, including the .Image, .Imagelist classes, and the + setImageList() method of the button class. + + - publicRoutines_demo.rex + + ooDialog contains a number of standard dialog and public routines. The + standard dialogs and public routines are designed to be easy to use. + They allow a programmer to added simple graphical elements to a program + without any detailed knowledge of the ooDialog framework. The + publicRoutines_demo program demonstrates how to use these public + routines. + + - simpleFolderBrowse.rex + + Demonstrates how to use the SimpleFolderBrowse class to allow the user + to pick a folder. + + - stopWatch.rex + + An intersting implmentation of a stop watch in Rexx. + + - useTools.rex + + This example program shows how to use a dialog that is an "owned" + window. Owned windows have several constraints, one of which is that + they always remain above their owner window. This makes them useful to + create "tool palette" types of programs. The example program does just + that, demonstrates a main dialog with a tool palette. + diff --git a/modules/windows/oodialog/examples/addManyRows.rex b/modules/windows/oodialog/examples/addManyRows.rex new file mode 100755 index 0000000..94c340f --- /dev/null +++ b/modules/windows/oodialog/examples/addManyRows.rex @@ -0,0 +1,609 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example shows how to use the standard dialog, the ProgressDialog + * dialog, to show the user how a lengthy operation is progressing. It also + * demonstrates how much faster an internal sort can be than using a Rexx sort. + * + * The main points of the example are: + * + * 1.) It shows how to use the ProgressDialog class. + * + * 2.) It shows how to use the LvFullRow, LvItem, and LvSubItem objects to add + * items to list-views + * + * 3.) It shows to sort on a column in the list-view + * + * Note that in the .rc file, the resource script file, for this example, the + * dialog is created *not* visible. Thus, while the dialog is being + * initialized, it is not visible on the screen. This eliminates flicker while + * the items are being inserted into the list-view. Some people like the users + * of their applications to see the list-view being filled, some people dislike + * flicker. So, it is mostly a matter of preference how you create the dialog, + * initially visible, or initially invisible. But, it is good to be aware of + * the option. + * + * In addition, with a large number of list-view items, it takes some time to + * create the LvFullRow objects and insert them into the list-view. With the + * dialog being invisible, the user is going to wonder what is going on. This + * is the perfect time to use a ProgressDialog. + * + * NOTE: During a Rexx sort of the items in a list-view, the list-view invokes + * the Rexx method in this dialog to do a comparison of 2 items. We do + * not know what sorting algorithm the list-view is using, but we can + * speculate that it is a quick sort. Each callback from the native code + * the list-view is running in, to the Rexx interpreter, is relatively + * expensive. Expensive relative to the time to actually do a single + * comparison. As the number of items to sort grows, the number of + * comparisons grows, worst case, exponentially. Even average case, + * O(n log n), the growth is far from linear. As the number of + * comparisons grows, the expensive callbacks into the interpreter truely + * dominate. Do not use the Rexx sort for a large number of items. + * Start by using a Rexx sort with a small number of items to get a feel + * for how long it is taking. Using a Rexx sort with a large nubmer of + * items, will always finish, eventually. It may literally take hours. + * + * This example times the operations where a progress dialog is displayed and + * shows those times in the main dialog. This is an interesting experiment. + * + * The internal sort is very fast, in comparison. Do not hesitate to sort + * even the maximum number of items using the internal sort. + */ + + -- Ensure we can be run from any directory. + srcDir = locate() + + -- Set the defaults for this application. Use the global .constDir 'O'nly, + -- Read the 'addManyRows.h' file for symbolic resource ID definitions. + -- And, turn automatica data detection off (.false.) + .application~setDefaults('O', srcDir'resources\addManyRows.h', .false) + + -- Allow the user to pick the number of items to be inserted into the + -- list-view. + dlgIntro = .ExampleSetUpDlg~new(srcDir'resources\addManyRows.rc', IDD_INTRO) + if dlgIntro~execute('SHOWTOP') == dlgIntro~IDCANCEL then do + ret = MessageDialog('You are missing out on an excellent example', ,'User Canceled', 'OK', 'WARNING') + return 99 + end + + dlg = .AddManyRowsDlg~new(srcDir'resources\addManyRows.rc', IDD_ADD_ROWS) + if dlg~initCode = 0 then do + dlg~itemCount = dlgIntro~selectedCount + dlg~execute("SHOWTOP") + end + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + + +/** AddManyRowsDlg + * + * Our main example dialog subclass. + */ +::class 'AddManyRowsDlg' subclass RcDialog + +::attribute itemCount +::attribute createRowsTime +::attribute insertRowsTime +::attribute insertedRows +::attribute internalSortTime +::attribute rexxSortTime + +/** initDialog() + * + * initDialog is the place to do any initialization that requires the underlying + * dialog to exist. Here we add some extended list-view styles and fill the + * list-view with its items. + */ +::method initDialog + expose list rows createCanceled insertCanceled + + list = self~newListView(IDC_LV) + + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP SUBITEMIMAGES") + + list~InsertColumn(0, "Line text", 75) + list~InsertColumn(1, "Line number", 55) + list~InsertColumn(2, "Numbers", 50) + list~InsertColumn(3, "Characters", 55) + list~InsertColumn(4, "Characters", 55) + list~InsertColumn(5, "Characters", 55) + list~InsertColumn(6, "Characters", 55) + list~InsertColumn(7, "Characters", 55) + list~InsertColumn(8, "Characters", 55) + list~InsertColumn(9, "Characters", 55) + list~InsertColumn(10, "Characters", 55) + list~InsertColumn(11, "Characters", 55) + + self~connectButtonEvent(IDC_PB_SORT_INTERN, 'CLICKED', onSortInternally) + self~connectButtonEvent(IDC_PB_SORT_REXX, 'CLICKED', onSortRexx) + + rows = self~createRows(list) + + self~newGroupBox(IDC_GB_TIMES)~setText('Time in seconds (' || self~itemCount || ' rows):') + + self~setStatics + +/** setStatics + * + * Helper method to set up the static controls that are used to display the + * timings. How they are set is dependent on whether the user canceled the + * LvFullRow creation or the insertion of the rows. + */ +::method setStatics private + expose createCanceled insertCanceled staticInternal staticRexxSort + + staticCreate = self~newStatic(IDC_ST_CREATE) + staticInsert = self~newStatic(IDC_ST_INSERT) + staticInternal = self~newStatic(IDC_ST_INTERNAL) + staticRexxSort = self~newStatic(IDC_ST_REXXSORT) + + if createCanceled then do + staticCreate~setText('Create full rows:' self~createRowsTime '(canceled)') + staticInsert~setText('Insert full rows: N/A') + staticInternal~hide + staticRexxSort~hide + self~newPushButton(IDC_PB_SORT_INTERN)~disable + self~newPushButton(IDC_PB_SORT_REXX)~disable + + rect = staticCreate~windowRect + s = .Size~new(rect~right - rect~left, rect~bottom - rect~top) + s~width *= 2 + staticCreate~resizeTo(s) + return 0 + end + + staticCreate~setText('Create full rows:' self~createRowsTime) + + if insertCanceled then do + staticInsert~setText('Insert full rows:' self~insertRowsTime '(canceled after inserting' self~insertedRows 'rows)') + staticInternal~hide + staticRexxSort~hide + self~newPushButton(IDC_PB_SORT_INTERN)~disable + self~newPushButton(IDC_PB_SORT_REXX)~disable + + rect = staticInsert~windowRect + s = .Size~new(rect~right - rect~left, rect~bottom - rect~top) + s~width *= 2 + staticInsert~resizeTo(s) + return 0 + end + + staticInsert~setText('Insert full rows:' self~insertRowsTime) + + +/** onSortInternally() + * + * The event handler for the Internal Sort push button. We put up a dialog to + * let the user decide what and how to sort. + */ +::method onSortInternally unguarded + expose list staticInternal + + dlg = .SortSetupDlg~new(.application~srcDir'resources\addManyRows.rc', IDD_SORT_PARAMS) + if dlg~execute('SHOWTOP') == dlg~IDCANCEL then return 0 + + d = .directory~new + d~column = dlg~column + d~ascending = dlg~ascending + d~caseless = dlg~caseless + + j = time('E') + + list~sortItems('InternalListViewSort', d) + + self~internalSortTime = time('e') + staticInternal~setText('Internal sort:' self~internalSortTime) + + +/** onSortRexx() + * + * The event handler for the Rexx Sort push button. We put up a dialog to + * let the user decide what and how to sort. We also warn the user that the + * sort can take a very long time depending on the number of items in the + * list-view + */ +::method onSortRexx unguarded + expose list staticRexxSort rexxColumn rexxAscending rexxCaseless + + count = self~itemCount + + if count > 1500 & count <= 2000 then do + msg = "A Rexx sort with" count 'items can take' || .endOfLine || - + 'some time. Please be patient.' || .endOfLine~copies(2) + end + else if count > 2000 then do + msg = "A Rexx sort with" count 'items is not a' || .endOfLine || - + 'good idea, it can take too long.' || .endOfLine~copies(2) || - + 'If you want to perform this sort out of' || .endOfLine || - + 'curiousity, start the sort and then let' || .endOfLine || - + 'it alone. Windows will say the window' || .endOfLine || - + 'is not responding. But it will event-' || .endOfLine || - + 'ually finish. 5 minutes for 5000 items.' || .endOfLine || - + 'Times are exponential for more items.' || .endOfLine~copies(2) + end + + if msg~length > 3 then do + msg || = 'Do you want to continue?' + title = 'Cautionary Statement - Think Twice' + if MessageDialog(msg, self~hwnd, title, 'YESNO', 'WARNING') == self~IDNO then return 0 + end + + dlg = .SortSetupDlg~new(.application~srcDir'resources\addManyRows.rc', IDD_SORT_PARAMS) + if dlg~execute('SHOWTOP') == dlg~IDCANCEL then return 0 + + rexxColumn = dlg~column + rexxAscending = dlg~ascending + rexxCaseless = dlg~caseless + + msg = 'Performing a list-view item sort using a Rexx method of this dialog. Please be patient...' + capt = 'Rexx ooDialog Dialog Method Sort' + pbDlg = .ProgressDialog~new(capt, msg) + + pbDlg~msgHeight = 2 + pbDlg~marqueeMode = .true + pbDlg~marqueePause = 50 + pbDlg~noStatus = .true + + j = time('E') + pbDlg~begin + + reply 0 + list~sortItems('DOREXXSORT') + + pbDlg~endNow + + self~rexxSortTime = time('e') + staticRexxSort~setText('Rexx sort:' self~rexxSortTime) + + +/** doRexxSort() + * + * This is the call back method that actually does the comparison for 2 items in + * the list view. + */ +::method doRexxSort unguarded + expose rexxColumn rexxAscending rexxCaseless + use arg lvRow1, lvRow2 + + if rexxColumn == 0 then do + text1 = lvRow1~item~text + text2 = lvRow2~item~text + end + else do + text1 = lvRow1~subitem(rexxColumn)~text + text2 = lvRow2~subitem(rexxColumn)~text + end + + if rexxAscending then do + if rexxCaseless then return text1~caselessCompareTo(text2) + else return text1~compareTo(text2) + end + else do + if rexxCaseless then return text2~caselessCompareTo(text1) + else return text2~compareTo(text1) + end + + +/** createRows() + * + * Here we create LvFullRow objects for every list-view item. LvItem objects + * represent the list-view item and LvSubItem objects represent each column in + * the list-view item. + * + * All the full row objects are put into an array. The array is then used to + * insert all the items into the list-view. + */ +::method createRows private + expose createCanceled insertCanceled + use arg list + + j = time('E') + + createCanceled = .false + insertCanceled = .false + + count = self~itemCount + rows = .array~new(count) + + step = (count * 2) / 100 + if \ step~datatype('W') then step = trunc(step) + pbDlg = .ProgressDialog~new + pbDlg~msgText = 'Creating and inserting full rows into the list-view. This will take some time.' + + if self~itemCount > 30000 then do + extra = .endOfLine~copies(2) || 'It is possible that inserting' self~itemCount 'items will exhaust your system resources.' + pbDlg~msgText || = extra + pbDlg~msgHeight = 5 + end + + a = .Alerter~new + pbDlg~setInterruptible(a) + pbDlg~begin + pbDlg~updateStatus('0 full rows created') + + do i = 1 to count + j = i - 1 + lvi = .LvItem~new(j, 'Line' i) + lvsi1 = .LvSubItem~new(j, 1, i) + lvsi2 = .LvSubItem~new(j, 2, random(1, 200)) + lvsi3 = .LvSubItem~new(j, 3, self~randomChars) + lvsi4 = .LvSubItem~new(j, 4, self~randomChars) + lvsi5 = .LvSubItem~new(j, 5, self~randomChars) + lvsi6 = .LvSubItem~new(j, 6, self~randomChars) + lvsi7 = .LvSubItem~new(j, 7, self~randomChars) + lvsi8 = .LvSubItem~new(j, 8, self~randomChars) + lvsi9 = .LvSubItem~new(j, 9, self~randomChars) + lvsi10 = .LvSubItem~new(j, 10, self~randomChars) + lvsi11 = .LvSubItem~new(j, 11, self~randomChars) + + rows[i] = .LvFullRow~new(lvi, lvsi1, lvsi2, lvsi3, lvsi4, lvsi5, lvsi6, lvsi7, lvsi8, lvsi9, lvsi10, lvsi11, .true) + + if i // step = 0 then do + pbDlg~increase + pbDlg~updateStatus(i 'full rows created') + end + + if a~isCanceled then do + pbDlg~updateStatus('canceled after creating' i 'full rows') + r = SysSleep(1.5) + pbDlg~endNow + leave + end + end + + self~createRowsTime = time('e') + self~itemCount = rows~items + + if a~isCanceled then do + createCanceled = .true + return rows + end + + j = time('r') + + pbDlg~updateStatus('0 full rows inserted') + + list~prepare4nItems(rows~items) + + do i = 1 to rows~items + list~addFullRow(rows[i]) + + if i // step = 0 then do + pbDlg~increase + pbDlg~updateStatus(i 'full rows inserted') + end + if a~isCanceled then do + pbDlg~updateStatus('canceled after inserting' i 'full rows') + r = SysSleep(1.5) + pbDlg~endNow + leave + end + end + + self~insertRowsTime = time('e') + + if a~isCanceled then do + self~insertedRows = i + insertCanceled = .true + end + else do + pbDlg~complete + pbDlg~updateStatus('finished inserting' rows~items 'full rows') + r = SysSleep(1.5) + pbDlg~endNow + end + + return rows + + +/** randomChars() + * + * Simple method to generate some random string of characters. + */ +::method randomChars private + + len = random(1, 7) + chars = '' + + do i = 1 to len + upper = random(0, 1) + if upper then chars || = random(65, 90)~d2c + else chars || = random(97, 122)~d2c + end + + return chars + + +/** ExampleSetUpDlg + * + * A simple helper dialog for our example. We let the user choose the number of + * list-view items to insert. + * + * There is not much comment for this class, it is really pretty straight + * forward, initialize the dialog controls to the beginning state, what until + * the user closes the dialog, record the number of items the user picked. + */ +::class 'ExampleSetUpDlg' subclass RcDialog + +::attribute selectedCount + +::method initDialog + expose selectedCount updItems editItems chkFreeForm firstRB lastRB + + firstRB = .constDir[IDC_RB_1000] + lastRb = .constDir[IDC_RB_25000] + + selectedCount = 5000 + self~newRadioButton(IDC_RB_5000)~check + + updItems = self~newUpDown(IDC_SP_ITEMS) + r = .directory~new + r~min = 500 + r~max = 50000 + updItems~setRange(r) + updItems~setPosition(10000) + + updItems~disable + editItems = self~newEdit(IDC_ED_ITEMS)~~disable + chkFreeForm = self~newCheckBox(IDC_CK_FREEFORM) + + self~connectButtonEvent(IDC_CK_FREEFORM, 'CLICKED', onClick) + self~connectUpDownEVent(IDC_SP_ITEMS, 'DELTAPOS', onPosChange) + + +::method onClick unguarded + expose chkFreeForm updItems editItems firstRB lastRB + + + if chkFreeForm~checked then do + updItems~enable + editItems~enable + + do i = firstRB to lastRB + self~newRadioButton(i)~disable + end + end + else do + updItems~disable + editItems~disable + + do i = firstRB to lastRB + self~newRadioButton(i)~enable + end + end + +::method onPosChange unguarded + use arg pos, delta, id, hwnd + return .UpDown~deltaPosReply(.true, .false, delta * 100) + + +::method ok unguarded + expose chkFreeForm updItems firstRB lastRB selectedCount + + if chkFreeForm~checked then do + selectedCount = updItems~getPosition + end + else do + j = 1 + do i = firstRB to lastRB + if self~newRadioButton(i)~checked then leave + j += 1 + end + select + when j = 1 then selectedCount = 1000 + when j = 2 then selectedCount = 2000 + when j = 3 then selectedCount = 5000 + when j = 4 then selectedCount = 10000 + when j = 5 then selectedCount = 15000 + when j = 6 then selectedCount = 25000 + otherwise selectedCount = 0 + end + -- End select + end + + return self~ok:super + + +/** SortSetUpDlg + * + * A dialog to let the user choose what and how they want soreted. + * + * Similar to the ExampleSetUpDlg class there is not much comment here, the + * dialog is straight forward, set up the controls, record what the user pickes. + */ +::class 'SortSetUpDlg' subclass RcDialog + +::attribute column +::attribute ascending +::attribute caseless + +::method initDialog + expose column ascending caseless rbItem rbAscending rbCaseless upDown edit + + column = 0 + ascending = .true + caseless = .true + + rbItem = self~newRadioButton(IDC_RB_ITEM)~~check + rbAscending = self~newRadioButton(IDC_RB_ASCENDING)~~check + rbCaseless = self~newRadioButton(IDC_RB_CASELESS)~~check + + upDown = self~newUpDown(IDC_SP_COL)~~disable + edit = self~newEdit(IDC_ED_COL)~~disable + + upDown~setRange(1, 11) + upDown~setPosition(3) + + self~connectButtonEvent(IDC_RB_ITEM, 'CLICKED', onItemClick) + self~connectButtonEvent(IDC_RB_SUBITEM, 'CLICKED', onSubItemClick) + + rbItem~assignFocus + + +::method onItemClick unguarded + expose upDown edit + + upDown~disable + edit~disable + + +::method onSubItemClick unguarded + expose upDown edit + + upDown~enable + edit~enable + + +::method ok unguarded + expose column ascending caseless rbItem rbAscending rbCaseless upDown + + if rbItem~checked then column = 0 + else column = upDown~getPosition + + if rbAscending~checked then ascending = .true + else ascending = .false + + if rbCaseless~checked then caseless = .true + else caseless = .false + + return self~ok:super + + diff --git a/modules/windows/oodialog/examples/browsePrinters.rex b/modules/windows/oodialog/examples/browsePrinters.rex new file mode 100755 index 0000000..2a36590 --- /dev/null +++ b/modules/windows/oodialog/examples/browsePrinters.rex @@ -0,0 +1,220 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2022 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * An example showing usage of the BrowseForFolder class. This example shows + * how to use the class to browse virtual folders, in this case the Printers + * folder. + * + * The BrowseForFolder object puts up the same Windows Shell browse dialog as + * does the SimpleFolderBrowse object, but it is much more configurable. + * + * This example uses the browse for folder dialog to let the user select a + * printer. + * + * The example puts up a regular dialog and on the push of a button shows the + * browse for folder dialog set to browse only printers. The user's pick is + * is displayed in an edit box. + */ + + -- Set up some symbolic IDs and then put up our example dialog. + .application~setDefaults('O', , .false) + .constDir[IDC_PB_BROWSE] = 100 + .constDir[IDC_ST_RESULTS] = 101 + .constDir[IDC_EDIT] = 102 + .constDir[IDC_RB_LONG_NAME] = 103 + .constDir[IDC_RB_SHORT_NAME] = 104 + + dlg = .PrintersDialog~new + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + return 0 + +::requires "ooDialog.cls" + +::class 'PrintersDialog' subclass UserDialog + +/** init() + * + * Typical UserDialog init() method. Initializes the super class, the starts + * the dialog template by creating the frame in the template. Internally, the + * create() method will invoke the define() method. When create() returns, + * the dialog template will be complete. + */ +::method init + forward class (super) continue + + self~create(30, 30, 257, 123, "Browse For Printers Example", "CENTER") + + +/** define() + * + * A typical define() method for a UserDialog. We create a push button in the + * dialog template that allows the user to show the browse for folder dialog. + * + * An edit control and two radio buttons are created, the edit control shows + * the result of the user's selection in the browse for folder dialog. The + * radio button control how the selection is returned from the browse for + * folder dialog. + */ +::method defineDialog + + self~createStaticText(IDC_ST_RESULTS, 10, 10, 30, 11, , "Results:") + self~createEdit(IDC_EDIT, 10, 24, 237, 11, 'AUTOSCROLLH') + self~createRadioButton(IDC_RB_LONG_NAME, 10, 60, 90, 14, "AUTO", 'Long Display Name') + self~createRadioButton(IDC_RB_SHORT_NAME, 10, 79, 90, 14, "AUTO", 'Short Display Name') + self~createPushButton(IDC_PB_BROWSE, 10, 99, 65, 14, "DEFAULT", "Browse Printers", onBrowse) + self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Done") + + +/** onBrowse() + * + * The event handler for the Browse Printers push button. We configure a + * BrowseForFolder object, display it, and report the user's actions in the edit + * control. + * + * The Windows Shell keeps track of things in the shell using a structure called + * an 'item ID list.' Every thing in the shell has an item ID list. Most + * things in the shell have a corresponding file system path. But not every + * thing. Virtual folders like the printer objects do not have a file system + * path. + * + * The getFolder() method returns the file system path picked by the user. That + * method can not return a value for a virtual folder, so it returns .nil. To + * get the printer the user picks, we need to use the getItemIDList() method. + * This method returns the handle to an item ID list. + * + * Currently, the programmer can not do much with an item ID list handle. This + * may change in future versions of ooDialog. However, the programmer can get + * the display name of the shell item through the item ID list, which is what + * we do here. + * + * Like most, if not all, handles in Windows, the item ID list handle represents + * a system resource that has been allocated by the OS. When the Rexx + * programmer is done with the item ID list, it is good practice to release the + * handle to free up the system resources used by the item ID list. + */ +::method onBrowse unguarded + expose rbShort edit + + -- Set title, banner, and a hint for the dialog. + title = 'Browse For a Printer' + banner = 'Select the printer to use for this test.' + hint = 'This is only a demonstration, no printing will be done.' + + bff = .BrowseForFolder~new(title, banner, hint) + + -- Make this dialog the owner window of the browse dialog. The root for the + -- browse dialog will be the virtual Printers folder. If that is not set, + -- the user will not see the printers. In addition, we want the user to + -- only see the printers. That way, if the dialog is not canceled, we are + -- sure a printer was picked and not some random folder. + bff~owner = self + bff~root = 'CSIDL_PRINTERS' + + -- Set non-default options for the browse dialog. We need the browse for + -- printers option. The operating system will not allow a new folder to be + -- created in the virtual printers folder, so it disables the Make New + -- Folder button. It looks better to just remove the button altogether. + bff~options = 'BROWSEFORPRINTER NONEWFOLDERBUTTON' + + -- The getItemIDList() method is what actually puts up the browse for folder + -- dialog. Normally, by default, the getItemIDList() will release the COM + -- resources used our BrowseForFolder object. But, we still need the COM + -- resources to be able to use the getDisplayName() method. So, we tell the + -- method we still need COM active by passing in .true to the method. + -- + -- We we tell the object we still need COM, it then becomes our + -- responsibility to release COM. If the user cancels, we release COM and + -- return. Otherwise, we release COM further down in this method when we + -- are finished with COM. + pidl = bff~getItemIDList(.true) + if pidl == .nil then do + edit~setText('The user canceled.') + bff~releaseCOM + return 0 + end + + -- Decide what the format for the returned display name. With no arguments, + -- the getDisplayName() method will try to return the most complete name. + -- For a folder with a file system path, that will be a fully qualified + -- path name. For a virtual folder, the name will include the parent + -- folder(s) of the actual folder picked. + -- + -- The second optional argument to getDisplayName() specifies the format of + -- the returned name. Normal display will be just the printer name. + if rbShort~checked then do + name = bff~getDisplayName(pidl, 'NORMALDISPLAY') + end + else do + name = bff~getDisplayName(pidl, 'DESKTOPABSOLUTEEDITING') + end + + -- We are done with pidl, release it. + bff~releaseItemIDList(pidl) + + -- We are done with the BrowseForFolder object. Since we told the + -- getItemIDList() method to not release the COM resources, we need to + -- explicitly do it ourself. + bff~releaseCOM + + -- Determine text for the edit control ... + if name == .nil then do + text = 'Unexpected result. ' .DlgUtil~errMsg(.systemErrorCode) + end + else do + text = 'The user picked: ' name + end + + -- ... and set it + edit~setText(text) + + return 0 + + +/** initDialog() + * + * Simple init dialog method. We get references to the edit control and one of + * the two radio buttons. Since the radio buttons are auto and there are only 2 + * of them we only need one reference to be able to tell which is checked. + */ +::method initDialog + expose rbShort edit + + edit = self~newEdit(IDC_EDIT) + rbShort = self~newRadioButton(IDC_RB_SHORT_NAME) + rbShort~check diff --git a/modules/windows/oodialog/examples/fileNameDialog_demo.rex b/modules/windows/oodialog/examples/fileNameDialog_demo.rex new file mode 100755 index 0000000..e54d04a --- /dev/null +++ b/modules/windows/oodialog/examples/fileNameDialog_demo.rex @@ -0,0 +1,225 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* fileNameDialog_demo.rex */ + +/* +Purpose.: Demonstrate possible ways to use FileNameDialog +Who.....: Lee Peedin with input from + Mark Miesfeld +When....: August 13, 2007 +*/ + +-- Define a path most likely to be common to anyone using this demo - change as necessary + ooRexxHome = value("REXX_HOME", , 'ENVIRONMENT' ) + if ooRexxHome~length == 0 then + path = 'C:\Program Files\ooRexx\' + else + path = ooRexxHome || '\' + +-- Define a couple of variables to use in the code + delimiter = '0'x + +-- Remind the user of what FileNameDialog actually does + msg = 'REMEMBER, FileNameDialog does NOT actually open or save your specified file,'||.endOfLine||- + 'it simply provides a dialog that will return the file path and name!' + call infoDialog msg + +-- Provide a menu of different examples - use the built in SingleSelection dialog + preselect = 1 + do until op = '' + option.1 = '(Open) Select any file in a pre-determined folder' + option.2 = '(Open) Show only *.cls files in a pre-determined folder' + option.3 = '(Open) Allow either a *.cls file or a *.dll file to be selected' + option.4 = '(Open) Allow *.cls, *.dll, or *.* to be selected' + option.5 = '(Open) Allow multiple *.cls files to be selected' + option.6 = '(Save) Create a save dialog where the appended extension is the default (.txt)' + option.7 = '(Save) Create a save dialog where the default extension is changed (.cls)' + + max = 7 + ssdlg = .SingleSelection~new('Select A Demonstration','FileNameDialog Demonstration',option.,preselect,,max) + op = ssdlg~execute + if op \= '' then + do + preselect = op + 1 + if preselect > max then preselect = 1 + call ('OPTION'op) + end + end + + -- We return an unique code to indicate that we did execute and are exiting + -- normally here. 37 is my lucky prime number for August 2007. +return 37 + +Option1: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'All Files (*.*)'delimiter'*.*'delimiter + loadorsave = '' -- Load is the default + title = '' -- See documentation for default + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Select A File' + else + call infoDialog 'You Selected' a_file +return +---------------------------------------------------------------------------------------------------------------- +Option2: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'Class Files (*.cls)'delimiter'*.cls'delimiter + loadorsave = 'LOAD' -- Load is the default + title = 'FileNameDialog-Option2'-- Define our own title + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Select A File' + else + call infoDialog 'You Selected' a_file +return +---------------------------------------------------------------------------------------------------------------- +Option3: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'Class Files (*.cls)'delimiter'*.cls'delimiter||- + 'DLL Files (*.dll)'delimiter'*.dll'delimiter + loadorsave = 'LOAD' -- Load is the default + title = 'FileNameDialog-Option3'-- Define our own title + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Select A File' + else + call infoDialog 'You Selected' a_file +return +---------------------------------------------------------------------------------------------------------------- +Option4: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'Class Files (*.cls)'delimiter'*.cls'delimiter||- + 'DLL Files (*.dll)'delimiter'*.dll'delimiter||- + 'All Files (*.*)'delimiter'*.*'delimiter + loadorsave = 'LOAD' -- Load is the default + title = 'FileNameDialog-Option4'-- Define our own title + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Select A File' + else + call infoDialog 'You Selected' a_file +return +---------------------------------------------------------------------------------------------------------------- +Option5: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'Class Files (*.cls)'delimiter'*.cls'delimiter'All Files (*.*)'delimiter'*.*'delimiter + loadorsave = 'LOAD' -- Load is the default + title = 'FileNameDialog-Option5'-- Define our own title + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = 'MULTI' -- Specify the ability to select multiple files + sepChar = '^' -- Define the charact to separate the multiple files + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Select A File' + else + do + if a_file~pos('^') == 0 then do + msg = 'You Selected one file:'.endOfLine + msg ||= ' ' a_file + end + else do + msg = 'You Selected multiple files.'.endOfLine~copies(2) + + parse var a_file dir'^'a_file + if dir~length < 30 then msg ||= 'The files are in the directory:' dir + else msg ||= 'The files are in the directory:'.endOfLine || ' ' dir + msg ||= .endOfLine~copies(2) + + do until a_file = '' + parse var a_file file_a'^'a_file + msg ||= ' ' file_a||.endOfLine + end + end + call infoDialog msg + end +return +---------------------------------------------------------------------------------------------------------------- +Option6: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'All Files (*.*)'delimiter'*.*'delimiter + loadorsave = 'SAVE' -- Load is the default + title = 'FileNameDialog-Option6'-- Define our own title + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Provide A Save Name' + else + call infoDialog 'You File Will Be Saved As' a_file +return +---------------------------------------------------------------------------------------------------------------- +Option7: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'Class Files (*.cls)'delimiter'*.cls'delimiter'All Files (*.*)'delimiter'*.*'delimiter + loadorsave = 'SAVE' -- Load is the default + title = 'FileNameDialog-Option7'-- Define our own title + defExtension = 'cls' -- Define an extension to append to the user's input + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call errorDialog 'You Did Not Provide A Save Name' + else + call infoDialog 'You File Will Be Saved As' a_file +return +---------------------------------------------------------------------------------------------------------------- +::requires "ooDialog.cls" + diff --git a/modules/windows/oodialog/examples/genGUID.rex b/modules/windows/oodialog/examples/genGUID.rex new file mode 100755 index 0000000..e7050d5 --- /dev/null +++ b/modules/windows/oodialog/examples/genGUID.rex @@ -0,0 +1,75 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** genGUID.rex - simple GUID generating program. + * + * Copy and paste the output as needed. + * + * To run in console only mode use: + * + * genGuid 1 + * + * In graphical mode you can use copy and paste of the edit control displayed. + */ + + -- Ensure we can be run from any directory. + srcDir = locate() + + .application~setDefaults('O', srcDir'resources\genGUID.h', .false) + + guid = .DlgUtil~getGUID + say guid + + if arg() == 0 then do + dlg = .DisplayDlg~new(srcDir'resources\genGUID.rc', IDD_GUID_GENERATOR) + if dlg~initCode = 0 then do + dlg~guid = guid + dlg~execute("SHOWTOP") + end + end + +return 0 + +::requires 'ooDialog.cls' + +::class 'DisplayDlg' subclass RcDialog + +::attribute guid + +::method initDialog + expose guid + self~newEdit(IDC_EDIT_GUID)~setText(guid) diff --git a/modules/windows/oodialog/examples/imageButton.rex b/modules/windows/oodialog/examples/imageButton.rex new file mode 100755 index 0000000..918d7f7 --- /dev/null +++ b/modules/windows/oodialog/examples/imageButton.rex @@ -0,0 +1,513 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * File: imageButton.rex + * + * Category: ooDialog example + * + * Syntax: + * rc = imageButton + * + * Purpose: + * Provides some example code of new ooDialog feature introduced in 4.0.0 + * + * This program uses a resource script (.rc) file for the dialog definition. + * The dialog was designed using a "what you see is what you get" dialog + * editor. The resource script can be compiled into a binary image for use + * with a ResDialog. In this case it is just left as a .rc file for use in + * a RcDialog. + * + * Dialogs built using a dialog editor are much easier to create and maintain + * then UserDialogs. + * + * Input: + * None. + * + * Returns: + * 0 on success, non-zero if the dialog could not be created for some reason. + * + * Notes: + * This is a short program written to amuse my niece. Two of the button + * controls in the dialog use an image list. The text for the buttons is 'Add + * Pictures' and 'View Pictures' with a picture of a camera on them. When the + * user moves the mouse pointer over either one of the buttons, the picture + * changes to a skull and the text changes to 'Death if you touch me.' When + * the user pushes either of the buttons the picture changes to a giant bee. + * + * My niece and I think this is hilarious. + * + * The dialog shows how to use a button control image list. Since I am not + * artistic, I produced the images by cutting them out of digital pictures + * I have taken over the last few years. + * + * A professional application would of course use professional graphics. This + * dialog just gives an idea of what the button control can do with an image + * list. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +use arg + + -- Ensure we can be run from any directory. + srcDir = locate() + + rcFile = srcDir"resources\imageButton.rc" + symbolFile = srcDir"resources\imageButton.h" + + .application~setDefaults("O", symbolFile, .false) + + dlg = .ImageListDlg~new(rcFile, IDD_IMAGELIST_BUTTON) + + if dlg~initCode <> 0 then do + say "The Image List Dialog was not created correctly" + say "Init code:" dlg~initCode + return 99 + end + + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'ImageListDlg' subclass RcDialog + +::method initDialog + expose pbPush pbView pbAdd stStatus ctr imagesLoaded + + self~connectButtonEvent(IDC_PB_PUSHME, "CLICKED", "onPushMe") + self~connectButtonEvent(IDC_PB_VIEW, "CLICKED", "onView") + self~connectButtonEvent(IDC_PB_ADD, "CLICKED", "onAdd") + + self~connectButtonEvent(IDC_PB_VIEW, "HOTITEM", onHover) + self~connectButtonEvent(IDC_PB_ADD, "HOTITEM", onHover) + + imagesLoaded = .false + ctr = 0 + + pbPush = self~newPushButton(IDC_PB_PUSHME) + pbView = self~newPushButton(IDC_PB_VIEW) + pbAdd = self~newPushButton(IDC_PB_ADD) + stStatus = self~newStatic(IDC_ST_STATUS) + + stStatus~setText("") + + self~setPictureButtons + +::method setPictureButtons private + expose pbView pbAdd stStatus imagesLoaded imageList + + -- Using an image list with the button controls needs at least comctl32 + -- version 6. See what version we are running under and don't use the image + -- list if we are on an older version of Windows. + if .DlgUtil~comCtl32Version < 6 then return self~oldSetButtons + + pbView~style = "MULTILINE BOTTOM" + + -- In the following code, there are a lot of if tests. You can change any of + -- the if tests to its converse to get an idea of the dialog behavior when + -- errors happen. Have fun, experiment. + + srcDir = .application~srcDir + + -- The images are loaded from files. + files = .array~new() + files[1] = srcDir"resources\Normal.bmp" -- Normal + files[2] = srcDir"resources\Hot.bmp" -- Hot (hover) + files[3] = srcDir"resources\Pushed.bmp" -- Pushed + files[4] = srcDir"resources\Disabled.bmp" -- Disabled + files[5] = srcDir"resources\Default.bmp" -- Default button + files[6] = srcDir"resources\Hot.bmp" -- Stylus hot, tablet PC only + + -- .ImageList~create() exposes the Windows API ImageList_Create(). Use the + -- MSDN documentation to fully understand this API. Simply do a Google search + -- with: MSDN ImageList_Create + -- + -- The IIC_COLOR24 flag and the size values correspond to the values the + -- bitmaps were created with. You can look at the properties page for one + -- of the bitamp files in Explorer to see these values. + + -- We set the flags to create a 24 bit color, masked image list. + flags = 'COLOR24 MASK' + + -- Create an empty .ImageList object: + imageList = .ImageList~create(.Size~new(61, 46), flags, 10, 10); + + -- Add the images to the image list, only if the image list is not null. If + -- the .ImageList object is null, an error happened when it was created and it + -- is not usable. + -- + -- When an image is added to the image list, the index of the image is + -- returned. -1 signals that the image was not added. We use that as a flag + -- to indicate some images are not added. + index = -1 + lastGoodIndex = -1 + if \ imageList~isNull then do + stStatus~setText('Created image list:' imageList~handle) + + -- We use a colorref when adding the image to the image list. The 255,255, + -- 255 value is white. Essentially it tells the image list to create a mask + -- that causes every white pixel in the image to be transparent. + -- + -- The only image it has any effect on is the camera. In the camera image, + -- the background uses white pixels. So, when the camera image is drawn, + -- the background becomes transparent, which allows the button color to show + -- through. + cRef = .Image~colorRef(255, 255, 255) + + -- For each image file, get an .Image object and add it to our image list. + do f over files + + -- The defaults for the optional arguments to getImage() are good for this + -- application. Again, isNull() signals the .Image object is not valid. + image = .Image~getImage(f) + if \ image~isNull then do + + -- Add the image, quit if we get back a -1. + index = imageList~addMasked(image, cRef) + if index == -1 then leave + + stStatus~setText('Added image index:' index) + lastGoodIndex = index + + -- The underlying ImageList control makes a copy of the image passed to + -- it. We can now relase the image to free up the system resource. + -- Note that when this program ends, the OS will free the resource + -- automatically, so this is NOT necessary. Note also that you should + -- not release SHARED images. However, when an image is loaded from a + -- file, it can not be a shared image. + image~release + + -- Once you release the image, the .Image object is no longer valid and + -- trying to use it will raise a syntax error. You can use the isNull() + -- method on any image object at any time to test if it is valid without + -- raising a syntax error. In addition, if you invoke the release() + -- method after the image has already been released, it is just ignored. + end + else do + say 'Failed to load bitmap:' f 'system error code:' .SystemErrorCode + end + end + end + else do + stStatus~setText('Error creating .ImageList. Images are not available.') + return + end + + if lastGoodIndex == -1 then do + stStatus~setText("Failed to add any images. Images are not available") + imageList~release + return + end + + imagesLoaded = .true + + if index == -1 then do + stStatus~setText("Not all images were loaded. Last good image at index" lastGoodIndex) + end + + -- Set up the alignment and margin around the image on the 'View Pictures' + -- button. Then set the image list in the button control + align = 'LEFT' + margin = .Rect~new(1) + + pbView~setImageList(imageList, margin, align) + + if .SystemErrorCode <> 0 then do + stStatus~setText('setImageList() failed. SystemErrorCode:' .SystemErrorCode 'Images not available.') + imageList~release + return + end + else do + stStatus~setText("View Pictures button image list loaded.") + end + + -- Temporarily set the title to the longest text, to calculate ideal size. + pbView~setTitle("DEATH if you touch me") + bestSize = pbView~getIdealSize + + -- Write this to the screen, example only. + say 'Got ideal size:' bestSize + say ' width: ' bestSize~width + say ' height:' bestSize~height + say + + -- Now reset the button label and set the size to the ideal size. + pbView~setTitle("View Pictures") + pbView~setRect(0, 0, bestSize~width, bestSize~height, "NOMOVE") + + -- Example only of the getImageList() method. A .Directory object is + -- returned. + d = pbView~getImageList + + -- Just write this to the screen. + say 'Got View Picutes button control image list information.' + say 'Returned:' d + if d <> .nil then do + say ' image list:' d~imageList + say ' handle: ' d~imageList~handle + say ' rect: ' d~rect + say ' align: ' d~alignmentKeyword + say 'Image margins:' d~rect~left',' d~rect~top',' d~rect~right',' d~rect~bottom + end + else do + stStatus~setText("Error getting View Pictures button control image list information.") + end + say + + -- For the Add Pictures button, use the same image list created for the View + -- Pictures button. We just change the margins and the alignment. + align = 'CENTER' + margin~left = 10 + margin~right = 10 + margin~top = 30 + margin~bottom = 15 + + pbAdd~setImageList(imageList, margin, align) + + if .SystemErrorCode <> 0 then do + stStatus~setText('setImageList() failed. SystemErrorCode:' .SystemErrorCode 'Images not available.') + + -- Releasing the image list now, after it has been successfully set for the + -- View Pictures button, causes the images to disappear from that button. + -- + -- In general, DON'T release an image list that is in use. This is just + -- done here to demonstrate that things won't blow up. + imageList~release + return + end + else do + stStatus~setText("Add Pictures button image list loaded.") + end + + -- Now, the same as above, figure out the ideal size and then adjust the + -- button size. + pbAdd~style = "BOTTOM MULTILINE" + pbAdd~setTitle("DEATH if you touch me") + s = pbAdd~getIdealSize + pbAdd~setTitle("Add Pictures") + pbAdd~setRect(0, 0, s~width, s~height, "NOMOVE") + + -- Again, just for an example of the getImageList() method. + d = pbAdd~getImageList + + say 'Got Add Picutes button control image list information.' + say 'Returned:' d + if d <> .nil then do + -- Write this to the screen. Note that the image list hand is the same as + -- the above. + say ' image list:' d~imageList + say ' handle: ' d~imageList~handle + say ' rect: ' d~rect + say ' align: ' d~alignmentKeyword + say 'Image margins:' d~rect~left',' d~rect~top',' d~rect~right',' d~rect~bottom + end + else do + stStatus~setText("Error getting Add Pictures button control image list information.") + end + say + +return + +-- This method allows the dialog to work on systems prior to XP. We just use +-- the old fashioned buttons. +::method oldSetButtons private + expose pbView pbAdd + + pbView~setTitle("View Pictures") + pbAdd~setTitle("Add Pictures") + + pbView~resize(50, 15) + pbAdd~resize(50, 15) + +return .true + +-- As the user pushes the Push Me button, we cycle through some different +-- examples of changing the button state and style. This changes the pictures +-- displayed on the buttons. (Provided of course that there were no errors in +-- setting the button control image list(s).) The state and style changes work +-- whether we have images or not, so we don't check for pictures loaded or not +-- on those. +::method onPushMe unguarded + expose pbView pbAdd stStatus ctr imagesLoaded oldImageList + + select + when ctr == 0 then do + pbView~state = "FOCUS" + stStatus~setText('View Pictures button set to the Focused state.') + ctr += 1 + end + when ctr == 1 then do + pbAdd~style = "DEFPUSHBUTTON" + stStatus~setText('Add Pictures button now the default push button.') + ctr += 1 + end + when ctr == 2 then do + pbView~style = "DEFPUSHBUTTON" + stStatus~setText('View Pictures button now the default push button.') + ctr += 1 + end + when ctr == 3 then do + pbView~disable + stStatus~setText('View Pictures button now disabled.') + ctr += 1 + end + when ctr == 4 then do + pbView~enable + cancel = self~newPushButton(IDCANCEL) + cancel~style = "DEFPUSHBUTTON" + stStatus~setText('View Pictures button now enabled, should not be default push button.') + ctr = 5 + end + when ctr == 5 then do + if imagesLoaded then do + oldImageList = pbView~setImageList(.nil) + stStatus~setText('Removed View Pictures button images. Push "Push Me one more time to restore".') + end + ctr = 6 + end + when ctr == 6 then do + if imagesLoaded, oldImageList \== .nil then do + pbView~setImageList(oldImageList~imageList, oldImageList~rect, oldImageList~alignment) + stStatus~setText('Restored View Pictures button images.') + end + ctr = 0 + end + otherwise do + -- Should be impossible to happen. Just do the same as if ctr were 6. + if imagesLoaded, oldImageList \== .nil then do + pbView~setImageList(oldImageList~imageList, oldImageList~rect, oldImageList~alignment) + stStatus~setText('Restored View Pictures button images.') + end + ctr = 0 + end + end + -- End select + +-- This is the amusing part. We get this event message when the mouse is first +-- moved over a button (entering will be .true) or when the mouse moves off a +-- button (entering will be .false.) We change the text and style of the +-- button, the button control itself changes the picture. +::method onHover unguarded + expose imagesLoaded pbView pbAdd + use arg id, entering + + if \ imagesLoaded then return + + isViewButton = (id == .constDir[IDC_PB_VIEW]) + + if entering then do + text = "DEATH if you touch me" + style = "TOP" + end + else do + if isViewButton then text = "View Pictures" + else text = "Add Pictures" + style = "BOTTOM" + end + + if isViewButton then do + pbView~style = style + pbView~setTitle(text) + end + else do + pbAdd~style = style + pbAdd~setTitle(text) + end + +::method onView unguarded + expose stStatus + stStatus~setText('In onView, no actions defined.') + +::method onAdd unguarded + expose stStatus + stStatus~setText('In onAdd, no actions defined.') + + +/* When you are done using an image list you can release it to free up system + * resources. + * + * Please note that when this program ends, the process will disappear and the + * OS will free up the resources automatically. + * + * As noted in a comment above, if you release the image list when it is in + * use, the pictures disappear. Testing has shown that releasing an image list + * when it is in use, does not crash the system. However, releasing an image + * list while it is in use would seem to be a foolish practice. + * + * When would you want to release an image list? In this case if this dialog + * was a part of a bigger, long running application. When this dialog ends, it + * makes sense to free up the system resources used for the image list. Since + * the main application is still running, the OS will not release the resources + * used in this dialog. + * + * Microsoft says, you should release an image list when you are done with it. + * + * In this case that would be when the dialog is closed. There are at least 2 + * strategies that could be employed. + * + * 1.) Save a reference to the image list handle returned by .ImageList~create() + * and pass it to release(). + * + * 2.) Use getImageList() to ask the button to give you the image list + * information and use the image list object that is returned as part of the + * .Directory object. The image list object in strategy 1 and 2 are the same + * object. + * + * Don't forget to release the handle if either the dialog is canceled or if it + * is closed. Below is a demonstration of both strategies. + */ + +::method cancel + expose imageList imagesLoaded + + if imagesLoaded then imageList~release + return self~cancel:super + +::method ok + expose imagesLoaded pbView + + if imagesLoaded then do + imageListInfo = pbView~getImageList + if imageListInfo <> .nil then imageListInfo~imageList~release + end + + return self~ok:super + diff --git a/modules/windows/oodialog/examples/openSaveFileDemo.rex b/modules/windows/oodialog/examples/openSaveFileDemo.rex new file mode 100755 index 0000000..2672623 --- /dev/null +++ b/modules/windows/oodialog/examples/openSaveFileDemo.rex @@ -0,0 +1,538 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** openSaveFileDemo.rex + * + * This application shows several examples of using the Common Item Dialog. + * + * The Common Item Dialog (formerly known as the Common File Dialog) is used in + * two variations: the Open dialog and the Save dialog. These two dialogs share + * most of their functionality, but each have some unique methods. + * + * The common item dialog implementation found in Windows Vista and later + * provides several advantages over the implementation provided in earlier + * versions of Windows. + * + * ooDialog provides complete support for all features of the Common Item + * Dialog. + * + * This example will only run on Vista or later. + * + * Both the .OpenFileDialog and the .SaveFileDialog are subclasses of the + * .CommonItemDialog class. The Rexx programmer can not instantiate a + * .CommonItemDialog object. Instead the programmer picks the type of file + * dialog he wants, a save file or an open file dialog and instantitates that + * class. Almost all of the methods for these classes come from the + * CommonItemDialog class and are documented in the reference manual under the + * CommonItemDialog section. + * + * Some of the features of the Common Item Dialog are a little advanced. How- + * ever, the basic every day usage is simple. This example puts up an opening + * dialog that allows the user to choose from a number of different usage + * patterns and then shows the Common Item Dialog picked. + * + * One of the features of the Common Item Dialog is that it allows its state to + * be saved on a per instance basis in addition to the per process basis. + * This is done by generating a GUID and assigning it to the dialog before it + * is configured. Then, for each dialog with the same GUID, the operating + * system saves its state separately. + * + * To make use of this feature, the programmer would generate a single GUID and + * then assign the same GUID each time the file dialog was shown in the + * application. + * + * This example makes use of that feature by assigning a different GUID for + * each of the XX dialogs that can be displayed from the opening dialog. + * + * This simple program can be used to generate a GUID. Run the program and + * then copy and paste the output on the command line in to your program. + * + * - - - - - - - - - Cut begin - - - - - - - - - - - - - - - - - - - - - - - - + * /* genGUID.rex */ + * + * guid = .DlgUtil~getGUID + * say guid + * return 0 + * + * ::requires 'ooDialog.cls' + * - - - - - - - - - Cut end - - - - - - - - - - - - - - - - - - - - - - - - - + * + */ + if \ .application~requiredOS('Vista', 'openSaveFileDemo.rex') then return 99 + + srcDir = locate() + + -- Set up the symbolic IDs and then put up our example dialog. + .application~setDefaults('O', srcDir'resources\osfDialogs.h', .false) + + dlg = .CommonSaveDialog~new(srcDir'resources\osfDialogs.rc', IDD_SIMPLE_OSF_DIALOGS) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + return 0 + +::requires "ooDialog.cls" + +::class 'CommonSaveDialog' subclass RcDialog + +-- Do not copy these GUIDs into your own code. Always generate your own GUID. +::constant GUID_OPEN '021b0a3d-cb16-4def-ab42-7fc259fd84d9' +::constant GUID_SAVE 'beff4495-fa60-468b-90c3-1dcb6fde0e78' +::constant GUID_OPEN_MULTI 'b6c25d80-198e-4baa-aad8-1249e4f15b3f' +::constant GUID_OPEN_CUSTOM '745c45cb-3464-46fc-96cf-8628ad4bf63b' +::constant GUID_SAVE_DEFAULT 'fe2c5305-d7f9-43cd-9d7b-9c3d4d1b79be' +::constant GUID_OPEN_FOLDER 'ce5ad183-b42f-4f37-a5d6-78d1cffea2e6' + + +/** initDialog() + * + * Simple standard init dialog method. We save references to our commonly used + * controls, and connect the button click event for the push button. + * + * We also use this method to find the installed directory of ooRexx. + */ +::method initDialog + expose rbOpen rbSave rbOpenMulti rbOpenCustom rbSaveDefault rbOpenFolder edit rexx_home + + rbOpen = self~newRadioButton(IDC_RB_OPEN)~~check + rbSave = self~newRadioButton(IDC_RB_SAVE) + rbOpenMulti = self~newRadioButton(IDC_RB_OPEN_MULTI) + rbOpenCustom = self~newRadioButton(IDC_RB_OPEN_CUSTOM) + rbSaveDefault = self~newRadioButton(IDC_RB_SAVE_DEFAULT) + rbOpenFolder = self~newRadioButton(IDC_RB_OPEN_FOLDER) + + edit = self~newEdit(IDC_EDIT_OSF) + + self~connectButtonEvent(IDC_PB_SHOW_OSF, 'CLICKED', onShowOSFDialog) + + rexx_home = value('REXX_HOME', , 'ENVIRONMENT') + if rexx_home == '' then rexx_home = 'C:\Program Files' + + self~addToolTips + + +/** onShowOSFDialog() + * + * When the user clicks on the 'Show' push button, we put up the example Common + * Item Dialog specified by the user through the radio buttons. + * + * Each Common Item Dialog is displayed using a separate, private, method. To + * look at the example code for some type of dialog, for instance the simple + * open file dialog, examine the associated method. + */ +::method onShowOSFDialog unguarded + expose rbOpen rbSave rbOpenMulti rbOpenCustom rbOpenFolder rbSaveDefault + + select + when rbOpen~checked then return self~openExample + when rbSave~checked then return self~saveExample + when rbOpenMulti~checked then return self~openMultifilesExample + when rbOpenCustom~checked then return self~openCustomExample + when rbSaveDefault~checked then return self~saveDefaultExample + when rbOpenFolder~checked then return self~openFolderExample + otherwise return 0 -- Can not really happen + end + -- End select + + +/** openExample() + * + * Displays the most simple Open File Dialog example. We just show the dialog + * and get the result. We do not use any customization or advanced features, + * other than slightly changing the options. + */ +::method openExample unguarded private + + -- Setting the client GUID has the operating system preserve the state for + -- this specific open file dialog. + ofd = .OpenFileDialog~new + ret = ofd~setClientGuid(self~GUID_OPEN) + + -- The default flags for the Open File Dialog contain the file must exsit + -- flag. This prevents the user from typing in their own file name; the + -- user can only open an exsiting file. + -- + -- For certain applications, this behaviour may be desired. But for this + -- example, we want the user to be able to type in any file name, so we + -- remove that flag. We get the exsiting flags and set the flags to the + -- existing flags minus the FILEMUSTEXIST keyword. + ofd~options = ofd~options~delWord(ofd~options~wordPos('FILEMUSTEXIST'), 1) + + -- Very simple, we are all set, show the dialog and get the user's response: + ret = ofd~show(self) + + if ret == ofd~canceled then text = 'The user canceled the open' + else text = 'Open file:' ofd~getResult + + -- The proper use of both the .SaveFileDialog and the .OpenFileDialog is to + -- instantiate the object, configure it, show it, and then release it. The + -- release() method is essential to ensuring the COM resources are properly + -- cleaned up. + -- + -- If release() is not called, the ooDialog framework will *attempt* to do + -- the clean up in an uninit() method. However, 1.) there is *no* guarentee + -- that the interpreter will invoke the uninit() method. 2.) There is *no* + -- guarentee the uninit() will be run on this thread. The COM resources can + -- *not* be cleaned up if uninit() is run on another thread than this one. + -- + -- The only way to guarentee that the COM resources are cleaned up properly + -- is for the programmer to invoke the release() method. + ofd~release + + -- Have the edit box display the result. + self~showResult(text) + + return 0 + + +/** saveExample() + * + * Displays the most simple Save File Dialog example. We just show the dialog + * and get the result. We do not use any customization or advanced features. + */ +::method saveExample unguarded private + + -- Setting the client GUID has the operating system preserve the state for + -- this specific save file dialog. + sfd = .SaveFileDialog~new + ret = sfd~setClientGuid(self~GUID_SAVE) + + -- We are all set, show the dialog and get the user's response: + ret = sfd~show(self) + + if ret == sfd~canceled then text = 'The user canceled the save' + else text = 'Save to file:' sfd~getResult + + -- The proper use of both the .SaveFileDialog and the .OpenFileDialog is to + -- instantiate the object, configure it, show it, and then release it. The + -- release() method is essential to ensuring the COM resources are properly + -- cleaned up. + -- + -- If release() is not called, the ooDialog framework will *attempt* to do + -- the clean up in an uninit() method. However, 1.) there is *no* guarentee + -- that the interpreter will invoke the uninit() method. 2.) There is *no* + -- guarentee the uninit() will be run on this thread. The COM resources can + -- *not* be cleaned up if uninit() is run on another thread than this one. + -- + -- The only way to guarentee that the COM resources are cleaned up properly + -- is for the programmer to invoke the release() method. + sfd~release + + -- Have the edit box display the result. + return self~showResult(text) + + return 0 + + +/** openMultiFilesExample() + * + * Displays a basic open file dialog that allows the user to pick multiple file + * names at one time. + */ + +::method openMultiFilesExample unguarded private + expose rexx_home + + ofd = .OpenFileDialog~new + ret = ofd~setClientGuid(self~GUID_OPEN_MULTI) + + -- To allow the user to select multiple files, we need to add this keywod + -- to the options: + ofd~options = ofd~options 'ALLOWMULTISELECT' + + -- Show the dialog and get the response + ret = ofd~show(self) + + -- If msg ends up not being .nil, we show a message box ... + msg = .nil + + if ret == ofd~canceled then do + text = 'The user canceled the open operation.' + end + else do + files = ofd~getResults + if files~items == 1 then do + text = 'Open file:' files[1] + end + else do + text = 'Open files (file names only):' + msg = 'Open files (complete file names as returned):' || .endOfLine~copies(2) + + do f over files + text ||= ' ' || fileSpec('N', f) + msg ||= f || .endOfLine + end + end + end + ofd~release + + -- Have the edit box display the result. + self~showResult(text) + + if msg \== .nil then do + title = 'Complete Open File Names' + j = MessageDialog(msg, self~hwnd, title, 'OK', 'INFORMATION') + end + + return 0 + + +/** openCustomExample() + * + * Displays an Open File Dialog that has some easy to use customizations. + */ +::method openCustomExample unguarded private + + ofd = .OpenFileDialog~new + ret = ofd~setClientGuid(self~GUID_OPEN_CUSTOM) + + ofd~options = ofd~options~delWord(ofd~options~wordPos('FILEMUSTEXIST'), 1) + + -- With the Common Item Dialog you can easily change the title for the + -- dialog, the label for the edit box, and the label for the ok button: + ofd~setTitle("The ooRexx Project's Open File Dialog") + ofd~setFileNameLabel('Type in, or select an existing, file to open here:') + ofd~setOkButtonLabel('Finished') + + -- There are also a large number of options that can be set or changed. + -- Here, we show just a few that effect the appearance of the dialog: + opts = 'FORCEPREVIEWPANEON HIDEMRUPLACES HIDEPINNEDPLACES' + ofd~options = ofd~options opts + + -- Okay, we are all set, show the dialog and get the user's response: + ret = ofd~show(self) + + if ret == ofd~canceled then text = 'The user canceled the open' + else text = 'Open file:' ofd~getResult + + ofd~release + + -- Have the edit box display the result. + return self~showResult(text) + + +/** saveDefaultExample() + * + * Displays a save file dialog that uses file type filters and sets the initial + * file name and directory location. + */ +::method saveDefaultExample unguarded private + expose rexx_home + + sfd = .SaveFileDialog~new + ret = sfd~setClientGuid(self~GUID_SAVE_DEFAULT) + + -- Add a file types filter. To do this you use an array containing the + -- filter values. Each single filter consists of 2 parts, the description + -- and the extension, so the array must contain an even number of items. + filter = .array~of('Rexx Program File', '*.rex', 'Rexx Class File', '*.cls', 'Text File', '*.txt') + sfd~setFileTypes(filter) + + -- Set the initial filter selected. This is done by using the index for + -- the filter in the array. Each filter consists of a pair, so in the above + -- we have 3 filters. The second filter is the 'Rexx Class File' filter + sfd~setFileTypeIndex(2) + + -- Set the default extension. Note that you do not include the period. The + -- default extension governs whether or not an extension is added if the + -- user leaves off the extension. If you do not set a deault extension, no + -- extension is added when the user does not type an extension, even if a + -- file type filter is in effect. When a default extension is set, if the + -- user picks a new filter, the extension is updated automatically by the + -- operating system. + sfd~setDefaultExtension('cls') + + -- Set the initial save as file name. You must provide a complete path + -- name or an error is generated. Likewise the file must exist. The + -- complete path name also serves to specifiy the directory that the save + -- file dialog is initially opened in. + ret = sfd~setSaveAsItem(rexx_home'\ooDialog.cls') + + -- The default options for the Save File Dialog contain the OVERWRITEPROMPT + -- keyword. This option causes the operating system to prompt the user if + -- they select a save file name that is the name of an existing file. If + -- that behaviour is not desired it can be changed by removing the keyword + -- as in this code. Uncomment to see the effect: + + /* sfd~options = sfd~options~delWord(sfd~options~wordPos('OVERWRITEPROMPT'), 1) */ + + -- Show the dialog and get the response + ret = sfd~show(self) + + if ret == sfd~canceled then text = 'The user canceled the save operation.' + else text = 'Save file:' sfd~getResult + + sfd~release + + -- Have the edit box display the result. + return self~showResult(text) + + +/** openFolderExample() + * + * Displays a basic open file dialog. The main point here is to demonstrate + * how to control which directory is initially selected when the dialog opens. + */ + +::method openFolderExample unguarded private + expose rexx_home + + ofd = .OpenFileDialog~new + ret = ofd~setClientGuid(self~GUID_OPEN_FOLDER) + + -- Normally the operating system will pick the initial directory that is + -- selected when the open file dialog is first shown. Usually this is the + -- last directory the user had selected. The setFolder() method over-rides + -- this behaviour and forces the dialog to open with the specified directory + -- selected. + ofd~setFolder(rexx_home) + + -- In this example we do not change the default options. One of the + -- defaults is that the file must exist. This is useful in the case where + -- we want to ensure the user picks an exsisting file. We do not need to + -- check for file existence. The operating system forces the user to pick + -- an exsiting file or cancel. + + -- Show the dialog and get the response + ret = ofd~show(self) + + if ret == ofd~canceled then text = 'The user canceled the open operation.' + else text = 'Open file:' ofd~getResult + + ofd~release + + -- Have the edit box display the result. + return self~showResult(text) + + +/** showResult() + * + * A convenience method that updates the edit box with the results for each + * open / save file dialog. + */ +::method showResult unguarded private + expose edit + use strict arg text + + edit~setText(text) + return 0 + + +/** addToolTips() + * + * A convenience method to add a tool tip for each radio button. The tool tips + * let us shwo some text explaining the tip of Open / Save File dialog that will + * be displayed when the specific radio button is selected. + * + * Notes: A tool tip will display the text on multiple lines, and will break + * the text at embedded new line characters. But - it will only do this + * if setMaxTipWidth() is invoked. However, if the width is set to less + * than the width up to the new line, the tool tip will break the text + * at a word break. So, what we do is set the max width to very large, + * the width of an entire text, and then the tool tip breaks the text at + * every new line. + * + * The text is pretty long, so to ensure the user has enough time to + * read it all, we set the delay before the tool tip disappears to twice + * the default delay time. + */ +::method addToolTips private + expose rbOpen rbSave rbOpenMulti rbOpenCustom rbSaveDefault rbOpenFolder edit + + text = "Select this Radio Button to show " || .endOfLine || - + "a simple Open File Dialog that" || .endOfLine || - + "allows the user to type in a" || .endOfLine || - + "file name." + s = self~getTextSizePX(text) + + ttOpen = self~createToolTip('IDC_TT_OPEN') + ttOpen~addTool(rbOpen, text) + ttOpen~setMaxTipWidth(s~width) + + delayTime = ttOpen~getDelayTime('AUTOPOP') * 2 + + ttOpen~setDelayTime('AUTOPOP', delayTime) + + text = "Select this Radio Button to show " || .endOfLine || - + "a simple Save File Dialog that" || .endOfLine || - + "allows the user to type in a" || .endOfLine || - + "file name." + + ttSave = self~createToolTip('IDC_TT_SAVE') + ttSave~addTool(rbSave, text) + ttSave~setMaxTipWidth(s~width) + ttSave~setDelayTime('AUTOPOP', delayTime) + + text = "Select this Radio Button to show" || .endOfLine || - + "an Open File Dialog that allows" || .endOfLine || - + "the user to select multiple files" || .endOfLine || - + "at one time." + + ttMulti = self~createToolTip('IDC_TT_OPEN_MULTI') + ttMulti~addTool(rbOpenMulti, text) + ttMulti~setMaxTipWidth(s~width) + ttMulti~setDelayTime('AUTOPOP', delayTime) + + text = "Select this Radio Button to show" || .endOfLine || - + "an Open File Dialog that has some" || .endOfLine || - + "simple customizations of the apparence" || .endOfLine || - + "of the dialog." + + ttCustom = self~createToolTip('IDC_TT_OPEN_CUSTOM') + ttCustom~addTool(rbOpenCustom, text) + ttCustom~setMaxTipWidth(s~width) + ttCustom~setDelayTime('AUTOPOP', delayTime) + + text = "Select this Radio Button to show" || .endOfLine || - + "a Save File Dialog that sets a" || .endOfLine || - + "default save as file name and a" || .endOfLine || - + "file type filter." + + ttDefault = self~createToolTip('IDC_TT_SAVE_DEFAULT') + ttDefault~addTool(rbSaveDefault, text) + ttDefault~setMaxTipWidth(s~width) + ttDefault~setDelayTime('AUTOPOP', delayTime) + + text = "Select this Radio Button to show" || .endOfLine || - + "an Open File Dialog that sets" || .endOfLine || - + "the initial direcotry that the" || .endOfLine || - + "dialog opens in." + + ttFolder = self~createToolTip('IDC_TT_OPEN_FOLDER') + ttFolder~addTool(rbOpenFolder, text) + ttFolder~setMaxTipWidth(s~width) + ttFolder~setDelayTime('AUTOPOP', delayTime) + diff --git a/modules/windows/oodialog/examples/publicRoutines_demo.rex b/modules/windows/oodialog/examples/publicRoutines_demo.rex new file mode 100755 index 0000000..3d01317 --- /dev/null +++ b/modules/windows/oodialog/examples/publicRoutines_demo.rex @@ -0,0 +1,377 @@ +/* publicRoutines_demo.rex */ + +/* +Purpose.: Demonstrate each of the ooDialog Public Routines +Who.....: Lee Peedin +When....: August 14, 2007 +*/ + +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 demo incorporates the following "features of ooRexx 3.2 +24 September 2007 + .endOfLine is used instead of '0d0a'x + ScreenSize + MSSleep + Variations of TimedMessage + time('t') +*/ + +-- Define a path most likely to be common to anyone using this demo - change as necessary + ooRexxHome = value("REXX_HOME", , 'ENVIRONMENT' ) + if ooRexxHome~length == 0 then + path = 'C:\Program Files\ooRexx\' + else + path = ooRexxHome || '\' + +-- Define a couple of variables to use in the code, including a global used for +-- a helper dialog. + delimiter = '0'x + .local~helperDlgTitle = "The publicRoutines_Demo Helper Dialog" + +-- Provide a menu of different examples - use the built in SingleSelection dialog + preselect = 1 + do until op = '' + option.1 = 'Play an audio file 1 time - (synchronously)' + option.2 = 'Play an audio file 1 time - (asynchronously)' + option.3 = 'Play an audio file multiple times - (loop)' + option.4 = 'Stop playing the audio file' + option.5 = 'Show an InfoDialog' + option.6 = 'Show an ErrorDialog' + option.7 = 'Show a multi-line InfoDialog' + option.8 = 'Show an AskDialog - Yes button as the default' + option.9 = 'Show an AskDialog - No button as the default' + option.10 = 'Show a FileNameDialog' + option.11 = 'Retrieve the handle to a window' + option.12 = 'Use the .DlgUtil Class To Return Screen Resolution' + option.13 = 'A Standard Timed Message (5 Seconds)' + option.14 = 'An unTimed Message' + option.15 = 'Stop The unTimed Message' + option.16 = 'An Early Reply Timed Message' + option.17 = 'Use the .DlgUtil Class To Query System Metrics' + + max = 17 + ssdlg = .SingleSelection~new('Select A Demonstration','Public Routines Demonstration',option.,preselect,,max%2+1) + op = ssdlg~execute + if op \= '' then + do + preselect = op + 1 + if preselect > max then preselect = 1 + call ('OPTION'op) ssdlg + end + end +exit + +Option1: + fileName = path||'samples\oodialog\wav\gotcha.wav' + wstream = .stream~new(filename) + if wstream~query('exists') = '' then + call errorDialog'The expected audio file' filename 'does not exist' + else + do + msg = "When you close this message box, a *.wav file will"||.endOfLine||- + "play synchronously. You will return to the demo progam"||.endOfLine||- + "when the *.wav file is ended." + call InfoDialog msg + + call Play fileName + end +return +---------------------------------------------------------------------------------------------------------------- +Option2: + fileName = path||'samples\oodialog\wav\gotcha.wav' + wstream = .stream~new(filename) + if wstream~query('exists') = '' then + call errorDialog 'The expected audio file' filename 'does not exist' + else + do + msg = "When you close this message box, a *.wav file will"||.endOfLine||- + "play asynchronously. You will return to the demo progam"||.endOfLine||- + "immediately, while the *.wav file continues to play." + call InfoDialog msg + + call Play fileName,'YES' + end +return +---------------------------------------------------------------------------------------------------------------- +Option3: + fileName = path||'samples\oodialog\wav\gotcha.wav' + wstream = .stream~new(filename) + if wstream~query('exists') = '' then + call errorDialog 'The expected audio file' filename 'does not exist' + else + do + msg = "When you close this message box, a *.wav file will"||.endOfLine||- + "play asynchronously in a continuous loop. You will"||.endOfLine||- + "return to the demo progam immediately. The *.wav"||.endOfLine||- + "file will continue to play until you stop it using"||.endOfLine||- + "the 'Stop playing the audio file' option." + call InfoDialog msg + + call Play fileName,'LOOP' + end +return +---------------------------------------------------------------------------------------------------------------- +Option4: + call Play fileName +return +---------------------------------------------------------------------------------------------------------------- +---------------------------------------------------------------------------------------------------------------- +Option5: + call InfoDialog 'This is an InfoDialog - note the icon used & the tone played' +return +---------------------------------------------------------------------------------------------------------------- +Option6: + call ErrorDialog 'This is an ErrorDialog - note the icon used & the tone played' +return +---------------------------------------------------------------------------------------------------------------- +Option7: + msg = 'This is line1'||.endOfLine||- + 'This is line2'||.endOfLine||- + 'This is line3 - note that the dialog is "stretched" to accomodate the longest line' + call InfoDialog msg +return +---------------------------------------------------------------------------------------------------------------- +Option8: + rv = AskDialog('Do you like this demonstration? (Yes button is pre-selected)') + if rv = 1 then + call InfoDialog 'You selected "Yes" - glad you like it' + else + call InfoDialog 'You selected "No" - mind sharing what you think would improve the demonstration?' + +return +---------------------------------------------------------------------------------------------------------------- +Option9: + rv = AskDialog('Do you like this demonstration? (No button is pre-selected)','n') + if rv = 1 then + call InfoDialog 'You selected "Yes" - glad you like it' + else + call InfoDialog 'You selected "No" - you must be hard to please' + +return +---------------------------------------------------------------------------------------------------------------- +Option10: + selfile = path + parent = '' -- don't need this in this example - just a place holder + filemask = 'All Files (*.*)'delimiter'*.*'delimiter + loadorsave = '' -- Load is the default + title = '' -- See documentation for default + defExtension = '' -- don't need this in this example - just a place holder + multiSelect = '' -- don't need this in this example - just a place holder + sepChar = '' -- don't need this in this example - just a place holder + + a_file = FileNameDialog(selfile,parent,filemask,loadorsave,title,defExtension,multiSelect,sepChar) + if a_file = 0 then + call ErrorDialog 'You Did Not Select A File' + else + call InfoDialog 'You Selected' a_file + + call InfoDialog 'For additional FileNameDialog examples, see the sample titled "fileNameDialog_demo.rex"' +return +---------------------------------------------------------------------------------------------------------------- +Option11: + + call infoDialog 'This program will open a dialog window in the'||.endOfLine||- + 'upper left corner of your screen named:'||.endOfLine||.endOfLine||- + '"'.helperDlgTitle'"'||.endOfLine||.endOfLine||- + 'and will return its handle. After finding the window, the'||.endOfLine||- + 'handle value will be added to the dialog window title.' + + -- The public routine FindWindow locates a window by its title. Since this + -- example should run for anyone, and there is no way of guaranteeing what + -- window might be open on anyone's desktop, the example creates its own + -- simple dialog window. That way it ensures that there is a known window + -- to find. + + aWindow = .SimpleDialog~new() + if aWindow~initCode = 0 then + do + -- Start the dialog concurrently, so this example program can + -- continue to run. Note, it takes some finite amount of time for + -- the OS to create and start up the underlying dialog. The example + -- sleeps a short time to give the OS time to get the dialog going. + aWindow~start("Execute") + call SysSleep .01 + + hWnd = FindWindow(.helperDlgTitle) + if hWnd = 0 then + call ErrorDialog 'Window could not be found' + else + do + -- The window handle can now be used to change the title of + -- the helper dialog, which demonstrates that the handle is + -- correct. + aWindow~SetWindowTitle(hWnd,.helperDlgTitle '- My handle is.:' hWnd) + call InfoDialog 'The handle to the "'.helperDlgTitle'" window is:' hWnd + end + + -- Now close the helper dialog. + aWindow~cancel + end + else + do + call ErrorDialog 'Sorry, the dialog creation failed' + end +return +---------------------------------------------------------------------------------------------------------------- +Option12: + use arg self + + -- Dialog units only have meaning in relation to a specfic dialog because the units are dependent on the + -- font used by the dialog. The screenSize() method of the .DlgUtil can accurately calculate the dialog + -- unit values for any dialog, if passed a reference to the dialog. + + ss = .DlgUtil~screenSize('B', self) + tab = '09'x + msg = 'Dialog units are expressed as dialog units' || .endOfLine ||- + 'of' self 'dialog' || .endOfLine~copies(3) || - + 'Width In Dialog Units: ' || tab || ss[1] || .endOfLine ||- + 'Height In Dialog Units:' || tab || ss[2] || .endOfLine ||- + 'Width In Pixels: ' || tab || tab || ss[3] || .endOfLine ||- + 'Height In Pixels:' || tab || tab || ss[4] + call InfoDialog msg +return +---------------------------------------------------------------------------------------------------------------- +Option13: + msg = 'This Message Will Remain On The Screen For 5000 milliSeconds' + ret = timedMessage(msg,'A Standard TimedMessage', 5000) +return +---------------------------------------------------------------------------------------------------------------- +Option14: + msg = "Hey, I'm Back Here - Frozen In Time! This Message Will Remain On The Screen Until The Program Calls For It To Be Stopped" + tdlg = timedMessage(msg,'An unTimedMessage', -1) +return +---------------------------------------------------------------------------------------------------------------- +Option15: + if symbol('tdlg') = 'VAR' then + do + tdlg~cancel + drop tdlg + end + else + call errorDialog 'There Is Not unTimed Message To Stop' +return +---------------------------------------------------------------------------------------------------------------- +Option16: +-- Total time will be the duration of the MSSleep - The TimeMessage will last only half the total duration +-- call time 'r' + startTime = time() + startTs = .TimeSpan~new(time('F')) + msg = 'Processing Occurring - Please Wait - Processing Will Take Longer Than This Message' + ret = timedMessage(msg,'A TimedMessage Early Reply', 5000, .true) + ret = MSSleep(10000) + endTime = time() + endTS = .TimeSpan~new(time('F')) + msg = 'Start Time:' startTime '- End Time:' endTime '- Duration:' (endTS - startTS)~string~right(9)~strip('T', '0') 'Seconds' + call infoDialog msg +return +---------------------------------------------------------------------------------------------------------------- + +---------------------------------------------------------------------------------------------------------------- +Option17: + + tab = '09'x + + -- There are a large number of system metric values. You query the value you + -- are interested in by numeric index. The GetSystemMetrics Windows API is + -- documented in the MSDN Library, which Microsoft makes available online. + -- The numeric values of the possible indexes and their meanings are all + -- documented there. Use a Google search of "GetSystemMetrics MSDN Library" + -- to locate the documentation. + + SM_CMONITORS = 80 + SM_CMOUSEBUTTONS = 43 + SM_MOUSEWHEELPRESENT = 19 + + countMonitors = .DlgUtil~getSystemMetrics(SM_CMONITORS) + countMouseButtons = .DlgUtil~getSystemMetrics(SM_CMOUSEBUTTONS) + haveMouseWheel = .DlgUtil~getSystemMetrics(SM_MOUSEWHEELPRESENT) + + if countMonitors <> -1 then + l1 = "Attached Monitors:" tab || countMonitors"." ||.endOfLine + else + l1 = "SystemMetrics error." ||.endOfLine + + select + when countMouseButtons == 0 then + l2 = "Mouse:" tab || tab || "no mouse attached." ||.endOfLine + when countMouseButtons > 0 then + l2 = "Mouse:" tab || tab || countMouseButtons "button mouse." ||.endOfLine + otherwise + l2 = "SystemMetrics error." ||.endOfLine + end + -- End select + + select + when countMouseButtons == 0 then + l3 = "Mouse wheel:" tab || "no mouse attached." ||.endOfLine + when haveMouseWheel then + l3 = "Mouse wheel:" tab || "present." ||.endOfLine + when \ haveMouseWheel then + l3 = "Mouse wheel:" tab || "none." ||.endOfLine + otherwise + l3 = "SystemMetrics error." ||.endOfLine + end + -- End select + + l4 = .endOfLine||.endOfLine||" --------------------------- "||.endOfLine||.endOfLine + + SM_CXSIZE = 30 + SM_CXVSCROLL = 20 + SM_CYHSCROLL = 3 + SM_CYMENU = 15 + + l5 = "Height of single line menu bar in pixels:" tab .DlgUtil~getSystemMetrics(SM_CYMENU) || ". " ||.endOfLine + l6 = "Width of title bar button in pixels:" tab .DlgUtil~getSystemMetrics(SM_CXSIZE) || ". " ||.endOfLine + l7 = "Width of vertical scroll bar in pixels:" tab .DlgUtil~getSystemMetrics(SM_CXVSCROLL) || ". " ||.endOfLine + l8 = "Height of horizontal scroll bar in pixels:" tab .DlgUtil~getSystemMetrics(SM_CYHSCROLL) || ". " ||.endOfLine + + msg = l1 || l2 || l3 || l4 || l5 || l6 || l7 || l8 + j = infoDialog(msg) + +return +---------------------------------------------------------------------------------------------------------------- + +-- Requires directive to use the Public Routines +::requires "ooDialog.cls" + +::class SimpleDialog subclass UserDialog public +::method Execute + self~Create(0,0,290,40, .helperDlgTitle) + self~execute:super("SHOWTOP") diff --git a/modules/windows/oodialog/examples/resources/CheckIn.bmp b/modules/windows/oodialog/examples/resources/CheckIn.bmp new file mode 100644 index 0000000..e73153e Binary files /dev/null and b/modules/windows/oodialog/examples/resources/CheckIn.bmp differ diff --git a/modules/windows/oodialog/examples/resources/ClosePalette.bmp b/modules/windows/oodialog/examples/resources/ClosePalette.bmp new file mode 100644 index 0000000..619506d Binary files /dev/null and b/modules/windows/oodialog/examples/resources/ClosePalette.bmp differ diff --git a/modules/windows/oodialog/examples/resources/CodeReview.bmp b/modules/windows/oodialog/examples/resources/CodeReview.bmp new file mode 100644 index 0000000..61c52d6 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/CodeReview.bmp differ diff --git a/modules/windows/oodialog/examples/resources/Default.bmp b/modules/windows/oodialog/examples/resources/Default.bmp new file mode 100644 index 0000000..9376901 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/Default.bmp differ diff --git a/modules/windows/oodialog/examples/resources/Disabled.bmp b/modules/windows/oodialog/examples/resources/Disabled.bmp new file mode 100644 index 0000000..26f86d3 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/Disabled.bmp differ diff --git a/modules/windows/oodialog/examples/resources/Hot.bmp b/modules/windows/oodialog/examples/resources/Hot.bmp new file mode 100644 index 0000000..dd16f21 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/Hot.bmp differ diff --git a/modules/windows/oodialog/examples/resources/LinkToWeb.bmp b/modules/windows/oodialog/examples/resources/LinkToWeb.bmp new file mode 100644 index 0000000..c83078b Binary files /dev/null and b/modules/windows/oodialog/examples/resources/LinkToWeb.bmp differ diff --git a/modules/windows/oodialog/examples/resources/LockModule.bmp b/modules/windows/oodialog/examples/resources/LockModule.bmp new file mode 100644 index 0000000..b97e6a5 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/LockModule.bmp differ diff --git a/modules/windows/oodialog/examples/resources/LockProject.bmp b/modules/windows/oodialog/examples/resources/LockProject.bmp new file mode 100644 index 0000000..77cbd8a Binary files /dev/null and b/modules/windows/oodialog/examples/resources/LockProject.bmp differ diff --git a/modules/windows/oodialog/examples/resources/Normal.bmp b/modules/windows/oodialog/examples/resources/Normal.bmp new file mode 100644 index 0000000..5c04613 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/Normal.bmp differ diff --git a/modules/windows/oodialog/examples/resources/ProjectReview.bmp b/modules/windows/oodialog/examples/resources/ProjectReview.bmp new file mode 100644 index 0000000..c4f2367 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/ProjectReview.bmp differ diff --git a/modules/windows/oodialog/examples/resources/Pushed.bmp b/modules/windows/oodialog/examples/resources/Pushed.bmp new file mode 100644 index 0000000..6563e94 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/Pushed.bmp differ diff --git a/modules/windows/oodialog/examples/resources/SaveAll.bmp b/modules/windows/oodialog/examples/resources/SaveAll.bmp new file mode 100644 index 0000000..d2be76b Binary files /dev/null and b/modules/windows/oodialog/examples/resources/SaveAll.bmp differ diff --git a/modules/windows/oodialog/examples/resources/SaveModule.bmp b/modules/windows/oodialog/examples/resources/SaveModule.bmp new file mode 100644 index 0000000..fc4d041 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/SaveModule.bmp differ diff --git a/modules/windows/oodialog/examples/resources/SaveProject.bmp b/modules/windows/oodialog/examples/resources/SaveProject.bmp new file mode 100644 index 0000000..434757a Binary files /dev/null and b/modules/windows/oodialog/examples/resources/SaveProject.bmp differ diff --git a/modules/windows/oodialog/examples/resources/SplitModule.bmp b/modules/windows/oodialog/examples/resources/SplitModule.bmp new file mode 100644 index 0000000..277cf98 Binary files /dev/null and b/modules/windows/oodialog/examples/resources/SplitModule.bmp differ diff --git a/modules/windows/oodialog/examples/resources/Update.bmp b/modules/windows/oodialog/examples/resources/Update.bmp new file mode 100644 index 0000000..9d3cb7d Binary files /dev/null and b/modules/windows/oodialog/examples/resources/Update.bmp differ diff --git a/modules/windows/oodialog/examples/resources/addManyRows.h b/modules/windows/oodialog/examples/resources/addManyRows.h new file mode 100644 index 0000000..e270aec --- /dev/null +++ b/modules/windows/oodialog/examples/resources/addManyRows.h @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ADD_ROWS 101 +#define IDD_INTRO 103 +#define IDD_SORT_PARAMS 105 +#define IDC_ST_CREATE 1000 +#define IDC_RB_ITEM 1001 +#define IDC_LV 1002 +#define IDC_PB_SORT_INTERN 1003 +#define IDC_RB_SUBITEM 1003 +#define IDC_PB_SORT_REXX 1004 +#define IDC_ED_COL 1005 +#define IDC_ST_INSERT 1006 +#define IDC_SP_COL 1007 +#define IDC_SP_ITEMS 1010 +#define IDC_ED_ITEMS 1011 +#define IDC_CK_FREEFORM 1013 +#define IDC_RB_1000 1020 +#define IDC_RB_2000 1021 +#define IDC_RB_5000 1022 +#define IDC_RB_10000 1023 +#define IDC_RB_15000 1024 +#define IDC_RB_25000 1025 +#define IDC_GB_TIMES 1027 +#define IDC_ST_INTERNAL 1028 +#define IDC_ST_REXXSORT 1029 +#define IDC_RB_ASCENDING 1030 +#define IDC_RB_DESCENDING 1031 +#define IDC_RB_CASELESS 1034 +#define IDC_RB_CASE 1035 diff --git a/modules/windows/oodialog/examples/resources/addManyRows.rc b/modules/windows/oodialog/examples/resources/addManyRows.rc new file mode 100644 index 0000000..81afddb --- /dev/null +++ b/modules/windows/oodialog/examples/resources/addManyRows.rc @@ -0,0 +1,106 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "addManyRows.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ADD_ROWS DIALOGEX 0, 0, 411, 238 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Large Item Count List View" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_LV, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_REPORT, 10, 10, 391, 153 + PUSHBUTTON "Rexx Sort", IDC_PB_SORT_REXX, 10, 214, 62, 14 + PUSHBUTTON "Internal Sort", IDC_PB_SORT_INTERN, 10, 195, 62, 14 + GROUPBOX "Time in seconds (2000 rows):", IDC_GB_TIMES, 77, 168, 269, 60 + LTEXT "Create full rows:", IDC_ST_CREATE, 86, 185, 107, 8, SS_LEFT + LTEXT "Insert full rows:", IDC_ST_INSERT, 86, 207, 107, 8, SS_LEFT + LTEXT "Internal sort:", IDC_ST_INTERNAL, 226, 185, 107, 8, SS_LEFT + LTEXT "Rexx sort:", IDC_ST_REXXSORT, 226, 207, 107, 8, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 351, 214, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_INTRO DIALOGEX 0, 0, 241, 130 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Progress Bar Example - Set Up" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + LTEXT "The upcoming example creates a list-view with a large number of items. Select the number of items for the list-view", IDC_STATIC, 12, 10, 209, 19, SS_LEFT + GROUPBOX "Pre-sets", IDC_STATIC, 11, 34, 104, 85, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "1,000", IDC_RB_1000, 21, 49, 35, 10, WS_TABSTOP + AUTORADIOBUTTON "2,000", IDC_RB_2000, 74, 49, 35, 10 + AUTORADIOBUTTON "5,000", IDC_RB_5000, 21, 73, 35, 10 + AUTORADIOBUTTON "10,000", IDC_RB_10000, 74, 73, 35, 10 + AUTORADIOBUTTON "15,000", IDC_RB_15000, 21, 98, 35, 10 + AUTORADIOBUTTON "25,000", IDC_RB_25000, 74, 98, 35, 10 + AUTOCHECKBOX "Use Free-form", IDC_CK_FREEFORM, 126, 39, 80, 10 + GROUPBOX "Free-form", IDC_STATIC, 126, 57, 104, 39 + EDITTEXT IDC_ED_ITEMS, 151, 73, 40, 14, ES_AUTOHSCROLL + CONTROL "", IDC_SP_ITEMS, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_SETBUDDYINT, 179, 73, 11, 14 + DEFPUSHBUTTON "OK", IDOK, 127, 106, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 181, 106, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SORT_PARAMS DIALOGEX 0, 0, 295, 162 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Set Up the Sort" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + GROUPBOX "Sort Parameters:", IDC_STATIC, 10, 10, 275, 116 + GROUPBOX "Column:", IDC_STATIC, 29, 31, 59, 77 + AUTORADIOBUTTON "Item", IDC_RB_ITEM, 38, 48, 39, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Subitem", IDC_RB_SUBITEM, 38, 67, 39, 8 + EDITTEXT IDC_ED_COL, 38, 87, 31, 12, ES_AUTOHSCROLL + CONTROL "", IDC_SP_COL, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 57, 87, 11, 14 + GROUPBOX "", IDC_STATIC, 107, 31, 160, 77, WS_GROUP + AUTORADIOBUTTON "Ascending", IDC_RB_ASCENDING, 124, 48, 48, 8, WS_TABSTOP + AUTORADIOBUTTON "Descending", IDC_RB_DESCENDING, 192, 48, 55, 8 + AUTORADIOBUTTON "Case Sensitive", IDC_RB_CASE, 124, 67, 60, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Case Insensitive", IDC_RB_CASELESS, 192, 67, 65, 8 + DEFPUSHBUTTON "OK", IDOK, 180, 138, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 235, 138, 50, 14 +} diff --git a/modules/windows/oodialog/examples/resources/genGUID.h b/modules/windows/oodialog/examples/resources/genGUID.h new file mode 100644 index 0000000..6dd8978 --- /dev/null +++ b/modules/windows/oodialog/examples/resources/genGUID.h @@ -0,0 +1,43 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_GUID_GENERATOR 100 +#define IDC_EDIT_GUID 1002 diff --git a/modules/windows/oodialog/examples/resources/genGUID.rc b/modules/windows/oodialog/examples/resources/genGUID.rc new file mode 100644 index 0000000..c542be1 --- /dev/null +++ b/modules/windows/oodialog/examples/resources/genGUID.rc @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "genGUID.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_GUID_GENERATOR DIALOGEX 0, 0, 186, 64 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "GUID Generator" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "This is your GUID:", IDC_STATIC, WC_STATIC, NOT WS_GROUP | SS_LEFT, 10, 11, 90, 10 + CONTROL "", IDC_EDIT_GUID, WC_EDIT, NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY, 11, 23, 165, 12 + CONTROL "Done", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON, 126, 40, 50, 14 +} diff --git a/modules/windows/oodialog/examples/resources/imageButton.h b/modules/windows/oodialog/examples/resources/imageButton.h new file mode 100644 index 0000000..43fdd9c --- /dev/null +++ b/modules/windows/oodialog/examples/resources/imageButton.h @@ -0,0 +1,45 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDC_ST_STATUS 1000 +#define IDC_PB_ADD 1001 +#define IDD_IMAGELIST_BUTTON 1033 +#define IDC_PB_PUSHME 1042 +#define IDC_PB_VIEW 1044 diff --git a/modules/windows/oodialog/examples/resources/imageButton.rc b/modules/windows/oodialog/examples/resources/imageButton.rc new file mode 100644 index 0000000..26b0149 --- /dev/null +++ b/modules/windows/oodialog/examples/resources/imageButton.rc @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include "imageButton.h" +#include + + +IDD_IMAGELIST_BUTTON DIALOGEX 0, 0, 235, 116 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "ooRexx Photograph Shop" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +BEGIN + PUSHBUTTON "", IDC_PB_VIEW, 7, 7, 69, 62 + PUSHBUTTON "", IDC_PB_ADD, 157, 7, 69, 62 + LTEXT "Status", IDC_ST_STATUS, 7, 78, 219, 11, SS_SUNKEN | SS_WORDELLIPSIS + PUSHBUTTON "Push Me", IDC_PB_PUSHME, 7, 95, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 123, 95, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 178, 95, 50, 14 +END diff --git a/modules/windows/oodialog/examples/resources/osfDialogs.h b/modules/windows/oodialog/examples/resources/osfDialogs.h new file mode 100644 index 0000000..f960def --- /dev/null +++ b/modules/windows/oodialog/examples/resources/osfDialogs.h @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_SAVE_FILE 100 +#define IDD_SIMPLE_OSF_DIALOGS 102 +#define IDC_EDIT_OSF 1000 +#define IDC_PB_SHOW 1000 +#define IDC_PB_SHOW_OSF 1001 +#define IDC_RB_OPEN 1002 +#define IDC_RB_OPEN_MULTI 1004 +#define IDC_EDIT 1005 +#define IDC_CK_EXE 1006 +#define IDC_CK_DLL 1007 +#define IDC_CK_CLS 1008 +#define IDC_CK_NONE 1009 +#define IDC_RB_SAVE 1010 +#define IDC_RB_OPEN_FOLDER 1012 +#define IDC_RB_SAVE_DEFAULT 1014 +#define IDC_RB_OPEN_CUSTOM 1016 + +#define IDC_TT_OPEN 1200 +#define IDC_TT_SAVE 1201 +#define IDC_TT_OPEN_MULTI 1202 +#define IDC_TT_OPEN_CUSTOM 1203 +#define IDC_TT_SAVE_DEFAULT 1204 +#define IDC_TT_OPEN_FOLDER 1205 + + diff --git a/modules/windows/oodialog/examples/resources/osfDialogs.rc b/modules/windows/oodialog/examples/resources/osfDialogs.rc new file mode 100644 index 0000000..96d480b --- /dev/null +++ b/modules/windows/oodialog/examples/resources/osfDialogs.rc @@ -0,0 +1,80 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "osfDialogs.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SAVE_FILE DIALOGEX 0, 0, 257, 123 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Save File Dialog Example" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + LTEXT "Result of the Save File Dialog execution will be shown here:", IDC_STATIC, 11, 10, 235, 11, SS_LEFT | SS_CENTERIMAGE + EDITTEXT IDC_EDIT, 10, 23, 236, 12, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Filter (remove from view) files with these extensions:", IDC_STATIC, 11, 49, 235, 11, SS_LEFT | SS_CENTERIMAGE + GROUPBOX "", IDC_STATIC, 10, 59, 236, 32 + AUTOCHECKBOX "*.exe", IDC_CK_EXE, 21, 72, 35, 9 + AUTOCHECKBOX "*.dll", IDC_CK_DLL, 71, 72, 35, 9 + AUTOCHECKBOX "*.cls", IDC_CK_CLS, 117, 72, 35, 9 + AUTOCHECKBOX "None", IDC_CK_NONE, 197, 72, 35, 9 + DEFPUSHBUTTON "Show Save File Dialog", IDC_PB_SHOW, 10, 99, 85, 14 + PUSHBUTTON "Done", IDCANCEL, 197, 99, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SIMPLE_OSF_DIALOGS DIALOGEX 0, 0, 256, 193 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Open File or Save File Demonstration" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + GROUPBOX "Pick the Open / Save File Dialog to display:", IDC_STATIC, 10, 10, 236, 106 + AUTORADIOBUTTON "Simple Open File", IDC_RB_OPEN, 23, 27, 66, 11 + AUTORADIOBUTTON "Simple Save File", IDC_RB_SAVE, 23, 49, 66, 11 + AUTORADIOBUTTON "Open Multiple Files", IDC_RB_OPEN_MULTI, 23, 72, 85, 11 + AUTORADIOBUTTON "Open File Easy Customizations", IDC_RB_OPEN_CUSTOM, 117, 27, 110, 11 + AUTORADIOBUTTON "Save File Default Name", IDC_RB_SAVE_DEFAULT, 117, 49, 110, 11 + AUTORADIOBUTTON "Open File in Specified Folder", IDC_RB_OPEN_FOLDER, 117, 72, 110, 11 + DEFPUSHBUTTON "Show", IDC_PB_SHOW_OSF, 84, 93, 50, 14 + LTEXT "Result of the Open / Save File Dialog execution will be shown here:", IDC_STATIC, 10, 136, 235, 11, SS_LEFT | SS_CENTERIMAGE + EDITTEXT IDC_EDIT_OSF, 10, 149, 236, 12, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "Done", IDCANCEL, 196, 169, 50, 14 +} diff --git a/modules/windows/oodialog/examples/resources/saveFileWithFilter.h b/modules/windows/oodialog/examples/resources/saveFileWithFilter.h new file mode 100644 index 0000000..254c4b1 --- /dev/null +++ b/modules/windows/oodialog/examples/resources/saveFileWithFilter.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_SAVE_FILE 100 +#define IDD_SIMPLE_OSF_DIALOGS 102 +#define IDC_PB_SHOW 1000 +#define IDC_RB_OPEN 1002 +#define IDC_EDIT 1005 +#define IDC_CK_EXE 1006 +#define IDC_CK_DLL 1007 +#define IDC_CK_CLS 1008 +#define IDC_CK_NONE 1009 +#define IDC_RB_SAVE 1010 +#define IDC_RB_OPEN_FOLDER 1012 +#define IDC_RB_SAVE_DEFAULT 1014 +#define IDC_RB_OPEN_CUSTOM 1016 diff --git a/modules/windows/oodialog/examples/resources/saveFileWithFilter.rc b/modules/windows/oodialog/examples/resources/saveFileWithFilter.rc new file mode 100644 index 0000000..354f9dc --- /dev/null +++ b/modules/windows/oodialog/examples/resources/saveFileWithFilter.rc @@ -0,0 +1,79 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "saveFileWithFilter.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SIMPLE_OSF_DIALOGS DIALOGEX 0, 0, 256, 169 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Open File or Save File Demonstration" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + GROUPBOX "Pick the Open / Save File Dialog to display:", IDC_STATIC, 10, 10, 236, 84 + AUTORADIOBUTTON "Simple Open File", IDC_RB_OPEN, 23, 27, 66, 11 + AUTORADIOBUTTON "Simple Save File", IDC_RB_SAVE, 23, 49, 66, 11 + AUTORADIOBUTTON "Open File in Specified Folder", IDC_RB_OPEN_FOLDER, 104, 73, 110, 11 + AUTORADIOBUTTON "Save File Default Name", IDC_RB_SAVE_DEFAULT, 104, 49, 110, 11 + AUTORADIOBUTTON "Open File Easy Customizations", IDC_RB_OPEN_CUSTOM, 104, 27, 110, 11 + DEFPUSHBUTTON "Show", IDOK, 23, 72, 50, 14 + LTEXT "Result of the Open / Save File Dialog execution will be shown here:", IDC_STATIC, 10, 112, 235, 11, SS_LEFT | SS_CENTERIMAGE + EDITTEXT IDC_EDIT, 10, 125, 236, 12, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "Done", IDCANCEL, 196, 145, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SAVE_FILE DIALOGEX 0, 0, 257, 123 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Save File Dialog Example" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + LTEXT "Result of the Save File Dialog execution will be shown here:", IDC_STATIC, 11, 10, 235, 11, SS_LEFT | SS_CENTERIMAGE + EDITTEXT IDC_EDIT, 10, 23, 236, 12, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Filter (remove from view) files with these extensions:", IDC_STATIC, 11, 49, 235, 11, SS_LEFT | SS_CENTERIMAGE + GROUPBOX "", IDC_STATIC, 10, 59, 236, 32 + AUTOCHECKBOX "*.exe", IDC_CK_EXE, 21, 72, 35, 9 + AUTOCHECKBOX "*.dll", IDC_CK_DLL, 71, 72, 35, 9 + AUTOCHECKBOX "*.cls", IDC_CK_CLS, 117, 72, 35, 9 + AUTOCHECKBOX "None", IDC_CK_NONE, 197, 72, 35, 9 + DEFPUSHBUTTON "Show Save File Dialog", IDC_PB_SHOW, 10, 99, 85, 14 + PUSHBUTTON "Done", IDCANCEL, 197, 99, 50, 14 +} diff --git a/modules/windows/oodialog/examples/resources/useTools.h b/modules/windows/oodialog/examples/resources/useTools.h new file mode 100644 index 0000000..8ffeaf6 --- /dev/null +++ b/modules/windows/oodialog/examples/resources/useTools.h @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#define IDC_ST_TOOL_SIMULATOR 200 +#define IDC_PB_SHOW_PALETTE 210 +#define IDC_PB_LOCKMODULE 301 +#define IDC_PB_LOCKPROJECT 302 +#define IDC_PB_SPLITMODULE 303 +#define IDC_PB_SAVEMODULE 304 +#define IDC_PB_SAVEPROJECT 305 +#define IDC_PB_SAVEALL 306 +#define IDC_PB_CHECKIN 307 +#define IDC_PB_LINKTOWEB 308 +#define IDC_PB_CODEREVIEW 309 +#define IDC_PB_UPDATE 310 +#define IDC_PB_PROJECTREVIEW 311 +#define IDC_PB_CLOSE 400 diff --git a/modules/windows/oodialog/examples/saveFileWithFilter.rex b/modules/windows/oodialog/examples/saveFileWithFilter.rex new file mode 100755 index 0000000..9ecea29 --- /dev/null +++ b/modules/windows/oodialog/examples/saveFileWithFilter.rex @@ -0,0 +1,408 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** saveFileWithFilter.rex + * + * This example shows how to use the Common Item Dialog in file save mode. + * + * This example will only run on Vista or later. + * + * Both the .OpenFileDialog and the .SaveFileDialog are subclasses of the + * .CommonItemDialog class. The Rexx programmer can not instantiate a + * .CommonItemDialog object. Instead the programmer picks the type of file + * dialog he wants, a save file or an open file dialog and instantitates that + * class. Almost all of the methods for these classes come from the + * CommonItemDialog class and are documented in the reference manual under the + * CommonItemDialog section. + * + * This example shows 2 things. 1.) How to use a filter with the dialog. This + * is done with the .ShellItemFilter class. 2.) How to connect event + * notifications. This is done with the .CommonDialogEvents class. + * + * For the purpose of the example, we use a hypothetical case that the + * application wants the user to pick a file to save to, but the data being + * saved can not be saved to file with the extension of .exe, or .dll, or .cls. + * + * To achieve this a filter is used so that the save dialog does not show any + * files with those extensions. To ensure the user does not type in a file + * name with those extensions, when the user picks a file name, the OnFileOk + * event is used to check the file name the user picked. + * + * To give the example a little variety, a dialog is first put up to allow the + * user to pick some or all of the extensions to filter out and the Save File + * Dialog can be shown multiple times. + * + * The Common Item Dialog allows its state to be saved on a per instance basis + * in addition to the per process basis. This is done by generating a GUID and + * assigning it to the dialog before it is configured. Then, for each dialog + * with the same GUID, the operating system saves its state separately. + * + * To make use of this feature, the programmer would generate a single GUID and + * then assign the same GUID each time the file dialog was shown in the + * application. + * + * This simple program can be used to generate a GUID. Run the program and + * then copy and paste the output on the command line in to your program. + * + * - - - - - - - - - Cut begin - - - - - - - - - - - - - - - - - - - - - - - - + * /* genGUID.rex */ + * + * guid = .DlgUtil~getGUID + * say guid + * return 0 + * + * ::requires 'ooDialog.cls' + * - - - - - - - - - Cut end - - - - - - - - - - - - - - - - - - - - - - - - - + * + */ + if \ .application~requiredOS('Vista', 'saveFileWithFilter.rex') then return 99 + + srcDir = locate() + + -- Set up the symbolic IDs and then put up our example dialog. + .application~setDefaults('O', srcDir'resources\saveFileWithFilter.h', .false) + + dlg = .CommonSaveDialog~new(srcDir'resources\saveFileWithFilter.rc', IDD_SAVE_FILE) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + return 0 + +::requires "ooDialog.cls" + +::class 'CommonSaveDialog' subclass RcDialog + +-- Do not copy this GUID into your own code. Always generate your own GUID. +::constant GUID 'a25b89e4-db67-4423-ae66-a4836bb76024' + + +/** initDialog() + * + * Simple standard init dialog method. We save references to our commonly used + * controls, set the .exe check box to checked on start up, and connect the + * button click event for the push button and the 'None' check box. Each time + * the None check box is clicked we toggle the state of the other 3 check boxex. + * + * We also use this method to find the installed directory of ooRexx. + */ +::method initDialog + expose ckExe ckDll ckCls ckNone edit rexx_home + + ckExe = self~newCheckBox(IDC_CK_EXE)~~check + ckDll = self~newCheckBox(IDC_CK_DLL) + ckCls = self~newCheckBox(IDC_CK_CLS) + ckNone = self~newCheckBox(IDC_CK_NONE) + + edit = self~newEdit(IDC_EDIT) + + self~connectButtonEvent(IDC_CK_NONE, 'CLICKED', onCheckNone) + self~connectButtonEvent(IDC_PB_SHOW, 'CLICKED', onShowSaveDialog) + + rexx_home = value('REXX_HOME', , 'ENVIRONMENT') + if rexx_home == '' then rexx_home = 'C:\Program Files' + + +/** onShowSaveDialog() + * + * When the user clicks on the 'Show Save File Dialog' push button, we put up + * the Save File Dialog and then report the results in the edit control. + * + * The Save File Dialog filters out files in the view of the dialog. The + * checked check boxes determine which files are filtered out, or no files are + * filtered out. + * + * Say the .exe and .dll extensions are set (through the check boxes) to be + * filtered out. + * + * To filter out those values in the view of the dialog, we need to instantiate + * a .ShellItemFilter object. The ShellItemFilter has just one method: + * includeItem(). The operating system's Save File Dialog will invoke that + * method for each file in the initial folder. When / if the user changes to a + * new folder, the operating system again invokes the method for each file in + * the new folder. If the method returns S_OK the file is included, if S_FALSE + * is returned, the file is not shown in the view. + * + * The includeItem() of the .ShellItemFilter class simply returns S_OK. To + * change that behavior the Rexx programmer creates a subclass and over-rides + * the includeItem() method. + * + * However, the user could simply type in the name: myfile.exe in the edit box. + * We also want to prevent that. To do this we need to instantiate a + * .CommonDialogEvents object. The .CommonDialogEvents class has a method for + * every notification the operating system's common item dialog sends. These + * methods all simply return the proper value to continue. To change the + * default behaviour the Rexx programmer creates a subclass and over-rides the + * methods she is interested in. + */ +::method onShowSaveDialog unguarded + expose edit rexx_home + + -- Setting the client GUID has the operating system preserve the state for + -- this specific save file dialog. + sfd = .SaveFileDialog~new + ret = sfd~setClientGuid(self~GUID) + + -- The filter variable is a simple string of words. Each word in the string + -- is a file extension to filter out of the view. + filter = self~getCurrentFilter + + -- If the filter is 'None', the None check box is checked. No point in + -- setting the filter or event handler at all for that case. + if filter \== 'None' then do + -- Instantiate our .CommonDialogEvents object and inform the Common Item + -- Dialog of it through the advise() method. + eventHandler = .CDevents~new + eventHandler~filter = filter + sfd~advise(eventHandler) + + -- Same basic thing for our filter object. The Common Item Dialog is + -- informed of the filter through the setFilter() method. + filterObj = .SIFilter~new + filterObj~filter = filter + sfd~setFilter(filterObj) + end + + -- We set the initial folder to the install directory of ooRexx because we + -- know that directory contains .exe, .dll, and .cls files. + sfd~setFolder(rexx_home) + + -- We are all set, show the dialog and get the user's response: + ret = sfd~show(self) + + + if ret == sfd~canceled then text = 'The user canceled the save' + else text = 'Save to file:' sfd~getResult + + -- The proper use of both the .SaveFileDialog and the .OpenFileDialog is to + -- instantiate the object, configure it, show it, and then release it. The + -- release() method is essential to ensuring the COM resources are properly + -- cleaned up. + -- + -- If release() is not called, the ooDialog framework will *attempt* to do + -- the clean up in an uninit() method. However, 1.) there is *no* guarentee + -- that the interpreter will invoke the uninit() method. 2.) There is *no* + -- guarentee the uninit() will be run on this thread. The COM resources can + -- *not* be cleaned up if uninit() is run on another thread than this one. + -- + -- The only way to guarentee that the COM resources are cleaned up properly + -- is for the programmer to invoke the release() method. + sfd~release + + -- Have the edit box display the result. + edit~setText(text) + + +/** onCheckNone() + * + * The event handler for the CLICK event. This method is invoked whenever the + * user clicks on the 'None' check box. If the click checks the check box we + * uncheck all the othe check boxes and disable them. If the click unchecks + * the check box we re-enable the other check boxes. + */ +::method onCheckNone unguarded + expose ckExe ckDll ckCls ckNone + + if ckNone~checked then do + ckExe~~uncheck~disable + ckDll~~uncheck~disable + ckCls~~uncheck~disable + end + else do + ckExe~enable + ckDll~enable + ckCls~enable + end + + +/** getCurrentFilter() + * + * A simple private helper method. We create a string with each file extension + * name for every extension whose check box is checked. If the None check box + * is checked we use the string 'None' The file extension names need to be + * separated by spaces so that we have a string of 'words.' + */ +::method getCurrentFilter unguarded private + expose ckExe ckDll ckCls ckNone + + if ckNone~checked then do + f = 'None' + end + else do + f = '' + if ckExe~checked then f = '.exe' + if ckDll~checked then f ||= ' .dll' + if ckCls~checked then f ||= ' .cls' + end + if f == '' then f = 'None' + + return f + + +/* Class: Helper + * + * Both the .SIFilter and the .CDEvents classes need to obtain the file + * extension from complete path names. The code to do that is put in this + * mixin class so we don't need to duplicate the code in each class. + * + * In addition both of the classes need a way to know which filter the user + * selected (through the check boxes.) The filter attribute is a convenient + * way to inform the objects of the current filter. + */ +::class 'Helper' mixinclass object +::attribute filter unguarded +::method getExtension + use strict arg file + + pos = file~lastpos('.') + if pos > 0 then return file~substr(pos) + else return '' + + +/* Class: SIFilter + * + * To assign a filter to your Open/Save File Dialog you need to use a + * ShellItemFilter object. + * + * The .ShellItemFilter class has one method, includeItem(). This method is + * invoked by the operating system (through the ooDialog framework's + * implementation of the COM IShellItemFilter interface.) + * + * The Rexx ShellItemFilter returns S_OK from the includeItem() method. To + * actually filter items, the programmer needs to subclass ShellItemFilter and + * provide a custom filter by over-riding the includeItem() method. + */ +::class 'SIFilter' subclass ShellItemFilter inherit Helper + +/** includeItem() + * + * Our includeItem() over-ride. + * + * sfd -> The Rexx SaveFileDialog object we are connected to. + * hwnd -> The window handle of the operating system's Save File Dialog. + * item -> The complete path name of a file about to be put in the view. + */ +::method includeItem + use arg sfd, hwnd, item + + -- If the filter is none, every file should be included and we simply return + -- S_OK. This can not actually happen in our program because, if the filter + -- is none, this event handler is not connected in the first place. + filStr = self~filter + if filStr == 'None' then return self~S_OK + + -- Get the extension of this file and see if the extension is in the filter. + -- If it is, return S_FALSE to exclude it from the view. + ext = self~getExtension(item) + if filStr~caselessWordPos(ext) <> 0 then return self~S_FALSE + + return self~S_OK + + +/* Class: CDEvents + * + * The operating system's Common Item Dialog has 12 event notifications it sends + * to an event handler. The Rexx programmer can elect to handle some or all of + * those events by using a CommonDialogEvents object. + */ +::class 'CDEvents' subclass CommonDialogEvents inherit Helper + +/** onFileOk() + * + * This is the event handler for the Ok push button, which is labeled Open, or + * Save depending on the type of file dialog. Or it could be a custom label. + * + * It is invoked when the user has pushed Save (for this dialog) but before + * the dialog is closed. It gives us a chance to veto the close. If S_OK is + * returned the dialog closes. If S_FALSE is returned the dialog does not + * close. + * + * Obviously, if the dialog does not close when the user presses the button, it + * can be disconcerting. So, you should always put up some explanation of why + * the dialog does not close. + * + * Here we examine the choosen file and see if it has one of the extensions not + * allowed. If so we refuse the file. + * + * cfd -> .CommonFileDialog This is the Rexx Common File Dialog object. + * hwnd -> This is the window handle of the operating system file dialog. + */ +::method onFileOk unguarded + use arg cfd, hwnd + + if self~filter == 'None' then return self~S_OK + + file = cfd~getResult + if file \== .nil then do + ext = self~getExtension(file) + + if self~filter~caselessWordPos(ext) <> 0 then do + extList = self~nameExtensions(self~filter) + title = 'ooRexx Save File Selection Error' + msg = 'File:' file 'is not acceptable.' || .endOfLine~copies(2) || - + 'The file to save to must not have' extList + j = MessageDialog(msg, hwnd, title, 'OK', 'ERROR') + return self~S_FALSE + end + end + + return self~S_OK + + +/** nameExtensions() + * + * Just a simple helper method to take the filter string: '.exe .dll' and turn + * it into a phrase for the message box. I.e.: + * + * '.cls' -> an extension of .cls + * + * '.exe .cls' -> an extension of .exe, or .cls + * + * etc., etc.. + */ +::method nameExtensions unguarded private + use strict arg exts + + count = exts~words + str = 'an extension of ' + + if count == 1 then do + str ||= exts + end + else do i = 1 to count + if i == count then str ||= 'or' exts~word(i) + else str ||= exts~word(i) || ', ' + end + return str || '.' diff --git a/modules/windows/oodialog/examples/simpleFolderBrowse.rex b/modules/windows/oodialog/examples/simpleFolderBrowse.rex new file mode 100755 index 0000000..821540b --- /dev/null +++ b/modules/windows/oodialog/examples/simpleFolderBrowse.rex @@ -0,0 +1,135 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A quick example of the SimpleFolderBrowse class. This class only has one + * method: getFolder() and it is a class method. + * + * It is very easy to use, you just invoke the getFolder() method and the folder + * picked by the user is returned. When the user picks a folder the fully + * qualified path name is returned. If the user cancels, the empty string is + * returned. + * + * It is possible, depending on how the dialog is set up, for the user to pick a + * virtual folder that has no file system path. In that case, .nil is returned. + * + */ + + -- Set up some symbolic IDs and then put up our dialog. + .application~setDefaults('O', , .false) + .constDir[IDC_PB_BROWSE] = 100 + .constDir[IDC_ST_RESULTS] = 101 + .constDir[IDC_EDIT] = 102 + .constDir[IDC_RB_USE_OPTIONS] = 103 + .constDir[IDC_RB_NO_OPTIONS] = 104 + + dlg = .BrowseDialog~new + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + return 0 + +::requires "ooDialog.cls" + +::class 'BrowseDialog' subclass UserDialog + +::method init + forward class (super) continue + + self~create(30, 30, 257, 123, "Simple Folder Browse Example", "CENTER") + + +/** defineDialog() + * + * Create a simple dialog template. + */ +::method defineDialog + + self~createStaticText(IDC_ST_RESULTS, 10, 10, 30, 11, , "Results:") + self~createEdit(IDC_EDIT, 10, 24, 237, 11, 'AUTOSCROLLH') + self~createRadioButton(IDC_RB_USE_OPTIONS, 10, 60, 90, 14, "AUTO", 'Use optional arguments') + self~createRadioButton(IDC_RB_NO_OPTIONS, 10, 79, 90, 14, "AUTO", 'No optional arguments') + self~createPushButton(IDC_PB_BROWSE, 10, 99, 50, 14, "DEFAULT", "Browse", onBrowse) + self~createPushButton(IDCANCEL, 197, 99, 50, 14, , "Done") + + +/** onBrowse() + * + * When the user clicks on the 'Browse' push button, we put up the browse for + * folder dialog and then report the results in the edit control. + * + * If the 'Use opitonal arguments' radio button is checked we use all the + * possible optional arugments. Otherwise we just put up the browse for folder + * dialog 'plain.' I.e., using all defaults. + */ +::method onBrowse unguarded + expose rbUse + + if rbUse~checked then do + title = 'Browsing for folders the REXXish way' + banner = 'Instructions could go here ...' + hint = 'Pick any folder you wish, or some other hint' + + startDir = value("REXX_HOME", , 'ENVIRONMENT') + if startDir == '' then startDir = 'C:\Program Files' + + folder = .SimpleFolderBrowse~getFolder(title, banner, hint, startDir, 'CSIDL_DRIVES', self) + end + else do + folder = .SimpleFolderBrowse~getFolder + end + + edit = self~newEdit(IDC_EDIT) + + select + when folder == .nil then text = 'The user picked a virtual folder' + when folder == '' then text = 'The user canceled' + otherwise text = 'The user picked:' folder + end + -- End select + + edit~setText(text) + + +/** initDialog() + * + * Simple init dialog method. We just use it to check one of the radio buttons. + */ +::method initDialog + expose rbUse + + rbUse = self~newRadioButton(IDC_RB_USE_OPTIONS) + rbUse~check diff --git a/modules/windows/oodialog/examples/stopWatch.rex b/modules/windows/oodialog/examples/stopWatch.rex new file mode 100755 index 0000000..c1f408c --- /dev/null +++ b/modules/windows/oodialog/examples/stopWatch.rex @@ -0,0 +1,189 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* ========================================================================= */ +/* Stopwatch a Rexx Stopwatch */ +/* ========================================================================= */ + + dlg = .StopWatchCls~new /* Create OODialog Class instance */ + dlg~execute('ShowTop') /* Create, show and run the Windows Object */ + +EXIT -->| +/* ========================================================================= */ +::requires 'ooDialog.cls' /* OODialog Windows GUI Class */ +::requires "winSystm.cls" /* for clipboard manager */ +/* ========================================================================= */ +::class StopWatchCls subclass userdialog +/* ------------------------------------------------------------------------- */ +::attribute state unguarded /* [Stopped,Running,Split,splitting] */ +::attribute session unguarded /* session number */ +::attribute events unguarded /* event record for clipboard */ +/* ------------------------------------------------------------------------- */ +::method Init +/* ------------------------------------------------------------------------- */ + + self~Init:super /* we call the Super Class (userdialog) */ + + rc = self~CreateCenter(160,62,'Stopwatch - - Stopped',,,'MS Sans Serif',8) + self~InitCode = (rc=0) + self~state = 'Stopped' + self~time = '00:00:00.00' + self~Session = 0 + self~events = .array~new + +/* ------------------------------------------------------------------------- */ +::method DefineDialog +/* ------------------------------------------------------------------------- */ +expose menuBar + + u = .dlgAreaU~new(self) /* Whole dialog */ + self~createEdit( 10, u~x, u~y, u~w, u~h('31%'), 'readonly center', 'time') + self~createPushButton(11, u~x, u~y('41%'),u~w('45%'),u~h('38%'), ,'Start', 'ButtonPress') + self~createPushButton(12, u~x('55%'),u~y('41%'),u~w('45%'),u~h('38%'), ,'Exit', 'ButtonPress') + + menuBar = .BinaryMenuBar~new + filePopup = .PopupMenu~new(13) + filePopup~insertItem(IDCANCEL,IDCANCEL,"E&xit") + editPopup = .PopupMenu~new(14) + editPopup~insertItem(15, 15, "&Copy","GRAYED",,,.true,"Copy2CB") + + menuBar~insertPopup(14,14,editPopup,"&Edit") + menuBar~insertPopup(13,13,filePopup,"&File") + +/* ------------------------------------------------------------------------- */ +::method InitDialog +/* ------------------------------------------------------------------------- */ +expose el b1 b2 menuBar + + menuBar~attachTo(self) + + b1 = self~newPushButton(11) + b2 = self~newPushButton(12) + el = self~newEdit(10) + + d = .Directory~new~~weight(700) + el~~setcolor(0,13)~~setFont(self~createFontEx('Lucida Console',18,d),1) + +return InitDlgRet + +/* ------------------------------------------------------------------------- */ +::Method ButtonPress UnGuarded +/* Pressing either button runs this method */ +/* ------------------------------------------------------------------------- */ +expose el b1 b2 events state session menuBar + + ----- + REPLY --> -- run asynchronously -v>| + ----- + + action = self~newPushButton(arg(1))~title /* pressed button title */ + + Select + when action='Start' then do + call time 'r' /* RESET the clock */ + session += 1 + events~append(session '0909'x 'Start' '09'x date('s',,,'-') time()) + call SetStateButtonsAndTitle 'Running','Stop','Split','Running' + menuBar~enable(15) + do while State <> 'Stopped' /* Run the stopwatch display */ + if State='Running' | State='Splitting' + then do + ftime=FormatTime(time('e')) + el~~SetTitle(ftime)~~Update + if State='Splitting' + then do + State='Split' + events~append(session '09'x ftime '09'x 'Split') + end /* DO */ + end + call syssleep 0.004 /* dont hog resources */ + end /* DO */ + events~append(session '09'x ftime '09'x 'Stop') + end /* DO */ + when action='Stop' + then call SetStateButtonsAndTitle 'Stopped','Start','Exit','Stopped' + when action='Resume' + then call SetStateButtonsAndTitle 'Running','Stop','Split','Running' + when action='Split' + then call SetStateButtonsAndTitle 'Splitting','Resume','Split','Split Time' + when action='Exit' then do + State='Stopped' /* kill running threads */ + self~OK -- EXIT Dialog ->| + end + otherwise + end /* select */ + +return + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +SetStateButtonsAndTitle: +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + State = arg(1) + b1~SetTitle(arg(2)) + b2~SetTitle(arg(3)) + self~SetTitle('Stopwatch -' session '-' arg(4)) + +return + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +FormatTime: +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +procedure +arg t + parse var t t'.'ms /* take off the ms */ + hh = t % 3600 + t = t // 3600 + mm = t % 60 + ss = t // 60 + +return hh~right(2,'0')||':'||mm~right(2,'0')||':'ss~right(2,'0')||'.'ms~left(2) + +/* ------------------------------------------------------------------------- */ +::Method Cancel UnGuarded /* stop possible running thread on exit */ +/* ------------------------------------------------------------------------- */ + self~state='Stopped' + return self~Cancel:Super -- Leave the dialog -->| +/* ------------------------------------------------------------------------- */ +::method Copy2CB UnGuarded +/* ------------------------------------------------------------------------- */ +expose events + + cb = .WindowsClipboard~new + cb~copy(events~makeString('l',.endofline)) + +/* ========================================================================= */ diff --git a/modules/windows/oodialog/examples/useTools.rex b/modules/windows/oodialog/examples/useTools.rex new file mode 100755 index 0000000..ab8e4b6 --- /dev/null +++ b/modules/windows/oodialog/examples/useTools.rex @@ -0,0 +1,360 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Owned window example + * + * This example demonstrates how to make a dialog window owned by another dialog + * window. It simulates a tool palette, which is owned by the main dialog. + * + * Windows that are owned by another window have several constraints. The owned + * window is always above its owner window. If the owner window is minimized, + * the owned window is hidden. When the owner window is destroyed, its owned + * windows are also destroyed. + * + * The programmer creates an owned window by setting its ownerDialog attribute + * to the owner window. Once set, the owner window can not be changed. The + * ownerDialog attribute can not be set once the Windows dialog of the owned + * windows has been created. The underlying Windows dialog of the owner window + * must be created before the underlying Windows dialog of the owned window is + * created. However, the owner Windows dialog does not have to be created yet + * when it is assigned to the owned window. + * + * The owned dialog always behaves as if it were executed using the popupAsChild + * method. That is, it is a modeless dialog that operates indepenedently of its + * owner dialog and it is destroyed when its owner (parent) dialog is destroyed. + * But, the programmer does not have to use the popupAsChild method to execute + * the owned dialog, the programmer can use any of the methods that start the + * underlying Windows dialog. + */ + + srcDir = locate() + + .application~useGlobalConstDir("O", srcDir"resources\useTools.h") + + dlg = .MainDialog~new + + dlgTool = .ToolPaletteDlg~new(srcDir) + dlgTool~ownerDialog = dlg + + -- Start the main dialog asynchronously so we continue and then can start the + -- tool palette. + dlg~executeAsync("SHOWTOP", IDI_DLG_OOREXX) + + -- Start the tool palette now. It can not be started until its owner dialog + -- has been started. + dlgTool~popup("SHOWTOP") + + -- End async execution which will not return until the main dialog closes. + dlg~endAsyncExecution + + +::requires "ooDialog.cls" + +::class 'MainDialog' subclass UserDialog + +::method init + forward class (super) continue + + self~create(30, 30, 466, 323, "Main Dialog", "CENTER MINIMIZEBOX MAXIMIZEBOX") + +::method defineDialog + + self~createStaticText(IDC_ST_TOOL_SIMULATOR, 50, 50, 366, 223, "CENTER", "") + self~createPushButton(IDC_PB_SHOW_PALETTE, 20, 299, 50, 14, "HIDDEN", "Show Palette", onShowPalette) + self~createPushButton(IDOK, 342, 299, 50, 14, "DEFAULT", "Ok") + self~createPushButton(IDCANCEL, 397, 299, 50, 14, , "Cancel") + +::method initDialog + expose font toolText + + d = .directory~new + d~weight = 700 + d~quality = 2 + font = self~createFontEx("Arial", 40, d) + + toolText = self~newStatic(IDC_ST_TOOL_SIMULATOR) + toolText~setFont(font) + + +-- The event handling method for the Show Palette button click. We hide the +-- button and execute a new tool palette dialog. The button is always hidden +-- while a tool palette dialog is executing and is only visible when the user +-- has closed the currently executing tool palette dialog. +::method onShowPalette unguarded + expose dlgTool + + self~paletteButton(.false) + + dlgTool = .ToolPaletteDlg~new( , "resources\useTools.h" ) + dlgTool~ownerDialog = self + + dlgTool~popup("SHOWTOP") + + +-- The leaving method is invoked automatically by ooDialog when the underlying +-- Windows dialog is being closed. It can be used to do some final clean up, +-- such as releasing resources. Note that in this program, it is not really +-- necessary to release the created font. As soon as the program ends, the +-- operating system will automatically release the font resource. +::method leaving + expose font + self~deleteFont(font) + + +-- The following methods just display the tool being used to simulate the +-- tool the user selected. A real program would need code to actually use +-- the selected tool. + +::method lockModule + expose toolText + toolText~setText('Running lockModule tool') + +::method lockProject + expose toolText + toolText~setText('Running lockProject tool') + +::method splitModule + expose toolText + toolText~setText('Running splitModule tool') + +::method saveModule + expose toolText + toolText~setText('Running saveModule tool') + +::method saveProject + expose toolText + toolText~setText('Running saveProject tool') + +::method saveAll + expose toolText + toolText~setText('Running saveAll tool') + +::method checkIn + expose toolText + toolText~setText('Running checkIn tool') + +::method linkToWeb + expose toolText + toolText~setText('Running linkToWeb tool') + +::method codeReview + expose toolText + toolText~setText('Running codeReview tool') + +::method update + expose toolText + toolText~setText('Running update tool') + +::method projectReview + expose toolText + toolText~setText('Running projectReview tool') + +-- Invoked by the tool palette dialog when the user presses the close tool +-- button. That is the only way for the user to close the tool palette. Here +-- we set the tool text to the empty string and then make the Show Palette +-- button visible. This allows the user to click on the button and reshow a +-- tool palette. +::method closePalette + expose toolText + + toolText~setText('') + self~paletteButton(.true) + +-- This private method either hides or makes visible the Show Palette button +-- depending on the value of the argument. +::method paletteButton private + use strict arg showButton + + if showButton then self~newPushButton(IDC_PB_SHOW_PALETTE)~show + else self~newPushButton(IDC_PB_SHOW_PALETTE)~hide + + +::class 'ToolPaletteDlg' subclass UserDialog + +::method init + expose s buttonIDs + + forward class (super) continue + + -- Populate the buttonIDs and buttonNames arrays. + self~populateButtons() + + -- The bitmaps are 32 x 32, we want the button to have a 4 pixel margin so + -- that the button high-lighting for hot, pressed, default, etc., shows. + -- Convert the size in pixels to dialog units + s = .Size~new(40, 40) + self~pixel2dlgUnit(s) + count = buttonIDs~items + + -- The last button is the close button. We palace an empty spot the width + -- of a button between the tool buttons and the last button. + count += 1 + + -- Now size the dialog to exactly fit the buttons + self~create(0, 30, count * s~width, s~height, "Tool Palette", "NOMENU") + +::method defineDialog + expose s buttonIDs + + -- Create all our tool buttons and connect their button click event with the + -- onToolClick method in this dialog. + do i = 1 to buttonIDs~items + x = (i - 1) * s~width + if i == buttonIDs~items then x += s~width + self~createPushButton(buttonIDs[i], x, 0, s~width, s~height, 'BITMAP', , onToolClick) + end + + +-- In the initDialog method we create a bitmap Image object from the bitmap +-- files for each button. Then an ImageList for each button is created and +-- assigned to the button. Each image list only has one image in it, so the +-- operating system uses that one image for all the states of the button. +-- +-- Note that when the bitmap image is added to the image list, the image list +-- makes a copy of the image, so we release the image resource in our copy once +-- it is added to the image list. +::method initDialog + expose buttonIDs buttonNames + + tempButton = self~newPushButton(buttonIDs[1]) + + size = tempButton~getRealSize + size~width -= size~width - 32 + size~height -= size~height - 32 + + flags = 'COLOR24 MASK' + type = 'BITMAP' + cRef = .Image~colorRef(0, 0, 0) + + align = 'CENTER' + margin = .Rect~new(4) + + do i = 1 to buttonIDs~items + bmpButton = self~newPushButton(buttonIDs[i]) + + image = .Image~getImage(buttonNames[i], type) + imageList = .ImageList~create(size, flags, 1, 0) + imageList~addMasked(image, cRef) + + bmpButton~setImageList(imageList, margin, align) + image~release + end + + +-- The leaving method is called automatically by the ooDialog framework when the +-- underlying Windows dialog is closing. The leaving method is a good place to +-- do any final clean up. We use it here to release the operating system +-- resouces used by the image lists. +-- +-- Note this. For some controls like the list-view control, Microsoft's +-- documentation explicityly states that the list-view control will release +-- the image list resources. However, for the button control, the documentation +-- does not say one way or the other. +::method leaving unguarded + expose buttonIDs + + do id over buttonIDs + btn = self~newPushButton(id) + btn~getImageList~release + end + +-- The event handler for the button click event. We map which button was +-- clicked to the proper method in the parent / owner dialog and invoke that +-- method +::method onToolClick unguarded + use arg id, hwnd + + select + when id == self~constdir[IDC_PB_LOCKMODULE ] then self~ownerDialog~lockModule + when id == self~constdir[IDC_PB_LOCKPROJECT ] then self~ownerDialog~lockProject + when id == self~constdir[IDC_PB_SPLITMODULE ] then self~ownerDialog~splitModule + when id == self~constdir[IDC_PB_SAVEMODULE ] then self~ownerDialog~saveModule + when id == self~constdir[IDC_PB_SAVEPROJECT ] then self~ownerDialog~saveProject + when id == self~constdir[IDC_PB_SAVEALL ] then self~ownerDialog~saveAll + when id == self~constdir[IDC_PB_CHECKIN ] then self~ownerDialog~checkIn + when id == self~constdir[IDC_PB_LINKTOWEB ] then self~ownerDialog~linkToWeb + when id == self~constdir[IDC_PB_CODEREVIEW ] then self~ownerDialog~codeReview + when id == self~constdir[IDC_PB_UPDATE ] then self~ownerDialog~update + when id == self~constdir[IDC_PB_PROJECTREVIEW] then self~ownerDialog~projectReview + when id == self~constdir[IDC_PB_CLOSE ] then do + self~cancel:super + self~ownerDialog~closePalette + end + otherwise nop + end + -- End select + +-- Over-riding the ok and cancel methods, but not doing anything, prevents the +-- user from closing the tool palette unless she uses the close tool button. +::method ok +::method cancel + +-- Private method to fill 2 arrays with the button IDs and the button bitmap +-- names. +::method populateButtons private + expose buttonIDs buttonNames + + srcDir = .application~srcDir + + buttonIDs = .array~of(IDC_PB_LOCKMODULE, - + IDC_PB_LOCKPROJECT, - + IDC_PB_SPLITMODULE, - + IDC_PB_SAVEMODULE, - + IDC_PB_SAVEPROJECT, - + IDC_PB_SAVEALL, - + IDC_PB_CHECKIN, - + IDC_PB_LINKTOWEB, - + IDC_PB_CODEREVIEW, - + IDC_PB_UPDATE, - + IDC_PB_PROJECTREVIEW, - + IDC_PB_CLOSE - + ) + + buttonNames = .array~of(srcDir'resources\LockModule.bmp', - + srcDir'resources\LockProject.bmp', - + srcDir'resources\SplitModule.bmp', - + srcDir'resources\SaveModule.bmp', - + srcDir'resources\SaveProject.bmp', - + srcDir'resources\SaveAll.bmp', - + srcDir'resources\CheckIn.bmp', - + srcDir'resources\LinkToWeb.bmp', - + srcDir'resources\CodeReview.bmp', - + srcDir'resources\Update.bmp', - + srcDir'resources\ProjectReview.bmp', - + srcDir'resources\ClosePalette.bmp' - + ) + diff --git a/modules/windows/oodialog/ftyperex.rex b/modules/windows/oodialog/ftyperex.rex new file mode 100755 index 0000000..08914aa --- /dev/null +++ b/modules/windows/oodialog/ftyperex.rex @@ -0,0 +1,181 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: ftyperex.rex */ +/* Type: ooRexx Script */ +/* */ +/* Description: */ +/* This script reads the registry entries for the Ftype REXXScript OPEN */ +/* type and allows to change it between REXX.EXE and REXXHIDE.EXE. */ +/* */ +/* It uses the WindowsRegistry Class and the UserDialog Class. */ +/* */ +/****************************************************************************/ + + +/* See if user gave directions */ +parse arg Interface + +/* The user may decide between Windowed or ooDialog Version */ +/* Default is ooDialog Version */ +/* If the Ftype Setting is to rexxhide, the WINDOWED Version will NOT work */ +/* Verify if the given parm starts with "W", TRANSLATE changes it to UPPER CASE */ +if Interface~LEFT(1)~TRANSLATE = "C" then Interface = "CONSOLE" +else Interface = "ooDialog" + + +/* create a new registry object */ +r = .WindowsRegistry~new + +/* leave if init failed */ +if r~InitCode \= 0 then do + call errorDialog 'Error open the registry. Program aborted.' + exit +end + +/* Set from default HKEY_LOCAL_MACHINE to HKEY_CLASSES_ROOT */ +r~Current_Key = r~CLASSES_ROOT + +/* Open the Key with Options QUERY and WRITE */ +if r~open(,"REXXScript\Shell\Open\Command","QUERY WRITE") = 0 then do + msg = 'Error opening the registry key with write access' || '0d0a0d0a'x || - + 'If you are on Vista you must run this program with' || '0d0a'x || - + 'elevated privileges to see the expected outcome.' + call ErrorDialog msg + exit +end + +/* Retrieves information about a given key in a compound variable */ +/* q.values holds the number of value entries. */ +q. = r~Query + +/* Retrieves all value entries of a given key into a compound variable */ +if r~ListValues(,vals.) = 0 then do + /* There are 3 possible values for each entry: + vals.i.name the Name of the value + vals.i.data the data of the entry + vals.i.type the type : NORMAL for alphabetic values, + EXPAND for expandable strings such as a path, + NONE for no specified type, + MULTI for multiple strings, + NUMBER for a 4-byte value, and + BINARY for any data format. + */ + /* verify, which is the current entry, TRANSLATE it to UPPER CASE */ + if vals.1.data~TRANSLATE~LASTPOS('REXX.EXE') = 0 then do + if vals.1.data~TRANSLATE~LASTPOS('REXXHIDE.EXE') = 0 then do + call errorDialog 'ftyperex is not prepared to work with this setting:' vals.1.data + end + else do /* remember the current entry */ + was = "rexxhide.exe" + end + end + else do /* remember the current entry */ + was = "rexx.exe" + end +end +else do + call errorDialog 'Error reading the registry. Program aborted.' + exit +end + + +/* Ask user, what to do */ +if Interface = "CONSOLE" then do + /* Test, if rexxhide was set. In this case, show Message Box */ + if was = "rexxhide.exe" then do + call errorDialog "Ftype is curently set to rexxhide.exe. You must use the ooDialog interface." + exit + end + /* The next lines use an plain text interface */ + /* Show the curent content */ + say 'Current Ftype Setting is : ' || vals.1.data + say 'Please enter a number + to set it to :' + say '1 to start it with rexx.exe' + say '2 to start it with rexxhide.exe' + say 'Any other entry to leave without changes' + say + /* Get selection */ + pull answer +end +else do + /* The next lines use an "Single Selection Dialog" as interface to the user */ + sel.1 = "Start it with rexx.exe" + sel.2 = "Start it with rexxhide.exe" + /* Get the current state, to make preselection in the dialog */ + if was = "rexx.exe" then answer = '1' + else if was = "rexxhide.exe" then answer = '2' + + dlg = .SingleSelection~new("Please select what to do","Ftype setting for REXXScript",sel.,answer,,answer) + answer = dlg~execute + /* end of userinteraction */ +end + +/* verify what to do */ +select + when answer = '1' then do + newval = LEFT(vals.1.data,LASTPOS(was,vals.1.data)-1)|| 'rexx.exe" "%1" %*' + end + + when answer = '2' then do + newval = LEFT(vals.1.data,LASTPOS(was,vals.1.data)-1)|| 'rexxhide.exe" "%1" %*' + end + otherwise exit +end + +/* Set the new value */ +/* Sets a named value of a given key */ +/* If name is blank or omitted, the default value is set */ +r~SetValue(r~Current_Key,"",newval,NORMAL) + +/* Forces the system to write the cache buffer of a given key to disk */ +/* If key_handle is omitted, CURRENT_KEY is flushed */ +r~flush(r~Current_Key) + +/* Closes a previously opened key specified by its handle */ +/* Since it can take several seconds before all data is written to disk,*/ +/* FLUSH was used before to empty the cache */ +/* If key_handle is omitted, CURRENT_KEY is closed */ +r~close(r~Current_Key) + +msg = 'The Ftype setting for RexxScript is now:' || '0d0a'x || newval +if interface = "CONSOLE" then say msg +else call InfoDialog msg + +::requires "winsystm.cls" -- required for the registry class +::requires "ooDialog.cls" -- required for the dialog class diff --git a/modules/windows/oodialog/menus/BinaryMenuBar.rex b/modules/windows/oodialog/menus/BinaryMenuBar.rex new file mode 100755 index 0000000..ffa9c7b --- /dev/null +++ b/modules/windows/oodialog/menus/BinaryMenuBar.rex @@ -0,0 +1,141 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Very, very simple example of a BinaryMenuBar. Please use the ooDialog + * reference manual to look up the meaning of the arguments to the methods of + * the menu objects. + */ + + .application~useGlobalConstDir('O') + + .constDir[IDC_STATIC] = 200 + .constDir[IDM_MENUBAR] = 1000 + .constDir[IDM_POP_FILE] = 1200 + .constDir[IDM_MI_LEAVE] = 1201 + .constDir[IDM_MI_TEST_ITEM] = 1202 + .constDir[IDM_MI_CONTEXT] = 1203 + .constDir[IDM_SEPARATOR] = 1204 + .constDir[IDM_POP_HELP] = 1300 + .constDir[IDM_MI_ABOUT] = 1301 + + dlg = .MenuDlg~new + dlg~execute('ShowTop') + +::requires 'ooDialog.cls' + +::class 'MenuDlg' subclass Userdialog + +::method init + forward class (super) continue + + self~createCenter(160, 80, 'Dialog with a menu') + +::method defineDialog + + text = "Choosing the 'Leave' menu item will close the dialog " - + "with 'Cancel', the 'Exit' menu item will close with 'Ok.'" + + self~createStaticText(IDC_STATIC, 10, 10, 140, 60, , text) + + +::method initDialog + expose staticText + + -- A subtle point here. We can either attach automatically, or connect menu + -- items automatically, be we can not do both. If we attach automatically, + -- then the menu bar is empty at this point, so there are no menu items to + -- automatically connect. In this case, we attach automatically, then when + -- the menu bar is populated, we automatically connect all menu items. + menu = .BinaryMenuBar~new(.nil, IDM_MENUBAR, , self) + + subMenu = .PopupMenu~new(IDM_POP_HELP) + subMenu~insertItem(IDM_MI_ABOUT, IDM_MI_ABOUT, "About") + + menu~insertPopup(IDM_POP_HELP, IDM_POP_HELP, subMenu, "Help") + + subMenu = .PopupMenu~new(IDM_POP_FILE) + subMenu~insertItem(IDOK, IDOK, "Exit") + subMenu~insertItem(IDOK, IDM_MI_LEAVE, "Leave") + subMenu~insertItem(IDM_MI_LEAVE, IDM_MI_TEST_ITEM, "Test Item") + subMenu~insertItem(IDM_MI_LEAVE, IDM_MI_CONTEXT, "Context") + subMenu~insertSeparator(IDM_MI_LEAVE, IDM_SEPARATOR) + + menu~insertPopup(IDM_POP_HELP, IDM_POP_FILE, subMenu, "File") + + menu~connectAllCommandEvents + + staticText = self~newStatic(IDC_STATIC) + +::method about + expose staticText + + staticText~setText(self~getMsg("About")) + +::method testItem + expose staticText + + staticText~setText(self~getMsg("Test Item")) + +::method context + expose staticText + + staticText~setText(self~getMsg("Context")) + +::method leave + expose staticText + + -- User will probably not see this blur by, so we sleep for a second. + staticText~setText(self~getMsg("Leave")) + j = SysSleep(1) + + self~cancel:super + +::method getMsg private + use strict arg item + + return "Menu item:".endOfLine~copies(2) || '9'x || item || - + .endOfLine~copies(2) || "was last selected." + + +-- We over-ride the cancel method and do nothing so that the user can only +-- close the dialog through the menu. +::method cancel unguarded + expose staticText + + msg = "You must use the 'Leave' or 'Exit' menu items to close the dialog." + staticText~setText(msg) diff --git a/modules/windows/oodialog/menus/ContextMenu.h b/modules/windows/oodialog/menus/ContextMenu.h new file mode 100644 index 0000000..a957fc0 --- /dev/null +++ b/modules/windows/oodialog/menus/ContextMenu.h @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#define IDD_CONTEXT 1000 +#define IDC_LV 1003 +#define IDC_ST_MSG 1004 + +#define IDM_RC_DLG 10000 +#define IDM_RC_SHOW 40000 +#define IDM_RC_ENABLE_LV 40005 +#define IDM_RC_DISABLE_LV 40001 +#define IDM_RC_BEEP 40002 +#define IDM_RC_QUIT 40003 + +#define IDM_LV_BAR 20000 +#define IDM_LV_SORT 20001 +#define IDM_LV_JUMBLE 20002 +#define IDM_LV_REVERSE 20003 +#define IDM_LV_SEP1 20004 +#define IDM_LV_SEP2 20005 +#define IDM_LV_FNAME 20006 +#define IDM_LV_LNAME 20007 +#define IDM_LV_PROFESSION 20008 +#define IDM_LV_RESTORE 20009 diff --git a/modules/windows/oodialog/menus/ContextMenu.rc b/modules/windows/oodialog/menus/ContextMenu.rc new file mode 100644 index 0000000..eb30edb --- /dev/null +++ b/modules/windows/oodialog/menus/ContextMenu.rc @@ -0,0 +1,68 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#include "ContextMenu.h" +#include +#include +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDM_RC_DLG MENU +BEGIN + POPUP "Sample" + BEGIN + MENUITEM "Show Message", IDM_RC_SHOW + MENUITEM SEPARATOR + MENUITEM "Disable List View", IDM_RC_DISABLE_LV + MENUITEM "Enable List View", IDM_RC_ENABLE_LV + MENUITEM SEPARATOR + MENUITEM "Beep", IDM_RC_BEEP + MENUITEM "Quit", IDM_RC_QUIT + END +END + + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_CONTEXT DIALOGEX 0, 0, 293, 148 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_FIXEDSYS | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Example Context Menus" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +BEGIN + CONTROL "", IDC_LV, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SINGLESEL | LVS_REPORT, 10, 10, 175, 93 + CTEXT "Right click on list view or right click on any other dialog area", IDC_ST_MSG, 10, 118, 156, 20 + DEFPUSHBUTTON "OK", IDOK, 178, 124, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 233, 124, 50, 14 +END diff --git a/modules/windows/oodialog/menus/ContextMenu.rex b/modules/windows/oodialog/menus/ContextMenu.rex new file mode 100755 index 0000000..6f79452 --- /dev/null +++ b/modules/windows/oodialog/menus/ContextMenu.rex @@ -0,0 +1,726 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* A demonstration of some of the Menu features in ooDialog. + * + * This example focuses on context menus. Two different context menus are used + * in this example, showing 2 different ways to create the context menus. One + * of the context menus is shown when the user right-clicks on the list view + * control. The other context menu is shown when the user right-clicks on any + * other place on the dialog. The first menu is specific to the list view, the + * other menu is specific to the dialog. + * + * The list view menu is created by loading a menu from a resource script file. + * Menus created from a resouce script are always menu bars. In this example, + * the menu bar is *not* attached to the dialog, rather it is simply used as the + * source of the list view context menu. + * + * The second context menu is created dynamically using methods of the PopupMenu + * class. + */ + + -- Locate the directory our source code is in. Then this program can be + -- executed from anywhere. It will work if the program is dragged and dropped + -- on ooDialog.exe for instance. + srcDir = locate() + + -- When using symbolic IDs with menus, as this program does, the programmer + -- *must* use the global constant directory, (.constDir,) rather than the + -- constDir attribute of a dialog. Menus are independent of dialogs. + -- + -- The use of the global constant directory is controlled by the .Application + -- object. The .Application object is also used to set other application-wide + -- defaults or values. In this program, we also want to make the default for + -- automatic data detection to be off. Both of these requirements can be done + -- with one method call to the .Application object. As a convenience, the + -- setDefaults() method will also populate the .constDir with symbols. + -- + -- In this invokcation, the application is set to use the .constDir only, "O", + -- symbols are loaded into the .constDir from the file: ContextMenu.h, and the + -- default for automatic data detection is set to off (.false.) Note that we + -- create a complete path name for ContextMenu.h + .application~setDefaults("O", srcDir'ContextMenu.h', .false) + + -- The folloing demonstrates that menu objects are distinct from dialogs. + -- + -- You can create a menu completely indepedent of a dialog. Note that at this + -- point in the program, there is no dialog object at all. Once created, the + -- menu object can then be used where ever it is convenient. + -- + -- The code for creating the list view menu is put in a separate function so + -- that people can focus on only one thing at a time. The function is at the + -- end of this file. In createListViewMenu(), the context menu is created + -- dynamically and passed back to us. + contextMenu = createListViewMenu() + + -- Create a RcDialog as normally done. + dlg = .ContextMenuDlg~new(srcDir"ContextMenu.rc", IDD_CONTEXT) + + -- putMenu() is a method added to our dialog class. It is used to pass the + -- context menu object to the dialog. There are any number of ways to + -- accomplish this. For instance the menu object could have been passed in + -- as an argument to new() above. + dlg~putMenu(contextMenu) + + -- Excute the dialog as usual. + if dlg~initCode = 0 then do + dlg~execute("SHOWTOP") + end + else do + say 'Error creating the context menu dialog initCode:' dlg~initCode + return 99 + end + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'ContextMenuDlg' subclass RcDialog + +/** init() + * + * The init() method is invoked for every object instantiation. This is part of + * ooRexx and has nothing to do with ooDialog, except for this: + * + * ooDialog programming is primarily based on subclassing the dialog classes + * provided by the ooDialog framework. If you over-ride the init() method, you + * *must* initialize the base class, with the proper arguments for the base + * class, before you invoke any methods of the base class. + * + * Here with create the second context menu and create some arrays that contain + * the list view items. Both of these tasks do not need to be done in this + * method, they could be done elsewhere. + */ +::method init + expose dlgPopup + use arg rcScript, dlgID + forward class (super) continue + + -- A menu bar can be loaded from a resource script file using the + -- .ScriptMenuBar class. + -- + -- The first argument to init(), rcScript, is the .rc file that contains the + -- dialog template. That .rc file also contains the menu template for the + -- dialog context menu. In the new method of the .ScriptMenuBar the .rc file + -- is parsed and the menu with symbolic resource id of: IDM_RC_DLG is loaded + -- into memory. + menuBar = .ScriptMenuBar~new(rcScript, IDM_RC_DLG) + + -- If an error occurs in a menu object initialization, then a condition is + -- always raised. menuBar will never be 0 + if menuBar == 0 then do + -- This code will never execute because if the menu bar was not created, a + -- condition was raised. + say 'ERROR: menubar shold be good, not 0.' + say 'A condition should have been raised.' + say 'SystemErrorCode:' .SystemErrorCode SysGetErrortext(.SystemErrorCode) + self~initCode = 1 + return + end + + -- A menu bar is made up of a number of pop up menus. You can get one of + -- those pop up menus by specifying either its resource ID or its position. + -- + -- In this program, the menu bar itself is not used. It contains only 1 pop + -- up menu, which is used as a context menu in this program. Which pop up + -- menu to get is specified either by its resource ID or by its position in + -- the menu. Here, we get it by its position, which is 1. Since both a + -- resource ID and a position are numbers, we need to denote whether we are + -- getting the menu by position or by resource ID. The second argument is the + -- 'byPosition' argument. If true, the first arugment is a position. If + -- false, the first argument is a resource ID. The default is .false. + dlgPopup = menubar~getPopup(1, .true) + + -- Start with the menu item to enable the list view greyed out. + dlgPopup~disable(IDM_RC_ENABLE_LV) + + -- Create an array of items for the list view control. This could be done in + -- initDialog(), or anywhere convenient. + self~createArrays() + +/** initDialog() + * + * initDialog() is invoked automatically by the dialog framework as soon as the + * underlying Windows dialog is created. This is the place to do any + * initialization of the dialog controls, initialization that requires the + * underlying dialog or dialog control to exist. + * + * We would not necessarily need to make the menu connections here. However, + * as you will see in makeMenuConnections() method, we are using the window + * handles of the dialog and the list view to filter the context menu + * notifications. This does require that the underlying dialog and controls do + * exist. + */ +::method initDialog + + self~makeMenuConnections + self~initListView + + +/** makeMenuConnections() + * + * Connects the menu related events to event handling methods in this dialog. + * + * There are 2 types of connections made here. + * + * 1.) The context menu event is connected. The context menu event is generated + * when ever the user right clicks on the dialog, types the shift-F10 keyboard + * combination, or the VK_APPS key (Natural keyboard.) The context menu event + * needs to be connected to a method that shows the context menu. + * + * 2.) The menu item command events are connected. A menu item command event is + * generated when the user selects a menu item. + */ +::method makeMenuConnections private + expose lvPopup dlgPopup + + -- Connect a click on a menu item in the short cut menus to this dialog. + -- + -- For the dialog popup menu, we connect all menu items to the same method, + -- onMenuCommand(). onMenuCommand() will recieve the resource ID of the menu + -- item selected, and we use that to decide what action to take. + if \ dlgPopup~connectAllCommandEvents(onMenuCommand, self) then do + say 'Error conecting menu items. SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + + -- To understand this explanation, note this point: although menu objects are + -- independent of dialog objects, at the time a menu is shown, the operating + -- system requires that the underlying menu be assigned to an underlying + -- dialog. For menu bars, the assigned dialog is the dialog the menu bar is + -- attached to. For pop up menus, the menu could be assigned to a dialog each + -- time the context menu is shown. But, it is usually more convenient to just + -- assign the menu to a dialog one time. That is what the assignTo() method + -- does. + -- + -- For the list view pop up menu, we connect each menu item to its own method. + -- There are menu methods to connect individual menu items. But there are + -- also a number of convenience methods to connect a number of menu items at + -- one time. + -- + -- The second optional arguement in assignTo() turns on automatic menu item + -- connection. The default is off. The third optional argument is the name + -- of a method to connect all the items to. So, you can either connect each + -- menu item to its own method, (omit the third argument,) or you can connect + -- all menu items to one method. When each menu item is connected to its own + -- method, the method name is constructed by the ooDialog framework using the + -- text of the menu item. + -- + -- For example, if the menu item text is 'Blow your own horn' then the method + -- name will be blowYourOwnHorn(). + -- + -- This is what we do here, assign the list view menu to this dialog, and at + -- the same time connect all the menu item comand events to an individual + -- method. + if \ lvPopup~assignTo(self, .true) then do + say 'Error conecting menu items. SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + say + + -- Next we connect the context menu message (right mouse click) with two + -- methods. If you supply a window handle as the second, optional, parameter, + -- then the event notifications are filtered by that window handle. In this + -- way you can easily show a context menu specific to a certain control. If + -- you do not use a window handle to filter the event notifications, you can + -- still do the same thing, you just need to determine the mouse position at + -- the time of the event and relate that position to the context menu you + -- want to show + -- + -- Here we send all right-clicks on the list-view control to one method and + -- all clicks on the dialog to a second method. + if \ lvPopup~connectContextMenu(onListViewContext, self~newListView(IDC_LV)~hwnd) then do + say 'Error conecting context menu. SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + + -- If we only use the first connectContextMenu(), then right clicks on the Ok + -- and cancel buttons are ignored. The shift-F10 and VK_APPS events are + -- also ignored when either of the buttons has the focus. + -- + -- That's perfectly fine, but it depends on what you want. Here, we pretend + -- that we don't want that behavior, and show how to prevent it. Simply add + -- filtered connections for the Ok and Cancel push buttons. + -- + -- You can play with this to see it works. Comment out the third and forth + -- connections and then tab to the Ok or Cancel key and use Shift-F10. There + -- will be no context menu. Or right click on one of those buttons, no + -- context menu. Uncomment the connections and try the same thing. + if \ dlgPopup~connectContextMenu(onDialogContext, self~hwnd, self) then do + say 'Error conecting context menu. SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + else if \ dlgPopup~connectContextMenu(onDialogContext, self~newPushButton(IDOK)~hwnd, self) then do + say 'Error conecting context menu. SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + else if \ dlgPopup~connectContextMenu(onDialogContext, self~newPushButton(IDCANCEL)~hwnd, self) then do + say 'Error conecting context menu. SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + + +/** onListViewContext() + * + * This is an event handler for the context menu event. + * + * The context menu event is generated when the user right-clicks the mouse, + * types the shift-F10 key combination, or types the VK_APPS key. In this + * program, onListViewContext() is only generated when the mouse is right + * clicked on the list view control, or if the list view has the input focus and + * shift-F10 or VK_APPS are used. + * + * Look at the makeMenuConnections() method to see how the connection is made. + * + * Three arguments are passed to the event handler for the context menu event: + * the window handle of the window clicked, (or that has the focus if it is a + * keyboard event,) and x / y co-ordinates. For a mouse click, the x / y co- + * ordinates are the position of the mouse, in pixels. For the keyboard keys, x + * and y are both -1. + * + * When the x and y arguments are -1, we need to decide where to place the + * context menu when it is shown. This is a design decision, there is no real + * right answer. A normal thing to do here would be to place it at the selected + * list view item. Instead, I decided to place at the lower right corner of the + * list view. However, the list view has a vertical scroll bar which is within + * the area of the list view and I didn't like the look of that. + * + * So, I decided to move it to the left of the scroll bar. I still didn't like + * that because of the shadowing, so I take that point and shift it up and over + * 15 pixels. + */ +::method onListViewContext + expose lvPopup listView + use arg hwnd, x, y + + if x == -1, y == -1 then do + -- The keyboard was used, not the mouse. Position the context menu as + -- described in the comments above. + rect = listView~windowRect + x = rect~right - .SM~cxVScroll + 15 + y = rect~bottom - 15 + end + + -- pos is the point on the screen, in pixels, to place the context menu. + pos = .Point~new(x, y) + + -- We show the menu. The second optional argument is the dialog to assign the + -- the menu to, but we've already done that in makeMenuConnections(). + ret = lvPopup~show(pos) + if ret == -1 then do + say 'lvPopup~show() failed SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + + +/** onDialogContext() + * + * This is an event handler for the context menu event. + * + * The comments for onListViewContext() above apply here. This method is + * invoked when the user rigth clicks anywhere but the list-view, or for the + * keyboard context menu event, whenever the list view does not have the focus. + * + * Here we also need to decide where to position the context menu for the + * keyboard event. I decided to place it in the rectangluar space between the + * rigth edge of the list view and the right edge of the dialog, in the center. + * I don't count the dialog caption bar as part of that space. + */ +::method onDialogContext + expose dlgPopup listView + use arg hwnd, x, y + + if x == -1, y == -1 then do + -- The keyboard was used, not the mouse. Position the context menu as + -- described in the comments above. + lvR = listView~windowRect + dlgR = self~windowRect + + xOffset = (dlgR~right - lvR~right) % 2 + yOffset = (dlgR~bottom - (dlgR~top + .SM~cyCaption)) % 2 + + x = lvR~right + xOffset + y = dlgR~bottom - yOffset + end + + -- This is the point where the context menu is positioned. + pos = .Point~new(x, y) + + -- In contrast to the list view pop up menu, the dialog pop up menu has never + -- been assigned to a dialog. Therefore, each time we show it, we need to + -- specify the dialog owner. Which is done in the second arguemnt. + ret = dlgPopup~show(pos, self) + if ret == -1 then do + say 'dlgPopup~show() failed SystemErrorCode:' || - + .SystemErrorCode SysGetErrortext(.SystemErrorCode) + end + +/** onMenuCommand() + * + * This is the event handler for any menu item selected in the dialog pop up + * menu. We simply determine which menu item was selected through the id + * argument and take the appropriate action. + */ +::method onMenuCommand unguarded + use arg id + + select + when id == .constDir[IDM_RC_SHOW ] then self~showMessage + when id == .constDir[IDM_RC_ENABLE_LV ] then self~enableListView(.true) + when id == .constDir[IDM_RC_DISABLE_LV] then self~enableListView(.false) + when id == .constDir[IDM_RC_BEEP ] then beep(330, 250) + when id == .constDir[IDM_RC_QUIT ] then return self~ok + end + -- End select + + +/** sort() + * + * The event handler when the Sort menu item is selected in the list view pop up + * menu. + */ +::method sort + expose sArray + self~rearrangeItems(sArray) + +/** jumble() + * + * The event handler when the Jumble menu item is selected in the list view pop + * up menu. + * + * Here we re-order the list view items in a somewhat random order. + */ +::method jumble + expose nArray + + tempArray = .array~new(11) + + indexes = .set~new + do while indexes~items < 11 + count = indexes~items + do while indexes~items == count + i = random(1, 11) + if \ indexes~hasItem(i) then do + tempArray~append(nArray[i]) + indexes~put(i) + end + end + end + + self~rearrangeItems(tempArray) + +/** reverseSort() + * + * The event handler when the Reverse Sort menu item is selected in the list + * view pop up menu. + */ +::method reverseSort + expose rsArray + self~rearrangeItems(rsArray) + +/** orderByFirstName() + * + * The event handler when the Order By First Name menu item is selected in the + * list view pop up menu. + */ +::method orderByFirstName + expose fnArray + self~rearrangeItems(fnArray) + +/** orderByLastName() + * + * The event handler when the Order By Last Name menu item is selected in the + * list view pop up menu. + */ +::method orderByLastName + expose lnArray + self~rearrangeItems(lnArray) + +/** orderByProfession() + * + * The event handler when the Order By Profession menu item is selected in the + * list view pop up menu. + */ +::method orderByProfession + expose profArray + self~rearrangeItems(profArray) + +/** restoreOriginalOrder() + * + * The event handler when the Restore Original Order menu item is selected in + * the list view pop up menu. + */ +::method restoreOriginalOrder + expose nArray + self~rearrangeItems(nArray) + +/** rearrangeItems() + * + * Places the list view items in the order specified. As explained elsewhere, + * the purpose of this example program is to show how context menus work, not + * to show how list view controls work. + * + * Therefore we don't actually sort the list view items, we just use some pre- + * ordered arrays of the items. To change the order, we delete all the existing + * items and replace them using the an array of the same items in a different + * order. The array is passed in here as the 'a' argument. + * + * The disable, delete, prepare ... enable redraw sequence seems, to me, to + * reduce flicker in the list view. However, there are not enough items in the + * list view to tell for sure. An interesting experiment would be to try it + * with several hundreds of items. + */ +::method rearrangeItems private + expose listView + use strict arg a + + listView~disable + listView~deleteAll + listView~prepare4nItems(11) + + do r over a + listView~addRow( , , r~fName, r~lName, r~profession) + end + + listView~enable + listView~redrawItems + + +/** showMessage() + * + * Helper method. Shows a simple message to the user in response to the Show + * Message menu item. + */ +::method showMessage private + + msg = "This is a good example of context menus." + z = MessageDialog(msg, self~hwnd, "Context Menu Message", "OK", "INFORMATION") + +/** enableListView() + * + * Helper method. Enables or disables the list view control in response to the + * Enable List View or Disable List View menu items. + * + * When the list view control is enabled, we disable the Enable List View menu + * item and enable the Disable List View menu item. When the list view is + * disabled we do the reverse. Note that when the list view is disabled, it is + * no longer possible for the user to trigger the list view context menu. + */ +::method enableListView private + expose listView dlgPopup + use strict arg enable + + if enable then do + dlgPopup~disable(IDM_RC_ENABLE_LV) + dlgPopup~enable(IDM_RC_DISABLE_LV) + listView~enable + end + else do + dlgPopup~disable(IDM_RC_DISABLE_LV) + dlgPopup~enable(IDM_RC_ENABLE_LV) + listView~disable + end + +/** initListView() + * + * Initializes the list view by adding the columns, setting the extended list + * view style, and adding the list view items. + */ +::method initListView private + expose nArray listView + + listView = self~newListView(IDC_LV) + + listView~addExtendedStyle("FULLROWSELECT DOUBLEBUFFER GRIDLINES") + + listView~insertColumnPX(1, 'First Name', 68) + listView~insertColumnPX(2, 'Last Name', 70) + listView~insertColumnPX(3, 'Profession', 102) + + do r over nArray + listView~addRow( , , r~fName, r~lName, r~profession) + end + +/** createArrays() + * + * The purpose of this example program is to demonstrate how context menus work, + * not how list view controls work. Rather than actually sort the list view + * items, we just produce some pre-sorted arrays to use. + * + * The n, ln, fn, etc., prefixes stand for normal, first name, last name, + * profession, sorted, and reverse sorted. + */ +::method createArrays private + expose nArray lnArray fnArray profArray sArray rsArray + + nArray = .array~new(11) + lnArray = .array~new(11) + fnArray = .array~new(11) + profArray = .array~new(11) + sArray = .array~new(11) + rsArray = .array~new(11) + + nArray[1 ] = .directory~new~~put('Mark', fName)~~put('Thompson', lName)~~put('Mechanic', profession) + nArray[2 ] = .directory~new~~put('Sue', fName)~~put('Lamont', lName)~~put('Nurse', profession) + nArray[3 ] = .directory~new~~put('Mary', fName)~~put('Greensmith', lName)~~put('CEO', profession) + nArray[4 ] = .directory~new~~put('Susan', fName)~~put('Dunn', lName)~~put('Stock broker', profession) + nArray[5 ] = .directory~new~~put('Hank', fName)~~put('Miller', lName)~~put('Librarian', profession) + nArray[6 ] = .directory~new~~put('Larry', fName)~~put('Williams', lName)~~put('Doctor', profession) + nArray[7 ] = .directory~new~~put('Alice', fName)~~put('Toklas', lName)~~put('Dentist', profession) + nArray[8 ] = .directory~new~~put('Bill', fName)~~put('Maher', lName)~~put('Lawyer', profession) + nArray[9 ] = .directory~new~~put('Vail', fName)~~put('Miesfeld', lName)~~put('Software Engineer', profession) + nArray[10] = .directory~new~~put('Eric', fName)~~put('Clapton', lName)~~put('Cook', profession) + nArray[11] = .directory~new~~put('Christin', fName)~~put('Henesy', lName)~~put('Detective', profession) + + lnArray[1 ] = .directory~new~~put('Eric', fName)~~put('Clapton', lName)~~put('Cook', profession) + lnArray[2 ] = .directory~new~~put('Susan', fName)~~put('Dunn', lName)~~put('Stock broker', profession) + lnArray[3 ] = .directory~new~~put('Mary', fName)~~put('Greensmith', lName)~~put('CEO', profession) + lnArray[4 ] = .directory~new~~put('Christin', fName)~~put('Henesy', lName)~~put('Detective', profession) + lnArray[5 ] = .directory~new~~put('Sue', fName)~~put('Lamont', lName)~~put('Nurse', profession) + lnArray[6 ] = .directory~new~~put('Bill', fName)~~put('Maher', lName)~~put('Lawyer', profession) + lnArray[7 ] = .directory~new~~put('Vail', fName)~~put('Miesfeld', lName)~~put('Software Engineer', profession) + lnArray[8 ] = .directory~new~~put('Hank', fName)~~put('Miller', lName)~~put('Librarian', profession) + lnArray[9 ] = .directory~new~~put('Mark', fName)~~put('Thompson', lName)~~put('Mechanic', profession) + lnArray[10] = .directory~new~~put('Alice', fName)~~put('Toklas', lName)~~put('Dentist', profession) + lnArray[11] = .directory~new~~put('Larry', fName)~~put('Williams', lName)~~put('Doctor', profession) + + fnArray[1 ] = .directory~new~~put('Alice', fName)~~put('Toklas', lName)~~put('Dentist', profession) + fnArray[2 ] = .directory~new~~put('Bill', fName)~~put('Maher', lName)~~put('Lawyer', profession) + fnArray[3 ] = .directory~new~~put('Christin', fName)~~put('Henesy', lName)~~put('Detective', profession) + fnArray[4 ] = .directory~new~~put('Eric', fName)~~put('Clapton', lName)~~put('Cook', profession) + fnArray[5 ] = .directory~new~~put('Hank', fName)~~put('Miller', lName)~~put('Librarian', profession) + fnArray[6 ] = .directory~new~~put('Larry', fName)~~put('Williams', lName)~~put('Doctor', profession) + fnArray[7 ] = .directory~new~~put('Mark', fName)~~put('Thompson', lName)~~put('Mechanic', profession) + fnArray[8 ] = .directory~new~~put('Mary', fName)~~put('Greensmith', lName)~~put('CEO', profession) + fnArray[9 ] = .directory~new~~put('Sue', fName)~~put('Lamont', lName)~~put('Nurse', profession) + fnArray[10] = .directory~new~~put('Susan', fName)~~put('Dunn', lName)~~put('Stock broker', profession) + fnArray[11] = .directory~new~~put('Vail', fName)~~put('Miesfeld', lName)~~put('Software Engineer', profession) + + profArray[1 ] = .directory~new~~put('Mary', fName)~~put('Greensmith', lName)~~put('CEO', profession) + profArray[2 ] = .directory~new~~put('Eric', fName)~~put('Clapton', lName)~~put('Cook', profession) + profArray[3 ] = .directory~new~~put('Alice', fName)~~put('Toklas', lName)~~put('Dentist', rprofession) + profArray[4 ] = .directory~new~~put('Christin', fName)~~put('Henesy', lName)~~put('Detective', profession) + profArray[5 ] = .directory~new~~put('Larry', fName)~~put('Williams', lName)~~put('Doctor', profession) + profArray[6 ] = .directory~new~~put('Bill', fName)~~put('Maher', lName)~~put('Lawyer', profession) + profArray[7 ] = .directory~new~~put('Hank', fName)~~put('Miller', lName)~~put('Librarian', profession) + profArray[8 ] = .directory~new~~put('Mark', fName)~~put('Thompson', lName)~~put('Mechanic', profession) + profArray[9 ] = .directory~new~~put('Sue', fName)~~put('Lamont', lName)~~put('Nurse', profession) + profArray[10] = .directory~new~~put('Vail', fName)~~put('Miesfeld', lName)~~put('Software Engineer', profession) + profArray[11] = .directory~new~~put('Susan', fName)~~put('Dunn', lName)~~put('Stock broker', profession) + + -- Sorted array is same as fnArray + sArray[1 ] = .directory~new~~put('Alice', fName)~~put('Toklas', lName)~~put('Dentist', profession) + sArray[2 ] = .directory~new~~put('Bill', fName)~~put('Maher', lName)~~put('Lawyer', profession) + sArray[3 ] = .directory~new~~put('Christin', fName)~~put('Henesy', lName)~~put('Detective', profession) + sArray[4 ] = .directory~new~~put('Eric', fName)~~put('Clapton', lName)~~put('Cook', profession) + sArray[5 ] = .directory~new~~put('Hank', fName)~~put('Miller', lName)~~put('Librarian', profession) + sArray[6 ] = .directory~new~~put('Larry', fName)~~put('Williams', lName)~~put('Doctor', profession) + sArray[7 ] = .directory~new~~put('Mark', fName)~~put('Thompson', lName)~~put('Mechanic', profession) + sArray[8 ] = .directory~new~~put('Mary', fName)~~put('Greensmith', lName)~~put('CEO', profession) + sArray[9 ] = .directory~new~~put('Sue', fName)~~put('Lamont', lName)~~put('Nurse', profession) + sArray[10] = .directory~new~~put('Susan', fName)~~put('Dunn', lName)~~put('Stock broker', profession) + sArray[11] = .directory~new~~put('Vail', fName)~~put('Miesfeld', lName)~~put('Software Engineer', profession) + + -- Just reverse the array indexes + rsArray[11] = .directory~new~~put('Alice', fName)~~put('Toklas', lName)~~put('Dentist', profession) + rsArray[10] = .directory~new~~put('Bill', fName)~~put('Maher', lName)~~put('Lawyer', profession) + rsArray[9 ] = .directory~new~~put('Christin', fName)~~put('Henesy', lName)~~put('Detective', profession) + rsArray[8 ] = .directory~new~~put('Eric', fName)~~put('Clapton', lName)~~put('Cook', profession) + rsArray[7 ] = .directory~new~~put('Hank', fName)~~put('Miller', lName)~~put('Librarian', profession) + rsArray[6 ] = .directory~new~~put('Larry', fName)~~put('Williams', lName)~~put('Doctor', profession) + rsArray[5 ] = .directory~new~~put('Mark', fName)~~put('Thompson', lName)~~put('Mechanic', profession) + rsArray[4 ] = .directory~new~~put('Mary', fName)~~put('Greensmith', lName)~~put('CEO', profession) + rsArray[3 ] = .directory~new~~put('Sue', fName)~~put('Lamont', lName)~~put('Nurse', profession) + rsArray[2 ] = .directory~new~~put('Susan', fName)~~put('Dunn', lName)~~put('Stock broker', profession) + rsArray[1 ] = .directory~new~~put('Vail', fName)~~put('Miesfeld', lName)~~put('Software Engineer', profession) + + +-- The putMenu() method simply provides a convenient way to pass in the menu +-- object created in the program entry code to this dialog. +::method putMenu + expose lvPopup + use strict arg lvPopup + + +/** routine::createListViewMenu() + * + * This routine creates the list view context menu dynamically using methods of + * the .PopupMenu. It is very easy to use. Menu items can be inserted or + * removed from a menu at any time. + * + * The other point that is being made by creating this menu in a routine is that + * menu objects are truely independent of a dialog. A menu object can be + * created without any existing dialogs. The object can then be used with any + * dialog. + */ +::routine createListViewMenu + use strict arg + + -- Create a new empty pop up menu. + m = .PopupMenu~new(IDM_LV_BAR) + + -- Insert the menu items. The first argument is the resource ID of the item + -- before which the inserted item goes. The second argument is the resource + -- ID of the item to insert. + -- + -- For the first item, since there are no items in the menu, the insert before + -- argument does not matter. I ususally just use the same resource ID as the + -- item being inserted. You could use any positive number. + -- + -- For the rest of the items, here they are just sort of in a random order. + -- This is to demonstrate how the 'insert before' works. I usually insert the + -- items in a last comes first order because it makes it a little easy to + -- visualize how the menu will look, if you picture the menu upside down. + m~insertItem(IDM_LV_RESTORE, IDM_LV_RESTORE, "Restore Original Order") + m~insertItem(IDM_LV_RESTORE, IDM_LV_PROFESSION, "Order by Profession") + m~insertItem(IDM_LV_PROFESSION, IDM_LV_FNAME, "Order by First Name") + + m~insertItem(IDM_LV_FNAME, IDM_LV_REVERSE, "Reverse Sort") + m~insertItem(IDM_LV_REVERSE, IDM_LV_SORT, "Sort") + m~insertItem(IDM_LV_REVERSE, IDM_LV_JUMBLE, "Jumble") + + m~insertItem(IDM_LV_PROFESSION, IDM_LV_LNAME, "Order by Last Name") + + m~insertSeparator(IDM_LV_FNAME, IDM_LV_SEP1) + m~insertSeparator(IDM_LV_RESTORE, IDM_LV_SEP2) + + return m + diff --git a/modules/windows/oodialog/menus/ScriptMenuBar.h b/modules/windows/oodialog/menus/ScriptMenuBar.h new file mode 100644 index 0000000..0409167 --- /dev/null +++ b/modules/windows/oodialog/menus/ScriptMenuBar.h @@ -0,0 +1,72 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_SCRIPTMENUBAR_DLG 101 +#define IDR_MENU_LV 103 +#define IDD_ABOUT_DIALOG 113 +#define IDC_ST_BITMAP 1000 +#define IDC_LV 1003 +#define IDC_ST_ABOUT 1039 +#define IDM_ADD_ITEMS 40000 +#define IDM_OPEN_LIST_VIEW 40001 +#define IDM_CLOSE_LIST_VIEW 40002 +#define IDM_GRID_LINES 40003 +#define IDM_CHECKBOXES 40004 +#define IDM_NO_CHECKBOXES 40005 +#define IDM_CONTENTS 40006 +#define IDM_INDEX 40007 +#define IDM_SEARCH 40008 +#define IDM_FULL_ROW_SELECT 40009 +#define IDM_ABOUT 40010 +#define IDM_INSERT_ITEM 40011 +#define IDM_DELETE_ITEM 40012 +#define IDM_UNDERLINE_HOT 40013 +#define IDM_EDIT_ITEM 40014 +#define IDM_CAPITALIZE_ITEM 40015 + +#define IDM_POP_FILE 40021 +#define IDM_POP_STYLE 40022 +#define IDM_POP_OPERATIONS 40023 +#define IDM_POP_HELP 40024 +#define IDM_SEP1 40025 +#define IDM_SEP2 40026 +#define IDM_SEP3 40027 + diff --git a/modules/windows/oodialog/menus/ScriptMenuBar.rc b/modules/windows/oodialog/menus/ScriptMenuBar.rc new file mode 100644 index 0000000..eb537e5 --- /dev/null +++ b/modules/windows/oodialog/menus/ScriptMenuBar.rc @@ -0,0 +1,105 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "ScriptMenuBar.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_MENU_LV MENUEX +{ + POPUP "File", IDM_POP_FILE, 0, 0 + { + MENUITEM "Add Items from File", IDM_ADD_ITEMS, 0, 0 + MENUITEM "Open List-View", IDM_OPEN_LIST_VIEW, 0, MFS_GRAYED | MFS_CHECKED + MENUITEM "Close List-View", IDM_CLOSE_LIST_VIEW, 0, 0 + MENUITEM "", IDM_SEP1, MFT_SEPARATOR, 0 + MENUITEM "Exit", IDOK, 0, 0 + } + POPUP "Style", IDM_POP_STYLE, 0, 0 + { + MENUITEM "Check Boxes", IDM_CHECKBOXES, 0, 0 + MENUITEM "Grid Lines", IDM_GRID_LINES , 0, 0 + MENUITEM "Full Row Select", IDM_FULL_ROW_SELECT, 0, 0 + MENUITEM "Underline When Hot", IDM_UNDERLINE_HOT, 0, 0 + } + POPUP "Operations", IDM_POP_OPERATIONS, 0, 0 + { + MENUITEM "Insert Item", IDM_INSERT_ITEM, 0, 0 + MENUITEM "Delete Item", IDM_DELETE_ITEM, 0, 0 + MENUITEM "", IDM_SEP2, MFT_SEPARATOR, 0 + MENUITEM "Edit Item", IDM_EDIT_ITEM, 0, 0 + MENUITEM "Capitalize Item", IDM_CAPITALIZE_ITEM, 0, 0 + } + POPUP "Help", IDM_POP_HELP, 0, 0 + { + MENUITEM "Contents", IDM_CONTENTS, 0, 0 + MENUITEM "Index ...", IDM_INDEX, 0, 0 + MENUITEM "Search ...", IDM_SEARCH, 0, 0 + MENUITEM "", IDM_SEP3, MFT_SEPARATOR, 0 + MENUITEM "About", IDM_ABOUT, 0, 0 + } +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ABOUT_DIALOG DIALOGEX 0, 0, 231, 121 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "About Script Menu Bar Example" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_ST_BITMAP, WC_STATIC, SS_BITMAP | 0x00000040, 16, 7, 102, 71 + CTEXT "An example of using a script menu bar in ooDialog.", IDC_ST_ABOUT, 141, 10, 76, 82, SS_CENTER + LTEXT "ooDialog an ooRexx Extenstion", IDC_STATIC, 16, 96, 107, 15, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 170, 97, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SCRIPTMENUBAR_DLG DIALOG 0, 0, 217, 195 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Example Dialog with a ScriptMenuBar" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Example List-View Control", IDC_STATIC, 15, 12, 92, 12, SS_LEFT + CONTROL "", IDC_LV, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 10, 29, 197, 117 + DEFPUSHBUTTON "OK", IDOK, 102, 158, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 157, 158, 50, 14 +} diff --git a/modules/windows/oodialog/menus/ScriptMenuBar.rex b/modules/windows/oodialog/menus/ScriptMenuBar.rex new file mode 100755 index 0000000..55adabd --- /dev/null +++ b/modules/windows/oodialog/menus/ScriptMenuBar.rex @@ -0,0 +1,196 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple dialog to demonstrate a .ScriptMenu. + */ + + sd = locate() + .application~useGlobalConstDir("O", sd"ScriptMenuBar.h") + + dlg = .SimpleDialog~new(sd"ScriptMenuBar.rc", IDD_SCRIPTMENUBAR_DLG) + if dlg~initCode <> 0 then do + return 99 + end + + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'SimpleDialog' subclass RcDialog + +::method initDialog + expose menuBar lv + + sd = .application~srcDir + menuBar = .ScriptMenuBar~new(sd"ScriptMenuBar.rc", IDR_MENU_LV, , , .true, self) + + lv = self~newListView(IDC_LV) + lv~insertColumnPX(0, "First Name", 70) + lv~insertColumnPX(1, "Last Name", 90) + lv~insertColumnPX(2, "Profession", 120) + + lv~addRow( , , "Bill", "Gates", "Philanthropist") + lv~addRow( , , "Steve", "Jobs", "Salesman") + lv~addRow( , , "Ron", "McCarthy", "Plumber") + lv~addRow( , , "Greg", "Allen", "Truck Driver") + +::method addItemsFromFile + self~notImplemented("File -> Add Items") + +::method 'openList-View' + expose lv menuBar + + lv~show + menuBar~check(IDM_OPEN_LIST_VIEW) + menuBar~disable(IDM_OPEN_LIST_VIEW) + + menuBar~unCheck(IDM_CLOSE_LIST_VIEW) + menuBar~enable(IDM_CLOSE_LIST_VIEW) + +::method 'closeList-View' + expose lv menuBar + + lv~hide + menuBar~enable(IDM_OPEN_LIST_VIEW) + menuBar~unCheck(IDM_OPEN_LIST_VIEW) + + menuBar~check(IDM_CLOSE_LIST_VIEW) + menuBar~disable(IDM_CLOSE_LIST_VIEW) + +::method checkBoxes + expose lv menuBar + + if menuBar~isChecked(IDM_CHECKBOXES) then do + lv~removeExtendedStyle("CHECKBOXES") + menuBar~unCheck(IDM_CHECKBOXES) + end + else do + lv~addExtendedStyle("CHECKBOXES") + menuBar~check(IDM_CHECKBOXES) + end + + +::method gridLines + expose lv menuBar + + if menuBar~isChecked(IDM_GRID_LINES) then do + lv~removeExtendedStyle("GRIDLINES") + menuBar~unCheck(IDM_GRID_LINES) + end + else do + lv~addExtendedStyle("GRIDLINES") + menuBar~check(IDM_GRID_LINES) + end + + +::method fullRowSelect + expose lv menuBar + + if menuBar~isChecked(IDM_FULL_ROW_SELECT) then do + lv~removeExtendedStyle("FULLROWSELECT") + menuBar~unCheck(IDM_FULL_ROW_SELECT) + end + else do + lv~addExtendedStyle("FULLROWSELECT") + menuBar~check(IDM_FULL_ROW_SELECT) + end + + +::method underLineWhenHot + expose lv menuBar + + if menuBar~isChecked(IDM_UNDERLINE_HOT) then do + lv~removeExtendedStyle("ONECLICKACTIVATE UNDERLINEHOT") + menuBar~unCheck(IDM_UNDERLINE_HOT) + end + else do + lv~addExtendedStyle("ONECLICKACTIVATE UNDERLINEHOT") + menuBar~check(IDM_UNDERLINE_HOT) + end + +::method insertItem + self~notImplemented("Operartions -> Insert Item") + +::method deleteItem + self~notImplemented("Operartions -> Delete Item") + +::method EditItem + self~notImplemented("Operartions -> Edit Item") + +::method capitalizeItem + self~notImplemented("Operartions -> Capitalize Item") + +::method contents + self~notImplemented("Help -> Contents") + +::method index + self~notImplemented("Help -> Index ...") + +::method search + self~notImplemented("Help -> Search ...") + +::method about unguarded + + dlg = .AboutDialog~new(.application~srcDir"ScriptMenuBar.rc", IDD_ABOUT_DIALOG) + + dlg~execute("SHOWTOP", IDI_DLG_DEFAULT) + + +::method notImplemented private + use strict arg title + + msg = title "has not been implemented yet." + ret = MessageDialog(msg, self~hwnd, title, "OK", "INFORMATION") + + +::class 'AboutDialog' subclass RcDialog + +::method initDialog + expose font + + bitmap = .Image~getImage(.application~srcDir"UserMenuBar.bmp") + self~newStatic(IDC_ST_BITMAP)~setImage(bitmap) + + font = self~createFontEx("Ariel", 14) + self~newStatic(IDC_ST_ABOUT)~setFont(font) + +::method leaving + expose font + self~deleteFont(font) diff --git a/modules/windows/oodialog/menus/UserMenuBar.bmp b/modules/windows/oodialog/menus/UserMenuBar.bmp new file mode 100644 index 0000000..1503357 Binary files /dev/null and b/modules/windows/oodialog/menus/UserMenuBar.bmp differ diff --git a/modules/windows/oodialog/menus/UserMenuBar.h b/modules/windows/oodialog/menus/UserMenuBar.h new file mode 100644 index 0000000..3ee14cc --- /dev/null +++ b/modules/windows/oodialog/menus/UserMenuBar.h @@ -0,0 +1,111 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_MAIN_DIALOG 101 +#define IDD_INSERT_DIALOG 103 +#define IDD_SELECT_DIALOG 105 +#define IDD_ACCEL_DIALOG 107 +#define IDD_RANGE_DIALOG 109 +#define IDD_POSITION_DIALOG 111 +#define IDD_ABOUT_DIALOG 113 +#define IDC_ST_BITMAP 1000 +#define IDC_ST_CURRENT_TEXT 1001 +#define IDC_EDIT 1002 +#define IDC_ST_EXPLANATION 1003 +#define IDC_UPD_ACCEL2 1004 +#define IDC_ST_UPD 1005 +#define IDC_UPD_POSITION 1006 +#define IDC_EDIT_ACCEL2 1007 +#define IDC_EDIT_BUDDY 1008 +#define IDC_EDIT_POSITION 1009 +#define IDC_ST_EDIT 1010 +#define IDC_UPD_ACCEL_SECONDS1 1011 +#define IDC_UPD 1012 +#define IDC_UPD_LOW 1013 +#define IDC_RB_WICKED 1014 +#define IDC_UPD_ACCEL_SECONDS2 1015 +#define IDC_UPD_START 1016 +#define IDC_EDIT_ACCEL_SECONDS2 1017 +#define IDC_UPD_HIGH 1018 +#define IDC_EDIT_LOW 1019 +#define IDC_UPD_ACCEL3 1020 +#define IDC_EDIT_ACCEL3 1021 +#define IDC_EDIT_HIGH 1022 +#define IDC_RB_LOTUS 1023 +#define IDC_UPD_ACCEL_SECONDS3 1024 +#define IDC_EDIT_ACCEL_SECONDS3 1025 +#define IDC_RB_IDES 1026 +#define IDC_EDIT_START 1027 +#define IDC_RB_TITANIC 1028 +#define IDC_UPD_ACCEL_SECONDS0 1029 +#define IDC_EDIT_END 1030 +#define IDC_EDIT_ACCEL_SECONDS0 1031 +#define IDC_UPD_END 1032 +#define IDC_EDIT_ACCEL0 1033 +#define IDC_UPD_ACCEL1 1034 +#define IDC_EDIT_ACCEL_SECONDS1 1035 +#define IDC_EDIT_ACCEL1 1036 +#define IDC_UPD_ACCEL0 1037 +#define IDC_ST_ABOUT 1039 + + +#define IDM_MENUBAR 800 +#define IDM_POP_FILES 810 +#define ID_FILES_HIDE_EDIT 811 +#define ID_FILES_HIDE_UPDOWN 812 +#define IDM_SEP_FILES 813 +#define ID_FILES_EXIT 814 +#define IDM_POP_EDITCONTROL 820 +#define ID_EDITCONTROL_LOWER 821 +#define ID_EDITCONTROL_NUMBER 822 +#define ID_EDITCONTROL_UPPER 823 +#define ID_EDITCONTROL_UNRESTRICTED 824 +#define IDM_SEP_EDITCONTROL 825 +#define ID_EDITCONTROL_INSERT 826 +#define ID_EDITCONTROL_SELECT 827 +#define IDM_POP_UPDOWNCONTROL 830 +#define ID_UPDOWNCONTROL_HEXIDECIMAL 831 +#define IDM_SEP_UPDOWNCONTROL 832 +#define ID_UPDOWNCONTROL_SET_ACCELERATION 833 +#define ID_UPDOWNCONTROL_SET_RANGE 834 +#define ID_UPDOWNCONTROL_SET_POSITION 835 +#define IDM_POP_HELP 840 +#define ID_HELP_ABOUT 841 diff --git a/modules/windows/oodialog/menus/UserMenuBar.rc b/modules/windows/oodialog/menus/UserMenuBar.rc new file mode 100644 index 0000000..bcdd7e4 --- /dev/null +++ b/modules/windows/oodialog/menus/UserMenuBar.rc @@ -0,0 +1,184 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "UserMenuBar.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ABOUT_DIALOG DIALOGEX 0, 0, 231, 105 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "About User Menu Bar Example" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_ST_BITMAP, WC_STATIC, SS_BITMAP | SS_REALSIZECONTROL, 16, 7, 102, 71 + CTEXT "An example of using a menu bar in ooDialog.", IDC_ST_ABOUT, 141, 10, 76, 56, SS_CENTER + LTEXT "ooDialog an ooRexx Extenstion", IDC_STATIC, 16, 83, 107, 15, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 170, 84, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ACCEL_DIALOG DIALOGEX 0, 0, 227, 163 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Set Acceleration" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CTEXT "Example: After 1 second(s) accelerate 2x.", IDC_STATIC, 9, 9, 224, 8, SS_CENTER + LTEXT "After", IDC_STATIC, 15, 38, 16, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL_SECONDS0, 36, 35, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL_SECONDS0, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 53, 35, 12, 14 + LTEXT "second(s) accelerate", IDC_STATIC, 73, 38, 67, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL0, 145, 36, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL0, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 163, 36, 12, 14 + LTEXT "X.", IDC_STATIC, 178, 38, 8, 8, SS_LEFT + LTEXT "After", IDC_STATIC, 15, 63, 16, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL_SECONDS1, 36, 60, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL_SECONDS1, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 53, 60, 12, 14 + LTEXT "second(s) accelerate", IDC_STATIC, 73, 63, 67, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL1, 145, 61, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL1, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 163, 61, 12, 14 + LTEXT "X.", IDC_STATIC, 178, 63, 8, 8, SS_LEFT + LTEXT "After", IDC_STATIC, 15, 89, 16, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL_SECONDS2, 36, 86, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL_SECONDS2, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 53, 86, 12, 14 + LTEXT "second(s) accelerate", IDC_STATIC, 73, 89, 67, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL2, 145, 87, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL2, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 163, 87, 12, 14 + LTEXT "X.", IDC_STATIC, 178, 117, 8, 8, SS_LEFT + LTEXT "After", IDC_STATIC, 15, 117, 16, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL_SECONDS3, 36, 114, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL_SECONDS3, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 53, 114, 12, 14 + LTEXT "second(s) accelerate", IDC_STATIC, 73, 117, 67, 8, SS_LEFT + EDITTEXT IDC_EDIT_ACCEL3, 145, 115, 29, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_ACCEL3, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 163, 115, 12, 14 + LTEXT "X.", IDC_STATIC, 178, 89, 8, 8, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 115, 142, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 170, 142, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_MAIN_DIALOG DIALOG 0, 0, 223, 150 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "User Menu Bar Example" +FONT 8, "Ms Shell Dlg" +{ + RTEXT "Enter text:", IDC_ST_EDIT, 10, 32, 40, 12, SS_RIGHT + EDITTEXT IDC_EDIT, 52, 30, 160, 12, ES_AUTOHSCROLL + RTEXT "Spin Me:", IDC_ST_UPD, 10, 63, 40, 12, SS_RIGHT + EDITTEXT IDC_EDIT_BUDDY, 52, 60, 65, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "", IDC_UPD, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_WRAP | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 257, 66, 12, 16 + DEFPUSHBUTTON "OK", IDOK, 107, 115, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 162, 115, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_INSERT_DIALOG DIALOGEX 0, 0, 283, 149 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Insert Text" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "OK", IDOK, 171, 128, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 226, 128, 50, 14 + CTEXT "Select the Text to Insert", IDC_STATIC, 7, 11, 269, 8, SS_CENTER + AUTORADIOBUTTON "The wicked flee when none pursueth ...", IDC_RB_WICKED, 11, 33, 141, 8, WS_TABSTOP + AUTORADIOBUTTON "Lotus 123 had its ups and downs.", IDC_RB_LOTUS, 11, 53, 122, 8 + AUTORADIOBUTTON "Ides of March - name of March 15 in Roman calendar.", IDC_RB_IDES, 11, 74, 186, 8, WS_TABSTOP + AUTORADIOBUTTON "472 lifeboat seats not used when 1,503 people died on the Titanic.", IDC_RB_TITANIC, 11, 95, 226, 8, WS_TABSTOP +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_POSITION_DIALOG DIALOGEX 0, 0, 186, 95 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Set New Position" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + DEFPUSHBUTTON "OK", IDOK, 74, 74, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 129, 74, 50, 14 + CTEXT "Pick a new position for the up-down control.", IDC_STATIC, 9, 11, 170, 8, SS_CENTER + LTEXT "New Position:", IDC_STATIC, 11, 41, 44, 8, SS_LEFT + EDITTEXT IDC_EDIT_POSITION, 56, 38, 68, 14, ES_RIGHT | ES_AUTOHSCROLL + CONTROL "", IDC_UPD_POSITION, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 112, 38, 12, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_RANGE_DIALOG DIALOGEX 0, 0, 203, 164 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Set UpDown Range" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CTEXT "Set the start and end values for the range.", IDC_STATIC, 11, 9, 185, 13, SS_CENTER + LTEXT "The complete possible range for an UpDown control is -2147,483,648 to 2,147,483,647. The start value does not have to be lower than the end value. 5 to -5 is a valid range.", IDC_ST_EXPLANATION, 11, 36, 180, 35, SS_LEFT + RTEXT "Start value:", IDC_STATIC, 8, 85, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_LOW, 51, 84, 70, 12, ES_AUTOHSCROLL + CONTROL "", IDC_UPD_LOW, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 109, 84, 12, 12 + RTEXT "End value:", IDC_STATIC, 8, 117, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_HIGH, 51, 116, 70, 12, ES_AUTOHSCROLL + CONTROL "", IDC_UPD_HIGH, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 109, 116, 12, 12 + DEFPUSHBUTTON "OK", IDOK, 91, 143, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 146, 143, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_SELECT_DIALOG DIALOGEX 0, 0, 277, 122 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Select Text" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + GROUPBOX "The current text in the edit control available for selection is:", IDC_STATIC, 7, 10, 261, 34 + DEFPUSHBUTTON "OK", IDOK, 165, 101, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 220, 101, 50, 14 + LTEXT "Static", IDC_ST_CURRENT_TEXT, 11, 26, 256, 10, SS_LEFT | SS_WORDELLIPSIS + LTEXT "Selection start position", IDC_STATIC, 11, 58, 86, 8, SS_LEFT + LTEXT "Selection end position", IDC_STATIC, 120, 58, 70, 8, SS_LEFT + EDITTEXT IDC_EDIT_START, 11, 72, 40, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "", IDC_UPD_START, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_WRAP | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 39, 72, 12, 14 + EDITTEXT IDC_EDIT_END, 120, 72, 40, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + CONTROL "", IDC_UPD_END, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_WRAP | UDS_AUTOBUDDY | UDS_HOTTRACK | UDS_SETBUDDYINT, 148, 72, 12, 14 +} diff --git a/modules/windows/oodialog/menus/UserMenuBar.rex b/modules/windows/oodialog/menus/UserMenuBar.rex new file mode 100755 index 0000000..05ee7ab --- /dev/null +++ b/modules/windows/oodialog/menus/UserMenuBar.rex @@ -0,0 +1,575 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple application that shows how to create an UserMenuBar menu. The + * dialog contains an Edit control and an UpDown control. The menu is used to + * change styles or behaviour of the two controls. + * + * About half of the menu items pop up a dialog to collect user input needed to + * carry out the menu item action. + * + * This example uses a number of up-down controls in the different dialogs, + * making it a good example of how to use up-down controls in addition, to being + * a menu bar example. + */ + + sd = locate() + .application~setDefaults("O", sd"UserMenuBar.h", .false) + + dlg = .SimpleDialog~new(sd"UserMenuBar.rc", IDD_MAIN_DIALOG) + if dlg~initCode <> 0 then do + return 99 + end + + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +-- We need 10 digits to work with the numbers in the full range of an up-down +-- control (-2147,483,648 to 2,147,483,647) +::options digits 10 + +::class 'SimpleDialog' subclass RcDialog + +::constant DEFAULT_TEXT "1, 2, 3, the Edit control Menu actions work better with text in the 1st edit control." +::constant WICKED_TEXT "The wicked flee when none pursueth ..." +::constant LOTUS_TEXT "Lotus 123 had its ups and downs." +::constant IDES_TEXT "Ides of March - name of March 15 in Roman calendar." +::constant TITANIC_TEXT "472 lifeboat seats not used when 1,503 people died on the Titanic." + +::method init + expose srcDir + + forward class (super) continue + + -- Grab the source dir value here and save it in an instance variable for + -- convenience. + srcDir = .application~srcDir + + if \ self~createMenuBar then do + self~initCode = 1 + return + end + + +::method initDialog + expose menuBar edit upDown + + upDown = self~newUpDown(IDC_UPD) + upDown~setRange(1, 20000) + upDown~setPosition(1000) + + if \ menuBar~attachTo(self) then do + msg = "Failed to attach menu bar System Error Code:" .SystemErrorCode + z = MessageDialog(msg, self~hwnd, "Menu Error", "OK", "WARNING") + end + + edit = self~newEdit(IDC_EDIT) + edit~setText(.SimpleDialog~DEFAULT_TEXT) + + self~setRadioChecks(ID_EDITCONTROL_UNRESTRICTED) + + +-- Creates a UserMenuBar +::method createMenuBar private + expose menuBar + + -- Create a menu bar that has a symbolic resource ID of IDM_MENUBAR, has no + -- help ID, uses the default menu item count, and autoconnects all command + -- menu items when it is attached to a dialog. + menuBar = .UserMenuBar~new(IDM_MENUBAR, , , .true) + + -- Create the menu bar template. + menuBar~addPopup(IDM_POP_FILES, "Files") + menuBar~addItem(ID_FILES_HIDE_EDIT, "Hide Edit Control", "DEFAULT CHECK") + menuBar~addItem(ID_FILES_HIDE_UPDOWN, "Hide UpDown Control", " CHECK") + menuBar~addSeparator(IDM_SEP_FILES) + menuBar~addItem(ID_FILES_EXIT, "Exit", "END") + + menuBar~addPopup(IDM_POP_EDITCONTROL, "Edit Control") + menuBar~addItem(ID_EDITCONTROL_LOWER, "Lower Case Only", "CHECK RADIO") + menuBar~addItem(ID_EDITCONTROL_NUMBER, "Numbers Only", "CHECK RADIO") + menuBar~addItem(ID_EDITCONTROL_UPPER, "Upper Case Only", "CHECK RADIO") + menuBar~addItem(ID_EDITCONTROL_UNRESTRICTED, "No Restriction", "CHECK RADIO DEFAULT") + menuBar~addSeparator(IDM_SEP_EDITCONTROL) + menuBar~addItem(ID_EDITCONTROL_INSERT, "Insert Text ...") + menuBar~addItem(ID_EDITCONTROL_SELECT, "Select Text ...", "END") + + menuBar~addPopup(IDM_POP_UPDOWNCONTROL, "UpDown Control") + menuBar~addItem(ID_UPDOWNCONTROL_HEXIDECIMAL, "Hexidecimal", "CHECK") + menuBar~addSeparator(IDM_SEP_UPDOWNCONTROL) + menuBar~addItem(ID_UPDOWNCONTROL_SET_ACCELERATION, "Set Acceleration ...") + menuBar~addItem(ID_UPDOWNCONTROL_SET_RANGE, "Set Range ...") + menuBar~addItem(ID_UPDOWNCONTROL_SET_POSITION, "Set Position ...", "END") + + menuBar~addPopup( IDM_POP_HELP, "Help", "END") + menuBar~addItem(ID_HELP_ABOUT, "About User Menu Bar", "END") + + if \ menuBar~complete then do + say 'User menu bar completion error:' .SystemErrorCode SysGetErrortext(.SystemErrorCode) + return .false + end + + return .true + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +-- The methods below, up to the next dividing lines, are the implementation +-- for each of the menu item command events. +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::method hideEditControl unguarded + expose menuBar edit + + if menuBar~isChecked(ID_FILES_HIDE_EDIT) then do + menuBar~uncheck(ID_FILES_HIDE_EDIT) + self~newStatic(IDC_ST_EDIT)~show + edit~show + end + else do + menuBar~check(ID_FILES_HIDE_EDIT) + self~newStatic(IDC_ST_EDIT)~hide + edit~hide + end + +::method hideUpDownControl unguarded + expose menuBar upDown + + if menuBar~isChecked(ID_FILES_HIDE_UPDOWN) then do + menuBar~uncheck(ID_FILES_HIDE_UPDOWN) + self~newStatic(IDC_ST_UPD)~show + self~newEdit(IDC_EDIT_BUDDY)~show + upDown~show + end + else do + menuBar~check(ID_FILES_HIDE_UPDOWN) + self~newStatic(IDC_ST_UPD)~hide + self~newEdit(IDC_EDIT_BUDDY)~hide + upDown~hide + end + +::method exit unguarded + self~cancel + + +::method lowerCaseOnly unguarded + expose menuBar edit + + alreadyChecked = menuBar~isChecked(ID_EDITCONTROL_LOWER) + + self~setRadioChecks(ID_EDITCONTROL_LOWER) + edit~replaceStyle("UPPER NUMBER", "LOWER") + + text = edit~getText + edit~setText(text~lower) + + if \ alreadyChecked then do + edit~assignFocus + edit~select(1, 1) + + msg = "You can only enter lower case letters in" || .endOfLine || - + "the edit control now. Try it." + z = MessageDialog(msg, self~hwnd, 'Edit Control Style Change', "OK", "INFORMATION") + end + + +::method numbersOnly unguarded + expose menuBar edit + + alreadyChecked = menuBar~isChecked(ID_EDITCONTROL_NUMBER) + + self~setRadioChecks(ID_EDITCONTROL_NUMBER) + edit~replaceStyle("LOWER UPPER", "NUMBER") + + text = edit~getText + edit~setText(text~translate("", xrange("00"X, "/") || xrange(":", "FF"X))~space(0)) + + if \ alreadyChecked then do + edit~assignFocus + edit~select(1, 1) + + msg = "You can only enter numbers in the" || .endOfLine || - + "edit control now. Try it." + z = MessageDialog(msg, self~hwnd, 'Edit Control Style Change', "OK", "INFORMATION") + end + + +::method upperCaseOnly unguarded + expose menuBar edit + + alreadyChecked = menuBar~isChecked(ID_EDITCONTROL_UPPER) + + self~setRadioChecks(ID_EDITCONTROL_UPPER) + edit~replaceStyle("LOWER NUMBER", "UPPER") + + text = edit~getText + edit~setText(text~upper) + + if \ alreadyChecked then do + edit~assignFocus + edit~select(1, 1) + + msg = "You can only enter upper case letters in" || .endOfLine || - + "the edit control now. Try it." + z = MessageDialog(msg, self~hwnd, 'Edit Control Style Change', "OK", "INFORMATION") + end + + +::method noRestriction unguarded + expose menuBar edit + + alreadyChecked = menuBar~isChecked(ID_EDITCONTROL_UNRESTRICTED) + + self~setRadioChecks(ID_EDITCONTROL_UNRESTRICTED) + edit~removeStyle("LOWER NUMBER UPPER") + + text = edit~getText + edit~setText(.SimpleDialog~DEFAULT_TEXT) + + if \ alreadyChecked then do + edit~assignFocus + edit~select(1, 1) + + msg = "You can now enter unrestricted text in" || .endOfLine || - + "the edit control. Try it." + z = MessageDialog(msg, self~hwnd, 'Edit Control Style Change', "OK", "INFORMATION") + end + + +::method insertText unguarded + expose edit srcDir + + dlg = .InsertDialog~new(srcDir"UserMenuBar.rc", IDD_INSERT_DIALOG, , srcDir"UserMenuBar.h") + + if dlg~execute("SHOWTOP", IDI_DLG_OODIALOG) == .PlainBaseDialog~IDOK then do + edit~setText(dlg~selectedText) + end + + +::method selectText unguarded + expose edit srcDir + + dlg = .SelectDialog~new(srcDir"UserMenuBar.rc", IDD_SELECT_DIALOG, , srcDir"UserMenuBar.h") + dlg~currentText = edit~getText + edit~select(1, 1) + + if dlg~execute("SHOWTOP", IDI_DLG_APPICON) == .PlainBaseDialog~IDOK then do + s = dlg~selection + edit~select(s~x, s~y) + end + + +::method hexidecimal unguarded + expose menuBar upDown + + if menuBar~isChecked(ID_UPDOWNCONTROL_HEXIDECIMAL) then do + menuBar~uncheck(ID_UPDOWNCONTROL_HEXIDECIMAL) + upDown~setBase(10) + end + else do + menuBar~check(ID_UPDOWNCONTROL_HEXIDECIMAL) + upDown~setBase(16) + end + + +::method setAcceleration unguarded + expose upDown srcDir + + dlg = .AccelDialog~new(srcDir"UserMenuBar.rc", IDD_ACCEL_DIALOG, , srcDir"UserMenuBar.h") + + if dlg~execute("SHOWTOP", IDI_DLG_APPICON2) == .PlainBaseDialog~IDOK then do + accel = dlg~acceleration + upDown~setAcceleration(accel) + end + + +::method setRange unguarded + expose upDown srcDir + + dlg = .RangeDialog~new(srcDir"UserMenuBar.rc", IDD_RANGE_DIALOG, , srcDir"UserMenuBar.h") + + if dlg~execute("SHOWTOP", IDI_DLG_OOREXX) == .PlainBaseDialog~IDOK then do + r = dlg~range + upDown~setRange(r~x, r~y) + + -- If the current position was no longer within the new range, the up-down + -- control will have internally reset its position so that it is within the + -- new range. But, the value displayed will still be the old value. This + -- forces the value displayed to match the current position. + upDown~setPosition(upDown~getPosition) + end + + +::method setPosition unguarded + expose upDown srcDir + + dlg = .PositionDialog~new(srcDir"UserMenuBar.rc", IDD_POSITION_DIALOG, , srcDir"UserMenuBar.h") + dlg~upDown = upDown + + if dlg~execute("SHOWTOP", IDI_DLG_DEFAULT) == .PlainBaseDialog~IDOK then do + p = dlg~position + upDown~setPosition(p) + end + + +::method aboutUserMenuBar unguarded + expose srcDir + + dlg = .AboutDialog~new(srcDir"UserMenuBar.rc", IDD_ABOUT_DIALOG, , srcDir"UserMenuBar.h") + + dlg~execute("SHOWTOP", IDI_DLG_DEFAULT) + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +-- End of the implementation methods for each of the menu item command events. +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + +-- Convenience method to set the radio button menu items. The checkRadio() +-- method takes a start resource ID and an end resource, and the resource ID for +-- a single menu item within that range of IDs. It removes the radio button +-- check mark from all the menu items in the range and adds the radio button +-- check mark to item specified by the third argument. +::method setRadioChecks private + expose menuBar + use strict arg item + + menuBar~checkRadio(ID_EDITCONTROL_LOWER, ID_EDITCONTROL_UNRESTRICTED, item) + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +-- The following classes all implement a single dialog that is used to collect +-- information, from the user, needed to carry out one of the menu item +-- commands. +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + +::class 'InsertDialog' subclass RcDialog + +::attribute selectedText + +::method initDialog + self~newRadioButton(IDC_RB_WICKED)~check + +::method ok unguarded + + select + when self~newRadioButton(IDC_RB_WICKED)~checked then self~selectedText = .SimpleDialog~WICKED_TEXT + when self~newRadioButton(IDC_RB_LOTUS)~checked then self~selectedText = .SimpleDialog~LOTUS_TEXT + when self~newRadioButton(IDC_RB_IDES)~checked then self~selectedText = .SimpleDialog~IDES_TEXT + when self~newRadioButton(IDC_RB_TITANIC)~checked then self~selectedText = .SimpleDialog~TITANIC_TEXT + otherwise self~selectedText = "" + end + -- End select + + self~ok:super + + +::class 'SelectDialog' subclass RcDialog + +::attribute selection +::attribute currentText + +::method initDialog + expose updStart updEnd currentText + + self~newStatic(IDC_ST_CURRENT_TEXT)~setText(currentText) + + updStart = self~newUpDown(IDC_UPD_START) + updStart~setRange(0, currentText~length) + updStart~setPosition(1) + + updEnd = self~newUpDown(IDC_UPD_END) + updEnd~setRange(0, currentText~length) + updEnd~setPosition(1) + +::method ok unguarded + expose updStart updEnd + + self~selection = .Point~new(updStart~getPosition, updEnd~getPosition) + self~ok:super + + + +::class 'AccelDialog' subclass RcDialog + +::attribute acceleration + +::method initDialog + + upd = self~newUpDown(IDC_UPD_ACCEL_SECONDS0) + upd~setPosition(0) + upd~disable + self~newEdit(IDC_EDIT_ACCEL_SECONDS0)~disable + + upd = self~newUpDown(IDC_UPD_ACCEL0) + upd~setPosition(1) + upd~disable + self~newEdit(IDC_EDIT_ACCEL0)~disable + + do i = 1 to 3 + upd = self~newUpDown(IDC_UPD_ACCEL_SECONDS || i) + upd~setRange(i, 32) + upd~setPosition(i) + + upd = self~newUpDown(IDC_UPD_ACCEL || i) + upd~setRange(2 ** i, 256) + upd~setPosition(2 ** i) + end + + self~newUpDown(IDC_UPD_ACCEL_SECONDS1)~assignFocus + + +::method ok unguarded + + a = .array~new(3) + + do i = 1 to 3 + d = .directory~new + + updS = self~newUpDown(IDC_UPD_ACCEL_SECONDS || i) + updA = self~newUpDown(IDC_UPD_ACCEL || i) + + d~seconds = updS~getPosition + d~increment = updA~getPosition + a[i] = d + end + + -- Check that the user has an unique value for each acceleration entry. + check = .set~of(a[1]~seconds, a[2]~seconds, a[3]~seconds) + if check~items <> 3 then do + msg = "For each of the 3 acceleration input" || .endOfLine || - + "lines, you must use a unique value for" || .endOfLine || - + "seconds. Found:" a[1]~seconds',' a[2]~seconds', and' a[3]~seconds'.' + + z = MessageDialog(msg, self~hwnd, "Acceleration Input Error", "OK", "STOP") + return .false + end + + -- Sort the entries by seconds, ascending, using brute force. + max = 0; min = 4 + do i = 1 to 3 + if a[i]~seconds > max then max = i + if a[i]~seconds < min then min = i + end + + -- The user only has 3 up-down pairs she can set. But, we also have the + -- first disabled up-down pair for seconds == 0, increment == 1 + aa = .array~new(4) + aa[1] = .directory~new~~setEntry("SECONDS", 0)~~setEntry("INCREMENT", 1) + + aa[2] = a[min] + aa[4] = a[max] + + do i = 1 to 3 + if i \== min, i \== max then do + aa[3] = a[i] + leave + end + end + + self~acceleration = aa + self~ok:super + + +::class 'RangeDialog' subclass RcDialog + +::attribute range + +::method initDialog + expose updLow updHigh + + -- Set an acceleration that goes very fast if the user hold down the arrow + -- keys, or holds down the mouse on the up / down arrows. + accel = .array~new(4) + accel[1] = .directory~new~~setEntry("SECONDS", 0)~~setEntry("INCREMENT", 1) + accel[2] = .directory~new~~setEntry("SECONDS", 1)~~setEntry("INCREMENT", 32) + accel[3] = .directory~new~~setEntry("SECONDS", 2)~~setEntry("INCREMENT", 64) + accel[4] = .directory~new~~setEntry("SECONDS", 3)~~setEntry("INCREMENT", 256) + + updLow = self~newUpDown(IDC_UPD_LOW) + updLow~setRange(-2147483648, 2147483647) + updLow~setPosition(0) + updLow~setAcceleration(accel) + + updHigh = self~newUpDown(IDC_UPD_HIGH) + updHigh~setRange(-2147483648, 2147483647) + updHigh~setPosition(0) + updHigh~setAcceleration(accel) + +::method ok unguarded + expose updLow updHigh + + self~range = .Point~new(updLow~getPosition, updHigh~getPosition) + self~ok:super + + +::class 'PositionDialog' subclass RcDialog + +::attribute position +::attribute upDown + +::method initDialog + expose upDown upd + + upd = self~newUpDown(IDC_UPD_POSITION) + + upd~setRange(upDown~getRange) + upd~setPosition(upDown~getPosition) + +::method ok unguarded + expose upd + + self~position = upd~getPosition + self~ok:super + + +::class 'AboutDialog' subclass RcDialog + +::method initDialog + expose font + + bitmap = .Image~getImage(.application~srcDir"UserMenuBar.bmp") + self~newStatic(IDC_ST_BITMAP)~setImage(bitmap) + + font = self~createFontEx("Ariel", 14) + self~newStatic(IDC_ST_ABOUT)~setFont(font) + +::method leaving + expose font + self~deleteFont(font) diff --git a/modules/windows/oodialog/mouse/dragNdrop.h b/modules/windows/oodialog/mouse/dragNdrop.h new file mode 100644 index 0000000..0ea61dd --- /dev/null +++ b/modules/windows/oodialog/mouse/dragNdrop.h @@ -0,0 +1,45 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_NFL_DLG 100 +#define IDC_LV_WEST 1005 +#define IDC_LV_EAST 1007 +#define IDC_LV_NFL 1008 diff --git a/modules/windows/oodialog/mouse/dragNdrop.rc b/modules/windows/oodialog/mouse/dragNdrop.rc new file mode 100644 index 0000000..382c717 --- /dev/null +++ b/modules/windows/oodialog/mouse/dragNdrop.rc @@ -0,0 +1,59 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "dragNdrop.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_NFL_DLG DIALOGEX 0, 0, 526, 345 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "NFL Dream Teams West vs East" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + LTEXT "Top NFL Players:", IDC_STATIC, 14, 10, 82, 13, SS_LEFT | SS_CENTERIMAGE + CONTROL "", IDC_LV_NFL, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 10, 25, 242, 275 + LTEXT "A Team Players (West):", IDC_STATIC, 278, 10, 103, 13, SS_LEFT | SS_CENTERIMAGE + CONTROL "", IDC_LV_WEST, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 274, 25, 242, 123 + LTEXT "B Team Players (East):", IDC_STATIC, 278, 162, 82, 13, SS_LEFT | SS_CENTERIMAGE + CONTROL "", IDC_LV_EAST, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 274, 177, 242, 123 + LTEXT "Pick your A team and B team by dragging Top NFL Players to the West or East team.", IDC_STATIC, 11, 310, 237, 19, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 411, 321, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 466, 321, 50, 14 +} diff --git a/modules/windows/oodialog/mouse/dragNdrop.rex b/modules/windows/oodialog/mouse/dragNdrop.rex new file mode 100755 index 0000000..4669683 --- /dev/null +++ b/modules/windows/oodialog/mouse/dragNdrop.rex @@ -0,0 +1,515 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 example program demonstrates one approach to adding drag-and-drop to an + * ooDialog program using the .Mouse class. + */ + + sd = locate() + .application~setDefaults('O', sd'dragNdrop.h', .false) + + dlg = .DreamTeamDlg~new(sd'dragNdrop.rc', IDD_NFL_DLG) + + if dlg~initCode == 0 then do + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + end + +::requires "ooDialog.cls" + +::class 'DreamTeamDlg' subclass RcDialog + +::method init + expose dropOkCursor noDropCursor cursorIsNoDrop dragging + forward class (super) continue + + -- This will load a cursor from a file. The file has to actually be a cursor + -- or the method will fail. The operating system will refuse to load anything + -- but an actual cursor. The return is an .Image object. + dropOkCursor = .Mouse~loadCursorFromFile(.application~srcDir"dragging.cur") + if dropOkCursor == 0 then do + say 'Error loading Drop Ok Cursor system error code:' .SystemErrorCode + self~initCode = 1 + return self~initCode + end + + -- This loads the system's predefined NO cursor. Again the return is a .Image + -- object. + noDropCursor = .Mouse~loadCursor("NO") + if noDropCursor == 0 then do + say 'Error loading No Drop Cursor, system error code:' .SystemErrorCode + self~initCode = 1 + return self~initCode + end + + cursorIsNoDrop = .false + dragging = .false + + return 0 + +::method initDialog + expose lvNFL lvWest lvEast noDropCursor dragItem nfl2west nfl2east + + lvNFL = self~newListView(IDC_LV_NFL) + self~setUpListView(lvNFL) + + lvWest = self~newListView(IDC_LV_WEST) + self~setUpListView(lvWest) + + lvEast = self~newListView(IDC_LV_EAST) + self~setUpListView(lvEast) + + self~setMice + + self~mapDropTargets + + dragItem = .nil + + +/** mapDropTargets() + * + */ +::method mapDropTargets private + expose lvNFL lvWest lvEast nfl2west nfl2east west2nfl west2east east2nfl east2west + + nfl2west = lvWest~clientRect + lvWest~mapWindowPoints(lvNFL~hwnd, nfl2west) + + nfl2east = lvEast~clientRect + lvEast~mapWindowPoints(lvNFL~hwnd, nfl2east) + + west2nfl = lvNFL~clientRect + lvNFL~mapWindowPoints(lvWest~hwnd, west2nfl) + + west2east = lvEast~clientRect + lvEast~mapWindowPoints(lvWest~hwnd, west2east) + + east2nfl = lvNFL~clientRect + lvNFL~mapWindowPoints(lvEast~hwnd, east2nfl) + + east2west = lvWest~clientRect + lvWest~mapWindowPoints(lvEast~hwnd, east2west) + + +::method doDrag private + expose oldCursor noDropCursor cursorIsNoDrop dragging + use arg lv, index, p, mouse + + mouse~capture + oldCursor = mouse~setCursor(noDropCursor) + + di = .DragItem~new(lv, index, p, mouse) + + cursorIsNoDrop = .true + dragging = .true + + return di + + +::method nflOnLBdown unguarded + expose lvNFL dragItem + use arg keyState, p, mouse + + index = lvNFL~hitTestInfo(p) + + if keyState \== 'lButton' | index = -1 then return .false + + lvNFL~assignFocus + lvNFL~focus(index) + lvNFL~select(index) + + if mouse~dragDetect(p) then do + dragItem = self~doDrag(lvNFL, index, p, mouse) + return .true + end + + return .false + +::method nflOnLBup unguarded + expose oldCursor cursorIsNoDrop dragging lvNFL lvWest lvEast dragItem nfl2west nfl2east + use arg keyState, p, mouse + + if dragging then do + okayToDrop = (cusorIsNoDrop \== .true) + + dragging = .false + cursorIsNoDrop = .false + mouse~releaseCapture + mouse~setCursor(oldCursor) + + if okayToDrop & dragItem \== .nil then do + if p~inRect(nfl2west) then do + dragItem~target = lvWest + end + else if p~inRect(nfl2east) then do + dragItem~target = lvEast + end + else do + -- Theoretically this can not happen, but just to be sure... + dragItem = .nil + return 0 + end + + -- The point p is in client coordinates of the NFL list view. We are + -- going to map that point back to the client coordinates of the list view + -- where the row is being dropped. Then the drag item can determine where + -- the insertion poing for the row should be in the target list view. + lvNFL~mapWindowPoints(dragItem~target~hwnd, p) + + dragItem~drop(p) + dragItem = .nil + end + end + + return 0 + + +::method nflOnMove unguarded + expose dragging dropOkCursor noDropCursor cursorIsNoDrop nfl2west nfl2east + use arg keyState, p, mouse + + if dragging then do + if p~inRect(nfl2west) then do + if cursorIsNoDrop then do + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else if p~inRect(nfl2east) then do + if cursorIsNoDrop then do + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else do + if \ cursorIsNoDrop then do + mouse~setCursor(noDropCursor) + cursorIsNoDrop = .true + end + end + end + + return 0 + +::method westOnLBdown unguarded + expose lvWest dragItem + use arg keyState, p, mouse + + index = lvWest~hitTestInfo(p) + + if keyState \== 'lButton' | index = -1 then return .false + + lvWest~assignFocus + lvWest~focus(index) + lvWest~select(index) + + if mouse~dragDetect(p) then do + dragItem = self~doDrag(lvWest, index, p, mouse) + return .true + end + + return .false + + +::method westOnLBup unguarded + expose oldCursor cursorIsNoDrop dragging lvNFL lvWest lvEast dragItem west2nfl west2east + use arg keyState, p, mouse + + if dragging then do + okayToDrop = (cusorIsNoDrop \== .true) + + dragging = .false + cursorIsNoDrop = .false + mouse~releaseCapture + mouse~setCursor(oldCursor) + + if okayToDrop & dragItem \== .nil then do + if p~inRect(west2nfl) then do + dragItem~target = lvNFL + end + else if p~inRect(west2east) then do + dragItem~target = lvEast + end + else do + -- Theoretically this can not happen, but just to be sure... + dragItem = .nil + return 0 + end + + -- The point p is in client coordinates of the West list view. We are + -- going to map that point back to the client coordinates of the list view + -- where the row is being dropped. Then the drag item can determine where + -- the insertion poing for the row should be in the target list view. + lvWest~mapWindowPoints(dragItem~target~hwnd, p) + + dragItem~drop(p) + dragItem = .nil + end + end + + return 0 + + +::method westOnMove unguarded + expose dragging dropOkCursor noDropCursor cursorIsNoDrop west2nfl west2east + use arg keyState, p, mouse + + if dragging then do + if p~inRect(west2nfl) then do + if cursorIsNoDrop then do + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else if p~inRect(west2east) then do + if cursorIsNoDrop then do + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else do + if \ cursorIsNoDrop then do + mouse~setCursor(noDropCursor) + cursorIsNoDrop = .true + end + end + end + + return 0 + +::method eastOnLBdown unguarded + expose lvEast dragItem + use arg keyState, p, mouse + + index = lvEast~hitTestInfo(p) + + if keyState \== 'lButton' | index = -1 then return .false + + lvEast~assignFocus + lvEast~focus(index) + lvEast~select(index) + + if mouse~dragDetect(p) then do + dragItem = self~doDrag(lvEast, index, p, mouse) + return .true + end + + return .false + + +::method eastOnLBup unguarded + expose oldCursor cursorIsNoDrop dragging lvNFL lvWest lvEast dragItem east2nfl east2west + use arg keyState, p, mouse + + if dragging then do + okayToDrop = (cusorIsNoDrop \== .true) + + dragging = .false + cursorIsNoDrop = .false + mouse~releaseCapture + mouse~setCursor(oldCursor) + + if okayToDrop & dragItem \== .nil then do + if p~inRect(east2nfl) then do + dragItem~target = lvNFL + end + else if p~inRect(east2west) then do + dragItem~target = lvWest + end + else do + -- Theoretically this can not happen, but just to be sure... + dragItem = .nil + return 0 + end + + -- The point p is in client coordinates of the East list view. We are + -- going to map that point back to the client coordinates of the list view + -- where the row is being dropped. Then the drag item can determine where + -- the insertion poing for the row should be in the target list view. + lvEast~mapWindowPoints(dragItem~target~hwnd, p) + + dragItem~drop(p) + dragItem = .nil + end + end + + return 0 + + +::method eastOnMove unguarded + expose dragging dropOkCursor noDropCursor cursorIsNoDrop east2nfl east2west + use arg keyState, p, mouse + + if dragging then do + if p~inRect(east2nfl) then do + if cursorIsNoDrop then do + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else if p~inRect(east2west) then do + if cursorIsNoDrop then do + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else do + if \ cursorIsNoDrop then do + mouse~setCursor(noDropCursor) + cursorIsNoDrop = .true + end + end + end + + return 0 + + + +::method setMice private + expose mLVnfl mLVwest mLVeast lvNFL lvWest lvEast + + mLVnfl = .Mouse~new(lvNFL) + mLVwest = .Mouse~new(lvWest) + mLVeast = .Mouse~new(lvEast) + + mLVnfl~connectEvent('LBUTTONDOWN', nflOnLBdown) + mLVnfl~connectEvent('LBUTTONUP', nflOnLBup) + mLVnfl~connectEvent('MOUSEMOVE', nflOnMove) + + mLVwest~connectEvent('LBUTTONDOWN', westOnLBdown) + mLVwest~connectEvent('LBUTTONUP', westOnLBup) + mLVwest~connectEvent('MOUSEMOVE', westOnMove) + + mLVeast~connectEvent('LBUTTONDOWN', eastOnLBdown) + mLVeast~connectEvent('LBUTTONUP', eastOnLBup) + mLVeast~connectEvent('MOUSEMOVE', eastOnMove) + +::method setUpListView private + use strict arg lv + + lv~addExtendedStyle("GRIDLINES DOUBLEBUFFER FULLROWSELECT") + lv~insertColumnPX(0, 'Player', 105, 'LEFT') + lv~insertColumnPX(1, 'Team', 115, 'CENTER') + lv~insertColumnPX(2, 'Position', 65, 'CENTER') + lv~insertColumnPX(3, 'Rating', 65, 'CENTER') + + if lv~id == .constDir[IDC_LV_NFL] then do + playerRows = self~getPlayers + do l over playerRows + lv~addRow( , , l~player, l~team, l~pos, l~rating) + end + end + +::method getPlayers private + + rows = .Array~new + + fileObj = .stream~new(.application~srcDir"nflPlayers.txt") + players = fileObj~makeArray + + do line over players + line = line~strip + if line~length == 0 | line~abbrev("#") | line~abbrev("/*") then iterate + + parse var line name', 'team', 'p', 'rating . + + r = .Directory~new + r~player = name + r~team = team + r~pos = p + r~rating = rating + rows~append(r) + end + + fileObj~close + + return rows + + +/* Class: DragItem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + + Drag items are an encapsulation of the data needed to drag and drop one row + of a list view to another. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'DragItem' + +::attribute target + +::method init + expose lv index row target + use arg lv, index, p, mouse + + row = .Directory~new + lv~getItemInfo(index, row) + row~player = row~text + + lv~getItemInfo(index, row, 1) + row~team = row~text + + lv~getItemInfo(index, row, 2) + row~pos = row~text + + lv~getItemInfo(index, row, 3) + row~rating = row~text + + target = .nil + +::method drop + expose lv index row target + use strict arg pt = 0 + + if target \== .nil then do + -- Drop the row at the end of the list by default. + targetIndex = target~items + + if pt~isA(.Point) then do + i = target~hitTestInfo(pt) + if i <> -1 then targetIndex = i + end + + target~addRow(targetIndex, , row~player, row~team, row~pos, row~rating) + + lv~delete(index) + + count = lv~items + if count <> 0 then do + if index == count then lv~select(index - 1) + else lv~select(index) + end + end + + diff --git a/modules/windows/oodialog/mouse/dragging.cur b/modules/windows/oodialog/mouse/dragging.cur new file mode 100644 index 0000000..064623d Binary files /dev/null and b/modules/windows/oodialog/mouse/dragging.cur differ diff --git a/modules/windows/oodialog/mouse/mouseWheel.h b/modules/windows/oodialog/mouse/mouseWheel.h new file mode 100644 index 0000000..ffce8de --- /dev/null +++ b/modules/windows/oodialog/mouse/mouseWheel.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_HELP 101 +#define IDC_EDIT_DATA 1000 +#define IDC_HELP_TEXT 1002 +#define IDD_MOUSE_DLG 1033 +#define IDC_EDIT_COMMAND 1035 +#define IDC_RB_ANYWHERE 1044 +#define IDC_RB_DIALOG 1045 +#define IDC_RB_ON_EDIT_OK 1046 +#define IDC_RB_FOCUSED_ANYWHERE 1047 +#define IDC_RB_FOCUSED_DIALOG 1048 +#define IDC_RB_FOCUSED_EDIT 1049 diff --git a/modules/windows/oodialog/mouse/mouseWheel.rc b/modules/windows/oodialog/mouse/mouseWheel.rc new file mode 100644 index 0000000..917b056 --- /dev/null +++ b/modules/windows/oodialog/mouse/mouseWheel.rc @@ -0,0 +1,74 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "mouseWheel.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_HELP DIALOGEX 0, 0, 409, 305 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Help for the Mouse Wheel Demonstration" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + EDITTEXT IDC_HELP_TEXT, 10, 10, 389, 271, WS_VSCROLL | ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY | ES_WANTRETURN + DEFPUSHBUTTON "Close", IDOK, 350, 281, 49, 14 +} + + + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +IDD_MOUSE_DLG DIALOGEX 0, 0, 485, 303 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Mouse Wheel Demonstration" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +{ + EDITTEXT IDC_EDIT_DATA, 10, 10, 465, 208, WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE + GROUPBOX "When To Scroll With Mouse Wheel", IDC_STATIC, 10, 223, 319, 70 + AUTORADIOBUTTON "Mouse is anywhere", IDC_RB_ANYWHERE, 19, 237, 131, 10 + AUTORADIOBUTTON "Mouse is over dialog", IDC_RB_DIALOG, 19, 256, 131, 10 + AUTORADIOBUTTON "Mouse over edit controls / Ok button", IDC_RB_ON_EDIT_OK, 19, 275, 131, 10 + AUTORADIOBUTTON "Multi-line edit focused / mouse anywhere", IDC_RB_FOCUSED_ANYWHERE, 161, 237, 165, 10 + AUTORADIOBUTTON "Multi-line edit focused / mouse over dialog", IDC_RB_FOCUSED_DIALOG, 161, 256, 165, 10 + AUTORADIOBUTTON "Multi-line edit focused / mouse over edit control", IDC_RB_FOCUSED_EDIT, 161, 275, 165, 10 + LTEXT "Command:", IDC_STATIC, 340, 233, 33, 14, SS_LEFT | SS_CENTERIMAGE + EDITTEXT IDC_EDIT_COMMAND, 377, 233, 98, 14, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", IDOK, 371, 279, 50, 14 + PUSHBUTTON "Help", IDHELP, 426, 279, 50, 14 +} diff --git a/modules/windows/oodialog/mouse/mouseWheel.rex b/modules/windows/oodialog/mouse/mouseWheel.rex new file mode 100755 index 0000000..f6a620e --- /dev/null +++ b/modules/windows/oodialog/mouse/mouseWheel.rex @@ -0,0 +1,761 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * An example program showing how to work with the mouse wheel. + * + * The ooDialog programmer can capture mouse wheel event by using the + * connectEvent() method of the .Mouse class. The event handler for the + * connection will be invoked each time the user turns the scroll wheel on the + * mouse. The event handler can then use the arguments passed to it to do + * custom scrolling. + * + * Read throught the code comments to understand how this works. + * + * The dialog for this program contains a large multi-line edit control with a + * number of lines in it. For each turn of the mouse scroll wheel, the text in + * the edit control is scrolled 1 line. If the shift key is held down while + * turning the mouse scroll wheel, the text is scrolled 3 lines instead of 1. + * If the control key is down, the text is scrolled 1 page and if both the + * shift and control keys are down, the text is scrolled 3 pages. + * + * The Help button in the dialog displays text explaining the dialog. Use the + * help button to see the expected behavior of the dialog and compare the + * behavior with the implementing code in this file. + */ + + -- First we locate the direcotry our source code is in. This allows us to + -- build complete path names to our resource files, which in turn allows this + -- program to be run from anywhwere on the computer. For instance the program + -- file can be dragged and dropped on ooDialog.exe and it will run correctly. + srcDir = locate() + + -- When programmers wish to use symbolic resource IDs in their programs, as + -- this program does, it is much easier to use the global constant directory, + -- (.constDir,) rather than the constDir attribute of a dialog. Using the + -- .constDir Only is by far the most efficient way to use symbolic IDs. + -- + -- The use of the global constant directory is controlled by the .Application + -- object. The .Application object is also used to set other application-wide + -- defaults or values. In this program, we also want to make the default for + -- automatic data detection to be off. Both of these requirements can be done + -- with one method call to the .Application object. As a convenience, the + -- setDefaults() method will also populate the .constDir with symbols. + -- + -- In this invokcation, the application is set to use the .constDir only, "O", + -- symbols are loaded into the .constDir from the file: ContextMenu.h, and the + -- default for automatic data detection is set to off (.false.) +.application~setDefaults('O', srcDir'mouseWheel.h', .false) + +dlg = .MouseDemo~new(srcDir"mouseWheel.rc", IDD_MOUSE_DLG) + +if dlg~initCode <> 0 then do + msg = "Error initializing the Mouse Wheel Demonstration dialog." || '0d0a0d0a'x || - + "This example will have to quit." + j = MessageDialog(msg, 0, "Application Error", "OK", "ERROR") + return 99 +end + +dlg~execute("SHOWTOP") +return 0 + +::requires 'ooDialog.cls' + +::class 'MouseDemo' subclass RcDialog + +/** initDialog() + * + * The ooDialog framework automatically invokes the initDialog() method + * immediately after the underlying Windows dialog is created. This makes it + * the correct place to do any initialization that requires the underlying + * dialog and dialog controls to exist. + * + * This is a typical initDialog(), but take note of these points. The mouse + * wheel event notification is sent by the operating system to the window with + * the current input focus. If the window does not process the message, then + * the OS sends the message to the parent window of that window. This continues + * on up the parent / child window chain until either a window does process the + * notification or the top of the chain is reached. + * + * Multi-line edit controls *do* process the notification and normally handle + * their own scrolling. Because of this, we need to get two mouse objects. One + * for this dialog and one for the edit control. We then connect the mouse + * wheel event in both mouse objects to a method in this dialog. + */ +::method initDialog + expose eData pbOk eCommand process + + -- Connect the help key event to our onHelp() method. + self~connectHelp(onHelp) + + eData = self~newEdit(IDC_EDIT_DATA) + + -- Get a mouse object for the edit control and connect the mouse wheel event. + -- There are several options of how to handle this. We could, using options + -- to connectEvent(), either have the edit control's mouse wheel events + -- connect to the same method as we connect the the dialog's mouse wheel + -- events to, or have them connect to a separate method. + -- + -- In this case we choose the later, and specify the onEditMouseWheel() + -- method. + -- + -- Note that onEditMouseWheel() method will only be invoked when the + -- IDC_EDIT_DATA edit control has the focus. + mouse = .Mouse~new(eData) + mouse~connectEvent('MOUSEWHEEL', onEditMouseWheel) + + -- Connect all mouse wheel events that reach the dialog to a method in this + -- dialog. The default method name is onMouseWheel, so we omit the method + -- name arugment and name our method in this dialog: 'onMousWheel'. + -- + -- Note that this onMouseWheel() method will never be invoked if the + -- IDC_EDIT_DATA edit control has the focus. + mouse = .Mouse~new(self) + mouse~connectEvent('MOUSEWHEEL') + + -- Set up the radio buttons, connect a click event on any of them to our + -- single onRbSelect() method. + self~connectButtonEvent(IDC_RB_ANYWHERE , 'CLICKED', onRbSelect) + self~connectButtonEvent(IDC_RB_DIALOG , 'CLICKED', onRbSelect) + self~connectButtonEvent(IDC_RB_ON_EDIT_OK , 'CLICKED', onRbSelect) + self~connectButtonEvent(IDC_RB_FOCUSED_ANYWHERE, 'CLICKED', onRbSelect) + self~connectButtonEvent(IDC_RB_FOCUSED_DIALOG , 'CLICKED', onRbSelect) + self~connectButtonEvent(IDC_RB_FOCUSED_EDIT , 'CLICKED', onRbSelect) + + -- Set the initial checked state to the 'Mouse is anywhere' radio button. + self~newRadioButton(IDC_RB_ANYWHERE)~check + process = "ANYWHERE" + + -- Save a reference to the ok push button and the single-line edit control. + pbOk = self~newPushButton(IDOK) + eCommand = self~newEdit(IDC_EDIT_COMMAND) + + -- Fill the edit control with data so we can see the scrolling. + text = '' + do i = 1 to 300 + text ||= 'Line number' || '09'x || i || '09'x || 'Mouse Wheel Demonstation' || .endOfLine + end + eData~setText(text) + + +/** onMouseWheel() + * + * This is an event handler for the mouse wheel event. Three arguments are + * sent to the event handler by the ooDialog framework. + * + * @param state A list of keywords that indicate the keyboard and mouse button + * modifiers. The list of possible words is exactly: + * + * None Control lButton mButton rButton Shift xButton1 xButton2 + * + * The none keyword will always be by itself, otherwise, the list + * can consist of one or more of the keywords. + * + * @param pos A .Point object that represents the position of the mouse + * pointer on the screen. This is in screen co-ordinates, in + * pixels. + * + * @param mouse The mouse object that connected this event. For our purposes + * we don't need the mouse so we just ignore this argument. + * + * @param delta A whole number that represents the amount the scroll wheel was + * turned. The number will always be a multiple of 120 because + * that is what the operating system sends. If the number is + * positive, the user turned the wheel away from herself and + * indicates to scroll up. When negative the user turned the + * wheel towards himself, and indicates to scroll down. + * + * At this point in time (c. 2011) the OS sends the event + * notification for each notch of the scroll wheel and so delta + * will always be 120 or -120. + * + * Because of the 2 mouse~connectEvent() calls in initDialog() the method will + * only be called when the dialog is the active window and the multi-line edit + * control does *not* have the focus. We simply delegate to the maybeScroll() + * method, passing on 3 of the arguments and .false to indicate the edit control + * does not have the focus. + */ +::method onMouseWheel unguarded + use arg state, pos, mouse, delta + + return self~maybeScroll(delta, state, pos, .false) + + +/** onEditMouseWheel + * + * This is an event handler for the mouse wheel event. The arguments are + * explained in the comment header for onMouseWheel(). + * + * Because of the 2 mouse~connectEvent() calls in initDialog() this method will + * *only* be called when the edit control has the focus. + * + * We simply delegate to the maybeScroll() method, passing on the 3 arguments + * and .true to indicate the edit control has the focus. + */ +::method onEditMouseWheel unguarded + use arg state, pos, mouse, delta + + return self~maybeScroll(delta, state, pos, .true) + + +/** maybeScroll + * Based on the arguments, we determine whether to scroll or not. + * + * In all cases .true is returned, which is eventually returned by the + * event handler. This indicates that the event message was processed. + */ +::method maybeScroll private + expose process eData + use strict arg delta, state, pos, focused + + -- Eliminate some easy stuff + if process~abbrev("FOCUSED"), \ focused then return 0 + + select + when process~right(8) == "ANYWHERE" then return self~scroll(delta, state) + when process~right(6) == "DIALOG" then return self~scrollOnDialog(delta, state, pos) + when process == "ON_EDIT_OK" then return self~scrollOnControls(delta, state, pos) + when process == "FOCUSED_EDIT", focused then return self~scrollOnEdit(delta, state, pos) + otherwise do + return .true + end + end + -- End select + + +/** scrollOnDialog() + * + * Determines if the position of the cursor (pos) is over the dialog window. If + * it is, we scroll, otherwise we do not scroll. + * + * In all cases .true is returned, which is eventually returned by the + * event handler. This indicates that the event message was processed. + */ +::method scrollOnDialog private + use strict arg delta, state, pos + + if pos~inRect(self~windowRect) then return self~scroll(delta, state) + + return .true + +/** scrollOnEdit() + * + * Determines if the position of the cursor (pos) is over the multi-line edit + * control. If it is, we scroll, otherwise we do not scroll. + * + * In all cases .true is returned, which is eventually returned by the + * event handler. This indicates that the event message was processed. + */ +::method scrollOnEdit private + expose eData + use strict arg delta, state, pos + + if pos~inRect(eData~windowRect) then return self~scroll(delta, state) + + return .true + + +/** scrollOnControls() + * + * Determines if the position of the cursor (pos) is over one of the edit + * controls, or over the Ok button. If it is, we scroll, otherwise we do not + * scroll. + * + * In all cases .true is returned, which is eventually returned by the + * event handler. This indicates that the event message was processed. + */ +::method scrollOnControls private + expose eData pbOk eCommand + use strict arg delta, state, pos + + if pos~inRect(eData~windowRect) | pos~inRect(eCommand~windowRect) | - + pos~inRect(pbOk~windowRect) then do + return self~scroll(delta, state) + end + + return .true + + +/** scroll() + * + * This private method is where the scrolling is actually done. It is called + * by other methods that have determined the mouse is in the correct place for + * scrolling to happen. delta and state are the orignal arguments sent to the + * mouse wheel event handler. See onMouseWheel() and onEditMouseWheel() for + * the explanation of the arguments. + * + * Based on the arguments, we have the edit control scroll the appropriate + * amount. In all cases we return .true which is eventually returned by the + * event handler. This indicates that the event message was processed. + */ +::method scroll private + expose eData + use strict arg delta, state + + if delta < 0 then do + select + when state == 'None' then eData~scrollCommand("DOWN") + + when state~wordPos('Control') <> 0, state~wordPos('Shift') <> 0 then do + -- Scroll 3 pages down. + eData~scrollCommand('PAGEDOWN', 3) + end + + when state~wordPos('Control') <> 0 then do + -- Scroll page down. + eData~scrollCommand('PAGEDOWN') + end + + when state~wordPos('Shift') <> 0 then do + -- Scroll 3 lines down. + eData~scrollCommand('DOWN', 3) + end + + otherwise do + -- Ignore all others and scroll 1 line. + eData~scrollCommand("DOWN") + end + end + -- End select + end + else do + -- Same as above, but scroll up. + select + when state == 'None' then eData~scrollCommand("UP") + + when state~wordPos('Control') <> 0, state~wordPos('Shift') <> 0 then do + -- Scroll 3 pages down. + eData~scrollCommand('PAGEUP', 3) + end + + when state~wordPos('Control') <> 0 then do + -- Scroll page down. + eData~scrollCommand('PAGEUP') + end + + when state~wordPos('Shift') <> 0 then do + -- Scroll 3 lines down. + eData~scrollCommand('UP', 3) + end + + otherwise do + -- Ignore all others and scroll 1 line. + eData~scrollCommand("UP") + end + end + -- End select + end + + return .true + + +/** onRbSelect() + * + * This is the event handler for a button click on one of the radio buttons. + * + * With auto radio buttons, (which the radio buttons in this program are,) when + * a radio button is clicked, it is automatically set to the selected state. + * + * Each time a radio button becomes the selected button, we update the process + * variable. That way 'process' always reflects which radio button is currently + * selected. + * + * The event handler is sent five arguments. However the first two are left + * over from the old IBM ooDialog implementation and we ignore them. We only + * need the third 'id' argument, so we ignore the last two args also. + */ +::method onRbSelect + expose process + use arg , , id + + select + when id == .ConstDir[IDC_RB_ANYWHERE ] then process = "ANYWHERE" + when id == .ConstDir[IDC_RB_DIALOG ] then process = "DIALOG" + when id == .ConstDir[IDC_RB_ON_EDIT_OK ] then process = "ON_EDIT_OK" + when id == .ConstDir[IDC_RB_FOCUSED_ANYWHERE] then process = "FOCUSED_ANYWHERE" + when id == .ConstDir[IDC_RB_FOCUSED_DIALOG ] then process = "FOCUSED_DIALOG" + when id == .ConstDir[IDC_RB_FOCUSED_EDIT ] then process = "FOCUSED_EDIT" + otherwise + nop + end + -- End select + + +/** help() + * + * This is the event handler for the IDHELP command. Any button or menu item + * with the resource ID of IDHELP will generate the HELP command event. The + * ooDialog framework automatically connects the IDOK, IDCANCEL, and IDHELP + * commands to the ok(), cancel(), and help() methods in the dialog object. + * + * The default help() method does nothing. To do something the programmer over- + * rides the method in her subclass. Here we simply invoke the onHelp() method + * to do the work. + * + * Do not confuse the HELP command event with the help key (F1) event. + */ +::method help + self~onHelp + +/** onHelp() + * + * This is the event handler for the help key (F1) event. The event is + * generated when the user presses the F1 key. + * + * The programmer connects this event to a method in the Rexx dialog by using + * the connectHelp() method. Here in this event handler, we show a modal dialog + * with some help text. + * + * Do not confuse the help key (F1) event with the HELP command event. + */ +::method onHelp + .MouseDemoHelp~new(.application~srcDir'mouseWheel.rc', IDD_HELP)~execute("SHOWTOP") + + +/** class::MouseDemoHelp + * + * This is a very simple dialog subclass whose purpose is to display the help + * text for the Mouse Wheel Demonstration program. + * + * Note that we set up our own handlers for the mouse wheel event for the help + * text simply to provide more example code. There is really not much need to + * do this. The edit control by default handles the scrolling for the mouse + * wheel itself. There is not a compelling reason in this dialog to not simply + * let the edit control handle the scrolling for us. (Other than the reason + * mentioned, to provide more code example.) + */ +::class 'MouseDemoHelp' subclass RcDialog + +::method initDialog + expose newFont e visibleLines + + -- Connect the mouse wheel event to a method in this dialog. We don't specify + -- a method name, we'll just accept the default name of onMouseWheel. + .Mouse~new(self)~connectEvent('MOUSEWHEEL') + + e = self~newEdit(IDC_HELP_TEXT) + + -- In this case we have the edit control not process the mouse wheel, but + -- rather pass the message on to the dialog. The fourth optional parameter of + -- SENDTODLG is a keyword that causes the mouse wheel notfication to be + -- passed on up the parent / child window chain and not sent to the edit + -- control. + -- + -- The effect of this is that the edit control never even sees the + -- notification, allowing our onMouseWheel() method to handle all mouse wheel + -- notifications, not matter where the mouse is over our dialog. + .Mouse~new(e)~connectEvent('MOUSEWHEEL', 'NOOP', , "SENDTODLG") + + -- Create a mono-spaced font for the edit control that displays the help text. + newFont = self~createFontEx('Courier New', 9) + + -- Set the font of the edit control to our custom font, set the text of the + -- edit control to our help text. + e~setFont(newFont) + e~setText(getHelpText()) + + -- visibleLines is the number of visible lines in the edit control. It is + -- only used if the user scrolls the help text using the mouse wheel. So, we + -- use lazy evaluation. It is only calculated if needed. + visibleLines = 0 + + +/** onMouseWheel + * + * This is the event handler for the mouse wheel event. We connected the event + * to this method through the Mouse connectEvent() method in initDialog(). + * + * The comment header for the onMouseWheel() event handler in the maid dialog + * explains the arguments in detail. + * + * The system-wide wheelScrollLines parameter is used to indicate how much to + * scroll for 1 notch of a turn of the mouse wheel. The system default is 3, + * but the user can set this to what they want. + * + * Microsoft says this about the wheel scroll lines parameter: it is the + * suggested number of lines to scroll when there are no modifier keys; if the + * value is 0, no scrolling should be done; if the value is greater than the + * number of visible lines, or its value is WHEEL_PAGESCROLL, it should be + * interpreted as clicking once in the page down or page up area of the scroll + * bar. + */ +::method onMouseWheel unguarded + expose e visibleLines + use arg state, pos, mouse, delta + + if visibleLines == 0 then visibleLines = self~calcVisibleLines(e) + + if delta > 0 then direction = 'up' + else direction = 'down' + + scrollLines = .SPI~wheelScrollLines + + -- scrollLines is only meant to indicate the number of lines to scroll when + -- there are no modifier keys or mouse buttons. + if state \== 'None' then do + select + when state~wordPos("Shift") <> 0, state~wordPos('Control') <> 0 then do + if direction == 'up' then e~scrollCommand('PAGEUP', 3) + else e~scrollCommand('PAGEDOWN', 3) + return .true + end + + when state~wordPos('Shift') then do + if direction == 'up' then e~scrollCommand('UP', 3) + else e~scrollCommand('DOWN', 3) + return .true + end + + when state~wordPos('Control') then do + if direction == 'up' then e~scrollCommand('PAGEUP') + else e~scrollCommand('PAGEDOWN') + return .true + end + + otherwise do + -- Some other modifier, key or mouse, is active. There are a lot of + -- things we could do, but for simplicity we are going to just ignore + -- this. + return .false + end + end + -- End select + end + + -- No modifiers, we use the system scroll lines value to decide how much to + -- scroll. + select + when scrollLines == 0 then do + -- Indicates to not scroll + end + + when scrollLines == .SPI~WHEEL_PAGESCROLL then do + -- This setting indicates to scroll 1 page. + if direction == 'up' then e~scrollCommand('PAGEUP') + else e~scrollCommand('PAGEDOWN') + end + + when scrollLines > visibleLines then do + -- Scroll 1 page. + if direction == 'up' then e~scrollCommand('PAGEUP') + else e~scrollCommand('PAGEDOWN') + end + + otherwise do + -- Scroll the number of lines specified by wheel scroll lines parameter. + if direction == 'up' then e~scrollCommand('UP', scrollLines) + else e~scrollCommand('DOWN', scrollLines) + end + end + -- End select + + return .true + + +/** caclVisibleLines() + * + * Calculates the number of visible lines in the edit control. This is done + * by gettting the size of the edit control formatting rectangle in pixels and + * the size of a string in the edit controls in pixels. The height of the + * formatting rectangle is then divided by the height of a line of text. + * + * When getting the height of a line in the edit control, any string can be used + * because we only need the height of the string. The length does not matter. + * + * On my first try at this, I used the client rect of the edit control for the + * calculation. But, it was off by 1. The proper way to calculate the height + * is to use the formatting rectangle. The edit control does all its drawing + * within that rectangle. + */ +::method calcVisibleLines private + use strict arg editCtrl + + fRect = editCtrl~getRect + + height = fRect~bottom - fRect~top + lineHeight = editCtrl~getTextSizePX("Any string will do for this")~height + + -- Note that we return a whole number here, not a fraction. The number is + -- exactly the number of *whole* lines in the edit control. Quite often in a + -- dialog, a multi-line edit control will contain a partial line, (as does + -- this dialog.) + return height % lineHeight + +/** leaving() + * + * The leaving method is invoked automatically by the ooDialog framework + * immediately before the dialog is destroyed. + * + * At this point, the underlying Windows dialog still exists. This makes the + * leaving method the proper place to do clean up. Especially if some of the + * clean up, as does deleteFont(), requires the underlying dialog to exist. + * + * Here we delete the mono-spaced font created for the help text display. + */ +::method leaving + expose newFont + + self~deleteFont(newFont) + + +/** routine::getHelpText() + * + * This is convenience routine that returns the help text for the Mouse Wheel + * demonstration program. The help text is constructed here as a single string. + * + * The text could be contained in a file and read in when needed. To reduce the + * nubmer of files needed for the program, the text was just typed into the + * program file. + */ +::routine getHelpText + + txt = - +'' || .endOfLine || - +'' || .endOfLine || - +' The Mouse Wheel Demonstration' || .endOfLine || - +' =============================' || .endOfLine || - +'' || .endOfLine || - +' This demonstration program allows you to scroll the lines of text in the' || .endOfLine || - +' main edit control using the mouse wheel.' || .endOfLine || - +'' || .endOfLine || - +'' || .endOfLine || - +' Scrolling' || .endOfLine || - +' =========' || .endOfLine || - +'' || .endOfLine || - +' When the mouse wheel is rotated one notch, the text is scrolled one line.' || .endOfLine || - +' Rotating the mouse wheel away from yourself scrolls the text up, while' || .endOfLine || - +' rotating the wheel towards yourself scrolls the text down. When the text' || .endOfLine || - +' is scrolled to line 1, scrolling up stops. Likewise when the lines of' || .endOfLine || - +' text are scrolled all the way to the bottom, scrolling down stops.' || .endOfLine || - +'' || .endOfLine || - +' Holding down the control and or the shift keys while rotating the mouse' || .endOfLine || - +' wheel changes the amount of text scrolled by rotating one notch of the' || .endOfLine || - +' mouse wheel. This is summarized in the following table:' || .endOfLine || - +'' || .endOfLine || - +' Notches Key Lines' || .endOfLine || - +' Rotated Down Scrolled' || .endOfLine || - +' =======================================' || .endOfLine || - +' 1 None 1' || .endOfLine || - +' ---------------------------------------' || .endOfLine || - +' 1 Shift 3' || .endOfLine || - +' ---------------------------------------' || .endOfLine || - +' 1 Control 1 page' || .endOfLine || - +' ---------------------------------------' || .endOfLine || - +' 1 Control' || .endOfLine || - +' & 3 pages' || .endOfLine || - +' Shift' || .endOfLine || - +' ---------------------------------------' || .endOfLine || - +'' || .endOfLine || - +'' || .endOfLine || - +' Radio Buttons' || .endOfLine || - +' =============' || .endOfLine || - +'' || .endOfLine || - +' The radio buttons at the bottom of the dialog change how the position of' || .endOfLine || - +' the mouse pointer affects whether the text is scrolled, or not.' || .endOfLine || - +'' || .endOfLine || - +' Text is never scrolled unless the dialog has the input focus. This' || .endOfLine || - +' essentially means when the dialog is the active window.' || .endOfLine || - +'' || .endOfLine || - +' The following table assigns a number to each radio button according to' || .endOfLine || - +' the text of the radio button. The next table uses the radio button' || .endOfLine || - +' number to describe its function.' || .endOfLine || - +'' || .endOfLine || - +' Radio Radio' || .endOfLine || - +' Button Button' || .endOfLine || - +' # Text' || .endOfLine || - +' =========================================================================' || .endOfLine || - +' 1 Mouse is anywhere' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 2 Mouse is over dialog' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 3 Mouse over edit controls / Ok button' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 4 Multi-line edit focused / mouse anywhere' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 5 Multi-line edit focused / mouse over dialog' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 6 Multi-line edit focused / mouse over edit control' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +'' || .endOfLine || - +'' || .endOfLine || - +' Radio Text is' || .endOfLine || - +' Button scrolled' || .endOfLine || - +' # when:' || .endOfLine || - +' =========================================================================' || .endOfLine || - +' 1 The mouse pointer is anywhere on the screen. It does not have' || .endOfLine || - +' to be over the dialog at all.' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 2 Only when the mouse pointer is over dialog. If the pointer is' || .endOfLine || - +' moved outside of the dialog, the scrolling stops.' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 3 Only when the mouse pointer is directly over one of the two' || .endOfLine || - +' edit controls, or directly over the Ok button.' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 4 First the multi-line edit control must have the focus. If any' || .endOfLine || - +' other control has the focus, text is not scrolled. The mouse' || .endOfLine || - +' pointer can be anywhere on the screen.' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 5 The multi-line edit control must have the focus. The mouse' || .endOfLine || - +' pointer must be directly over the dialog.' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +' 6 The multi-line edit control must have the focus. The mouse' || .endOfLine || - +' pointer must be directly over the multi-line edit control.' || .endOfLine || - +' -------------------------------------------------------------------------' || .endOfLine || - +'' || .endOfLine || - +'' || .endOfLine || - +' Edit Controls' || .endOfLine || - +' =============' || .endOfLine || - +'' || .endOfLine || - +' Large, top, edit control:' || .endOfLine || - +' -------------------------' || .endOfLine || - +' This contains the text that is scrolled. You can type into this control' || .endOfLine || - +' to add or remove lines.' || .endOfLine || - +'' || .endOfLine || - +' Small, bottom, edit control labeled Command:' || .endOfLine || - +' --------------------------------------------' || .endOfLine || - +' This control serves no purpose, other than to take up real estate in the' || .endOfLine || - +' dialog. You can typ in this control, but it does nothing.' || .endOfLine || - +'' || .endOfLine || - +'' || .endOfLine || - +' Push Buttons' || .endOfLine || - +' ============' || .endOfLine || - +'' || .endOfLine || - +' Ok button -> Closes the dialog' || .endOfLine || - +'' || .endOfLine || - +' Help button -> Shows this help.' || .endOfLine + + return txt diff --git a/modules/windows/oodialog/mouse/nflPlayers.txt b/modules/windows/oodialog/mouse/nflPlayers.txt new file mode 100644 index 0000000..1041a0e --- /dev/null +++ b/modules/windows/oodialog/mouse/nflPlayers.txt @@ -0,0 +1,113 @@ +# This list of top NFL players was compiled by Berkeley Miesfeld. +# +# +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +Tom Brady, New England Patriots, QB, ***** +Cam Newton, Carolina Panthers, QB, ***+ +Matt Hasselbeck, Tennessee Titans, QB, **+ +Tim Tebow, Denver Broncos, QB, *** +Chris Johnson, Tennessee Titans, RB, ***+ +Maurice Jones-Drew, Jacksonville Jaguars, RB, ***** +Frank Gore, San Francisco 49ers, RB, **** +Marshawn Lynch, Seattle Seahawks, RB, *** +Vonta Leach, Baltimore Ravens, FB, ***** +Ovie Mughelli, Atlanta Falcons, FB, ***** +Leonard Weaver, Philadelphia Eagles, FB, ***** +Tony Richardson, New York Jets, FB, ***** +Rob Gronkowski, New England Patriots, TE, ****+ +Vernon Davis, San Francisco 49ers, TE, *** +Kellen Winslow, Tampa Bay Buccaneers, TE, **+ +Brent Celek, Philadelphia Eagles, TE, ***- +Wes Welker, New England Patriots, WR, ***** +Percy Harvin, Minnesota Vikings, WR, *** +Dwayne Bowe, Kansas City Chiefs, WR, ****- +Hakeem Nicks, New York Giants, WR, ***- +Kris Dielman, San Diego Chargers, G, ***** +Carl Nicks, New York Giants, G, ***** +Steve Hutchinson, Minnesota Vikings, G, **** +Michael Roos, Tennessee Titans, T, ***+ +Tyson Clabo, Atlanta Falcons, T, *** +Ryan Clady, Denver Broncos, T, *** +Nick Mangold, New York Jets, C, ***** +Andre Gurode, Dallas Cowboys, C, **** +Maurkice Pouncey, Steelers, C, ***+ +Johnathan Babineax, Tennessee Titans, DT, ***+ +Vince Wilfork, New England Patriots, DT, ****+ +Richard Seymour, Oakland Raiders, DT, **** +Domata Peko, Cincinnati Bengals, DT, ***+ +Ndamukong Suh, Detriot Lions, DT, ****- +Jay Ratliff, Dallas Cowboys, DT, **** +Antonio Garay, San Diego Chargers, DT, *** +Jared Allen, Minnesota Vikings, DE, ***** +Jason Babin, Philadelphia Eagles, DE, ***** +Haloti Ngata, Baltimore Ravens, DE, **** +Jason Pierre-Paul, New York Giants, DE, ***+ +Osi Umemyiora, New York Giants, DE, **** +Julius Peppers, Chicago Bears, DE, ***** +James Laurinitis, Saint Louis Rams, LB, *** +Daryl Smith, Jacksonvile Jaguars, LB, **** +Clay Matthews, Green Bay Packers, LB, ***** +Jon Beason, Carolina Panthers, LB, ***** +Takeo Spikes, San Diego Chargers, LB, ***- +Brian Urlacher, Chicago Bears, LB, **** +David Harris, New York Jets, LB, ***+ +Rolando McClain, Oakland Raiders, LB, ****- +Jerod Mayo, New England Patriots, LB, ****- +London Fletcher, Washington Redskins, LB, *****- +Michael Griffin, Tennessee Titans, S, ****+ +Oj Atogwe, Washington Redskins, S, ****+ +Laron Landry, Washington Redskins, S, ****+ +Adrian Wilson, Arizona Cardinals, S, ***** +Bob Sanders, San Diego Chargers, S, *** +Tyvon Branch, Oakland Raiders, S, ***+ +Nnamdi Asumogha, Philadelphia Eagles, CB, ***** +Darrelle Revis, New York Jets, CB, ***** +Asante Samuel, Philadelphia Eagles, CB, ****+ +Charles Woodson, Green Bay Packers, CB, ****+ +Chris Gamble, Carolina Panthers, CB, ***+ +Cortland Finnegan, Tennessee Titans, CB, **** +Antoine Winfield, Minnesota Vikings, CB, ****+ +Mike Nugent, Cincinnati Bengals, K, **** +David Akers, San Francisco 49ers, K, ***** +Billy Cundiff, Baltimore Ravens, K, ****+ +Adam Vinateri, Indianapolis Colts, K, *** +Shane Lechler, Oakland Raiders, P, ***** +Andy Lee, San Francisco 49ers, P, ***** +Pat McAfee, Indianapolis Colts, P, ***+ +Britton Colquitt, Denver Broncos, P, **** diff --git a/modules/windows/oodialog/oleinfo/help.txt b/modules/windows/oodialog/oleinfo/help.txt new file mode 100644 index 0000000..d68792f --- /dev/null +++ b/modules/windows/oodialog/oleinfo/help.txt @@ -0,0 +1,164 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + *** OLEINFO Help File *** + + Contents: + + 1. What is OLEINFO? + + 2. Using OLEINFO + 2.1 ProgID + 2.2 Look up + 2.3 Selecting a method + 2.4 Invoking a method + + 3. Disclaimer + + +1. What is OLEINFO? + +This REXX script helps you to gather information about the methods of an OLE +object. This is done through the use of the GetKnownMethods method of the +REXX OLE object. A comprehensive introduction to OLE can be found in the +Open Object REXX online documentation. + +GetKnownMethods retrieves information from the so-called "Type Library" of the +OLE object, which should be - but is not always - installed together with the +OLE object. + +To execute this sample the ooDialog extension of Open Object REXX is needed. +ooDialog is part of Open Object REXX for Windows + +2. Using OLEINFO + +First you have to specify the ProgID of the OLE object you want to +instantiate. If necessary, consult the documentation to find out what the +ProgID is. To specify the ProgID, either enter it into the ProgID text field +and press Enter, or look it up from the registry by using the Look Up button. +Instructions follow on how to do this. After the object has been created +successfully, a list with all its methods, properties, and events is displayed +in the main list window. The icons that are shown to the left of the item +names signify the following: + +Green down arrow: This is a method. +Yellow right arrow: This is a 'property get.' +Red left arrow: This is a 'property put.' +Blue waves: This is an event. + +For more information see your documentation of the OLE object. + + +2.1 ProgID + +If you already know the ProgID of the object you want to instantiate, simply +type it into the ProgID text field, and press Enter. + +Example: Enter "InternetExplorer.Application" and press Enter to start + Microsoft Internet Explorer, if it is installed on your system. + + +2.2 Look Up + +To search the registry for OLE objects, click the Look Up button. All entries +in HKEY_CLASSES_ROOT\CLSID with a VersionIndependentProgID (or ProgID) will be +put into the objects list. To instantiate an object, select it and click OK. +You can use the Search button to look for a specific entry; it searches the +list for entries beginning with the string you specify. The search is not +case-sensitive. + +Note: Not all entries in this list are useful. You can only instantiate OLE + objects that support the automation interface. + + +2.3 Selecting a method + +All the methods that are returned will be displayed in alphabetical order in +the "List of methods". Click a selected item to get detailed information. +This information is shown in the "Details" section, as follows: + +* Method signature + This displays the name of the method and the argument that it takes. What is + displayed depends on the options chosen in the check boxes in the "Show" line. + In the default setting, only the method name and the names of the parameters + are displayed. + The check boxes have the following functionality: + + - Types + Shows the OLE types of the method, its return type and argument types. + Conversion to and from these types is normally done automatically by the + REXX OLEObject. The types may give you an indication of what kind of object + to expect. + + Examples: + VT_BOOL <=> .TRUE or .FALSE in REXX + VT_BSTR <=> A REXX string. + VT_Ix <=> A whole number (x=1, x=2, x=4, or x=8). + VT_Rx <=> A real number (x=1, x=2, x=4, or x=8). + VT_VARIANT <=> This can be any REXX object representable as a VARIANT. + VT_DISPATCH <=> Another OLE object. + + - Flags + Shows the flags for the method arguments. These can be: + + in: This argument is the input to the method. + out: This argument creates output. See the documentation on 'out' + parameters. + opt: This argument is optional. + + Any combination of these flags can be used. + + - Member ID + Displays the so-called MemID of a method. It is used internally only. + +* Documentation + If a textual description of what the method does is available, it will be + displayed in this line. (Use the cursor to scroll to parts of the text that + do not fit into the visible area.) + + +2.4 Invoking a method + +To invoke a method of the OLE object, double-click the desired method in the +list of methods. An invocation window will appear, and here you can enter data. +If there are 'out' parameters you will not be able to change these fields. +Note that if you try to invoke a method by using wrong data, the entire +program may stop and give you an error message. The results of an invocation +will be displayed in another window. This will include one line showing the +result object, and also a list giving the output of possible 'out' parameters. +If an OLE object is returned, you can use this as the new object that the +viewer displays for you. diff --git a/modules/windows/oodialog/oleinfo/icons.bmp b/modules/windows/oodialog/oleinfo/icons.bmp new file mode 100644 index 0000000..a75daf9 Binary files /dev/null and b/modules/windows/oodialog/oleinfo/icons.bmp differ diff --git a/modules/windows/oodialog/oleinfo/oleinfo.rc b/modules/windows/oodialog/oleinfo/oleinfo.rc new file mode 100644 index 0000000..90464c7 --- /dev/null +++ b/modules/windows/oodialog/oleinfo/oleinfo.rc @@ -0,0 +1,116 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** +oleview.rc + +*****************************************************************************/ + +#include + +#define BITMAP_2 2 +#define DIALOG_5 5 +#define DIALOG_4 4 +#define HelpDialog 4714 +#define DIALOG_3 3 +#define ResultDialog 4713 +#define DIALOG_2 2 +#define RegistryDialog 4712 +#define DIALOG_1 1 +#define MainDialog 4711 + +MainDialog DIALOG 6, 15, 294, 318 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Open Object Rexx OLE/ActiveX Object Viewer" +FONT 10, "MS Shell Dlg" +{ + PUSHBUTTON "Exit", 200, 8, 296, 50, 14 + PUSHBUTTON "Help", IDHELP, 236, 296, 50, 14 + LTEXT "ProgID", -1, 8, 8, 52, 9 + LTEXT "Name", -1, 8, 22, 52, 8 + LTEXT "Documentation", -1, 8, 36, 52, 9 + EDITTEXT 101, 68, 22, 162, 11, ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP + EDITTEXT 102, 68, 36, 162, 11, ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP + PUSHBUTTON "Look up", 103, 236, 6, 50, 14 + GROUPBOX "List of methods, properties and events", 200, 8, 84, 278, 136, BS_GROUPBOX + GROUPBOX "Details", 201, 8, 224, 278, 60, BS_GROUPBOX + EDITTEXT 105, 72, 236, 208, 11, ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP + EDITTEXT 106, 72, 250, 208, 11, ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP + LTEXT "Method signature", -1, 12, 236, 58, 9 + LTEXT "Documentation", -1, 12, 250, 58, 9 + LTEXT "Show:", -1, 12, 268, 58, 9 + AUTOCHECKBOX "Types", 107, 72, 268, 32, 9 + AUTOCHECKBOX "Flags", 108, 116, 268, 36, 9 + AUTOCHECKBOX "Member ID", 109, 160, 268, 48, 9 + GROUPBOX "Progress", 202, 8, 52, 278, 28, BS_GROUPBOX + CONTROL "Progress", 110, "msctls_progress32", WS_CHILD | WS_VISIBLE, 12, 62, 270, 12 + CONTROL "", 104, "SysListView32", LVS_LIST | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 13, 95, 268, 121 + COMBOBOX 100, 67, 8, 164, 284, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP +} + +RegistryDialog DIALOG 6, 15, 198, 219 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Registry Information" +FONT 10, "MS Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 8, 196, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 140, 196, 50, 14 + LTEXT "ProgIDs from the registry", -1, 8, 8, 96, 12 + LISTBOX 200, 8, 24, 180, 164, LBS_STANDARD + PUSHBUTTON "Search", 201, 74, 196, 50, 14 +} +ResultDialog DIALOG 6, 15, 251, 219 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Result of method invocation" +FONT 10, "MS Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 100, 196, 50, 14 + LTEXT "Return Value", -1, 8, 8, 48, 9 + EDITTEXT 400, 64, 8, 174, 11, ES_AUTOHSCROLL | ES_READONLY | WS_BORDER | WS_TABSTOP + GROUPBOX "Out Parameters", 402, 8, 24, 232, 160, BS_GROUPBOX + LISTBOX 401, 16, 36, 216, 144, LBS_NOTIFY | WS_BORDER | LBS_USETABSTOPS | WS_BORDER | WS_VSCROLL +} +HelpDialog DIALOG 6, 15, 345, 208 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Help" +FONT 10, "Fixedsys" +{ + DEFPUSHBUTTON "OK", IDOK, 290, 188, 50, 14 + EDITTEXT 500, 4, 7, 336, 176, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_BORDER | WS_VSCROLL | WS_TABSTOP +} + + diff --git a/modules/windows/oodialog/oleinfo/oleinfo.rex b/modules/windows/oodialog/oleinfo/oleinfo.rex new file mode 100755 index 0000000..e2b1a10 --- /dev/null +++ b/modules/windows/oodialog/oleinfo/oleinfo.rex @@ -0,0 +1,654 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: OLEINFO.REX */ +/* Type: Open Object Rexx Script using ooDialog */ +/* Resource: OLEINFO.RC */ +/* */ +/* Description: */ +/* A "small" browser for OLE objects */ +/* */ +/****************************************************************************/ + +discard = locate() + +/* start the main dialog */ +MainDialog = .OLEINFO~new +if MainDialog~InitCode = 0 then do + rc = MainDialog~Execute("SHOWTOP") +end + +exit /* leave program */ + +::requires "ooDialog.cls" /* contains the ooDialog classes */ +::requires "WINSYSTM.CLS" /* used for registry lookup */ + +/*****************************************/ +/* This routine creates the OLE object */ +/* the code has been placed outside the */ +/* object code to safely catch any error */ +/* during creation of the OLE object */ +/*****************************************/ +::routine createObject + use arg target, name + target~currentObject=.nil + signal on syntax name returnToObject + target~currentObject=.OLEObject~new(name,"NOEVENTS") + signal on syntax + return +returnToObject: + signal on syntax + call RxMessageBox "Error" rc":" errortext(rc)||'0a'x||condition('o')~message, "Error", "OK", "EXCLAMATION" + return + +/*******************************************/ +/* This routine calls a method of the OLE */ +/* object. The code has been placed */ +/* outside the object code to safely catch */ +/* any error during the invocation */ +/*******************************************/ +::routine callMethod + use arg target, method, self + resultOfCall = "" + signal on syntax name callFailed + interpret "resultOfCall = target~"method + signal on syntax + return resultOfCall +callFailed: + call RxMessageBox "Error" rc":" errortext(rc)||'0a'x||condition('o')~message, "Error", "OK", "EXCLAMATION" + self~lastError=rc + signal on syntax + return resultOfCall + + +/**************************/ +/* Main Dialog of OLEINFO */ +/**************************/ +::class OLEINFO subclass UserDialog + +::method Init + expose cache + forward class (super) continue /* call parent constructor */ + InitRet = Result + + cache = .nil + /* load main dialog */ + if self~Load(.application~srcDir"OLEINFO.rc", 4711 ) \= 0 then do + self~InitCode = 1 + return 1 + end + + /* Connect dialog control items to class methods */ + self~connectButtonEvent(200, "CLICKED", "MyOk") + self~connectButtonEvent(103, "CLICKED", "Lookup") + + self~connectComboBoxEvent(100,"SELCHANGE","Ok") + self~connectListViewEvent(104,"ACTIVATE","selectDoubleClick") + self~connectListViewEvent(104,"CHANGED","selectionChange") + + self~connectButtonEvent(107, "CLICKED", "selectionChange") + self~connectButtonEvent(108, "CLICKED", "selectionChange") + self~connectButtonEvent(109, "CLICKED", "selectionChange") + + self~currentObject = .nil + self~currentObjectName = "" + return InitRet + +::method InitDialog + self~newListView(104)~setImageList(self~getImages, SMALL) + cb = self~newComboBox(100) + default = .array~of("InternetExplorer.Application","Excel.Application","Freelance.Application",, + "Notes.NotesSession","Lotus123.Workbook","Outlook.Application",, + "Word.Application","WordPro.Application","Access.Application") + do i over default + cb~add(i) + end + + /* Method Ok will be called if enter is pressed in dialog */ +::method Ok + cb = self~newComboBox(100) + if cb \= .nil then do + OLEID = cb~Title /* get ProgID or ClassID of OLE Object */ + if OLEID \= self~currentObjectName then do + call createObject self, OLEID + if self~currentObject \= .nil then do + self~currentObjectName=OLEID + self~updateView + end + else do + call RxMessageBox "Could not create OLE object", "Error", "OK", "EXCLAMATION" + cb~title = self~currentObjectName + end + end + end + return 0 /* don't leave dialog, this is done via method MyOk */ + + /* Method MyOk is connected to item 200 */ +::method MyOk + return self~OK:super /* make sure self~Validate is called and self~InitCode is set to 1 */ + + /* Method Help is connected to item 9 */ +::method Help + self~Help:super + file = .stream~new(.application~srcDir"help.txt") + data.500 = file~charin(,file~chars) + file~close + temp = .HelpDialog~new(data.) + if temp~InitCode = 0 then do + rc = temp~execute("SHOWTOP") + end + + /* Method Lookup is connected to item 103 */ +::method Lookup + expose cache + + self~Cursor_Wait + + progressBar = self~newProgressBar(110) + if cache == .nil then do + cache = .list~new + registry = .WindowsRegistry~new + if registry~InitCode \= 0 then return /* no access to registry? return */ + handle = registry~open(registry~classes_root, "CLSID", "READ") + + clslist. = registry~query(handle) + + registry~list(handle,info.) + + if progressBar \= .nil then do + progressBar~SetStep(1) + progressBar~SetRange(0,clslist.subkeys) + end + + do i =1 to clslist.subkeys + temphandle = registry~open(handle, info.i, "READ") + if temphandle \= 0 then do + templist. = registry~query(temphandle) + value = self~getProgID(registry,temphandle,progressBar) + registry~close(temphandle) + if value \= .nil then cache~insert(value) + end + end + registry~close(handle) + end + + if progressBar \= .nil then progressBar~SetPos(0) + self~Cursor_Arrow + + + picked = "" + temp = .RegistryDialog~new(,cache) + if temp~InitCode = 0 then do + rc = temp~execute("SHOWTOP") + if rc =1 then do + combo = self~newComboBox(100) + combo~title = temp~data200 + picked = combo~title + self~ok + end + end + cb = self~newComboBox(100) + if cb \= .nil then do + cb~DeleteAll + do i over cache + cb~add(i) + end + if picked \== "" then cb~title = picked + end + + /* extract ProgID from registry */ +::method getProgID + use arg registry, handle, progressBar + res = .nil + + /* try to get a version independent ProgID first */ + temphandle = registry~open(handle, "VersionIndependentProgID", "READ") + + if progressBar \= .nil then progressBar~step + + if temphandle \= 0 then do + registry~listvalues(temphandle,info.) + + res = info.1.data + + registry~close(temphandle) + end + else do + /* this failed, so maybe there's a "normal" ProgID? */ + temphandle = registry~open(handle, "ProgID", "READ") + + if temphandle \= 0 then do + registry~listvalues(temphandle,info.) + + res = info.1.data + + registry~close(temphandle) + end + end + + return res + + +::method currentObject ATTRIBUTE /* store the current object */ +::method currentObjectName ATTRIBUTE /* store object's name */ + + /* update the list of methods and events */ +::method updateView + expose indexStem. methods. events. + lc = self~newListView(104) + if lc \= .nil then do + methods. = self~currentObject~GetKnownMethods /* retrieve info on methods */ + if methods. = .nil then do + temp = RxMessageBox("OLE Object did not return any information on known methods.","Information","OK","INFORMATION") + lc~DeleteAll /* remove all items from list */ + return + end + events. = self~currentObject~GetKnownEvents /* retrieve info on events */ + if events. = .nil then events.0 = 0 + + lc~DeleteAll /* remove all items from list */ + if var("methods.!LIBNAME") = 1 then + self~newEdit(101)~title = methods.!LIBNAME + else + self~newEdit(101)~title = "unavailable" + if var("methods.!LIBDOC") = 1 then + self~newEdit(102)~title = methods.!LIBDOC + else + self~newEdit(102)~title = "unavailable" + + /* collect the indices of the info stem ordered according to their method names */ + indexStem.0 = 0 + + self~Cursor_Wait + pbc = self~newProgressBar(110) + if pbc \= .nil then do + pbc~SetStep(1) + pbc~SetRange(0,methods.0 + events.0) + end + + do i = 1 to methods.0 + events.0 + if i <= methods.0 then do + /* add method name to list box */ + if methods.i.!INVKIND \= 4 then + j = lc~add(methods.i.!NAME, (methods.i.!INVKIND)%2) + else /* this is a property put, symbolize with "=" */ + j = lc~add(methods.i.!NAME||"=",2) + end + else do + k = i - methods.0 + j = lc~add(events.k.!NAME, 3) + end + + j=j+1 + if i \= j then do + do k = indexStem.0 to j by -1 + t = k + 1 + indexStem.t = indexStem.k + end + indexStem.j = i + end + else + indexStem.i = i + indexStem.0 = indexStem.0 + 1 + if pbc \= .nil then pbc~Step + end + self~Cursor_Arrow + if pbc \= .nil then pbc~SetPos(0) + end + + + /* displays information on the selected method */ +::method selectionChange + expose indexStem. methods. events. + + listbox=self~newListView(104) + + j = 1 + listbox~Selected + if j < 1 then return /* return if nothing was selected */ + i = indexStem.j + + types = self~getCheckBoxData(107) + flags = self~getCheckBoxData(108) + + if i > methods.0 then do + workstem. = events. + i = i - methods.0 + infostring = "" + end + else do + workstem. = methods. + memberID = self~getCheckBoxData(109) + /* show member ID? */ + if memberID \= 0 then + infostring = "['"||workstem.i.!MEMID||"'x] " + else + infostring = "" + /* show return type? */ + if types \= 0 then + infostring = infostring||workstem.i.!RETTYPE||" " + end + + if methods.i.!INVKIND = 4 then /* property put */ + infostring = infostring||workstem.i.!NAME||"=" + else /* normal method or property get */ + do + /* build method signature with name(...) */ + infostring = infostring||workstem.i.!NAME + do j = 1 to workstem.i.!PARAMS.0 + if j = 1 then infostring = infostring||"(" + /* show flags? */ + if flags \= 0 then + infostring = infostring||workstem.i.!PARAMS.j.!FLAGS||" " + /* show types? */ + if types \= 0 then + infostring = infostring||workstem.i.!PARAMS.j.!TYPE||" " + /* show name of argument */ + infostring = infostring||workstem.i.!PARAMS.j.!NAME + if j < workstem.i.!PARAMS.0 then + infostring = infostring||", " + else infostring = infostring||")" + end + end + + /* set string to dialog */ + signature = self~newEdit(105) + if signature \= .nil then + signature~title = infostring + desc = self~newEdit(106) + /* show documentation if available */ + if desc \= .nil then do + interpret 'exists = var("workstem.'i'.!DOC")' + if exists = 1 then + desc~title = workstem.i.!DOC + else + desc~title="unavailable" + end + + /* invoke method */ +::method selectDoubleClick + expose indexStem. methods. + + listbox=self~newListView(104) + + j = 1 + listbox~Selected + i = indexStem.j + + if i > methods.0 then do + call RxMessageBox "This is an event!"||'0a'x||"Build a subclass of OLEObject and add a method with", + "this name if you wish REXX to call it when this event occurs.", "Information", "OK", "EXCLAMATION" + return + end + + params.0 = methods.i.!PARAMS.0 + do j = 1 to params.0 + params.j.!NAME = methods.i.!PARAMS.j.!NAME + params.j.!FLAGS = methods.i.!PARAMS.j.!FLAGS + params.j.!TYPE = methods.i.!PARAMS.j.!TYPE + end + + aDialog=.invokeDialog~new(,params.) + aDialog~create(100,100,200,26+13*params.0,"Method invocation:" methods.i.!NAME) + rc = aDialog~execute("showtop") + if rc = 1 then do + execString = methods.i.!name + usesOutParms = .FALSE + self~LastError = 0 + /* method call? */ + if methods.i.!INVKIND = 1 then do + if params.0 > 0 then execString = execString"(" + do i = 1 to params.0 + interpret "value = aDialog~param"i + execString = execString || value + if i < params.0 then execString = execString", " + if params.i.!FLAGS~pos("out") > 0 then usesOutParms = .TRUE + end + if params.0 > 0 then execString = execString")" + resultOfCall = callMethod(self~currentObject, execstring, self) + end + /* property put? */ + if methods.i.!INVKIND = 4 then do + value = aDialog~param1 /* can only have one argument */ + interpret "self~currentObject~"execString "=" value + resultOfCall = "" + end + /* property get? */ + if methods.i.!INVKIND = 2 then do + interpret "resultOfCall = self~currentObject~"execString + end + + if usesOutParms = .TRUE then + outp = self~currentObject~GetOutParameters + else + outp = .nil + + if self~LastError \= 0 then call RxMessageBox ERRORTEXT(self~LastError), "Error", "OK", "EXCLAMATION" + else do + temp = .ResultDialog~new(resultOfCall,outp) + if temp~initcode = 0 then do + temp~execute("showtop") + /* if useOLEobject attribute is filled in, change browser to this object */ + if temp~useoleobject \= .nil then do + self~currentObject = temp~useOLEobject + self~currentObjectName = "??? (from execution)" + self~newComboBox(100)~title = self~currentObjectName + self~updateView + end + end + end + + end + +::method getImages private + image = .Image~getImage(.application~srcDir"icons.bmp") + imageList = .ImageList~create(.Size~new(16, 12), COLOR4, 6, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + image~release + return imageList + end + return .nil + +::method LastError ATTRIBUTE + + + +/*************************************/ +/* Dialog for invoking an OLE method */ +/*************************************/ +::CLASS invokeDialog SUBCLASS UserDialog + +::METHOD resultObject ATTRIBUTE /* takes the result of the invocation */ + +::METHOD init + expose params. + use arg initstem., params. + self~init:super + +::METHOD DefineDialog + expose params. + + self~DefineDialog:super + + do i = 1 to params.0 + self~createEdit(300+i, 64, -5+(13*i), 128, 11, "AUTOSCROLLH", "Param"i) + self~createStaticText(-1, 8, -5+(13*i), 56, 11, , params.i.!NAME) + end + self~createOkCancelRightBottom + +::METHOD InitDialog + expose params. + self~resultObject = .nil + do i = 1 to params.0 + /* plain out parameters can not be edited */ + if params.i.!FLAGS = "[out]" then do + interpret "self~Param"i"='.NIL'" + self~newEdit(300+i)~disable + end + /* set .true if BOOL expected */ + if params.i.!TYPE = "VT_BOOL" then interpret "self~param"i"='.TRUE'" + /* set empty string if string expected */ + if params.i.!TYPE = "VT_BSTR" then interpret "self~param"i"='""""'" + end + + +::METHOD ok + return self~OK:super /* make sure self~Validate is called and self~InitCode is set to 1 */ + + + + + +/*******************************************************/ +/* Dialog that shows the result of a method invocation */ +/*******************************************************/ +::class ResultDialog subclass UserDialog + +::method Init + expose outarray + use arg rvalue, outarray + InitRet = self~init:super + + if self~Load(.application~srcDir"OLEINFO.rc", 4713 ) \= 0 then do + self~InitCode = 1 + return 1 + end + + self~data400=rvalue~string + if self~data400 = "an OLEOBJECT" then self~useOLEobject = rvalue + else self~useOLEobject = .nil + return InitRet + +::method InitDialog + expose outarray + + lc = self~newListBox(401) + + if outarray \= .nil then do + if lc \= .nil then do + i = 1 + do j over outarray + lc~add(i||'09'x||j~string) + i = i + 1 + end + end + end + else + if lc \= .nil then do lc~add("object did not return out parameters") + end + +::METHOD ok + if self~useOLEobject \= .nil then do + keep = RxMessageBox("An OLE object was returned from the method invocation. Do you want to use it as the active object?","Question","OKCANCEL","QUESTION") + if keep \= 1 then self~useOLEobject = .nil + end + return self~ok:super + +::method useOLEobject ATTRIBUTE + + + + + + +/********************************************************/ +/* Dialog that shows all ProgIDs obtained from Registry */ +/********************************************************/ +::class RegistryDialog subclass UserDialog + +::method Init + expose cache + use arg stem., cache + forward class (super) continue /* call parent constructor */ + InitRet = Result + + if self~Load(.application~srcDir"OLEINFO.rc", 4712 ) \= 0 then do + self~InitCode = 1 + return 1 + end + self~connectListBoxEvent(200, "DBLCLK", "selectDoubleClick") + self~connectButtonEvent(201, "CLICKED", "search") + + return InitRet + +::method GetCache + expose cache + return cache + +::method InitDialog + expose cache + lc = self~newListBox(200) + if lc \= .nil then do + do item over cache + lc~add(item) + end + end + +::method OK + res = self~OK:super + return res + + /* double clicking in the list closes this dialog window */ +::method selectDoubleClick + self~OK /* make sure self~Validate is called and self~InitCode is set to 1 */ + +::method search + dlg = .InputBox~new("String:", "String search", "", 150) + value = dlg~Execute + drop dlg + + lb = self~newListBox(200) + startindex = lb~selectedindex + lb~selectindex(lb~find(value,startindex,0)) + + + +/******************************/ +/* Dialog that shows the help */ +/******************************/ +::class HelpDialog subclass UserDialog + +::method Init + forward class (super) continue /* call parent constructor */ + InitRet = Result + + if self~Load(.application~srcDir"OLEINFO.rc", 4714 ) \= 0 then do + self~InitCode = 1 + return 1 + end + + return InitRet diff --git a/modules/windows/oodialog/ooDraw.h b/modules/windows/oodialog/ooDraw.h new file mode 100644 index 0000000..4cc9c8b --- /dev/null +++ b/modules/windows/oodialog/ooDraw.h @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* Symbolic resource IDs for the ooDraw (oodraw.rex) program. */ + +#define IDC_PB_DRAW 100 +#define IDC_PB_INTERRUPT 101 + +#define IDC_PB_BRUSH_RECTANGLES 110 +#define IDC_PB_PEN_RECTANGLES 120 +#define IDC_PB_PIXELS 130 +#define IDC_PB_STAR_LINES 140 +#define IDC_PB_RANDOM_LINES 150 +#define IDC_PB_RANDOM_SQUARES 160 +#define IDC_PB_ELLIPSES 170 + diff --git a/modules/windows/oodialog/ooRexxTry/doc/ooRexxTry.pdf b/modules/windows/oodialog/ooRexxTry/doc/ooRexxTry.pdf new file mode 100644 index 0000000..afac7f0 Binary files /dev/null and b/modules/windows/oodialog/ooRexxTry/doc/ooRexxTry.pdf differ diff --git a/modules/windows/oodialog/ooRexxTry/ooRexxTry.rex b/modules/windows/oodialog/ooRexxTry/ooRexxTry.rex new file mode 100755 index 0000000..acb54d7 --- /dev/null +++ b/modules/windows/oodialog/ooRexxTry/ooRexxTry.rex @@ -0,0 +1,983 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007-2019 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* oorexxtry.rex */ +/* +What: 21st Century version of Rexxtry +Who: Lee Peedin +See documentation for version control + +10/04/07 Extended fileNameDialog mask for open (*.*) +10/05/07 Added charout method to sayCatcher class + Added lineout method to sayCatcher class + +10/15/07 Directives now work - return values aren't captured +10/16/07 Added header to copy all + +11/29/07 Modified ~getText for occasions when lines should not be stripped. + Place in the incubator + +04/19/09 Removed deprecated createFont() and replaced it with createFontEx(). +04/19/09 Enhanced the menu to use check marks for font name, size, and silent. +*/ + + -- Capture the location of our source code program + discard = locate() + + parse arg isDefault + .local~useDefault = .false + if isDefault~translate = 'DEFAULT' then + .local~useDefault = .true + + call LoadEnvironment -- Set up the environment to work with + code = .oort_dialog~new() -- Create the dialog + if code~initCode \= 0 then + do + call errorDialog 'Error creating code dialog. initCode:' code~initCode + exit + end + say + say "This console will receive the output of your system commands." + say "Try 'dir' for example." + say + code~execute('ShowTop') -- Execute the dialog +exit + +::requires "ooDialog.cls" -- Needed for the dialog +::requires 'winsystm.cls' -- Needed for the Windows clipboard + +::class oort_dialog subclass userdialog +::method init + self~init:super + rc = self~create(.dx,.dy,.dwidth,.dheight,.title,'ThickFrame MinimizeBox MaximizeBox') + self~initCode = (rc=0) + self~fontMenuHelper + +::method defineDialog + expose u menuBar + u = .dlgAreaU~new(self) + if .nil \= u~lastError then + call errorDialog u~lastError + +---------- Arguments title & dialog area + at = .dlgArea~new(0,0,u~w,10) + self~createStaticText(17,at~x,at~y,at~w,at~h,'CENTER','Arguments') + ad = .dlgArea~new(0,at~y + 10,u~w,u~h('15%')) + self~createEdit(12,ad~x,ad~y,ad~w,ad~h,'multiline hscroll vscroll','args_data') + +---------- Code title & dialog area + ct = .dlgArea~new(0,ad~y + ad~h,u~w,10) + self~addText(ct~x,ct~y,ct~w,ct~h,'Code','CENTER',18) + cd = .dlgArea~new(0,ct~y + ct~h,u~w,u~h('40%')) + self~addEntryLine(13,'code_data',cd~x,cd~y,cd~w,cd~h,'multiline hscroll vscroll') + +---------- Says title & dialog area + st = .dlgArea~new(0,cd~y + cd~h,u~w('50%'),10) + self~createStaticText(19,st~x,st~y,st~w,st~h,'CENTER','Says') + sd = .dlgArea~new(0,st~y + st~h,u~w('50%'),u~h('43%')) + self~createEdit(14,sd~x,sd~y,sd~w,sd~h,'notab readonly multiline hscroll vscroll','say_data') + +---------- Returns title & dialog area + rt = .dlgArea~new(sd~x + sd~w,cd~y + cd~h,u~w('50%'),10) + self~createStaticText(20,rt~x,rt~y,rt~w,rt~h,'CENTER','Returns') + rd = .dlgArea~new(rt~x,st~y + st~h,u~w('50%'),u~h('15%')) + self~createEdit(15,rd~x,rd~y,rd~w,rd~h,'notab readonly multiline hscroll vscroll','results_data') + +---------- Errors/Information title & dialog area + et = .dlgArea~new(rt~x,rd~y + rd~h,u~w('50%'),10) + self~createStaticText(21,et~x,et~y,et~w,et~h,'CENTER','Errors / Information') + ed = .dlgArea~new(rt~x,et~y + et~h,u~w('50%'),u~h('17%')) + self~createEdit(16,ed~x,ed~y,ed~w,ed~h,'notab readonly multiline hscroll vscroll','error_data') + +---------- Run & Exit buttons for easier execution + self~createPushButton(80,ed~x ,ed~y + ed~h + 2,35,10,,'&Run','RunIt') + self~createPushButton(IDCANCEL,ed~x + 40,ed~y + ed~h + 2,35,10,,'E&xit') + +---------- + menuBar = .UserMenuBar~new(500,0,65) + + menuBar~addPopup(510, '&File') + menuBar~addItem(22,'&Run' , ,'RunIt') + menuBar~addItem(23,'&SaveAs', ,'FileDialog') + menuBar~addItem(25,'&Open' , ,'FileDialog') + menuBar~addItem(24,'E&xit' ,'END','Cancel') + + menuBar~addPopup(520,'&Edit') + menuBar~addPopup(530,'Font&Name') + menuBar~addItem(30,'&Lucida Console', ,'onFontMenuClick') + menuBar~addItem(31,'&Courier New' ,'END','onFontMenuClick') + menuBar~addSeparator(535) + menuBar~addPopup(540,'Font&Size','END') + menuBar~addItem(40,'&8' , ,'onFontMenuClick') + menuBar~addItem(41,'1&0', ,'onFontMenuClick') + menuBar~addItem(42,'1&2', ,'onFontMenuClick') + menuBar~addItem(43,'1&4', ,'onFontMenuClick') + menuBar~addItem(44,'1&6', ,'onFontMenuClick') + menuBar~addItem(45,'1&8','END','onFontMenuClick') + menuBar~addPopup(550,'&Tools') + menuBar~addPopup(560,'&Copy') + menuBar~addItem(50,'&Args' , ,'Clipboard') + menuBar~addItem(51,'&Code' , ,'Clipboard') + menuBar~addItem(52,'&Says' , ,'ClipBoard') + menuBar~addItem(53,'&Returns', ,'ClipBoard') + menuBar~addItem(54,'&Errors' , ,'ClipBoard') + menuBar~addItem(55,'A&ll' ,'END','ClipBoard') + menuBar~addSeparator(565) + menuBar~addPopup(570,'C&lear') + menuBar~addItem(60,'&Args' , ,'ClearAll') + menuBar~addItem(61,'&Code' , ,'ClearAll') + menuBar~addItem(62,'&Says' , ,'ClearAll') + menuBar~addItem(63,'&Returns', ,'ClearAll') + menuBar~addItem(64,'&Errors' , ,'ClearAll') + menuBar~addItem(65,'A&ll' ,'END','ClearAll') + menuBar~addSeparator(575) + menuBar~addPopup(580,'&Silent') + menuBar~addItem(66,'&No' , ,'Silent') + menuBar~addItem(67,'&Yes' ,'END','Silent') + menuBar~addSeparator(585) + menuBar~addPopup(590,'Sa&ve Settings','END') + menuBar~addItem(72,'Sa&ve' ,'END','SaveSettings') + menuBar~addPopup(600,'&Help','END') + menuBar~addItem(71,'Current &Settings', ,'Settings') + menuBar~addItem(70,'&About' ,'END','Help') + + if \ menuBar~complete then + statusText = 'User menu bar completion error:' .SystemErrorCode SysGetErrortext(.SystemErrorCode) + +::method initDialog unguarded + expose args_input code_input result_input say_input errors_input menuBar + -- Use font data from .ini file or defaults if .ini not present yet + + -- FW_EXTRALIGHT == 200 + d = .Directory~new + d~weight = 200 + hfont = self~createFontEx(.fontname,.fontsize,d) + + if menuBar \== .nil then menuBar~attachTo(self) + + -- Set the font and silent menu item check marks. + self~setFontMenuChecks + if .silent then menuBar~check(67) + else menuBar~check(66) + + -- Get the controls for all dialog elements that will need to be adjusted + args_input = self~newEdit(12) + code_input = self~newEdit(13) + say_input = self~newEdit(14) + result_input = self~newEdit(15) + errors_input = self~newEdit(16) + args_title = self~newStatic(17) + code_title = self~newStatic(18) + say_title = self~newStatic(19) + result_title = self~newStatic(20) + errors_title = self~newStatic(21) + + -- Set the color of the titles + args_title ~setColor(5,10) + code_title ~setColor(16,10) + say_title ~setColor(15,0) + result_title~setColor(14,0) + errors_title~setColor(13,10) + + -- Set the font name/size to the default values + self~reDraw + + if \.useDefault then + do + -- Read oorexxtry.ini position & size the dialog based on its values + sd = .application~srcDir + k1 = SysIni(sd'oorexxtry.ini','oorexxtry','k1') + k2 = SysIni(sd'oorexxtry.ini','oorexxtry','k2') + k3 = SysIni(sd'oorexxtry.ini','oorexxtry','k3') + k4 = SysIni(sd'oorexxtry.ini','oorexxtry','k4') + if k1 = 'ERROR:' | k2 = 'ERROR:' | k3 = 'ERROR:' | k4 = 'ERROR:' then + nop -- First exection will not find the ini file + else + do + r = .Rect~new(k1,k2,k3-k1,k4-k2) + self~setWindowPos(TOP,r) + self~ensureVisible + end + end + + self~connectResize('onResize', 'sync') + +-- Run menu option +::method RunIt + expose args_input code_input result_input say_input errors_input + + -- Calculate the center point of the code_input edit control, in screen + -- co-ordinates. + r = code_input~clientRect + centerPoint = .Point~new((r~right - r~left) % 2, (r~bottom - r~top) % 2) + code_input~client2screen(centerPoint) + + -- Get and save the current mouse position. + mouse = .Mouse~new(code_input) + oldCursorPos = mouse~getCursorPos + + -- Set the cursor to the busy symbol / move the cursor to our center point + oldCursor = mouse~wait + mouse~setCursorPos(centerPoint) + + arg_array = self~getText(args_input,.true) + .local~si = say_input + w1 = code_input~selected~word(1) + w2 = code_input~selected~word(2) + code_array = self~getText(code_input,.true) + if (w1 = .max_length & w2 = .max_length) | (w1 = w2) then + nop -- we've already loaded our code_array + else + do + code_string = code_array~makeString + code_array = code_string~substr(w1,w2-w1)~makearray + end + + -- Clear any previous error data + self~error_data = '' + errors_input~title = self~error_data + + -- Clear any previous say data + self~say_data = '' + say_input~title = self~say_data + + -- Clear any previous returns data + self~results_data = '' + result_input~title = self~results_data + + .local~emsg = '' + .local~imsg = '' + + self~error_data = 'Code Is Executing' + errors_input~title = self~error_data + + .local~Error? = .false + .local~badarg = '' + -- Interpret each argument so that expressions can be used + signal on syntax name ArgSyntax + do i = 1 to arg_array~items + .local~badarg = i arg_array[i] + interpret 'arg_array['i'] =' arg_array[i] + end + signal off syntax + + exec = .executor~new('oorexxtry.code',code_array) + exec~run(arg_array) + + if .emsg \= '' then + do + if \.silent then + call beep 600,100 + self~error_data = .emsg + errors_input~title = self~error_data + self~results_data = '' + result_input~title = self~results_data + end + else + do + self~error_data = 'Code Execution Complete' + errors_input~title = self~error_data + end + + if .nil \= .run_results['returns'] then + do + self~results_data = .run_results['returns'] + result_input~title = self~results_data + end + if \.silent then -- Let the user know when code execution is complete + call beep 150,150 + + mouse~restoreCursor(oldCursor) + mouse~setCursorPos(oldCursorPos) + + self~returnFocus +return + +ArgSyntax: + msg = 'Trapped In'~right(11)'..: ArgSyntax' + obj = condition('o') + msg = msg||.endOfLine||'Message'~right(11)'..:' obj['MESSAGE'] + msg = msg||.endOfLine||'ErrorText'~right(11)'..:' obj['ERRORTEXT'] + msg = msg||.endOfLine||'Code'~right(11)'..:' obj['CODE'] + msg = msg||.endOfLine||('Argument' .badarg~word(1))~right(11)'..:' .badarg~subword(2) + .local~emsg = msg + if \.silent then + call beep 600,100 + self~error_data = .emsg + errors_input~title = self~error_data + self~results_data = '' + result_input~title = self~results_data + .local~emsg = '' + self~focusItem(12) + args_input~select(1,1) + + mouse~restoreCursor(oldCursor) + mouse~setCursorPos(oldCursorPos) +return + +::method cancel + + r = self~windowRect + -- Write out the size,position,fontname,fontsize, & silent to the .ini file + sd = .application~srcDir + if \self~isMinimized & \self~isMaximized then + do + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k1',r~left) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k2',r~top) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k3',r~right) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k4',r~bottom) + end + rv = SysIni(sd'oorexxtry.ini','oorexxtry','fn',.fontname) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','fs',.fontsize) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','sl',.silent) +return self~ok:super + +-- Clipboard menu option +::method ClipBoard + expose args_input errors_input code_input say_input result_input + use arg msg, args + cp = .WindowsClipBoard~new + select + when msg = 50 then + do + cp_array = self~getText(args_input,.false) + cp_string = cp_array~makestring + cp~copy(cp_string) + .local~imsg = 'Arguments Are On ClipBoard' + end + when msg = 51 then + do + cp_array = self~getText(code_input,.false) + cp_string = cp_array~makestring + cp~Copy(cp_string) + .local~imsg = 'Code Is On ClipBoard' + end + when msg = 52 then + do + cp_array = self~getText(say_input,.false) + cp_string = cp_array~makestring + cp~copy(cp_string) + .local~imsg = 'Says Are On The ClipBoard' + end + when msg = 53 then + do + cp_array = self~getText(result_input,.false) + cp_string = cp_array~makestring + cp~Copy(cp_string) + .local~imsg = 'Returns Are On ClipBoard' + end + when msg = 54 then + do + cp_array = self~getText(errors_input,.false) + cp_string = cp_array~makestring + cp~copy(cp_string) + .local~imsg = 'Errors Are On ClipBoard' + end + when msg = 55 then + do + allData = 'The Following Output Was Generated With ooRexxTry'.endOfLine||.endOfLine + cp_array = self~getText(args_input,.false) + cp_string = cp_array~makestring + allData = alldata||'Arguments'||.endOfLine||cp_string||.endOfLine||'-'~copies(20)||.endOfLine + + cp_array = self~getText(code_input,.false) + cp_string = cp_array~makestring + allData = allData||'Code'||.endOfLine||cp_string||.endOfLine||'-'~copies(20)||.endOfLine + + cp_array = self~getText(say_input,.false) + cp_string = cp_array~makestring + allData = allData||'Says'||.endOfLine||cp_string||.endOfLine||'-'~copies(20)||.endOfLine + + cp_array = self~getText(result_input,.false) + cp_string = cp_array~makestring + allData = allData||'Results'||.endOfLine||cp_string||.endOfLine||'-'~copies(20)||.endOfLine + + cp_array = self~getText(errors_input,.false) + cp_string = cp_array~makestring + allData = allData||'Errors/Information'||.endOfLine||cp_string||.endOfLine||'-'~copies(20)||.endOfLine + + cp~copy(allData) + .local~imsg = 'All Data Is On ClipBoard' + end + otherwise + nop + end + self~error_data = .imsg + errors_input~title = self~error_data + self~returnFocus + +-- Code2File menu option +::method FileDialog + expose code_input errors_input + use arg msg, args + if msg = 23 then + do + c_array = self~getText(code_input,.false) + c_string = c_array~makestring + action = 'S' + dtitle = 'ooRexxTry File Save' + end + else + do + action = 'L' + dtitle = 'ooRexxTry File Open' + end + + delimiter = '0'x + filemask = 'ooRexx Files (*.rex)'delimiter'*.rex'delimiter||- + 'All Files (*.*)'delimiter'*.*'delimiter + handle = self~getSelf + a_file = FileNameDialog(.preferred_path,handle,filemask,action,dtitle,'.rex') + if a_file \= 0 then + do + ostream = .stream~new(a_file) + if msg = 23 then + do + ostream~open('Write Replace') + ostream~lineout(c_string) + ostream~close + .local~imsg = 'Code Saved As' a_file + self~error_data = .imsg + errors_input~title = self~error_data + end + else + do + oarray = ostream~charin(,ostream~chars)~makearray + ostream~close + mycode = '' + do i = 1 to oarray~items + mycode = mycode||oarray[i] + if i < oarray~items then + mycode = mycode||.endOfLine + end + self~code_data = mycode + code_input~title = self~code_data + + .local~imsg = 'Code From' a_file 'In Code Dialog' + self~error_data = .imsg + errors_input~title = self~error_data + end + end + self~returnFocus + +-- ClearAll menu option +::method ClearAll + expose args_input code_input result_input say_input errors_input + use arg msg, args + select + when msg = 60 then + do + self~args_data = '' + args_input~title = self~args_data + end + when msg = 61 then + do + self~code_data = '' + code_input~title = self~code_data + end + when msg = 62 then + do + self~say_data = '' + say_input~title = self~say_data + end + when msg = 63 then + do + self~results_data = '' + result_input~title = self~results_data + end + when msg = 64 then + do + self~error_data = '' + errors_input~title = self~error_data + end + when msg = 65 then + do + self~args_data = '' + args_input~title = self~args_data + + self~code_data = '' + code_input~title = self~code_data + + self~results_data = '' + result_input~title = self~results_data + + self~say_data = '' + say_input~title = self~say_data + + self~error_data = '' + errors_input~title = self~error_data + end + otherwise + nop + end + self~returnFocus + +::method Silent + expose menuBar + use arg msg, args + select + when msg = 66 then do + .local~silent = .false + menuBar~check(66) + menuBar~unCheck(67) + end + when msg = 67 then do + .local~silent = .true + menuBar~check(67) + menuBar~unCheck(66) + end + otherwise + nop + end + self~returnFocus + +::method SaveSettings + use arg msg, args + + r = self~windowRect + select + when msg = 72 then + do + sd = .application~srcDir + if \self~isMinimized & \self~isMaximized then + do + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k1',r~left) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k2',r~top) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k3',r~right) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','k4',r~bottom) + end + rv = SysIni(sd'oorexxtry.ini','oorexxtry','fn',.fontname) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','fs',.fontsize) + rv = SysIni(sd'oorexxtry.ini','oorexxtry','sl',.silent) + end + otherwise + nop + end + self~returnFocus + +::method ReturnFocus + expose code_input + w1 = code_input~selected~word(1) + w2 = code_input~selected~word(2) + code_array = self~getText(code_input,.true) + if w1 = .max_length & w2 = .max_length then + do + sel_start = .max_length + sel_end = .max_length + end + else + do + sel_start = w1 + sel_end = w2 + end + self~focusItem(13) + code_input~select(sel_start,sel_end) + +-- Method to handle all the resizing +::method onResize + expose u + use arg dummy,sizeinfo + u~resize(self,sizeinfo) + +::method Help + expose code_input u + handle = self~getSelf + parse value self~GetWindowRect(handle) with var1 var2 var3 var4 + .local~dw = (var3 - var1) / self~factorX + .local~dh = (var4 - var2) / self~factorY + + parse value self~GetPos with dx dy + .local~dx = dx + .local~dy = dy + + help = .help_dialog~new() + if help~initCode \= 0 then + do + call errorDialog 'Error creating help dialog. initCode:' help~initCode + exit + end + help~execute('ShowTop') + +::method Settings + expose code_input u + handle = self~getSelf + parse value self~getWindowRect(handle) with var1 var2 var3 var4 + .local~dw = (var3 - var1) / self~factorX + .local~dh = (var4 - var2) / self~factorY + + parse value self~getPos with dx dy + .local~dx = dx + .local~dy = dy + + settings = .settings_dialog~new() + if settings~initCode \= 0 then + do + call errorDialog 'Error creating help dialog. initCode:' settings~initCode + exit + end + settings~execute('ShowTop') + +-- Redraw applicable areas of the dialog based on the font menu choice +::method ReDraw + expose args_input code_input say_input result_input errors_input + + -- FW_EXTRALIGHT == 200 + d = .Directory~new + d~weight = 200 + hfont = self~createFontEx(.fontname,.fontsize,d) + args_input ~setFont(hfont) + code_input ~setFont(hfont) + say_input ~setFont(hfont) + result_input~setFont(hfont) + errors_input~setFont(hfont) + +::method getText + use arg the_input,stripIt + iarray = .array~new() + max_length = 0 + do i = 1 to the_input~lines + if stripIt then + do + if the_input~getLine(i)~strip() \= '' then + do + iarray~append(the_input~getLine(i)) + max_length += iarray[iarray~last]~length + end + end + else + do + iarray~append(the_input~getLine(i)) + max_length += iarray[iarray~last]~length + end + end + .local~max_length = max_length + 1 +return iarray + +-- This method is invoked whenever the user clicks on one of the font menu items. +-- The first arg to the method is the resource id of the menu id that was clicked. +::method onFontMenuClick + expose fontMenuIDs + use arg id + + -- Map the menu item id to a font setting. Could be size of name. + item = fontMenuIDs~index(id) + + -- If item is a number, then it is a font size menu item, otherwis a font name. + if item~datatype('W') then .local~fontSize = item + else .local~fontname = item + + -- Reset the menu item check marks and redraw in the new font. + self~setFontMenuChecks + self~reDraw + +-- This method sets the appropriate font menu item check state. Checked for selected +-- and unchecked for unselected. +::method setFontMenuChecks private + expose fontMenuIDs menuBar + + -- Iterate over all items in the table unchecking each menu item. Brute force, + -- but easy, and there are not many items. The alternative is to keep track of + -- which items are checked and uncheck / check the correct ones. + do id over fontMenuIDs~allItems + menuBar~unCheck(id) + end + + -- Now check the menu item that matches what font name and size is currently + -- in use. + menuBar~check(fontMenuIDs[.fontname]) + menuBar~check(fontMenuIDs[.fontsize]) + +-- A private help method that sets up things to make working with the font menu easier +::method fontMenuHelper private + expose fontMenuIDs + + -- Create a table that maps menu item IDs to the matching font setting. Since + -- the Table class has the index() method, the mapping works both ways. + fontMenuIDs = .Table~new + fontMenuIDs["Lucida Console"] = 30 + fontMenuIDs["Courier New"] = 31 + + fontMenuIDs[ 8] = 40 + fontMenuIDs[10] = 41 + fontMenuIDs[12] = 42 + fontMenuIDs[14] = 43 + fontMenuIDs[16] = 44 + fontMenuIDs[18] = 45 + +-- Class that dynamically creates a method to take the arguments and execute the code +::class executor public +::method init + expose rt_routine + use arg routine_name,code + .local~Error? = .false + signal on syntax name ExecSyntax + rt_routine = .routine~new(routine_name, code) +return + +-- Syntax trap similiar to rexxc.exe +ExecSynTax: + msg = 'Trapped In'~right(11)'..: ExecSyntax' + obj = condition('o') + msg = msg||.endOfLine||'Message'~right(11)'..:' obj['MESSAGE'] + msg = msg||.endOfLine||'ErrorText'~right(11)'..:' obj['ERRORTEXT'] + msg = msg||.endOfLine||'Code'~right(11)'..:' obj['CODE'] + msg = msg||.endOfLine||'Line #'~right(11)'..:' obj['POSITION'] + .local~emsg = msg + .local~Error? = .true +return + +-- Method that actually runs our code +::method run + expose rt_routine say_string + signal on syntax name RunSyntax + .local~run_results = .directory~new + .local~say_stg = '' + my_result = '' + if \.Error? then + do + -- Redirect STDOUT for say statements + scrnOut = .SayCatcher~New('STDOUT')~~Command('open write nobuffer') + theSayMonitor = .monitor~New(scrnOut) + .output~destination(theSayMonitor) + -- Run the Code + args = arg(1) + rt_routine~callWith(args) + -- Test if there was anything returned by the code + if symbol('result') = 'VAR' then + my_result = result + -- Load the says and returns into environment variables for updating the dialog areas + .local~run_results['returns'] = my_result + -- Redirect STDOUT back to what it was (probably the screen) + .output~Destination() + end +return .run_results + +-- Syntax trap for errors in the code +RunSyntax: + msg = 'Trapped In'~right(11)'..: RunSyntax' + obj = condition('o') + msg = msg||.endOfLine||'Message'~right(11)'..:' obj['MESSAGE'] + msg = msg||.endOfLine||'ErrorText'~right(11)'..:' obj['ERRORTEXT'] + msg = msg||.endOfLine||'Code'~right(11)'..:' obj['CODE'] + msg = msg||.endOfLine||'Line #'~right(11)'..:' obj['POSITION'] + .local~emsg = msg +return + +-- Class to "catch" all say,charout,lineout statements in the code +-- Will not catch charout & lineout if the first argument is supplied +::class SayCatcher subclass stream +::method say + use arg input + .local~say_stg = .say_stg||input||.endOfLine + .si~title = .say_stg +return + +::method charout + use arg input + .local~say_stg = .say_stg||input + .si~title = .say_stg +return 0 + +::method lineout + use arg input + .local~say_stg = .say_stg||input||.endOfLine + .si~title = .say_stg +return 0 + + +::class help_dialog subclass userdialog +::method init + self~init:super + lp = (.dx + (.dw / 2) - 50)~format( , 0) + tp = (.dy + (.dh / 2) - 30)~format( , 0) + rc = self~create(lp,tp,100,60,.title,"THICKFRAME") + self~initCode = (rc=0) + +::method defineDialog + expose h sizing + h = .dlgAreaU~new(self) + if .nil \= h~lastError then + call errorDialog h~lastError + h~updateOnResize = .false + sizing = .false + + vt = .dlgArea~new(h~x,0,h~w,10) + self~createStaticText(20,vt~x,vt~y,vt~w,vt~h,'CENTER','Version') + vd = .dlgArea~new(h~x,vt~y + vt~h,h~w,10) + self~createStaticText(21,vd~x,vd~y,vd~w,vd~h,'CENTER',.version) + + at = .dlgArea~new(h~x,vd~y + vd~h,h~w,10) + self~createStaticText(22,at~x,at~y,at~w,at~h,'CENTER','Author') + ad = .dlgArea~new(h~x,at~y + at~h,h~w,10) + self~createStaticText(23,ad~x,ad~y,ad~w,ad~h,'CENTER','Lee Peedin') + + dt = .dlgArea~new(h~x,ad~y + ad~h,h~w,10) + self~createStaticText(24,dt~x,dt~y,dt~w,dt~h,'CENTER','Documentation') + dd = .dlgArea~new(h~x,dt~y + dt~h,h~w,10) + self~createPushButton(25,dd~x,dd~y,dd~w,10,,'&PDF','Help') + +::method initDialog unguarded + v_title = self~newStatic(20) + a_title = self~newStatic(22) + d_title = self~newStatic(24) + + v_title~setColor(5,10) + a_title~setColor(5,10) + d_title~setColor(5,10) + + self~connectResize('onResize', 'sync') + self~connectSizeMoveEnded('onSizeMoveEnded') + +::method help + -- The help doc is supposed to be in the 'doc' subdirectory, but we will also check the + -- current directory, then the Rexx home directory. + if SysFileExists('doc\ooRexxTry.pdf') then do + helpDoc = 'doc\ooRexxTry.pdf' + end + else if SysFileExists('ooRexxTry.pdf') then do + helpDoc = 'ooRexxTry.pdf' + end + else if SysfileExists(value("REXX_HOME",,"ENVIRONMENT")||"\doc\ooRexxTry.pdf") then do + helpDoc = value("REXX_HOME",,"ENVIRONMENT")||"\doc\ooRexxTry.pdf" + end + else do + msg = "The ooRexxTry.pdf help documentation could not be located." || .endOfLine - + || .endOfLine || - + "Tried:" || .endOfLine - + " doc subdirectory: "||directory()||"\doc\ooRexxTry.pdf" || .endOfLine - + " current directory: "||directory()||"\ooRexxTry.pdf" || .endOfLine - + " Rexx home: "||value("REXX_HOME",,"ENVIRONMENT")||"\doc\ooRexxTry.pdf" || .endOfLine - + || .endOfLine || - + "Sorry, no help is available" + title = 'ooRexx Try for the 21st Century - Error' + j = MessageDialog(msg, self~hwnd, title, 'Ok', 'WARNING') + return + end + 'start "ooRexxTry Online Documentation"' '"'||helpDoc||'"' + +::method onResize unguarded + expose h sizing + use arg sizingType, sizeinfo + + sizing = .true + h~resize(self, sizeinfo) + +::method onSizeMoveEnded unguarded + expose sizing + + -- If we were resizing, force the dialog controls to redraw themselves. + if sizing then self~update + + -- We are not resizing anymore. + sizing = .false + return 0 + + +::class settings_dialog subclass userdialog +::method Init + self~init:super + lp = (.dx + (.dw / 2) - 50)~format( , 0) + tp = (.dy + (.dh / 2) - 30)~format( , 0) + rc = self~Create(lp,tp,100,60,.title) + self~InitCode = (rc=0) + +::method DefineDialog + expose h + h = .dlgAreaU~new(self) + if .nil \= h~lastError then + call errorDialog h~lastError + vt = .dlgArea~new(h~x,0,h~w,10) + self~addText(vt~x,vt~y,vt~w,vt~h,'Font Name','CENTER',20) + vd = .dlgArea~new(h~x,vt~y + vt~h,h~w,10) + self~addText(vd~x,vd~y,vd~w,vd~h,.fontname,'CENTER',21) + + at = .dlgArea~new(h~x,vd~y + vd~h,h~w,10) + self~addText(at~x,at~y,at~w,at~h,'Font Size','CENTER',22) + ad = .dlgArea~new(h~x,at~y + at~h,h~w,10) + self~addText(ad~x,ad~y,ad~w,ad~h,.fontsize,'CENTER',23) + + dt = .dlgArea~new(h~x,ad~y + ad~h,h~w,10) + self~addText(dt~x,dt~y,dt~w,dt~h,'Silent','CENTER',24) + dd = .dlgArea~new(h~x,dt~y + dt~h,h~w,10) + self~addText(dd~x,dd~y,dd~w,dd~h,.silent,'CENTER',23) + +::method InitDialog + v_title = self~newStatic(20) + a_title = self~newStatic(22) + d_title = self~newStatic(24) + + v_title~setColor(14,0) + a_title~setColor(14,0) + d_title~setColor(14,0) + +::routine LoadEnvironment + .local~px = ScreenSize()[3] + .local~py = ScreenSize()[4] + +-- Establish dialog area sizes based of the user's screen resolution - will only be used for the first +-- execution - from then on data is retrieved from the .ini file, unless user specifies default as an +-- execution argument from the command line + .local~dwidth = ((.px / 2.5) * .65)~format(,0) + .local~dheight = ((.py / 2.5) * .65)~format(,0) + .local~dx = 0 + .local~dy = 0 + + +-- Need a few generic variables + .local~version = '1.0' -- Internal version control + .local~preferred_path = '' -- Default starting path for Save As dialog - will be either + -- the folder ooRexxTry is executed from or the last folder that + -- was accessed using the Windows File Dialog + .local~title = 'ooRexxTry' -- Title to use for the dialogs + +-- If the .ini file is present, use it for font/silent variables + sd = .application~srcDir + .local~fontname = SysIni(sd'oorexxtry.ini','oorexxtry','fn') + .local~fontsize = SysIni(sd'oorexxtry.ini','oorexxtry','fs') + .local~silent = SysIni(sd'oorexxtry.ini','oorexxtry','sl') + +-- Else use some defaults + if .fontname = 'ERROR:' | .useDefault then + .local~fontname = 'Lucida Console' + if .fontsize = 'ERROR:' | .useDefault then + .local~fontsize = 12 + if .silent = 'ERROR:' | .useDefault then + .local~silent = .false +return + + + diff --git a/modules/windows/oodialog/oobandit.rex b/modules/windows/oodialog/oobandit.rex new file mode 100755 index 0000000..bbc041a --- /dev/null +++ b/modules/windows/oodialog/oobandit.rex @@ -0,0 +1,428 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oobandit.rex An ooDialog example, the Jackpot Slot Machine. + * + * This example demonstrates one way of animating bitmaps, by drawing them on + * the face of a button. It also shows how to correctly use dialog units in + * a UserDialog to size and place the controls. + * + * Creating the dialog and its controls is done this way: + * + * The pixel size of the bitmaps is known. Although bitmaps can be stretched + * by the OS to fit a specific size, bitmaps look best displayed in their + * actual size. The pixel size of the bitmaps is first converted to the + * correct dialog unit size, correct for the actual dialog to be constructed. + * + * Then the size of the dialog and the size and placement of the dialog + * controls are calculated around the bitmap size. + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + -- Use the global .constDir for symbolic IDs, and add IDs for this example. + .application~useGlobalConstDir('O') + .constDir[IDC_PB_STOP] = 1100 + .constDir[IDC_STATIC_JACKPOT] = 1200 + .constDir[IDC_PB_BMP_LEFT] = 1201 + .constDir[IDC_PB_BMP_CENTER] = 1202 + .constDir[IDC_PB_BMP_RIGHT] = 1203 + .constDir[IDC_EDIT] = 120 + .constDir[IDC_UD] = 1206 + + /* 1ms fast, 500ms slow, 200ms start, equals random every 25th */ + d = .BanditDlg~new(1, 1000, 1000, 25) + d~execute("SHOWTOP") + + return 0 + +/*---------------------------------- requires ------------------------*/ + +::requires "ooDialog.cls" +::requires "samplesSetup.rex" + +/*---------------------------------- dialog class --------------------*/ + +::class 'BanditDlg' subclass UserDialog + +::constant BITMAP_X 152 +::constant BITMAP_Y 178 +::constant FONT_NAME "MS Shell Dlg" +::constant FONT_SIZE 14 + +::constant MARGIN_X 10 +::constant MARGIN_Y 5 +::constant JACKPOT_LINE_Y 22 +::constant TEXT_Y 12 + +::constant BUTTON_X 35 +::constant BUTTON_Y 15 + +::method init + expose kind3 initialSpeed minSpeed maxSpeed maxCycle cycle equal misses initPot won bitMapSize dlgSize + use arg minSpeed, maxSpeed, initialSpeed, kind3 + + self~init:super() + + -- Set the font the dialog will use when created. Without this step, dialog + -- units can not be calculated correctly. + self~setDlgFont(self~FONT_NAME, self~FONT_SIZE) + + -- Set our various instance variables. + minSpeed = max(1,minSpeed) + maxCycle = 200; initPot = 1000; equal = 0; misses = 0; cycle = maxCycle; won = .false + + -- Calculate the size of a bitmap in dialog units. + bitMapSize = .Size~new(self~BITMAP_X, self~BITMAP_Y) + self~pixel2dlgUnit(bitMapSize) + + -- Calculate the size of this dialog based on the bitmap size. + dlgSize = self~calcSize(bitMapSize) + + title = "Jackpot Slot Machine - Stop on 3 of a Kind and Win $$$" + self~initCode = self~createcenter(dlgSize~width, dlgSize~height, title) + +::method defineDialog + expose bmp. initialSpeed dlgSize bitMapSize + + sd = locate() + + -- Load the bitmaps into memory. + bmp.1 = self~loadBitmap(sd"bmp\tiger.bmp") + bmp.2 = self~loadBitmap(sd"bmp\chihuahu.bmp") + bmp.3 = self~loadBitmap(sd"bmp\eleph2.bmp") + bmp.4 = self~loadBitmap(sd"bmp\horse.bmp") + bmp.5 = self~loadBitmap(sd"bmp\sealion.bmp") + bmp.6 = self~loadBitmap(sd"bmp\moose.bmp") + bmp.7 = self~loadBitmap(sd"bmp\rhinoce.bmp") + bmp.8 = self~loadBitmap(sd"bmp\goat.bmp") + bmp.0 = 8 + + -- Note that for a static text control, the CENTERIMAGE flag has the effect + -- of vertically centering the text within the control. + + -- Create the jackpot line. First a frame around the whole thing. + x = self~MARGIN_X + y = self~MARGIN_Y + self~createBlackFrame(IDC_STATIC, x, y, dlgSize~width - (2 * self~MARGIN_X), self~JACKPOT_LINE_Y, "BORDER") + + -- Static text on the right, centered over the 1st bitmap + txt = "Jackpot $$$" + txtSize = self~getTextSizeDU(txt) + x += trunc((bitMapSize~width / 2) - (txtSize~width / 2)) + y += self~MARGIN_Y + self~createStaticText(IDC_STATIC, x, y, txtSize~width, self~TEXT_Y, "CENTER CENTERIMAGE", txt) + + -- The jackpot number, could be up to 9 digits. Just a static control with a + -- fancy frame, centered over the middle bitmap + txt = "888888888" + txtSize = self~getTextSizeDU(txt) + x = trunc((dlgSize~width / 2) - ((txtSize~width + 6) / 2)) + self~createBlackFrame(IDC_STATIC, x + 0, y - 2, txtSize~width + 6, self~TEXT_Y + 4, "BORDER") + self~createBlackFrame(IDC_STATIC, x + 1, y - 1, txtSize~width + 4, self~TEXT_Y + 2, "BORDER") + self~createStaticText(IDC_STATIC_JACKPOT, x + 3, y - 0, txtSize~width + 0, self~TEXT_Y + 0, "RIGHT CENTERIMAGE") + + -- Static text on the left, centered over the 3rd bitmap. + txt = "$$$ Jackpot" + txtSize = self~getTextSizeDU(txt) + x = (bitMapSize~width * 2) + (3 * self~MARGIN_X) -- The left edge of the 3rd bitmap ... + x += trunc((bitMapSize~width / 2) - (txtSize~width / 2)) -- ... and center + self~createStaticText(IDC_STATIC, x, y, txtSize~width, self~TEXT_Y, "CENTER CENTERIMAGE", txt) + + -- Now place the bitmaps + x = self~MARGIN_X + y = (2 * self~MARGIN_Y) + self~JACKPOT_LINE_Y + self~createBitmapButton(IDC_PB_BMP_LEFT, x, y, bitMapSize~width, bitMapSize~height, "INMEMORY USEPAL", , , bmp.1) + + x += bitMapSize~width + self~MARGIN_X + self~createBitmapButton(IDC_PB_BMP_CENTER, x, y, bitMapSize~width, bitMapSize~height, "INMEMORY ", , , bmp.1) + + x += bitMapSize~width + self~MARGIN_X + self~createBitmapButton(IDC_PB_BMP_RIGHT, x, y, bitMapSize~width, bitMapSize~height, "INMEMORY ", , , bmp.1) + + -- Stop and cancel buttons, placed at left margin and under bitmaps + x = self~MARGIN_X + y += bitMapSize~height + self~MARGIN_Y + buttons = "&Stop" .constDir[IDC_PB_STOP] "onStop &Cancel" .constDir[IDCANCEL] "Cancel" + self~createPushButtonGroup(x, y, self~BUTTON_X, self~BUTTON_Y, buttons, .false, "DEFAULT") + + -- A group box to hold the speed adjustment controls + txt = 'Speed (in ms) lower is faster' + x += bitMapSize~width + self~MARGIN_X + cy = dlgSize~height - y - self~MARGIN_Y + self~createGroupBox(IDC_STATIC, x, y, (bitMapSize~width * 2) + self~MARGIN_X, cy, , txt) + + -- And finally the speed adjustment controls them selves. The top of a group box + -- is higher than the top line of the group box (to allow for text.) So in order + -- for the speed controls to look centered with the group box lines, we need to + -- calculate the center, adjust for the height of the controls, and then push it + -- "down a bit." I arbitrarily choose 3 as 'a bit.' + x += self~MARGIN_X + y += trunc((cy / 2) - (self~TEXT_Y / 2)) + 3 + txt = ' Faster :' + txtSize = self~getTextSizeDU(txt) + self~createStaticText(IDC_STATIC, x, y, txtSize~width, self~TEXT_Y, 'RIGHT CENTERIMAGE', txt) + + x += txtSize~width + 2 + self~createEdit(IDC_EDIT, x , y, 35, self~TEXT_Y, "NUMBER") + + x += 35 + self~createUpDown(IDC_UD, x, y, 25, self~TEXT_Y, "RIGHT ARROWKEYS AUTOBUDDY BUDDYINT HORIZONTAL NOTHOUSANDS", 'speed') + + x += 2 + self~createStaticText(IDC_STATIC, x, y, 30, self~TEXT_Y, 'LEFT CENTERIMAGE', ': Slower') + + -- Set the up down position to the initial speed. + self~speed = initialSpeed + +::method initDialog + expose minSpeed maxSpeed notStopped jackPotCtrl speedCtrl + + self~newUpDown(IDC_UD)~setRange(minSpeed, maxSpeed) + + speedCtrl = self~newEdit(IDC_EDIT) + speedCtrl~setLimit(maxSpeed~length - 1) + ret = speedCtrl~connectCharEvent(onKey) + + jackPotCtrl = self~newStatic(IDC_STATIC_JACKPOT) + + notStopped = .true + self~disableControl(IDC_PB_STOP) + self~start("bandit") + +-- An attempt to disallow cut and paste into the speed control. +::method onKey unguarded + expose speedCtrl + use arg key, shift, control, alt, info + + s = speedCtrl~selection + + if control then return .false -- Don't allow cut and paste + if key == 57 then return .false + else return .true + +::method bandit unguarded + expose x y z bmp. kind3 cycle maxCycle equal misses notStopped won + + rand = random(1, 8, time('S') * 7) /* init random */ + ret = play("WHISTLE.WAV") + + -- The user could have canceled while the whistle was playing.. + if \self~isDialogActive then return 0 + + self~enableControl(IDC_PB_STOP) + + do cycle = maxCycle by -1 to 1 until \self~isDialogActive + if self~checkSpeed = 0 then leave + + sleep = format(max(1, min(100, self~speed / 2)), , 0) + do j = 1 to self~speed / sleep + if self~isDialogActive then call msSleep sleep + end + + if \self~isDialogActive then return 0 + guard on when notStopped -- Don't change the bitmaps out from under the user. + + if random(1, kind3) = 3 then do + x = equal // 8 + 1; y = x; z = x; equal += 1 + end + else do + x = random(1, 8); y = random(1, 8); z = random(1, 8) + end + + -- It's an error to invoke changeBitmapButton if the underlying dialog + -- no longer exists. (Which may be if the user hit cancel.) + if \self~isDialogActive then return 0 + + self~changeBitmapButton(IDC_PB_BMP_LEFT, bmp.x,,,,"INMEMORY STRETCH") + self~changeBitmapButton(IDC_PB_BMP_CENTER, bmp.y,,,,"INMEMORY STRETCH") + self~changeBitmapButton(IDC_PB_BMP_RIGHT, bmp.z,,,,"INMEMORY STRETCH") + + guard off + if \self~isDialogActive then return 0 + end + + if \won then do + self~disableControls + + msg = 'Sorry, you did not get the jackpot in ' || .endOfLine || - + misses 'tries.' || .endOfLine~copies(2) || - + 'There were' equal 'chances. ('equal' three' || .endOfLine || - + 'of a kind were shown.)' + title = 'End of run' + ret = messageDialog(msg, self~hwnd, title, "OK", "INFORMATION") + end + + -- Clean up is in our cancel method, so we invoke that rather than self~ok:super + if self~isDialogActive then return self~cancel + else return 1 + +::method disableControls private + self~disableControl(IDC_PB_STOP) + self~disableControl(IDCANCEL) + self~disableControl(IDC_EDIT) + self~disableControl(IDC_UD) + +::method onStop + expose x y z misses initPot notStopped won jackpotCtrl + + notStopped = .false -- Prevent the 'bandit' from changing the bitmaps + + if ((x=y) & (y=z)) then do + -- All 3 bitmaps are the same, jackpot. + won = .true + ret = play("tada.wav") + self~setWindowTitle(self~get,"Congratulations !") + do i = 40 by 20 to 120 + self~write(i*self~factorx,i*self~factory,"Congratulations...","Arial",14,'BOLD') + end + money = jackpotCtrl~getText + self~write(10*self~factorx+5,75*self~factory,"You won the jackpot:" money,"Arial",18,'BOLD') + do i=1 to min(money%500 + 1,10) + ret = play("jackpot.wav") + money = max(0,money - 500) + jackpotCtrl~setText(money) + end + jackpotCtrl~setText(0) + call msSleep 1000 + return self~cancel + end + + -- Not 3 of a kind + misses += 1 + ret = play("nope.wav", "yes") + + if ((x=y) | (y=z) | (x=z)) then do + ret = infoDialog("2 equal, not bad, try again... jackpot reduced 25%") + initPot = trunc(initPot * .75) + end + else do + ret = infoDialog("Not a chance, try again... jackpot is halfed!") + initPot = trunc(initPot * .5) + end + + if initPot = 1 then ret = infoDialog("One more chance to hit the jackpot....") + self~checkSpeed + notStopped = .true -- Unblock the 'bandit' + return 0 + +::method checkSpeed + expose minSpeed maxSpeed cycle initPot jackpotCtrl + + if \self~isDialogActive then return 0 + + self~getDataAttribute('speed') + + -- Although the edit control is numbers only, and the up down control won't + -- allow the user to spin outside of the range, or use the arrow keys to move + -- outside of the range, it is possible for the user to delete all the + -- numbers in the edit control, or to type in numbers larger than the + -- maximum. In which case the up down control seems to return the empty + -- string for its position ?? + if self~speed == "" then do + say 'Up down position: ' self~newUpDown(IDC_UD)~getPosition + say 'Edit control text:' self~newEdit(IDC_EDIT)~getText + end + + money = trunc(cycle * initPot / self~speed) + jackpotCtrl~setText(money) + + return money + + + -- You can not remove the bitmap handles while the dialog is still displayed + -- on the screen. As long as the dialog is showing, the os will try to + -- repaint the dialog when needed. If the bitmaps are destroyed, the + -- program will crash. The leaving method is provided for just this purpose, + -- it allows you to clean up resources. +::method leaving + expose bmp. + + do i = 1 to bmp.0 + self~removeBitmap(bmp.i) + end + + +::method cancel + expose notStopped + + self~disableControls + self~cancel:super + + call Play "byebye.wav" + + -- Be sure the bandit() method is not blocked so that this Rexx program ends. + notStopped = .true + + return 1 + +::method calcSize private + use strict arg bitMapSize + + s = .Size~new + + -- For the width of the dialog, we have 3 bitmaps, an X magin on both sides, + -- and we space the bitmaps apart horizontaly using the X margin. 3 bitmaps + -- and 4 X margins + s~width = (3 * bitMapSize~width) + (4 * self~MARGIN_X) + + -- The height is sligthly more complicated. It goes like this from top to + -- bottom: Y margin, jackpot line, Y margin, bitmap height, Y margin, push + -- button group height, Y margin. + s~height = (4 * self~MARGIN_Y) + self~JACKPOT_LINE_Y + bitMapSize~height + - + self~getButtonGroupHeight + + return s + +::method getButtonGroupHeight private + expose h + + if \h~dataType('W') then do + -- To calculate the height of the push button group, we need to know the + -- height of a button, the number of buttons (2), and the vertical spacing + -- between buttons. It so happens that I know the vertical spacing is 1/2 + -- the button height, truncated. + h = (2 * self~BUTTON_Y) + trunc(.5 * self~BUTTON_Y) + end + return h + diff --git a/modules/windows/oodialog/oobmpvu.rex b/modules/windows/oodialog/oobmpvu.rex new file mode 100755 index 0000000..cf1143d --- /dev/null +++ b/modules/windows/oodialog/oobmpvu.rex @@ -0,0 +1,114 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* */ +/* ooDialog\Samples\oobmpvu.rex BMP Display - GraphicDemo */ +/* */ +/*--------------------------------------------------------------------------*/ + + -- Use the global .constDir for symbolic IDs, and add IDs for this example. + .application~useGlobalConstDir('O') + .constDir[IDC_CB] = 101 + .constDir[IDC_PB_BITMAP] = 102 + + sd = locate() + oldDir = directory() + j = directory(sd"bmp") + + b.IDC_CB = '' + d = .BmpDialog~new(b.) + d~createCenter(300, 200, "Bitmap Viewer") + d~execute("SHOWTOP") + + j = directory(oldDir) + + return + +/*-------------------------------- requires --------------------------*/ + +::requires "ooDialog.cls" + +/*-------------------------------- dialog class ----------------------*/ + +::class 'BmpDialog' subclass UserDialog + +::method defineDialog + self~createStaticText(IDC_STATIC, 10, 10, , , , "Filename: ") + + self~createComboBox(IDC_CB, 60, 10, 130, 180, "VSCROLL", "Filename") + self~connectComboBoxEvent(IDC_CB, "SELCHANGE", "FileSelected") + + self~createBitmapButton(IDC_PB_BITMAP, 13, 33, self~SizeX - 26, self~SizeY - 30 - 36, , , , "blank.bmp") + + self~createPushButtonGroup(100, self~sizeY - 18,,, "&Show 1 OK &Cancel 2 CANCEL", 1) + self~createBlackFrame(IDC_STATIC, 10, 30, self~SizeX - 20, self~SizeY - 30 - 30) + +::method initDialog + self~addComboEntry(IDC_CB, "...") + self~comboAddDirectory(IDC_CB, "*.bmp", "READWRITE") + self~comboAddDirectory(IDC_CB, "*.dib", "READWRITE") + + -- This is done so that when the dialog is initially displayed, the bitmap viewer portion, + -- the bitmap button, is blank. + self~changeBitmapButton(IDC_PB_BITMAP,0) + +::method fileSelected /* drop-down selection */ + self~getData + if self~filename = "..." then self~OK + else self~showBitmap + +::method OK /* show button */ + self~getData + if self~filename = "..." then + do + self~filename = fileNameDialog("*.*", self~DlgHandle) + if self~filename \= "0" then + do + self~comboDrop(IDC_CB) + self~addComboEntry(IDC_CB, "...") + self~comboAddDirectory(IDC_CB, filespec("drive", self~Filename) || filespec("path", self~Filename) || "*.bmp", "READWRITE") + self~comboAddDirectory(IDC_CB, filespec("drive", self~Filename) || filespec("path", self~Filename) || "*.dib", "READWRITE") + self~setDataAttribute("Filename") + end + end + self~showBitmap + return 0 + +::method showBitmap /* draw the bitmap */ + self~changeBitmapButton(IDC_PB_BITMAP,0) + self~changeBitmapButton(IDC_PB_BITMAP,self~filename,,,,"USEPAL") diff --git a/modules/windows/oodialog/oodStandardDialogs.rex b/modules/windows/oodialog/oodStandardDialogs.rex new file mode 100755 index 0000000..6a18858 --- /dev/null +++ b/modules/windows/oodialog/oodStandardDialogs.rex @@ -0,0 +1,232 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oDialog\Samples\oodStandardDialog.rex Standard Dialog demonstration. + * + * This example pops up a main dialog from which the user can select to display + * any of the standard dialogs provided by ooDialog. + * + * This example also demonstrates using the .application object to set a default + * application icon. This icon will then be used for every dialog that does not + * over-ride the default by explicitly specifying some other application icon. + * This gives all the dialogs displayed an uniform appearance. + */ + + sd = locate() + .application~setDefaults('O', sd'rc\oodStandardDialogs.h') + .application~defaultIcon(sd'bmp\oodStandardDialogs.ico') + + dlg = .StandardDialogs~new(sd"rc\oodStandardDialogs.rc", IDD_STDDLGS) + dlg~execute("SHOWTOP") + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" +::requires "samplesSetup.rex" + +::class 'StandardDialogs' subclass RcDialog + +::method initDialog + self~newRadioButton(IDC_RB_CHECKLIST)~check + + +::method ok unguarded + reply 0 + + select + when self~newRadioButton(IDC_RB_CHECKLIST)~checked then self~checkList + when self~newRadioButton(IDC_RB_INTEGERBOX)~checked then self~integerBox + when self~newRadioButton(IDC_RB_INPUTBOX)~checked then self~inputBox + when self~newRadioButton(IDC_RB_LISTCHOICE)~checked then self~listChoice + when self~newRadioButton(IDC_RB_MULTIINPUTBOX)~checked then self~multiInputBox + when self~newRadioButton(IDC_RB_MULTILISTCHOICE)~checked then self~multiListChoice + when self~newRadioButton(IDC_RB_PASSWORDBOX)~checked then self~passwordBox + when self~newRadioButton(IDC_RB_SINGLESELECTION)~checked then self~singleSelection + when self~newRadioButton(IDC_RB_TIMEDMESSAGE)~checked then self~timedMessage + otherwise nop + end + -- End select + + +/********************************************************************/ +/* How to use "CheckList" class */ +/********************************************************************/ +::method checkList private + lst.1 = "Monday" ; lst.2 = "Tuesday" ; lst.3 = "Wednesday" ; lst.4 = "Thursday" + lst.5 = "Friday" ; lst.6 = "Saturday"; lst.7 = "Sunday" + + do i = 101 to 107 + chk.i = 0 + end + chk.102 = 1 + chk.104 = 1 + + d = .CheckList~new("This is a checklist dialog","Checklist",lst., chk.) + + msg = "Your CheckList data:" || .endOfLine~copies(2) + if d~execute = 1 then do i = 101 to 107 + a = i-100 + if chk.i = 1 then msg ||= " ->" lst.a || .endOfLine + end + else do + msg ||= 'The user canceled the dialog.' + end + self~displayResult(msg, 'Check List Dialog Results') + + +/********************************************************************/ +/* How to use "InputBox" class */ +/********************************************************************/ +::method inputBox private + d = .InputBox~new("This is an input dialog, please enter some data","InputBox") + msg = "Your InputBox data:" || .endOfLine~copies(2) || d~execute + self~displayResult(msg, 'Input Box Dialog Results') + + +/********************************************************************/ +/* How to use "IntegerBox" class */ +/********************************************************************/ +::method integerBox private + d = .IntegerBox~new("This is an integer dialog, please enter numerical data","IntegerBox") + msg = "Your IntegerBox data:" || .endOfLine~copies(2) || d~execute + self~displayResult(msg, 'Integer Box Dialog Results') + + +/********************************************************************/ +/* How to use "ListChoice" class */ +/********************************************************************/ +::method listChoice private + lst.1 = "Monday" ; lst.2 = "Tuesday" ; lst.3 = "Wednesday" ; lst.4 = "Thursday" + lst.5 = "Friday" ; lst.6 = "Saturday"; lst.7 = "Sunday" + + d = .ListChoice~new("This is a listchoice dialog, please select the day","ListChoice",lst., , , 'Thursday') + s = d~execute + msg = "Your ListChoice data:" || .endOfLine~copies(2) || s + self~displayResult(msg, 'List Choice Dialog Results:') + + +/********************************************************************/ +/* How to use "MultiInputBox" class */ +/********************************************************************/ +::method multiInputBox private + lab.1 = "First name: " + lab.2 = "Last name: " + lab.3 = "Street and City: " + lab.4 = "Profession:" + + addr.101 = "John" ; addr.102 = "Smith" ; addr.103 = "" + addr.104 = "Software Engineer" + + d = .MultiInputBox~new("This is a multi input dialog, please enter the address","Your Address",lab., addr.) + msg = "Your MultiInputBox data:" || .endOfLine~copies(2) + if d~execute = 1 then do + msg || = " ->" d~FirstName || .endOfLine || " ->" d~LastName || .endOfLine ||- + " ->" d~StreetandCity || .endOfLine || " ->" d~Profession + end + else do + msg ||= 'The user canceled the dialog.' + end + self~displayResult(msg, 'MultiInput Box Dialog Results:') + + +/********************************************************************/ +/* How to use "MultiListChoice" class */ +/********************************************************************/ +::method multiListChoice private + lst.1 = "Monday" ; lst.2 = "Tuesday" ; lst.3 = "Wednesday" ; lst.4 = "Thursday" + lst.5 = "Friday" ; lst.6 = "Saturday"; lst.7 = "Sunday" + + d = .MultiListChoice~new("This is a multiple list choice dialog, please select the days",, + "MultipleListChoice",lst.) + s = d~execute + msg = "Your MultiListChoice data:" || .endOfLine~copies(2) || "returned indexes:" s || .endOfLine~copies(2) + if s <> 0 then do while s <> "" + parse var s res s + if res <> "" then msg ||= " ->" lst.res || .endOfLine + end + self~displayResult(msg, 'MultiList Choice Dialog Results') + + +/********************************************************************/ +/* How to use "PasswordBox" class */ +/********************************************************************/ +::method passwordBox private + d = .PasswordBox~new("Please enter your password","Security") + msg = "Your PasswordBox data:" || .endOfLine~copies(2) || d~execute + self~displayResult(msg, 'Password Box Dialog Results') + + +/********************************************************************/ +/* How to use "SingleSelection" class */ +/********************************************************************/ +::method singleSelection private + mon.1 = "January" ; mon.2 = "February" ; mon.3 = "March" ; mon.4 = "April" + mon.5 = "May" ;mon.6 = "June" ; mon.7 = "July" ; mon.8 = "August" + mon.9 = "September";mon.10= "October" ; mon.11= "November"; mon.12= "December" + + d = .SingleSelection~new("This is a single selection dialog","Single Selection",mon.,6,,6) + d~focusControl(106) + s = d~execute + msg = "Your SingleSelection data:" || .endOfLine~copies(2) + if s > 0 then do + msg ||= mon.s + end + else do + msg ||= 'The user canceled the dialog.' + end + self~displayResult(msg, 'Single Selection Dialog Results') + + +/********************************************************************/ +/* How to use "TimedMessage" class */ +/********************************************************************/ +::method timedMessage private + d = .TimedMessage~new("This is a timed message, maybe you will need it sometime", "Hello !", 4000) + d~execute + + +::method displayResult private + use strict arg msg, title + + j = MessageDialog(msg, self~hwnd, title, "OK", "INFORMATION") + diff --git a/modules/windows/oodialog/oodStandardRoutines.rex b/modules/windows/oodialog/oodStandardRoutines.rex new file mode 100755 index 0000000..66f188e --- /dev/null +++ b/modules/windows/oodialog/oodStandardRoutines.rex @@ -0,0 +1,330 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** ooDialog\Samples\oodStandardRoutines.rex Standard Public Routines Demo + * + * This example application pops up a dialog from which any of the standard + * public routines provided by the ooDialog framework can be selected and + * displayed. These routines are used to create a short cut to launching one of + * the standard dialogs provided by ooDialog. + * + * For a similar example program that displays the standard dialogs, see the + * oodStandardDialogs.rex example. + * + * Note the use of the defaultIcon() method to give all the dialogs shown during + * the execution of this example a similar look. + * + * Note also that both this example and the oodStandardDialogs example share the + * same resource script and .h file. + */ + + sd = locate() + .application~setDefaults('O', sd'rc\oodStandardDialogs.h') + .application~defaultIcon(sd'bmp\oodStandardRoutines.ico') + + dlg = .StandardRoutines~new(sd"rc\oodStandardDialogs.rc", IDD_STDRTNS) + dlg~execute("SHOWTOP") + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'StandardRoutines' subclass RcDialog + +::constant COMMON_TITLE "Standard Public Routines Demo" + +::method initDialog + self~newRadioButton(IDC_RB_ASKDIALOG_R)~check + + +::method ok unguarded + reply 0 + + select + when self~newRadioButton(IDC_RB_ASKDIALOG_R)~checked then self~askDialog + when self~newRadioButton(IDC_RB_CHECKLIST_R)~checked then self~checkList + when self~newRadioButton(IDC_RB_ERRORDIALOG_R)~checked then self~errorDialog + when self~newRadioButton(IDC_RB_FILENAMEDIALOG_R)~checked then self~fileNameDialog + when self~newRadioButton(IDC_RB_INFODIALOG_R)~checked then self~infoDialog + when self~newRadioButton(IDC_RB_INTEGERBOX_R)~checked then self~integerBox + when self~newRadioButton(IDC_RB_INPUTBOX_R)~checked then self~inputBox + when self~newRadioButton(IDC_RB_LISTCHOICE_R)~checked then self~listChoice + when self~newRadioButton(IDC_RB_MESSAGEDIALOG_R)~checked then self~messageDialog + when self~newRadioButton(IDC_RB_MULTIINPUTBOX_R)~checked then self~multiInputBox + when self~newRadioButton(IDC_RB_MULTILISTCHOICE_R)~checked then self~multiListChoice + when self~newRadioButton(IDC_RB_PASSWORDBOX_R)~checked then self~passwordBox + when self~newRadioButton(IDC_RB_SINGLESELECTION_R)~checked then self~singleSelection + when self~newRadioButton(IDC_RB_TIMEDMESSAGE_R)~checked then self~timedMessage + otherwise nop + end + -- End select + + +::method askDialog private + + msg = 'AskDialog routine:' || .endOfLine~copies(2) || - + 'This routine is good for getting input' || .endOfLine || - + 'from the user, when the input can be' || .endOfLine || - + 'supplied by a simple Yes or No answer.' || .endOfLine~copies(2) || - + 'Was this information helpful to you?' + + if AskDialog(msg) then do + msg = 'Glad this example is of use.' || .endOfLine~copies(2) || - + 'Did you notice the default button has changed?' + + ret = AskDialog(msg, 'N') + end + else do + msg = 'Well, the text for the message is a littel contrived.' || .endOfLine~copies(2) || - + 'Did you notice the default button has changed?' + + ret = AskDialog(msg, 'N') + end + + +::method checkList private + chks = .array~new + chks[3] = .true + chks[4] = .true + + labels = .array~of("Jan", "Feb", "Mar", "April in Paris is nice", - + "May", "Jun", "Jul", "Aug", - + "Sep", "Oct", "Nov", "Dec") + + ar = CheckList('Select a few months:', self~COMMON_TITLE, labels, chks, , 4) + + msg = 'Check list routine results:' || .endOfLine~copies(2) + if ar \= .nil then do i=1 to ar~items + if ar[i] = 1 then msg ||= ' CheckList['i'] (' || labels[i] || ') is checked.' || .endOfLine + end + else do + msg ||= 'The user canceled.' + end + + self~displayResult(msg, 'Check List Public Routine') + + +::method errorDialog private + + msg = 'ErrorDialog routine:' || .endOfLine~copies(2) || - + 'This routine is good for displaying error' || .endOfLine || - + 'messages to the user. Serious warning' || .endOfLine || - + 'messages might also be appropriate for this' || .endOfLine || - + 'routine.' + + return ErrorDialog(msg) + + +::method fileNameDialog private + + ooRexxHome = value("REXX_HOME", , 'ENVIRONMENT' ) + if ooRexxHome~length == 0 then path = 'C:\Program Files\ooRexx\' + else path = ooRexxHome || '\' + + delimiter = '0'x + filemask = 'All Files (*.*)'delimiter'*.*'delimiter + + fileName = FileNameDialog(path, self~hwnd, filemask) + + if fileName == 0 then msg = 'You did not select a file.' + else msg = 'You selected' fileName 'as your pick.' + self~displayResult(msg, 'File Name Dilaog Public Routine') + + +::method infoDialog private + + msg = 'InfoDialog routine:' || .endOfLine~copies(2) || - + 'This routine is good for displaying short' || .endOfLine || - + 'bits of information to the user, when no' || .endOfLine || - + 'reply from the user is needed.' + + return InfoDialog(msg) + + +::method inputBox private + + width = 60 + data = Inputbox('Please enter some fact:', self~COMMON_TITLE, , 200) + if data \== '' then msg = 'You entered:' data 'is that a fact?' + else msg = 'You canceled and did not enter any fact.' + self~displayResult(msg, 'Input Box Public Routine', .true) + + +::method integerBox private + + integer = Integerbox('Please enter a numeric value now:', self~COMMON_TITLE) + if integer \== '' then msg = 'You entered:' integer + else msg = 'You canceled and did not enter any value.' + self~displayResult(msg, 'Integer Box Public Routine') + + +::method listChoice private + + day = ListChoice('Select your favorite day:', self~COMMON_TITLE, - + .array~of("Monday", "Tuesday", "Wednesday", "Tursday", - + "Friday", "Saturday", "Sunday"), 102) + if day \== .nil then do + msg = 'So, your favorite day is' day'?' + self~displayResult(msg, 'List Choice Public Routine', .true) + end + else do + msg = 'You canceled and did not pick a favorite day.' + self~displayResult(msg, 'List Choice Public Routine') + end + + +::method messageDialog private + + msg = 'MessageDialog routine:' || .endOfLine~copies(2) || - + 'The message dialog gives the progammer more' || .endOfLine || - + 'flexibilty in crafting a dialog to inform the' || .endOfLine || - + 'user or to solicit information from the user.' || .endOfLine~copies(2) || - + 'That is a good thing, is it not?' + + do while .true + ret = MessageDialog(msg, self~hwnd, self~COMMON_TITLE, 'YESNOCANCEL', 'INFORMATION') + if ret == self~IDCANCEL then return + + if ret == self~IDNO then do + msg1 = 'No is not an appropriate answer!' + ret = MessageDialog(msg1, self~hwnd, self~COMMON_TITLE, 'RETRYCANCEL', 'EXCLAMATION', 'DEFBUTTON2') + if ret == self~IDCANCEL then return + end + else do + msg1 = 'Yes is the correct answer.' + ret = MessageDialog(msg1, self~hwnd, self~COMMON_TITLE, 'CANCELTRYCONTINUE', 'INFORMATION', 'DEFBUTTON3') + if ret == self~IDCANCEL then return + else if ret = self~IDTRYAGAIN then iterate + + msg2 = 'I could continue asking questions all day.' + ret = MessageDialog(msg2, self~hwnd, self~COMMON_TITLE, 'ABORTRETRYIGNORE', 'WARNING', 'DEFBUTTON3') + if ret == self~IDABORT then return + end + end + + +::method multiInputBox private + + editWidth = 100 + tab = '09'x + labels = .array~of("&First name", "Last &name", "&State") + + ar = MultiInputBox('Enter employee information:', self~COMMON_TITLE, - + labels, .array~of("Ueli", "Wahli", ''), 100) + + msg = 'Multi Input Box routine results:' || .endOfLine~copies(2) + if ar \== .nil then do i = 1 to 3 + msg ||= labels[i]~changeStr('&', '') || tab || ':' ar[i] || .endOfLine + end + else do + msg ||= 'You canceled the dialog.' + end + self~displayResult(msg, 'Multi Input Box Public Routine') + + +::method multiListChoice private + + labels = .array~of("Monday", "Tuesday", "Wednesday", "Tursday", "Friday", "Saturday", "Sunday") + + msg = 'Multi List Choice routine results:' || .endOfLine~copies(2) + ar = MultiListChoice('Select several days:', self~COMMON_TITLE, labels) + if ar \= .nil then do + msg ||= 'You selected' || .endOfLine + do i = 1 to ar~items + msg ||= ' ' ar[i] || .endOfLine + end + end + else do + msg ||= 'You did not select any days.' + end + self~displayResult(msg, 'Multi List Choice Public Routine') + + +::method passwordBox private + + -- This just shows that the password box increases in width to fit the prompt. + p = Passwordbox('Please enter a password, and be quick about it:', self~COMMON_TITLE) + msg = 'The password entered was:' p + self~displayResult(msg, 'Password Box Public Routine') + + p = Passwordbox('Password:', self~COMMON_TITLE) + msg = 'The password entered was:' p + self~displayResult(msg, 'Password Box Public Routine') + + + +::method singleSelection private + + labels = .array~of("Jan", "Feb", "Mar", "Apr", "May", "Jun", "July is the hottest month", - + "Aug", "Sep", "Oct", "Nov", "Dec") + selected = 7 + + choice = SingleSelection('Select one:', self~COMMON_TITLE, labels, selected) + msg = 'You selected' labels[choice] + self~displayResult(msg, 'Single Selection Public Routine') + + -- This shows the radio buttons do not have to be all in 1 row. Here we + -- break the buttons up so that no more than 6 are in 1 row. + selected = 3 + maxInRow = 6 + choice = SingleSelection('Select one, one more time:', self~COMMON_TITLE, labels, selected, , maxInRow) + msg = 'You selected' labels[choice] + self~displayResult(msg, 'Single Selection Public Routine') + + + +::method timedMessage private + + x = TimedMessage('Please read this message. You will have to be quick.', 'Message', 2000) + + +::method displayResult private + use strict arg msg, title, isQuestion = .false + + icon = "INFORMATION" + bttn = "OK" + if isQuestion then do + icon = "QUESTION" + bttn = "YESNO" + end + j = MessageDialog(msg, self~hwnd, title, icon, bttn) + diff --git a/modules/windows/oodialog/oodpbar.rex b/modules/windows/oodialog/oodpbar.rex new file mode 100755 index 0000000..8cac32a --- /dev/null +++ b/modules/windows/oodialog/oodpbar.rex @@ -0,0 +1,186 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: oodpbar.rex */ +/* Type: Open Object Rexx Script using ooDialog */ +/* Resource: oodpbar.rc */ +/* */ +/****************************************************************************/ + +-- Use the global .constDir for symbolic IDs +.application~useGlobalConstDir('O') + +sd = locate() + +myDialog = .MyDialogClass~new(sd"rc\oodpbar.rc") +if myDialog~initCode = 0 then do + rc = myDialog~execute("SHOWTOP") +end + +/* Add program code here */ + +exit /* leave program */ + + +::requires "ooDialog.cls" /* This file contains the ooDialog classes */ + +/* ---------------------------- Directives ---------------------------------*/ + +::class 'MyDialogClass' subclass RcDialog + +::method init + forward class (super) continue /* call parent constructor */ + initRet = Result + + /* Connect dialog control items to class methods. Ok, Cancel, and Help are + * already connected by the super class init() + */ + + /* Initial values that are assigned to the object attributes */ + + /* Add your initialization code here */ + return initRet + + +::method initDialog + + /* Initialize progress bar IDC_PBAR_A */ + curPB = self~newProgressBar("IDC_PBAR_A") + if curPB \= .nil then do + curPB~setRange(0,100) + curPB~setStep(50) + curPB~setPos(10) + end + + /* Initialize progress bar IDC_PBAR_B */ + curPB = self~newProgressBar("IDC_PBAR_B") + if curPB \= .nil then do + curPB~setRange(0,100) + curPB~setStep(40) + curPB~setPos(20) + end + + /* Initialize progress bar IDC_PBAR_C */ + curPB = self~newProgressBar("IDC_PBAR_C") + if curPB \= .nil then do + curPB~setRange(0,100) + curPB~setStep(30) + curPB~setPos(30) + end + + /* Initialize progress bar IDC_PBAR_D */ + curPB = self~newProgressBar("IDC_PBAR_D") + if curPB \= .nil then do + curPB~setRange(0,100) + curPB~setStep(20) + curPB~setPos(40) + end + + /* Initialize progress bar IDC_PBAR_E */ + curPB = self~newProgressBar("IDC_PBAR_E") + if curPB \= .nil then do + curPB~setRange(0,100) + curPB~setStep(10) + curPB~setPos(50) + end + + /* Othe initialization Code (e.g. fill list and combo boxes) */ + return 0 + + +::method defineDialog + + if self~initCode = 0 then do + -- Additional dialog control items could be added here. e.g. + -- createEditInputGroup(), createDateTimePicker(), etc.. However, that is + -- rarely done with a RcDialog. It makes more sense to simply have all the + -- controls in the resource script file. + end + + +/* --------------------- event handler(s) ------------------------------------*/ + + -- Method 0k is automatically connected to the button CLICK event with the + -- resource ID of IDOK by the ooDialog framework. In the resource script + -- file: "rc\oodpbar.rc" the button with ID of IDOK is labeled 'step' +::method ok unguarded + /* step each progress bar by the step set with the setStep method */ + curPB = self~newProgressBar("IDC_PBAR_A") + curPB~step + curPB = self~newProgressBar("IDC_PBAR_B") + curPB~step + curPB = self~newProgressBar("IDC_PBAR_C") + curPB~step + curPB = self~newProgressBar("IDC_PBAR_D") + curPB~step + curPB = self~newProgressBar("IDC_PBAR_E") + curPB~step + return 0 + + -- Method cancel is automatically connected to resource ID IDCANCEL by the + -- ooDialog framework. +::method cancel unguarded + /* Calling the superclass cancel will *always* close the dialog. If you want + * to over-ride that behavior, for example to ask the user if she is sure she + * wants to cancel, do not call the super class cancel first. Here, commented + * out, is one possible over-ride. + */ + + /* + text = 'There are unsaved changes, are you'.endOfLine'sure you want to cancel?' + title = "Abort All Changes !" + ret = MessageDialog(text, self~hwnd, title, "YESNO", "WARNING", "DEFBUTTON2") + say 'ret' ret 'self~IDYES:' self~IDYES + if ret == self~IDYES then return self~cancel:super + else return 1 + */ + + return self~cancel:super + + -- Method help() is automatically connected to resource ID IDHELP by the + -- ooDialog framework. The super class does nothing, you need to over-ride + -- this method to actually do anything. +::method help unguarded + + text = "There is no help for oodpbar.rex" + title = "The ooDialog ProgressBar Example" + + ret = MessageDialog(text, self~hwnd, title, "OK", "EXCLAMATION") + + return 0 + diff --git a/modules/windows/oodialog/oodraw.rex b/modules/windows/oodialog/oodraw.rex new file mode 100755 index 0000000..e9be291 --- /dev/null +++ b/modules/windows/oodialog/oodraw.rex @@ -0,0 +1,721 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oodraw.rex, an ooDialog sample program. + * + * This example demonstrates how to do custom drawing in ooDialog. It uses + * a large button as the drawing surface. + */ + + sd = locate() + .application~useGlobalConstDir("O", sd'ooDraw.h') + + d = .drawDlg~new + if d~initCode <> 0 then do + say 'The Draw dialog was not created correctly. Aborting.' + return d~initCode + end + d~execute("SHOWTOP") + + return 0 + +/*---------------------------------- requires ------------------------*/ + +::requires "ooDialog.cls" + +/*---------------------------------- dialog class --------------------*/ + +::class 'drawDlg' subclass UserDialog + +::attribute interrupted unguarded + +::method init + expose colornames + + forward class (super) continue + + colornames = .array~of('dark red', 'dark green', 'dark yellow', 'dark blue', - + 'purple', 'blue grey', 'light grey', 'pale green', - + 'light blue', 'white', 'grey', 'dark grey', 'red', - + 'light green', 'yellow', 'blue', 'pink', 'turquoise') + self~interrupted = .true + + if \ self~createcenter(200, 235, "ooDialog Color Drawing Demonstration", , , "System", 8) then + self~initCode = 1 + +::method defineDialog + + self~createPushButton(IDC_PB_DRAW, 0,0,200,200, "DISABLED NOTAB") -- The drawing surface. + + self~createPushButton(IDC_PB_BRUSH_RECTANGLES, 5, 205, 55, 12, ,"&Rectangles","brushRectangles") + self~createPushButton(IDC_PB_PEN_RECTANGLES, 62, 205, 55, 12, ,"&Pen Rectangles","penRectangles") + self~createPushButton(IDC_PB_PIXELS, 119, 205, 36, 12, ,"Pi&xels","pixels") + self~createPushButton(IDC_PB_STAR_LINES, 5, 220, 36, 12, ,"S&tar","starLines") + self~createPushButton(IDC_PB_RANDOM_LINES, 43, 220, 36, 12, ,"&Lines","randomLines") + self~createPushButton(IDC_PB_RANDOM_SQUARES, 81, 220, 36, 12, ,"&Squares","randomSquares") + self~createPushButton(IDC_PB_ELLIPSES, 119, 220, 36, 12, ,"&Ellipses","circleEllipses") + + self~createPushButton(IDC_PB_INTERRUPT, 160, 205, 35, 12, "DEFAULT", "&Interrupt", "interrupt") + self~createPushButton(IDCANCEL, 160, 220, 35, 12, ,"&Cancel") + + do i=5 to 49 + self~createBlackRect(-1, 2*i, 2*i, 200-4*i, 200-4*i, "BORDER") + end + do i=51 to 99 + self~createWhiteRect(-1, i+25, i+25, 200-2*i, 200-2*i, "BORDER") + end + +::method initDialog unguarded + expose x y dc myBrush myPen recThick linthick ranthick kpix change sysFont oldFont + + self~disableControl(IDC_PB_INTERRUPT) /* cannot interrupt yet */ + change = 0 + recThick = 0; linthick = 1; ranthick=0; kpix = 1; + x = self~factorx + y = self~factory + + dc = self~getButtonDC(IDC_PB_DRAW) + myBrush = self~createBrush(10) /* white */ + myPen = self~createPen(1,'solid',0) /* thin black */ + sysFont = self~createFontEx("System",10) + oldFont = self~FontToDC(dc,sysFont) + self~writeToButton(IDC_PB_DRAW,45*x,30*y,"Black rectangles","Arial",12,"BOLD") + self~writeToButton(IDC_PB_DRAW,80*x,80*y,"White rectangles","Arial",12,"BOLD") + +::method interrupt unguarded + self~interrupted = .true + self~disableControl(IDC_PB_INTERRUPT) + +::method cancel unguarded -- Stop the drawing program and quit. + expose x y dc myBrush myPen sysFont oldFont + + drawSurface = self~newPushButton(IDC_PB_DRAW) + self~interrupted = .true + j = msSleep(1) + + opts = .directory~new + opts~weight = 700 + tmpFont = self~createFontEx("Arial",28,opts) + xFont = self~fontToDC(dc,tmpFont) + + do i = 2 to 6 + if i // 2 = 1 then self~transparentText(dc) + else self~opaqueText(dc) + self~writeDirect(dc, 30 * x, 25 * i * y, "Good bye !") + j = SysSleep(.5) + end + + self~fontToDC(dc,oldFont) + self~deletefont(tmpFont) + self~deletefont(sysFont) + self~deleteObject(myBrush) + self~deleteObject(myPen) + self~freeButtonDC(IDC_PB_DRAW,dc) + + call msSleep 1000 + + self~cancel:super + +::method enableButtons -- Enable the selection buttons, disable interrupt. + self~enableControl(IDCANCEL) + self~enableControl(IDC_PB_BRUSH_RECTANGLES) + self~enableControl(IDC_PB_PEN_RECTANGLES) + self~enableControl(IDC_PB_PIXELS) + self~enableControl(IDC_PB_STAR_LINES) + self~enableControl(IDC_PB_RANDOM_LINES) + self~enableControl(IDC_PB_RANDOM_SQUARES) + self~enableControl(IDC_PB_ELLIPSES) + self~disableControl(IDC_PB_INTERRUPT) + +::method disableButtons -- Disable the selection buttons, enable interrupt. + self~disableControl(IDCANCEL) + self~disableControl(IDC_PB_BRUSH_RECTANGLES) + self~disableControl(IDC_PB_PEN_RECTANGLES) + self~disableControl(IDC_PB_PIXELS) + self~disableControl(IDC_PB_STAR_LINES) + self~disableControl(IDC_PB_RANDOM_LINES) + self~disableControl(IDC_PB_RANDOM_SQUARES) + self~disableControl(IDC_PB_ELLIPSES) + self~enableControl(IDC_PB_INTERRUPT) + +::method greyButton -- Repaint the drawing surface all grey. + expose x y dc change + change = 0 + brush = self~createBrush(7) + pen = self~createPen(1, 'solid', 7) + ob = self~objectToDC(dc, brush) + op = self~objectToDC(dc, pen) + + self~rectangle(dc, x, y, 199 * x, 199 * y, 'FILL') + + self~objectToDC(dc, op) + self~objectToDC(dc, ob) + self~deleteObject(brush) + self~deleteObject(pen) + +::method brushRectangles /* draw rectangles */ + expose x y dc myBrush myPen recThick change + + self~disableButtons + + if change \= 3 then do + self~greyButton + self~rectangle(dc, 26 * x, 26 * y, 174 * x, 174 * y, 'FILL') + end + + op = self~objectToDC(dc, myPen) + ob = self~objectToDC(dc, myBrush) + if change = 3 then signal doRectangles + + do col = 0 to 18 + i = col + 1 + brush = self~createBrush(col) + self~objectToDC(dc, brush) + j = 5*i + self~rectangle(dc, j * x, j * y, (200 - j) * x, (200 - j) * y, 'FILL') + self~objectToDC(dc,ob) + self~deleteObject(brush) + end + + self~writeToButton(IDC_PB_DRAW, 25 * x, 15 * y, "Colored brush rectangles", "Arial", 12, "BOLD") + call msSleep 2000 + change = 3 + +doRectangles: + self~transparentText(dc) + self~interrupted = .false + do recThick = recThick + 1 to 100 while \ self~interrupted + self~objectToDC(dc, myPen) + self~objectToDC(dc, myBrush) + self~rectangle(dc, 7 * x, 7 * y, 193 * x, 193 * y, 'FILL') + + do k = 1 to 25 while \ self~interrupted + brushcol = random(1, 18) + brush = self~createBrush(brushcol) + if recThick // 3 = 0 then pencol = brushcol + else pencol = random(1, 18) + + thick = recThick % 3 + 1 + pen = self~createPen(thick, 'solid', pencol) + self~objectToDC(dc, pen) + self~objectToDC(dc, brush) + px = random(10, 190) * x + py = random(10, 180) * y + pxx= random(10, 190) * x + pyy= random(10, 180) * y + + if recThick // 3 = 2 then self~rectangle(dc, px, py, pxx, pyy) + else self~rectangle(dc, px, py, pxx, pyy, 'FILL') + + self~objectToDC(dc, ob) + self~objectToDC(dc, op) + self~deleteObject(pen) + self~deleteObject(brush) + end + + if recThick // 3 = 1 then do + self~writeDirect(dc, 15 * x, 183 * y, "Random filled rectangles of thickness" thick) + end + else do + if recThick // 3 = 2 then self~writeDirect(dc, 15 * x, 183 * y, "Random rectangles of thickness" thick) + else self~writeDirect(dc, 15 * x, 183 * y, "Random unicolor rectangles") + end + + if \ self~interrupted then do + call msSleep 2000 + end + end + self~objectToDC(dc, op) + self~objectToDC(dc, ob) + self~opaqueText(dc) + self~interrupted = .true + self~enableButtons + +::method penRectangles unguarded /* draw rectangles with pen */ + expose x y dc myBrush myPen + self~disableButtons + self~greyButton + op = self~objectToDC(dc, myPen) + ob = self~objectToDC(dc, myBrush) + do col = 0 to 18 + i = col + 1 + pen = self~createPen(5, 'solid', col) + self~objectToDC(dc, pen) + j = 5 * i + 1 + self~rectangle(dc, j * x, j * y, (200 - j) * x, (200 - j) * y, 'FILL') + self~objectToDC(dc, op) + self~deleteObject(pen) + end + + self~writeToButton(IDC_PB_DRAW, 35 * x, 24 * y, "Colored pen rectangles", "Arial", 12, "BOLD") + styles = .array~of('solid', 'dash', 'dot', 'dashdot', 'dashdotdot', 'null') + call msSleep 2000 + + self~interrupted = .false + do k = 1 by 1 while \ self~interrupted + self~objectToDC(dc, myPen) + self~objectToDC(dc, myBrush) + self~rectangle(dc, 7 * x, 7 * y, 193 * x, 193 * y, 'FILL') + do i = 1 to 19 + if random(1, 4) = 1 | k // 2 = 0 then th = 1; else th = random(1, 8) + pen = self~createPen(th, styles[random(1, 6)], random(1, 18) ) + self~objectToDC(dc, pen) + + j = 5 * i + if k // 2 = 1 then self~rectangle(dc, j * x, j * y, (200 - j) * x, (200 - j) * y) + else self~rectangle(dc, random(10, 190) * x, random(10 , 180) * y, random(10, 190) * x, random(10, 180) * y) + + self~objectToDC(dc, op) + self~deleteObject(pen) + end + self~writeToButton(IDC_PB_DRAW, 25 * x, 24 * y, "Solid and dotted rectangles", "Arial", 12, "BOLD") + if \ self~interrupted then do + call msSleep 2000 + end + end + + self~objectToDC(dc, ob) + self~interrupted = .true + self~enableButtons + +::method pixels /* draw individual pixels */ + expose x y dc myBrush myPen kpix change + mx = trunc(100 * x); my = trunc(100 * y); size = 100 + self~disableButtons + if change \= 2 then do + self~greyButton + self~rectangle(dc, mx - size, my - size, mx + size + 2, my + size + 2, 'FILL') + end + change = 2 + self~writeToButton(IDC_PB_DRAW, 20 * x, 20 * y, "Drawing colored pixels", "Arial", 14, "BOLD") + call msSleep 1000 + + self~interrupted = .false + do kpix = kpix to size until self~interrupted + px = mx + kpix + do py = my - kpix + 2 to my + kpix while \ self~interrupted + if \ self~interrupted then self~pause + col= random(0, 18); self~drawPixel(dc, px, py, col) + end + + py = my + kpix + do px = mx + kpix - 1 by -1 to mx - kpix + 1 while \ self~interrupted + if \ self~interrupted then self~pause + col = random(0, 18); self~drawPixel(dc, px, py, col) + end + + px = mx - kpix + 1 + do py = my + kpix - 1 by -1 to my - kpix + 1 while \ self~interrupted + if \ self~interrupted then self~pause + col= random(0, 18); self~drawPixel(dc, px, py, col) + end + + py = my - kpix + 1 + do px = mx - kpix + 2 to mx + kpix while \ self~interrupted + if \ self~interrupted then self~pause + col= random(0, 18); self~drawPixel(dc, px, py, col) + end + if \ self~interrupted then self~writeDirect(dc, 125 * x, 170 * y, "Done" kpix) + end + if kpix >= size then do; change = 0; kpix = 1; end + + self~interrupted = .true + self~enableButtons + +::method starLines /* draw rotating lines */ + expose x y dc myBrush myPen linthick change + self~disableButtons + self~interrupted = .false + + op = self~objectToDC(dc, myPen) + ob = self~objectToDC(dc, myBrush) + if change \= 1 then do + self~greyButton + self~rectangle(dc, 26 * x, 26 * y, 174 * x, 174 * y, 'FILL') + end + change = 1 + self~writeToButton(IDC_PB_DRAW, 20 * x, 6 * y, "Drawing colored lines", "Arial", 14, "BOLD") + px = 100 * x + py = px + call msSleep 1000 + maxthick = 140 + do linthick = linthick by 1 to maxthick until self~interrupted + self~writeToButton(IDC_PB_DRAW, 20 * x, 185 * y, "Lines are" linthick "thick", "System", 10) + do j = 1 to 4 until self~interrupted + do i = 30 by linthick to 170 until self~interrupted + if \ self~interrupted then self~pause + if j = 1 then do; pxx = 170 * x; pyy = i * y ; end + if j = 2 then do; pyy = 170 * x; pxx = (200 - i) * y; end + if j = 3 then do; pxx = 30 * x; pyy = (200 - i) * y; end + if j = 4 then do; pyy = 30 * x; pxx = i * y ; end + col= random(0, 18) + pen = self~createPen(linthick,' solid', col) + self~objectToDC(dc, pen) + self~drawLine(dc, px, py, pxx, pyy) + self~objectToDC(dc, op) + self~deleteObject(pen) + end + end + end + if linthick >= maxthick then do; change = 0; linthick = 1; end + self~objectToDC(dc, ob) + self~interrupted = .true + self~enableButtons + +::method randomLines /* draw random lines */ + expose x y dc myBrush myPen change ranthick + + self~disableButtons + self~interrupted = .false + + if change \= 5 then do + self~greyButton + self~rectangle(dc, 26 * x, 26 * y, 174 * x, 174 * y, 'FILL') + end + change = 5 + op = self~objectToDC(dc, myPen) + ob = self~objectToDC(dc, myBrush) + self~writeToButton(IDC_PB_DRAW, 20 * x, 5 * y, "Drawing random lines", "Arial", 14, "BOLD") + call msSleep 1000 + + do ranthick = ranthick by 1 until self~interrupted + self~rectangle(dc, 15 * x, 15 * y, 185 * x, 185 * y, 'FILL') + pxx = 30 * x; pyy = 30 * y + maxthick = max(1, random(1, 150) - 10) /* favor 1 */ + do i = 0 to 49 until self~interrupted + if \ self~interrupted then self~pause + col= random(0, 18) + if ranthick // 2 = 1 then thickd = ranthick % 2 // 50 + 1 + else thickd = (maxthick - i * maxthick / 50) % 3 + 1 + pen = self~createPen(thickd, 'solid', col) + if i = 0 then do + if ranthick // 2 = 1 then text = "Connected lines of even thickness" thickd + else text = "Random lines of thickness" thickd "to 1 " + + self~writeToButton(IDC_PB_DRAW, 15 * x, 188 * y, text, "System", 10) + end + ix = trunc(thickd / 2 / x) + iy = trunc(thickd / 2 / y) + pxx = random(15 + ix, 185 - ix) * x + pyy = random(15 + iy, 185 - iy) * y + self~objectToDC(dc, pen) + if ranthick // 2 = 1 then do + /* connected lines */ + self~drawLine(dc,,,pxx,pyy) + end + else do + /* random lines */ + px = random(15 + ix, 185 - ix) * x + py = random(15 + iy, 185 - iy) * y + self~drawLine(dc, px, py, pxx, pyy) + end + self~objectToDC(dc, op) + self~deleteObject(pen) + end + if \self~interrupted then do + call msSleep 2000 + end + end + + self~objectToDC(dc, ob) + self~interrupted = .true + self~enableButtons + +::method randomSquares /* draw colored squares */ + expose x y dc myBrush myPen colornames + self~disableButtons + self~interrupted = .false + self~greyButton + blackbrush = self~createBrush(0) + op = self~objectToDC(dc, myPen) + ob = self~objectToDC(dc, blackbrush) + self~rectangle(dc, x, y, 199 * x, 199 * y, 'FILL') + self~objectToDC(dc, ob) + self~deleteObject(blackbrush) + self~writeToButton(IDC_PB_DRAW, 15 * x, 5 * y, "Drawing colored squares", "Arial", 14, "BOLD") + colorx = .array~of(1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16, 17, 18, 10) + colors = colorx~copy + sx = 10 * x; sy = 10 * y; sx5 = 5 * x; sy5 = 5 * y + do i = 1 by 1 until self~interrupted + if \ self~interrupted then self~pause + + px = random(1, 17) * sx + sx5 + py = random(1, 17) * sy + sy5 + col= colors[random(1, 18)] + brush = self~createBrush(col) + self~objectToDC(dc, brush) + self~rectangle(dc, px, py, px + sx, py + sy,'FILL') + self~objectToDC(dc, ob) + self~deleteObject(brush) + + if i // 50 = 0 then do + if i < 1000 then do + c1 = colors[min(i / 50, 18)]; c2 = 10 + colors[i / 50] = 10 /* make whiter */ + end + else do + i1 = i / 50 // 18 + 1; i2 = 18 - i % 250 // 18 + c1 = colors[i1]; c2 = colorx[i2] + colors[i1] = colorx[i2] /* shift colors */ + end + txt = '- ' colornames[c1]~left(20) '+ ' colornames[c2]~left(20) + self~writeToButton(IDC_PB_DRAW, 15 * x, 188 * y, txt, "System") + self~writeToButton(IDC_PB_DRAW, 150 * x, 188 * y, "Done" i, "System") + end + end + + self~objectToDC(dc, op) + self~interrupted = .true + self~enableButtons + +::method circleEllipses /* draw circles and ellipses */ + expose x y dc myBrush myPen colornames change jellipse + + self~interrupted = .false + self~disableButtons + + variat = 6 + if change \= 4 then do + self~greyButton + jellipse = 1 + end + op = self~objectToDC(dc, myPen) + ob = self~objectToDC(dc, myBrush) + if change = 4 then signal doEllipses + + self~writeToButton(IDC_PB_DRAW, 15 * x, 2 * y, "Drawing colored ellipses", "Arial", 14, "BOLD") + self~rectangle(dc, 10 * x, 10 * y, 190 * x, 190 * y, 'FILL') + do i = 1 to 18 until self~interrupted + if \ self~interrupted then self~pause + px = i * 5 + 5; py = i * 3 + 7 + self~drawEllipse(i, 3, px, py, 200 - px, 200 - py) + end + + call msSleep 2000 + if self~interrupted then signal restore + + self~rectangle(dc, 10 * x, 10 * y, 190 * x, 190 * y, 'FILL') + do i = 1 to 18 until self~interrupted + if \ self~interrupted then self~pause + px = i * 4 + 6; py = i * 5 + 5 + self~drawEllipse(random(1, 18),random(1, 4), px, py, 200 - px, 200 - py) + self~drawEllipse(random(1, 18),random(1, 4), py, px, 200 - py, 200 - px) + end + call msSleep 2000 + change = 4 + +DOELLIPSES: + if self~interrupted then signal restore + do jellipse = jellipse by 1 until self~interrupted + self~rectangle(dc, 10 * x, 10 * y, 190 * x, 190 * y, 'FILL') + self~setArcDirection(dc, 'COUNTERCLOCKWISE') + if jellipse // variat = 1 then do i = 1 to 18 until self~interrupted + /* concentric partial circles */ + px = i * 5 + 5; py = i * 5 + 5 + if i // 4 = 3 then do + if random(1, 2) = 1 then do + self~drawEllipse(random(1, 18), random(1, 10), px, py, 200 - px, 200 - py, 200, 100, 0, 100) + end + else do + self~drawEllipse(random(1, 18), random(1, 10), px, py, 200 - px, 200 - py, 0, 100, 200, 100) + end + end + else do + self~drawEllipse(random(1, 18), random(1, 10), px, py, 200 - px, 200 - py, - + (random(1, 2) - 1) * 200, (random(1, 2) - 1) * 200, - + (random(1, 2) -1 ) * 200, (random(1, 2) - 1) * 200) + end + if i = 1 then do + self~writeToButton(IDC_PB_DRAW, 15 * x, 190 * y, "concentric partial circles ", "System", 10) + end + end + else if jellipse // variat = 2 then do i = 1 to 50 until self~interrupted + /* random full ellipses */ + if \ self~interrupted then self~pause + px = random(15, 185); py = random(15, 185) + pxx= random(15, 185); pyy= random(15, 185) + col = random(1, 18) + self~drawEllipse(col, random(1, 10), px, py, pxx, pyy) + + if i // 3 = 1 & col \= 10 & abs(px - pxx) > 1 & abs(py - pyy) > 2 then do + brush = self~createBrush(random(1, 18)) + self~objectToDC(dc, brush) + self~fillDrawing(dc, (px + pxx) %2 * x, (py + pyy) % 2 * x, col) + self~objectToDC(dc, ob) + self~deleteObject(brush) + end + if i = 1 then do + self~writeToButton(IDC_PB_DRAW, 15 * x, 190 * y, "random complete ellipses", "System", 10) + end + end + else if jellipse // variat = 3 then do i = 1 to 40 until self~interrupted + /* random partial ellipses */ + if \ self~interrupted then self~pause + + if i // 3 = 0 then self~setArcDirection(dc, 'COUNTERCLOCKWISE') + else self~setArcDirection(dc, 'CLOCKWISE') + + px = random(15, 185); py = random(15, 185) + pxx= random(15, 185); pyy= random(15, 185) + sx = random(15, 185); sy = random(15, 185) + ex = random(15, 185); ey = random(15, 185) + self~drawEllipse(random(1, 18), random(1, 16), px, py, pxx, pyy, sx, sy, ex, ey) + if i = 1 then do + self~writeToButton(IDC_PB_DRAW, 15 * x, 190 * y, "random partial ellipses ", "System", 10) + end + end + else if jellipse // variat = 4 then do i = 1 to 20 until self~interrupted + /* nice pies */ + if \ self~interrupted then self~pause + + px = 15; py = 15; pxx = 185; pyy = 185 + if i < 11 then do + sx = 60 * i - 260 + ex = sx + 50 + end + else do + sx = 900 - 50 * i + ex = sx - 40 + end + + if i = 1 | i = 11 then sy = 100 + else if i < 11 then sy = 0 + else sy = 200 + + if i < 10 then ey = 0 + else if i = 10 then ey = 95 + else if i < 20 then ey = 200 + else ey = 105 + + col = random(1, 18) + self~drawPieX(col, col, 1, px, py, pxx, pyy, ex, ey, sx, sy) + if i=1 then do + self~writeToButton(IDC_PB_DRAW, 15 * x, 190 * y, "arranged pies ", "System", 10) + end + end + else if jellipse//variat = 5 then do i = 1 to 30 until self~interrupted + /* random pies */ + if \ self~interrupted then self~pause + + px = random(15, 185); py = random(15, 185) + pxx = random(15, 185); pyy= random(15, 185) + sx = random(15, 185); sy = random(15, 185) + ex = random(15, 185); ey = random(15, 185) + col = random(1, 18) + + if i // 2 = 1 then + self~drawPieX(col, random(1, 18), random(1, 8), px, py, pxx, pyy, sx, sy, ex, ey) + else + self~drawPieX(col, col, 1, px, py, pxx, pyy, sx, sy, ex, ey) + + if i = 1 then do + self~writeToButton(IDC_PB_DRAW, 15 * x, 190 * y, "random pies ", "System", 10) + end + end + else do i = 1 to 10 until self~interrupted | ret > 0 + /* random angle arcs */ + if \ self~interrupted then self~pause + + sx = 150 - random(1, 100); sy = 150 - random(1, 100) + px = 130 - random(1, 60); py = 130 - random(1, 60) + radius = random(20, min(px, 200 - px, py, 200 - py) - 10) + angle = random(1, 360); sweep = random(1, 360) + col = random(1, 18) + pen = self~createPen(random(3, 10), 'solid', col) + self~objectToDC(dc, pen) + + ret = self~drawAngleArc(dc, sx * x, sy * y, px * x, py * y, radius * x, angle, sweep) + if i // 2 = 1 then self~drawLine(dc, , , sx * x, sy * y) + self~objectToDC(dc, myPen) + self~deleteObject(pen) + + if i = 1 then do + self~writeToButton(IDC_PB_DRAW, 15 * x, 190 * y, "random angle arcs ", "System", 10) + end + if ret > 0 then do + self~writeToButton(IDC_PB_DRAW, 50 * x, 100 * y, "Not working on Windows 95", "System", 10) + end + end + if \ self~interrupted then do + call msSleep 2000 + end + end + +restore: + self~objectToDC(dc, op) + self~objectToDC(dc, ob) + self~setArcDirection(dc, 'COUNTERCLOCKWISE') + self~interrupted = .true + self~enableButtons + +::method drawEllipse private + expose x y dc myBrush myPen + use arg col, penth, px, py, pxx, pyy, sx, sy, ex, ey + + pen = self~createPen(penth, 'solid', col) + self~objectToDC(dc, pen) + + if arg()<7 then self~drawArc(dc, px * x, py * y, pxx * x, pyy * y) + else self~drawArc(dc, px * x, py * y, pxx * x, pyy * y, sx * x, sy * y, ex * x, ey * y) + + self~objectToDC(dc, myPen) + self~deleteObject(pen) + +::method drawPieX + expose x y dc myBrush myPen jellipse + use arg col, col2, penth, px, py, pxx, pyy, sx, sy, ex, ey + + pen = self~createPen(penth, 'solid', col) + if jellipse // 3 = 1 then brush = self~createBrush(col2) /* no args */ + else brush = self~createBrush(col) + + self~objectToDC(dc, pen) + self~objectToDC(dc, brush) + + self~drawPie(dc, px * x, py * y, pxx * x, pyy * y, sx * x, sy * y, ex * x, ey * y) + + self~objectToDC(dc, myPen) + self~objectToDC(dc, myBrush) + + self~deleteObject(pen) + self~deleteObject(brush) + +::method pause + j = msSleep(10) + diff --git a/modules/windows/oodialog/oograph.rex b/modules/windows/oodialog/oograph.rex new file mode 100755 index 0000000..09452ca --- /dev/null +++ b/modules/windows/oodialog/oograph.rex @@ -0,0 +1,237 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: oograph.rex + * Type: Open Object REXX Script + * + * Description: A dialog that allows the user to execute two graphical ooRexx + * examples. One example displays bitmaps and the other example + * shows how to use the drawing methods provided by ooDialog. + * + * The main program, this program, shows how to use the + * scrollBitmapFromTo() and scrollInControl() methods. + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + -- Use the global .constDir for symbolic IDs + .application~useGlobalConstDir('O') + + .constDir[IDC_BMP_TOP] = 101 + .constDir[IDC_BMP_MIDDLE] = 102 + .constDir[IDC_ST_WFRAME] = 203 + .constDir[IDC_PB_OWNERDRAW] = 103 + .constDir[IDC_PB_VIEWER] = 111 + .constDir[IDC_PB_DRAW] = 112 + + d = .GraphDialog~new() + if d~initCode \= 0 then do + say "Dialog init did not work" + return d~initCode + end + + title = "Graphical Demonstration of Open Object Rexx and ooDialog Capabilities" + d~createCenter(trunc(770 / d~FactorX), trunc(470 / d~FactorY), title) + d~execute("SHOWTOP") + + return 0 + +/*-------------------------------- requires --------------------------*/ + +::requires "ooDialog.cls" +::requires "samplesSetup.rex" + +/*-------------------------------- dialog class ----------------------*/ + +::class 'GraphDialog' subclass UserDialog + +::method defineDialog + expose but2size sd + but2pos = trunc(170 / self~factorY) + but2size = trunc(300 / self~factorY) + + -- The two bitmap buttons are created larger than they need to be. In particular, + -- The IDC_BMP_MIDDLE button height is much larger, it covers most of the lower part of the + -- dialog. + -- + -- Then, the bitmaps for the buttons are positioned (moved from the upper left corner + -- of the button) by a large amount. The IDC_BMP_TOP button is positioned far to the right, + -- and the IDC_BMP_MIDDLE button is positioned far to the bottom and far to the left. In the + -- showInterface() method, scrollBitmapFromTo() is used to scroll the bitmaps from + -- their positions back to the upper left corner of the buttons. This gives the IDC_BMP_TOP + -- button the appearance of scrolling from the right to the left, and the IDC_BMP_MIDDLE button + -- the appearance of scrolling from the bottom to the top. + + -- install.bmp 550 x 100 pixels + -- install2.bmp 450 x 120 pixels + + sd = locate() + + self~createBitmapButton(IDC_BMP_TOP, 1, 10, self~sizeX-1, trunc(130 / self~factorY), "USEPAL", , , sd"bmp\install.bmp") + self~createBitmapButton(IDC_BMP_MIDDLE, 20, but2pos, self~sizeX - 20, but2size, , , , sd"bmp\install2.bmp") + + pos = .Point~new(trunc(self~sizeX * self~factorX) + 10, 0) + self~setBitmapPosition(IDC_BMP_TOP, pos) + + pos~x = 0 + pos~y = trunc(self~sizeY * self~factorY) + 10 + self~setBitmapPosition(IDC_BMP_MIDDLE, pos) + + -- Add the other controls. + self~createWhiteFrame(IDC_ST_WFRAME, 10, self~SizeY - 62, self~sizeX - 20, 38, "HIDDEN") + self~createPushButton(IDC_PB_OWNERDRAW, 12, self~SizeY - 60, self~sizeX - 24, 34, "OWNER NOTAB") + + groupArgs = "&Bitmap-Viewer" .constDir[IDC_PB_VIEWER] "bitmapViewer " || - + "&Draw-Color-Demo" .constDir[IDC_PB_DRAW] "ooDraw " || - + "&Cancel" .constDir[IDCANCEL] "cancel" + self~createPushButtonGroup(self~sizeX - 220, self~sizeY - 18, 60, 12, groupArgs, 1, "DEFAULT") + +::method initDialog + + -- We set the background color of these buttons to the same backgroud color + -- as the dialog, so that the buttons blend into the dialog. + COLOR_BTNFACE = 15 + self~setControlSysColor(IDC_PB_OWNERDRAW, COLOR_BTNFACE) + self~setControlSysColor(IDC_BMP_TOP, COLOR_BTNFACE) + self~setControlSysColor(IDC_BMP_MIDDLE, COLOR_BTNFACE) + + self~start("showInterface") + +::method showInterface unguarded + expose m but2size + + bmppos = trunc(but2size - 125 / self~FactorY) + + self~disableControl(IDC_PB_VIEWER) /* disable push buttons */ + self~disableControl(IDC_PB_DRAW) + self~disableControl(IDCANCEL) + + ret = play("inst.wav", yes) + + -- Scroll the bitmaps from their displaced positions back to the upper left corners + -- of the buttons. + self~scrollBitmapFromTo(IDC_BMP_TOP, trunc(self~SizeX * self~FactorX), 5, 12, 5, -12, 0, 1) + self~scrollBitmapFromTo(IDC_BMP_MIDDLE, 30, bmppos, 30, 0, 0, -3, 2, 1) + + -- The size of the IDC_BMP_MIDDLE button actually covers the controls under the button. If the + -- user clicks on any portion of the button, the button is repainted in the 'depressed' + -- state. Since the other controls are not repainted, this cause them (or parts of + -- them) to disappear. To prevent that, we resize the button to only take up the height + -- needed for the bitamp. + self~resizeControl(IDC_BMP_MIDDLE, 450 + 32, 120 + 2, "NOREDRAW") + + self~showControl(IDC_PB_OWNERDRAW) /* show scroll button */ + self~showControl(IDC_ST_WFRAME) + self~enableControl(IDCANCEL) /* Enable push buttons */ + self~enableControl(IDC_PB_VIEWER) + self~enableControl(IDC_PB_DRAW) + + -- Start the Asynchronuous scrolling of the introductory text. + text = "This ooDialog sample demonstrates dynamic dialog creation" + m = self~start("scrollInControl", IDC_PB_OWNERDRAW, text, "Arial", 36, "BOLD", 0, 2, 2, 6) + m~notify(.message~new(self, "scrollingFinished")) + + -- Now, wait until the scrolling finishes, or the user closes the main dialog. + self~waitForEvent + + -- While the user has not closed the dialog, scroll the instruction text. + do while self~isDialogActive + text = "... please press Bitmap-Viewer or Draw-Color-Demo buttons to run graphical applications ..." + m = self~start("scrollInControl", IDC_PB_OWNERDRAW, text, "Arial", 32, "SEMIBOLD", 0, 2, 4) + m~notify(.message~new(self, "scrollingFinished")) + + self~waitForEvent + end + +-- Wait until the haveEvent object variable turns .true. In this program we just +-- watch for two events, the scrolling text has finished, or the user has closed +-- the dialog. +::method waitForEvent unguarded + expose haveEvent + + haveEvent = .false + guard on when haveEvent + +-- This is the notification method for the scrolling text. It is invoked when +-- the scrollInControl() method has finished. The haveEvent object variable is +-- set to true which causes ourself to stop waiting. +::method scrollingFinished unguarded + expose haveEvent + haveEvent = .true + +-- leaving() is invoked by the ooDialog framework when the underlying dialog is +-- closed. It serves as a notification that the dialog is finished. The +-- default implementation does nothing. It can be, and ii meant to be, over- +-- ridden by the programmer when desired. We use it to signal ourself to stop +-- waiting by setting haveEvent to true. +::method leaving unguarded + expose haveEvent + haveEvent = .true + + +-- Invoke the Bitmap Viewer program (oobmpvu.rex.) +::method bitmapViewer + expose m sd + + -- Stop the scrolling and hide ourself. + if \ m~completed then self~scrollInControl(IDC_PB_OWNERDRAW) + self~hide + + call (sd"oobmpvu.rex") + + -- Show ourself and become the topmost. + self~~show~toTheTop + +-- Invoke the Color Draw Demo program (oodraw.rex.) +::method ooDraw + expose m sd + + -- Stop the scrolling and hide ourself. + if \ m~completed then self~scrollInControl(IDC_PB_OWNERDRAW) + self~hide + + call (sd"oodraw.rex") + + -- Show ourself and become the topmost. + self~~show~toTheTop + diff --git a/modules/windows/oodialog/oophil.ico b/modules/windows/oodialog/oophil.ico new file mode 100644 index 0000000..332179b Binary files /dev/null and b/modules/windows/oodialog/oophil.ico differ diff --git a/modules/windows/oodialog/oophil.rex b/modules/windows/oodialog/oophil.rex new file mode 100755 index 0000000..d07bcdf --- /dev/null +++ b/modules/windows/oodialog/oophil.rex @@ -0,0 +1,430 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oophil.rex An ooDialog demonstration of the Philosopher's Forks + */ + + myDir = locate() + +/*---------------------- run default parameters ----------------------*/ + + parms.107 = 80 /* sleeping time 80 * 100 ms = 8 sec */ + parms.108 = 50 /* eating time 50 * 100 ms = 5 sec */ + parms.109 = 3 /* 3 repetitions */ + parms.104 = 0 /* radio button left fork first off */ + parms.105 = 0 /* right fork first off */ + parms.106 = 1 /* any fork first on */ + +/*---------------------- dialogs & resources -------------------------*/ + + v.anidialogID = 100 /* animation dialog graphical */ + v.anidialog = myDir'rc\oophil2.rc' + v.setdialogID = 101 /* setup dialog for parameters */ + v.setdialog = myDir'rc\oophil1.rc' + +/*---------------------- animation dialog IDs ------------------------*/ + + v.idp = 100 /* phil 101-105 */ + v.idf = 105 /* fork 106-110 */ + v.idhr = 111 /* hand-r 121,131,141,151,161 */ + v.idhl = 112 /* hand-l 122,132,142,152,162 */ + v.idcake = 120 /* cake */ + v.idpc = 110 /* piece of cake 111-115 */ + +/*---------------------- animation audio files -----------------------*/ + + v.help = myDir'wav\philhelp.wav' + v.stop = myDir'wav\philstop.wav' + v.eat = myDir'wav\phileat.wav' + v.sleep = myDir'wav\philslep.wav' + v.wait = myDir'wav\philwait.wav' + v.ouch = myDir'wav\philouch.wav' + v.cakewhere = myDir'wav\philstrt.wav' + v.cakenew = myDir'wav\philcake.wav' + + v.helptext = "<<< The values of this dialog determine the" , + "behavior of the Philosophers' Forks execution <<<" + +/*----------------------- bitmaps (will be memory loaded) ------------*/ + + vb.bmpblank = myDir'bmp\blank.bmp' + vb.bmpphil = myDir'bmp\philphil.bmp' + vb.bmpwait = myDir'bmp\philwait.bmp' + vb.bmpeat = myDir'bmp\phileat.bmp' + vb.bmpeat2 = myDir'bmp\phileat2.bmp' + vb.bmpsleep = myDir'bmp\philslep.bmp' + vb.bmpouch = myDir'bmp\philouch.bmp' + vb.bmpfork = myDir'bmp\fork.bmp' + vb.bmphandr = myDir'bmp\handrite.bmp' + vb.bmphandl = myDir'bmp\handleft.bmp' + vb.bmphandrf = myDir'bmp\handfkri.bmp' + vb.bmphandlf = myDir'bmp\handfkle.bmp' + vb.bmppiece = myDir'bmp\cakepiec.bmp' + do i=1 to 11 + icake = 'BMPCAKE'i + vb.icake = myDir'bmp\cake'i'.bmp' + end + +/*---------------------- main logic ----------------------------------*/ + + setUpDlg = .SetUpDialog~new(parms., v., vb.) + setUpDlg~execute("SHOWTOP") + + return 0 + + +/*---------------------- requires ooDialog ----------------------------*/ + +::requires 'ooDialog.cls' +::requires 'samplesSetup.rex' + + +/*---------------------- setup dialog ---------------------------------*/ + +::class 'SetupDialog' subclass UserDialog + +::method init + expose v. vb. + use arg parms., v., vb. + self~init:super(parms.) + self~load(v.setdialog, v.setdialogID, 'CENTER') + +::method initDialog + expose msg v. vb. + msg = .nil + + -- Set the up down controls. They all have a range from 0 to 1000. Then + -- we connect the delta postion event notification for the sleeping and + -- eating time controls so that we can increment them by 5 rather than 1. + do id = 107 to 109 + self~newUpDown(id)~setRange(0, 1000) + end + + self~connectUpDownEvent(107, "DELTAPOS", onDelta) + self~connectUpDownEvent(108, "DELTAPOS", onDelta) + + -- Load the bitmaps in to memory + do i over vb. + v.i = self~loadBitmap(vb.i) + end + +-- The user incremented (or decremented) one of the up down controls. We +-- intercept the notification so that we can increment (or decrement) by 5 +-- rather than 1. +::method onDelta + use arg pos, delta, id, hwnd + + return .UpDown~deltaPosReply(.true, .false, delta * 5) + +::method help + expose msg v. + if msg = .NIL then ret = Play(v.help, 'yes') + else if msg~completed then ret = Play(v.help, 'yes') + else ret = Play() + msg = self~start("scrollInButton", 110, v.helptext, - + "Arial", 30, "BOLD", 0, 4, 8) + return 0 + +::method ok /* run philosophers */ + expose msg v. + if msg \= .nil then + if msg~completed=0 then self~scrollInButton(110) + self~getDataStem(parms.) + /* philosopher dialog */ + dlg = .phildlg~new(v.) + if dlg~executeAsync(,"SHOWTOP") = 0 then do + dlg~myExecute(parms.) /* philosopher animation */ + dlg~endAsyncExecution + end + else call errorDialog "Couldn't execute Philosophers Forks Dialog" + +::method cancel + expose msg v. vb. + if msg \= .nil then + if \msg~completed then self~scrollInButton(110) + do i over vb. /* bitmaps out of memory */ + self~removeBitmap(v.i) + end + self~cancel:super + + +/*---------------------- animation dialog -----------------------------*/ + +::class 'PhilDlg' subclass UserDialog + +::attribute stopped unguarded + +::method init + expose v. + use arg v. + self~init:super + self~stopped = .false + self~load(v.anidialog, v.anidialogID, 'CENTER') + +::method initDialog + expose f1 f2 f3 f4 f5 p1 p2 p3 p4 p5 v. + + self~disableControl(1) /* disable stop button */ + do i = 1 to 5 + ret = self~installBitmapButton(v.idp + i, '', v.bmpphil ,,,,"STRETCH INMEMORY") + ret = self~installBitmapButton(v.idf + i, '', v.bmpfork ,,,,"STRETCH INMEMORY") + ret = self~installBitmapButton(v.idhl + 10*i, '', v.bmpblank,,,,"STRETCH INMEMORY") + ret = self~installBitmapButton(v.idhr + 10*i, '', v.bmpblank,,,,"STRETCH INMEMORY") + ret = self~installBitmapButton(v.idpc + i, '', v.bmpblank,,,,"STRETCH INMEMORY") + end + ret = self~installBitmapButton(v.idcake, '', v.bmpblank,,,,"STRETCH INMEMORY") + + f1 = .fork~new(1, self) /* create 5 forks */ + f2 = .fork~new(2, self) + f3 = .fork~new(3, self) + f4 = .fork~new(4, self) + f5 = .fork~new(5, self) + + p1 = .phil~new(1,f5,f1, self) /* create 5 philos. */ + p2 = .phil~new(2,f1,f2, self) + p3 = .phil~new(3,f2,f3, self) + p4 = .phil~new(4,f3,f4, self) + p5 = .phil~new(5,f4,f5, self) + +::method myExecute unguarded /* animate dialog */ + expose f1 f2 f3 f4 f5 p1 p2 p3 p4 p5 + use arg parms. + reply + T.sleep = parms.101 + T.eat = parms.102 + T.veat = trunc(T.eat / 2) + T.vsleep = trunc(T.sleep / 2) + if parms.104 = 1 then T.side = 100 /* left fork first */ + else if parms.105 = 1 then T.side = 0 /* right */ + else T.side = 50 /* random */ + T.repeats = parms.103 + + self~cake('init') /* set up the cake */ + + m1 = p1~start("run",T.) /* run 5 philsophers */ + m2 = p2~start("run",T.) + m3 = p3~start("run",T.) + m4 = p4~start("run",T.) + m5 = p5~start("run",T.) + self~enableControl(1) /* enable stop button */ + + -- wait untill the 5 philsopers are done, or the stop button is pushed. + do while(m1~completed+m2~completed+m3~completed+m4~completed+m5~completed <5) & \self~stopped + j = SysSleep(.340) + end + m1~result /* check 5 phils */ + m2~result + m3~result + m4~result + m5~result + self~ok:super /* finish dialog */ + +::method ok unguarded /* Stop button */ + expose f1 f2 f3 f4 f5 p1 p2 p3 p4 p5 v. + self~disableControl(1) + self~stopped = .true + call play v.stop,'yes' + f1~layDown /* take away forks */ + f2~layDown + f3~layDown + f4~layDown + f5~layDown + +::method cancel unguarded + self~ok /* stop ourself */ + +::method setPhil unguarded /* philosoph bitmap */ + expose v. + use arg num, bmp + self~changeBitmapButton(v.idp + num, value('v.bmp'bmp),,,,'STRETCH INMEMORY') + +::method setFork unguarded /* fork bitmap */ + expose v. + use arg num, bmp + self~changeBitmapButton(v.idf + num, value('v.bmp'bmp),,,,'STRETCH INMEMORY') + +::method setLeft unguarded /* left hand bitmap */ + expose v. + use arg num, bmp + self~changeBitmapButton(v.idhl + num*10, value('v.bmp'bmp),,,,'STRETCH INMEMORY') + +::method setRight unguarded /* righthand bitmap */ + expose v. + use arg num, bmp + self~changeBitmapButton(v.idhr + num*10, value('v.bmp'bmp),,,,'STRETCH INMEMORY') + +::method setPiece unguarded /* cakepiece bitmap */ + expose v. + use arg num, bmp + self~changeBitmapButton(v.idpc + num, value('v.bmp'bmp),,,,'STRETCH INMEMORY') + +::method cake unguarded /* cake bitmap */ + expose curCake v. + if arg() = 1 then do + curCake = -1 + self~audio('cakewhere') + call SysSleep(2) + end + curCake = (curCake+1)//11 + i = curCake + 1 + self~changeBitmapButton(v.idcake, value('v.bmpcake'i),,,,'STRETCH INMEMORY') + if curCake=10 then self~audio('cakenew') + +::method audio unguarded /* play a sound */ + expose v. + use arg act + ret = play(value('v.'act), 'yes') + + +/*---------------------- philosopher ---------------------------------*/ + +::class phil /*** philosophers ***/ + +::method init /* initialize */ + expose num rFork lFork dlg + use arg num, rFork, lFork, dlg + +::method run /* run the philosop.*/ + expose num rFork lFork dlg + use arg T. + x = random(1,100,time('S')*num) + do i=1 to T.repeats until dlg~stopped /* - run the loop */ + stime = random(T.sleep-T.vsleep,T.sleep+T.vsleep) + if dlg~stopped then leave /* - stop clicked */ + self~sleep(stime) /* - call sleep */ + if dlg~stopped then leave /* - stop clicked */ + self~wait /* - call wait */ + if random(1,100) < T.side then do /* - pick up forks */ + self~pickLeft(T.eat>20) /* - - left first */ + self~pickRight(T.eat>20) + end + else do /* - - right first */ + self~pickRight(T.eat>20) + self~pickLeft(T.eat>20) + end + etime = random(T.eat-T.veat,T.eat+T.veat) + if dlg~stopped then leave /* - stop clicked */ + self~eat(etime) /* - call eat */ + self~layDownLeft /* - free forks */ + self~layDownRight + end + self~done + return 1 + +::method sleep /* philosoph sleeps */ + expose num dlg + use arg ds + dlg~setPhil(num, 'sleep') + if num=1 & ds>=20 then dlg~audio('sleep') + if ds > 0 then call msSleep ds*100 + +::method eat /* philosoph eats */ + expose num dlg + use arg ds + dlg~setPhil(num, 'eat') + dlg~cake /* - cake smaller */ + dlg~setPiece(num, 'piece') /* - he gets piece */ + if ds > 0 then do + if num=1 & ds>=20 then dlg~audio('eat') + do i = 1 to ds/5 while \dlg~stopped /* - eat, check stop */ + call msSleep 300 + if random(1,50)=11 then + dlg~~audio('ouch')~setPhil(num, 'ouch') + else dlg~setPhil(num, 'eat2') + call msSleep 200 + dlg~setPhil(num, 'eat') + end + if \dlg~stopped then call msSleep ds//10 * 100 + end + dlg~setPiece(num, 'blank') + +::method wait /* philosoph waits */ + expose num dlg + dlg~setPhil(num, 'wait') + +::method pickLeft /* pick left fork */ + expose num dlg lFork + use arg sound + dlg~setLeft(num, 'handl') + lFork~pickUp(num=1 & sound) + dlg~setLeft(num, 'handlf') + +::method pickRight /* pick right fork */ + expose num dlg rFork + use arg sound + dlg~setRight(num, 'handr') + rFork~pickUp(num=1 & sound) + dlg~setRight(num, 'handrf') + +::method layDownLeft /* down left fork */ + expose num dlg lFork + dlg~setLeft(num, 'blank') + lFork~layDown + +::method layDownRight /* down right fork */ + expose num dlg rFork + dlg~setRight(num, 'blank') + rFork~layDown + +::method done /* philosopher done */ + expose num dlg + dlg~setPhil(num, 'blank') + + +/*---------------------- fork ----------------------------------------*/ + +::class fork /*** forks **********/ + +::method init /* initialize */ + expose used num dlg + use arg num, dlg + used = 0 /* - forks are free */ + +::method pickUp /* pickUp the fork */ + expose used num dlg + use arg sound + if used & sound then dlg~audio('wait') + guard on when used = 0 /* - wait until free*/ + used = 1 /* - set occupied */ + dlg~setFork(num, 'blank') + +::method layDown unguarded /* layDown the fork */ + expose used num dlg + dlg~setFork(num, 'fork') + used = 0 /* - set to free */ diff --git a/modules/windows/oodialog/oovideo.rex b/modules/windows/oodialog/oovideo.rex new file mode 100755 index 0000000..60afb91 --- /dev/null +++ b/modules/windows/oodialog/oovideo.rex @@ -0,0 +1,168 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: oovideo.rex */ +/* Type: ooRexx Script */ +/* */ +/* Description: Video archive */ +/* */ +/* + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + ****************************************************************************/ + + srcDir = locate() + + -- Use the global .constDir for symbolic IDs + .application~useGlobalConstDir('O', srcDir'rc\ldvideo.h') + + logfile = srcDir'oovideo.log' + a.IDC_EDIT_TAPE_NO = "10000" + a.IDC_EDIT_TAPE_LABEL = "Actionfilms 1" + a.IDC_EDIT_FILM1 = "Gone with the Wind" + a.IDC_EDIT_FILM2 = "True Lies" + a.IDC_EDIT_FILM3 = "Rambo 4" + a.IDC_EDIT_FILM4 = "" + a.IDC_CB_LOCATION = "Unknown" + a.IDC_LB_LENT_TO = "Maria Shell" + do i = .constDir[IDC_CK_LONGPLAY] to .constDir[IDC_RB_C240] + a.i = 0 + end + a.IDC_RB_C180 = 1 + a.IDC_CK_HIFI = 1 + + dlg = .MyDialog~new(srcDir"rc\ldvideo.rc", IDD_VIDEO_DLG, A., , "CONNECTBUTTONS") + + if dlg~initcode > 0 then do + call errorDialog "Couldn't load the Video dialog" + return 99 + end + else if dlg~execute("SHOWTOP") = .MyDialog~IDOK then do + o=.stream~new(logfile) + o~open('write replace') + o~lineout("OOVideo - Data:") + o~lineout("Nr :" a.IDC_EDIT_TAPE_NO) + o~lineout("Titel :" a.IDC_EDIT_TAPE_LABEL) + o~lineout("Film 1 :" a.IDC_EDIT_FILM1) + o~lineout("Film 2 :" a.IDC_EDIT_FILM2) + o~lineout("Film 3 :" a.IDC_EDIT_FILM3) + o~lineout("Film 4 :" a.IDC_EDIT_FILM4) + o~lineout("Lent to :" a.IDC_LB_LENT_TO) + o~lineout("Location:" a.IDC_CB_LOCATION) + o~lineout("Longplay:" a.IDC_CK_LONGPLAY) + o~lineout("Hifi :" a.IDC_CK_HIFI) + o~lineout("Protect :" a.IDC_CK_WRITEPROTECT) + if (a.IDC_RB_C120 = 1) then o~lineout("Tape : C120") + if (a.IDC_RB_C180 = 1) then o~lineout("Tape : C180") + if (a.IDC_RB_C240 = 1) then o~lineout("Tape : C240") + o~close() + 'type "'logfile'"' + end + + return + +/*--------------------------------- requires -------------------------*/ + +::requires "ooDialog.cls" +::requires "samplesSetup.rex" + +/*--------------------------------- dialog class --------------------*/ + +::class 'MyDialog' subclass RcDialog + +::method initDialog + expose sd + + sd = locate() + + cb = self~newComboBox(IDC_CB_LOCATION) + cb~add("Drawer 1") + cb~add("Drawer 2") + cb~add("Behind the door") + cb~add("Under the bed") + cb~add("On the floor") + cb~add("Unknown") + + lb = self~newListBox(IDC_LB_LENT_TO) + lb~add("Hans-Maria Baier") + lb~add("John Smith") + lb~add("Peter Fonda") + lb~add("Maria Shell") + lb~add("Mike Miller") + + return 0 + +::method validate + expose sd + tst = self~newEdit(IDC_EDIT_TAPE_NO)~getText + if tst <> "" then do + call Play sd"wav\take.wav" + return .true + end + else do + msg = "The tape number can not be blank. Use cancel to quit, if needed." + title = 'Video Archive Database Warning' + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING') + end + + return .false + +::method cancel unguarded + expose sd + + ret = Play(sd"wav\cancel.wav", yes) + + msg = "Do you really want to cancel? " + title = 'Exiting Video Database Application' + + ret = MessageDialog(msg, self~hwnd, title, 'YESNO', 'QUESTION') + + if ret == self~IDYES then return self~cancel:super + else return 0 + +::method search unguarded + + msg = "Entry not found in Video Archive database." + title = 'Video Archive Database Warning' + ret = MessageDialog(msg, self~hwnd, title, 'OK', 'WARNING') + + return 0 + diff --git a/modules/windows/oodialog/oowalk2.rex b/modules/windows/oodialog/oowalk2.rex new file mode 100755 index 0000000..944b73f --- /dev/null +++ b/modules/windows/oodialog/oowalk2.rex @@ -0,0 +1,293 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oowalk2.rex Animation demonstration (using a compiled binary resource + * for the dialog template. A DLL file.) + * + * The only real difference between this sample and the oowalker.rex sample is + * the way the bitmaps for the animation are loaded. Look at the initDialog() + * method of the .WalkerDialog to see this difference. + * + * An animated button is used to simulate a man walking across the dialog. The + * user can adjust the pace of the waling by setting the amount the man is + * moved each time the button is redrawn and the delay between redrawing the + * button. The button is drawn using a sequence of bitmaps that show the man + * with different leg and arm positions. The user can also set how the man + * 'walking' off the edge of the dialog is handled, smoothly or bouncy, by + * using the "smooth corner wrap" check box. + * + * A 'got cha' point (!!!) is periodically drawn and if the man is close enough + * to this 'danger,' the man is 'gotten' and the animation is stopped. Each + * time the button is drawn, the !!! is over-drawn, so the !!! is only seen + * as a flicker. + * + * Normally the dialog ends when the walker is gotten. However there is a + * check box that allows the user to cancel this behavior and then restart the + * animation. + */ + + srcDir = locate() + .application~setDefaults('O', srcDir'rc\walker.h', .false) + + dlg = .WalkerDialog~new(srcDir'res\oowalk2.dll', IDD_WALKER) + + if dlg~initCode \= 0 then do + mgr~goBack + return 99 + end + dlg~execute("SHOWTOP") + + return + +/*---------------------------- requires -----------------------------*/ + +::requires "ooDialog.cls" +::requires "samplesSetup.rex" + +/*---------------------------- walker dialog ------------------------*/ + +::class 'WalkerDialog' subclass ResDialog + +::method initDialog + expose bitmaps spriteButton quitCheckBox restartButton okButton + + -- Make button IDC_DRAW_BUTTON a bitmap button. Bitmap buttons are owner- + -- drawn and ooDialog will manage the 'drawing' of the button by painting a + -- series of bitmaps on the button, using the AnimatedButton class. + self~installBitmapButton(IDC_DRAW_BUTTON, '', 0); + + -- The bitmaps are loaded from the resource DLL by specifying their resouce + -- IDs in the DLL file, res\oowalk2.dll. + -- + -- We use symbolic IDs for the bitmaps, and we assigned the IDs in order. + -- In the new() method, the 2nd arg is the first bitmap ID and the 3rd is the + -- last bitmap ID and they are assumed to be in order. The AnimatedButton + -- class was never updated to accept symbolic IDs, so we need to convert the + -- IDs to numeric IDs + bmpFirst = .constDir[ID_BMP_FIG1] + bmpLast = .constDir[ID_BMP_FIG8] + spriteButton = .WalkButton~new(IDC_DRAW_BUTTON, bmpFirst, bmpLast, 10, 2, 70, 120, 60, 10, 10, self) + + -- Use 'bouncy' operation when hitting edges. + spriteButton~setSmooth(.false) + + -- Size of the step through the bitmap IDs. + spriteButton~setstep(1) + + -- Get things set up. + self~connectButtonEvent(IDC_PB_RESTART, "CLICKED", onRestart) + + quitCheckBox = self~newCheckBox(IDC_CB_GOTCHA) + restartButton = self~newPushButton(IDC_PB_RESTART) + okButton = self~newPushButton(IDOK) + + quitCheckBox~check + spriteButton~fillData(data.) + spriteButton~suspendGotCha(.false) + self~doValueStemSet(data.) + ret = Play(srcDir"tada.wav", n) -- TODO not playing in Win7 + + -- Animate the button. + spriteButton~run + +::method doValueStemGet unguarded + use strict arg data. + data.IDC_EDIT_MOVEX = self~newEdit(IDC_EDIT_MOVEX)~getText + data.IDC_EDIT_MOVEY = self~newEdit(IDC_EDIT_MOVEY)~getText + data.IDC_EDIT_DELAY = self~newEdit(IDC_EDIT_DELAY)~getText + if self~newCheckBox(IDC_CB_SMOOTH)~checked then data.IDC_CB_SMOOTH = 1 + else data.IDC_CB_SMOOTH = 0 + +::method doValueStemSet unguarded + use strict arg data. + self~newEdit(IDC_EDIT_MOVEX)~setText(data.IDC_EDIT_MOVEX) + self~newEdit(IDC_EDIT_MOVEY)~setText(data.IDC_EDIT_MOVEY) + self~newEdit(IDC_EDIT_DELAY)~setText(data.IDC_EDIT_DELAY) + if data.IDC_CB_SMOOTH == 1 then self~newCheckBox(IDC_CB_SMOOTH)~check + else self~newCheckBox(IDC_CB_SMOOTH)~uncheck + +::method onGotCha + expose okButton + use strict arg animatedButton, x, y + okButton~disable + self~writetoButton(IDC_DRAW_BUTTON, x, y, "Got-cha", "Arial", 28, "BOLD") + ret = play('gotcha.wav') + animatedButton~stop + call msSleep 1000 + +::method maybeQuit + expose quitCheckBox restartButton okButton + if quitCheckBox~checked then return self~ok + + restartButton~enable + okButton~enable + +::method onRestart + expose spriteButton restartButton + restartButton~disable + spriteButton~stopped = .false + + -- Suspend the 'GotCha' before we start the animated button. Otherwise the + -- walker will be 'gotten' as soon as he starts. + spriteButton~suspendGotCha(.true) + spriteButton~run + + -- Give the walker time to 'walk' out of the danger zone before reactivating + -- the 'GotCha.' + delay = self~newEdit(IDC_EDIT_DELAY)~getText + j = msSleep(2 * delay) + spriteButton~suspendGotCha(.false) + +::method ok unguarded + self~stopAnimation + return self~ok:super + +::method cancel unguarded + self~stopAnimation + return self~cancel:super + +::method stopAnimation private + expose bitmaps spriteButton + spriteButton~stop + + -- Wait until the animation sequence is finished. + do while spriteButton~isRunning + j = msSleep(30) + end + + +/*------------------------------ animated button --------------------*/ + +::class 'WalkButton' subclass AnimatedButton + +::method run unguarded + expose xDanger yDanger running + xDanger = 300; yDanger = 70; running = .true + + reply 0 + + do until self~stopped | self~parentStopped + self~doAnimatedSequence + end + + -- Have the walker do one more sequence, gives the appearance of walking 'in + -- place.' + self~doAnimatedSequence + + -- We are no longer running, tell the parent dialog to maybe quit. + running = .false + self~parentDlg~maybeQuit + +::method doAnimatedSequence private unguarded + expose xDanger yDanger + + self~parentDlg~doValueStemGet(data.) + do k over data. + if \ data.k~datatype('N') then data.k = 0 + end + self~moveseq + self~setmove(data.IDC_EDIT_MOVEX, data.IDC_EDIT_MOVEY) + self~setdelay(data.IDC_EDIT_DELAY) + self~setsmooth(data.IDC_CB_SMOOTH) + if \ self~stopped then + self~parentDlg~writetoButton(IDC_DRAW_BUTTON,xDanger,yDanger,"!!!","Arial",20,"BOLD") + +::method isRunning unguarded + expose running + return running + +::method suspendGotCha unguarded + expose gotCha + use strict arg suspend + if suspend then gotCha = .false + else gotCha = .true + +::method hitright + ret = play('ding.wav', 'YES') + return 1 + +::method hitleft + ret = play('ding.wav', 'YESY') + return 1 + +::method hitbottom + self~getsprite(s.) + ret = play('chord.wav', 'YES') + s.movey = -s.movey + self~setsprite(s.) + self~fillData(data.) + self~parentDlg~doValueStemSet(data.) + return 0 + +::method hittop + expose sprite. + self~getsprite(s.) + ret = play('chimes.wav', 'YES') + s.movey = -s.movey + self~setsprite(s.) + self~fillData(data.) + self~parentDlg~doValueStemSet(data.) + return 0 + +::method fillData + expose quitCheckBox + use arg data. + if \ quitCheckBox~isA(.CheckBox) then quitCheckBox = self~parentDlg~newCheckBox(IDC_CB_GOTCHA) + self~getSprite(msprite.) + data.IDC_EDIT_MOVEX = msprite.movex + data.IDC_EDIT_MOVEY = msprite.movey + data.IDC_EDIT_DELAY = msprite.delay + data.IDC_CB_SMOOTH = msprite.smooth + + if quitCheckBox~checked then data.IDC_CB_GOTCHA = 1 + else data.IDC_CB_GOTCHA = 0 + +::method movepos + use arg px, py + if \ self~stopped then do + self~movepos:super(px,py) + self~checkDanger + end + +::method checkDanger + expose xDanger yDanger gotCha + self~getpos(cur.) + if abs(cur.x+10-xDanger) <= 10 & abs(cur.y+55-yDanger) <= 30 then do + if gotCha then self~parentDlg~onGotCha(self, xDanger-50, yDanger) + end diff --git a/modules/windows/oodialog/oowalker.rex b/modules/windows/oodialog/oowalker.rex new file mode 100755 index 0000000..cf0101c --- /dev/null +++ b/modules/windows/oodialog/oowalker.rex @@ -0,0 +1,285 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oowalker.rex Animation demonstration (using a .rc file for the dialog + * template.) + * + * The only real difference between this sample and the oowalk2.rex sample is + * the way the bitmaps for the animation are loaded. Look at the initDialog() + * method of the .WalkerDialog to see this difference. + * + * An animated button is used to simulate a man walking across the dialog. The + * user can adjust the pace of the waling by setting the amount the man is + * moved each time the button is redrawn and the delay between redrawing the + * button. The button is drawn using a sequence of bitmaps that show the man + * with different leg and arm positions. The user can also set how the man + * 'walking' off the edge of the dialog is handled, smoothly or bouncy, by + * using the "smooth corner wrap" check box. + * + * A 'got cha' point (!!!) is periodically drawn and if the man is close enough + * to this 'danger,' the man is 'gotten' and the animation is stopped. Each + * time the button is drawn, the !!! is over-drawn, so the !!! is only seen + * as a flicker. + * + * Normally the dialog ends when the walker is gotten. However there is a + * check box that allows the user to cancel this behavior and then restart the + * animation. + */ + + srcDir = locate() + + .application~useGlobalConstDir('O', srcDir"rc\walker.h") + dlg = .WalkerDialog~new(srcDir"rc\walker.rc", , data.) + + if dlg~initCode \= 0 then do + return 99 + end + dlg~execute("SHOWTOP") + + return 0 + +/*---------------------------- requires -----------------------------*/ + +::requires "ooDialog.cls" +::requires "samplesSetup.rex" -- For sound path + +/*---------------------------- walker dialog ------------------------*/ + +::class 'WalkerDialog' subclass RcDialog + +::method initDialog + expose bitmaps spriteButton quitCheckBox restartButton okButton + + -- Make button 105 a bitmap button. Bitmap buttons are owner-drawn and + -- ooDialog will manage the 'drawing' of the button by painting a series of + -- bitmaps on the button, using the AnimatedButton class. + self~installBitmapButton(105, '', 0); + + -- Load the bitmaps from the bitmap files into an array. + bitmaps = .array~new(8) + do i= 1 to 8 + bitmaps[i] = self~loadBitmap(.application~srcDir"bmp\wlkfig"i".bmp") + end + + -- Create the animated button class and pass the array of bitmaps. + spriteButton = .WalkButton~new(105, bitmaps, 0, 10, 2, 70, 120, 60, 10, 10, self) + + -- Use 'bouncy' operation when hitting edges. + spriteButton~setSmooth(.false) + + -- Get things set up. + self~connectButtonEvent(107, "CLICKED", onRestart) + quitCheckBox = self~newCheckBox(106) + restartButton = self~newPushButton(107) + okButton = self~newPushButton(IDOK) + quitCheckBox~check + spriteButton~fillData(data.) + spriteButton~suspendGotCha(.false) + self~setDataStem(data.) + ret = Play("tada.wav", n) + + -- Animate the button. + spriteButton~run + +::method doDataStemGet unguarded + use strict arg data. + self~getDataStem(data.) + +::method doDataStemSet unguarded + use strict arg data. + self~setDataStem(data.) + +::method onGotCha + expose okButton + use strict arg animatedButton, x, y + okButton~disable + self~writetoButton(105, x, y, "Got-cha", "Arial", 28, "BOLD") + ret = play('gotcha.wav') + animatedButton~stop + call msSleep 1000 + +::method maybeQuit + expose quitCheckBox restartButton okButton + if quitCheckBox~checked then return self~ok + + restartButton~enable + okButton~enable + +::method onRestart + expose spriteButton restartButton + restartButton~disable + spriteButton~stopped = .false + + -- Suspend the 'GotCha' before we start the animated button. Otherwise the + -- walker will be 'gotten' as soon as he starts. + spriteButton~suspendGotCha(.true) + spriteButton~run + + -- Give the walker time to 'walk' out of the danger zone before reactivating + -- the 'GotCha.' + delay = self~newEdit(103)~getText + j = msSleep(2 * delay) + spriteButton~suspendGotCha(.false) + +::method ok + self~stopAnimation + return self~ok:super + +::method cancel + self~stopAnimation + return self~cancel:super + +::method stopAnimation private + expose bitmaps spriteButton + spriteButton~stop + + -- Wait until the animation sequence is finished. + do while spriteButton~isRunning + j = msSleep(30) + end + + -- Now it is safe to delete the bitmaps. + if bitmaps \== .nil then do i= 1 to 8 + self~removeBitmap(bitmaps[i]) + end + + -- Be sure we don't free the bitmaps twice. The WalkButton will invoke + -- maybeQuit() which can cause stopAnimation() to be invoked twice. + bitmaps = .nil + + +/*------------------------------ animated button --------------------*/ + +::class 'WalkButton' subclass AnimatedButton + +::method run + expose xDanger yDanger running + xDanger = 300; yDanger = 70; running = .true + + reply 0 + + do until(self~stopped = 1) | (self~parentStopped = 1) + self~doAnimatedSequence + end + + -- Have the walker do one more sequence, gives the appearance of walking 'in + -- in place.' + self~doAnimatedSequence + + -- We are no longer running, tell the parent dialog to maybe quit. + running = .false + self~parentDlg~maybeQuit + +::method doAnimatedSequence private + expose xDanger yDanger + + self~moveseq + self~parentDlg~doDataStemGet(data.) + do k over data. + if data.k~datatype('N') = 0 then data.k = 0 + end + self~setmove(data.101, data.102) + self~setdelay(data.103) + self~setsmooth(data.104) + if self~stopped = 0 then + self~parentDlg~writetoButton(105,xDanger,yDanger,"!!!","Arial",20,"BOLD") + +::method isRunning unguarded + expose running + return running + +::method suspendGotCha unguarded + expose gotCha + use strict arg suspend + if suspend then gotCha = .false + else gotCha = .true + +::method hitright + ret = play('ding.wav', 'YES') + return 1 + +::method hitleft + ret = play('ding.wav', 'YESY') + return 1 + +::method hitbottom + self~getsprite(s.) + ret = play('chord.wav', 'YES') + s.movey = -s.movey + self~setsprite(s.) + self~fillData(data.) + self~parentDlg~doDataStemSet(data.) + return 0 + +::method hittop + expose sprite. + self~getsprite(s.) + ret = play('chimes.wav', 'YES') + s.movey = -s.movey + self~setsprite(s.) + self~fillData(data.) + self~parentDlg~doDataStemSet(data.) + return 0 + +::method fillData + expose quitCheckBox + use arg data. + if \ quitCheckBox~isA(.CheckBox) then quitCheckBox = self~parentDlg~newCheckBox(106) + self~getSprite(msprite.) + data.101 = msprite.movex + data.102 = msprite.movey + data.103 = msprite.delay + data.104 = msprite.smooth + + if quitCheckBox~checked then data.106 = 1 + else data.106 = 0 + +::method movepos + use arg px, py + if self~stopped=0 then do + self~movepos:super(px,py) + self~checkDanger + end + +::method checkDanger + expose xDanger yDanger gotCha + self~getpos(cur.) + if abs(cur.x+10-xDanger) <= 10 & abs(cur.y+55-yDanger) <= 30 then do + if gotCha then self~parentDlg~onGotCha(self, xDanger-50, yDanger) + end diff --git a/modules/windows/oodialog/propertysheet.tabControls/PropertySheetDemo.rex b/modules/windows/oodialog/propertysheet.tabControls/PropertySheetDemo.rex new file mode 100755 index 0000000..7c7f5fd --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/PropertySheetDemo.rex @@ -0,0 +1,633 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Propery Sheet / Dialog Controls Example + * + * This example demonstrates how to use the PropertySheetDialog and has examples + * of using 5 dialog controls, the: List View, Tree View, Progress Bar, Track + * Bar, and Tab. + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + sd = locate() + .application~setDefaults("O", sd"rc\PropertySheetDemo.h", .false) + + -- Create the 5 dialog pages. + p1 = .ListViewDlg~new(sd"rc\PropertySheetDemo.rc", IDD_LISTVIEW_DLG) + p2 = .TreeViewDlg~new(sd"rc\PropertySheetDemo.rc", IDD_TREEVIEW_DLG) + p3 = .ProgressBarDlg~new(sd"rc\PropertySheetDemo.rc", IDD_PROGRESSBAR_DLG) + p4 = .TrackBarDlg~new(sd"rc\PropertySheetDemo.rc", IDD_TRACKBAR_DLG) + p5 = .TabDlg~new(sd"rc\PropertySheetDemo.rc", IDD_TAB_DLG) + + -- Create the PropertySheetDialog using an array of the 5 dialog pages. The + -- order of the pages in the array will be the order of the pages in the tab + -- control of the property sheet. + pages = .array~of(p1, p2, p3, p4, p5) + propDlg = .PropertySheetDemoDlg~new(pages, "NOAPPLYNOW", "ooRexx Property Sheet with Controls") + + -- Do any customization of the property sheet dialog by setting the values of + -- the appropriate attributes. However, for this example we do not do any + -- customization. + + -- Show the property sheet. + propDlg~execute + + return 0 + +::requires "ooDialog.cls" + +::class 'ListViewDlg' subclass RcPSPDialog + +::method initDialog + expose lv + + sd = locate() + + -- Instantiate a Rexx list view object that represents the underlying + -- Windows list-view. The list-view style is report. + lv = self~newListView(IDC_LV_MAIN) + + -- Set the column headers + lv~insertColumn(0, "Symbol", 40) + lv~insertColumn(1, "Quote", 50) + lv~insertColumn(2, "Year high", 50) + lv~insertColumn(3, "Year low", 50) + lv~insertColumn(4, "Description", 120) + + -- Set the images for the items in the list-view. The list-view control was + -- created without the SHAREIMAGES styles, so it takes care of releasing the + -- image list when the program ends. + image = .Image~getImage(sd"rc\propertySheetDemoListView.bmp") + imageList = .ImageList~create(.Size~new(16, 16), COLOR8, 4, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + lv~setImageList(imageList, SMALL) + + -- The image list makes a copy of the bitmap, so we can release it now + -- to free up some (small) amount of system resources. This is not + -- necessary, the OS will release the resource automatically when the + -- program ends. + image~release + end + + -- Fill the list-view with random data. + do ch = "A"~c2d to "Z"~c2d + q = random(200) + yh = random(400) + yh = max(yh, q) + yl = random(100) + yl = min(yl, q) + lv~addRow( , random(3), "_" || ch~d2c~copies(3) || "_", "$" || q, "$" || yh, "$" || yl, - + ch~d2c~copies(3) "is a fictitious company.") + end + + -- Add full row select and the ability to drag and drop the columns to the + -- list-view. + lv~addExtendedStyle("FULLROWSELECT HEADERDRAGDROP") + + -- Connect 2 list-view events to Rexx methods in this dialog. The double- + -- click on a list-view item, and the click on a column header events. + self~connectListViewEvent(IDC_LV_MAIN, "ACTIVATE", "onActivate") + self~connectListViewEvent(IDC_LV_MAIN, "COLUMNCLICK") + +-- Invoked when a list-view item is double-clicked. We display a message and +-- set the focus to the next item in the list. +::method onActivate + expose lv + + selectedItem = lv~focused + symbol = lv~itemText(selectedItem) + price = lv~itemText(selectedItem, 1) + + question = "You have selected the stock with symbol" symbol". Do you want to order" || .endOfLine || - + "50 shares of stock at" price"?" + placeOrder = MessageDialog(question, self~hwnd, "Place Order for Stock", "YESNO", "QUESTION", "DEFBUTTON2" ) + + cost = 50 * price~substr(2) + if placeOrder == self~constDir["IDYES"] then do + j = MessageDialog("Okay, your bank account will be debited $"cost "dollars.", self~hwnd, - + "Order Confirmation", "OK", "INFORMATION") + end + else do + j = MessageDialog("That saved you $"cost "dollars.", self~hwnd, "Order Canceled", "OK", "EXCLAMATION") + end + + lv~deselect(selectedItem) + selectedItem += 1 + lv~focus(selectedItem) + lv~select(selectedItem) + +-- Invoked when a column header of the list-view is clicked. We just show a +-- message box so that the user has some feedback. +::method OnColumnClick + use arg id, column + j = MessageDialog("Column" column + 1 "was clicked in control" id, self~hwnd, "List-View Notification") + + +::class 'TreeViewDlg' subclass RcPSPDialog + +::method initDialog + + -- Instantiate a Rexx tree view object that represents the Windows tree-view + -- control. + tv = self~newTreeView(IDC_TV_MAIN) + + -- Create and set the ImageList for the tree view items + sd = locate() + image = .Image~getImage(sd"rc\propertySheetDemoTreeView.bmp") + imageList = .ImageList~create(.Size~new(32, 32), COLOR8, 10, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + tv~setImageList(imageList, NORMAL) + image~release + end + + -- Add the tree view items. Toys will be the root (the first argument is + -- not omitted. Subitems are added by omitting the first arguments. The + -- number of arguments omitted indicates the depth of the subitem. + -- + -- The last numeric argument in some of the items is the index for the icon + -- for that item in the image list. Those items without a number will not + -- display an icon. + + tv~add("Toys", 1) + tv~add(, "Indoor", 14) + tv~add(, , "Boys", 19) + tv~add(, , , "Cowboys", 13) + tv~add(, , , "Cars", 8) + tv~add(, , , "Starwars", 9) + tv~add(, , "Girls", 0) + tv~add(, , , "Barby", 19) + tv~add(, , , "Painting", 15) + tv~add(, , , "Cooking", 13) + tv~add(, , "Adults", 17) + tv~add(, , , "Poker", 15) + tv~add(, , "Technical", 16) + tv~add(, , , "Racing cars", 8) + tv~add(, , , "Trains", 7) + tv~add(, "Outdoor", 11) + tv~add(, , "Water", 22) + tv~add(, , , "Ball", 5) + tv~add(, , , "Soft tennis", 6) + tv~add(, , "Sand", 12) + tv~add(, , , "Shovel", 12) + tv~add(, , , "Bucket", 19) + tv~add(, , , "Sandbox", 12) + tv~add(, , "Technical", 16) + tv~add(, , , "Trains", 7) + tv~add(, , , "Remote controlled", 8) + tv~add("Office Articles", 2) + tv~add( , "Tools", 16) + tv~add( , "Books", 19) + tv~add( , , "Introduction", 14) + tv~add( , , "Advanced Programming", 17) + tv~add( , , "Tips & Tricks", 16) + tv~add("Hardware", 4) + tv~add( , "Garden", 0) + tv~add( , "Handyman", 18) + tv~add( , "Household", 18) + tv~add("Furniture", 3) + tv~add( , "Standard", 12) + tv~add( , "Luxury", 21) + + -- Connecting the begin drag event and using the default tree drag handler + -- allows us to suppport drag and drop (using the default behaviour. + self~connectTreeViewEvent(IDC_TV_MAIN, "BeginDrag", "DefTreeDragHandler") + + +::class 'ProgressBarDlg' subclass RcPSPDialog + +::method initDialog + expose threadsStarted processes + + threadsStarted = 0 + processes = .array~of('animateProgressA', 'animateProgressB', 'animateProgressC', - + 'animateProgressD', 'animateProgressE') + + +-- The setActive event notification is sent by the property sheet to the page +-- that is about to become the active page. It is sent before the page is +-- visible. This allows the page to do any initialization necessary. For this +-- program, we use the notification to start the progress bar animation threads. +::method setActive unguarded + expose threadsStarted processes + use arg propSheet + + reply 0 + + -- If no threads are running, start a thread to run each progress bar + -- asynchronously. + if threadsStarted < 1 then do + threadsStarted = processes~items + do methodName over processes + self~start(methodName) + end + end + +-- This is the generic method that simulates some type of processing that takes +-- a long time. The progress of this processing is displayed by the progress +-- bar. to simulate a process of which the progress is displayed by a progress bar */ +::method animateProgress unguarded + use arg progressBar, label, step, iterations, tsleep + + progressBar~setRange(0, iterations * step) + progressBar~setStep(step) + do i = 1 to iterations + progressBar~step + if (iterations * step == 100) then label~setText(i * step "%") + else label~setText(i * step) + + call msSleep tsleep + if \ self~isDialogActive then return + end + +-- The following 5 methods are started asynchronously to animate the progress +-- bars. +::method animateProgressA unguarded + expose threadsStarted pbA labelA + + if \ pbA~isA(.ProgressBar) then do + pbA = self~newProgressBar(IDC_PBAR_PROCESSA) + labelA = self~newStatic(IDC_ST_PERCENTA) + end + + self~animateProgress(pbA, labelA, 5, 20, 600) + threadsStarted -= 1 + +::method animateProgressB unguarded + expose threadsStarted pbB labelB + + if \ pbB~isA(.ProgressBar) then do + pbB = self~newProgressBar(IDC_PBAR_PROCESSB) + labelB = self~newStatic(IDC_ST_PERCENTB) + end + + self~animateProgress(pbB, labelB, 1, 100, 150) + threadsStarted -= 1 + +::method animateProgressC unguarded + expose threadsStarted pbC labelC + + if \ pbC~isA(.ProgressBar) then do + pbC = self~newProgressBar(IDC_PBAR_PROCESSC) + labelC = self~newStatic(IDC_ST_PERCENTC) + end + + self~animateProgress(pbC, labelC, 2, 50, 200) + threadsStarted -= 1 + +::method animateProgressD unguarded + expose threadsStarted pbD labelD + + if \ pbD~isA(.ProgressBar) then do + pbD = self~newProgressBar(IDC_PBAR_PROCESSD) + labelD = self~newStatic(IDC_ST_PERCENTD) + end + + self~animateProgress(pbD, labelD, 10, 40, 300) + threadsStarted -= 1 + +::method animateProgressE unguarded + expose threadsStarted pbE labelE + + if \ pbE~isA(.ProgressBar) then do + pbE = self~newProgressBar(IDC_PBAR_PROCESSE) + labelE = self~newStatic(IDC_ST_PERCENTE) + end + + self~animateProgress(pbE, labelE, 20, 50, 500) + threadsStarted -= 1 + + +::class 'TrackBarDlg' subclass RcPSPDialog + +::method initDialog + expose font1 trackBars tbLabels + + -- As we initialize each track bar we'll stash the Rexx object in a table + -- for easy access later, indexed by its numeric resource id. The same + -- thing is done for the static control that is the label for the track bar. + trackBars = .table~new + tbLabels = .table~new + + -- For the horizonatal track bars we'll use a big font for the label. + font1 = self~CreateFontEx("Arial", 24, "BOLD") + + -- The symbolic IDs for the track bars / labels are named after the style + -- of the track bar. Vertical or horizontal and where the ticks are placed. + + -- Initialize the horizontal track bar with ticks on the bottom. + tb = self~newTrackBar(IDC_TB_HORZ_BOTTOM) + label = self~newStatic(IDC_ST_HORZ_BOTTOM) + + tb~setTickFrequency(10) + tb~setPos(20, .true) + label~setText(20) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTTOM] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the top. + tb = self~newTrackBar(IDC_TB_HORZ_TOP) + label = self~newStatic(IDC_ST_HORZ_TOP) + + tb~initRange(0, 200) + tb~setTickFrequency(50) + tb~setPos(40, .true) + label~setText(40) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_TOP] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_HORZ_BOTH) + label = self~newStatic(IDC_ST_HORZ_BOTH) + + tb~initSelRange(20, 60) + tb~setTickFrequency(10) + tb~setPos(80, .true) + label~setText(80) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the right. + tb = self~newTrackBar(IDC_TB_VERT_RIGHT) + label = self~newStatic(IDC_ST_VERT_RIGHT) + + tb~setTickFrequency(10) + tb~setPos(30, .true) + label~setText(30) + + id = self~constDir[IDC_TB_VERT_RIGHT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the left. + tb = self~newTrackBar(IDC_TB_VERT_LEFT) + label = self~newStatic(IDC_ST_VERT_LEFT) + + tb~setTickFrequency(10) + tb~initRange(0,400) + tb~setLineStep(5) + tb~setPageStep(50) + tb~setPos(90, .true) + label~setText(90) + + id = self~constDir[IDC_TB_VERT_LEFT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_VERT_BOTH) + label = self~newStatic(IDC_ST_VERT_BOTH) + + tb~setTickFrequency(5) + tb~setPos(70, .true) + label~setText(70) + + id = self~constDir[IDC_TB_VERT_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Connect the event notification that is sent when a track bar is moved to + -- the onEndTrack() method. That method will update the text label for the + -- track bar with the new postition. + self~connectTrackBarEvent(IDC_TB_HORZ_BOTH, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_TOP, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_BOTTOM, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_RIGHT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_LEFT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_BOTH, "EndTrack", "onEndTrack") + +-- Update the static contol that shows the position for a slider when the +-- user is done moving it. +::method onEndTrack + expose trackBars tbLabels + use arg code, hwndTrackBar + + -- hwndTrackBar is the handle to the track bar that was moved. Get its + -- resource ID and use that as an index into the table of track bar objects + -- and the table of the labels. + id = self~getControlID(hwndTrackBar) + tbLabels[id]~setText(trackBars[id]~pos) + +-- We use the leaving() method to clean up (delete) the font we created. In +-- this program there is really no need to do this. As soon as the interpreter +-- terminates, the OS cleans up the resources automatically. The only time +-- cleaning up resources makes sense is in a long-running program that creates +-- and ends a lot of dialogs. Then, over time, the memory usge of the program +-- would keep growing. +::method leaving + expose font1 + self~deleteFont(font1) + + +::class 'TabDlg' subclass RcPSPDialog + +::method initDialog + expose font2 font3 imageList iconsRemoved needWrite + + -- Set the iconsRemoved and needWrite to false. These flags are used in + -- the OnDrawTabRect() method. + iconsRemoved = .false + needWrite = .false + + -- Connect the draw event of the owner-drawn button. This is sent when the + -- button needs to be drawn. Then connect the selection changed event of the + -- tab control. This is sent when the user clicks on a different tab. + self~connectDraw(IDC_PB_OWNERDRAW, "onDrawTabRect") + self~connectTabEvent(IDC_TAB_MAIN, "SELCHANGE", "onTabSelChange") + + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Create a font used to display the name of the color in the owner-drawn + -- button. Create another font used to display some informative text. + font2 = self~createFontEX("Arial", 48, "BOLD ITALIC") + font3 = self~createFontEx("Arial", 16, "BOLD") + + -- Add all the tabs, including the index into the image list for an icon for + -- each tab. + tc~AddFullSeq("Red", 0, ,"Green", 1, , "Moss", 2, , "Blue", 3, , "Purple", 4, , "Cyan", 5, , "Gray", 6) + + -- Create a COLORREF (pure white) and load our bitmap. The bitmap is a + -- series of 16x16 images, each one a colored letter. + sd = locate() + cRef = .Image~colorRef(255, 255, 255) + image = .Image~getImage(sd"rc\propertySheetDemoTab.bmp") + + -- Create our image list, as a masked image list. + flags = 'COLOR24 MASK' + imageList = .ImageList~create(.Size~new(16, 16), flags, 10, 0) + if \image~isNull, \imageList~isNull then do + -- The bitmap is added and the image list deduces the number of images + -- from the width of the bitmap. For each image, the image list creates a + -- mask using the color ref. In essence, the mask is used to turn each + -- white pixel in the image to transparent. In this way, only the letter + -- part of the image shows and the rest of the image lets the under-lying + -- color show through. + imageList~addMasked(image, cRef) + tc~setImageList(imageList) + + -- The image list makes a copy of each image added to it. So, we can now + -- release the original image to free up some small amount of system + -- resoureces. + image~release + end + else do + iconsRemoved = .true + end + + -- We will position and size the owner-draw button so that it exactly covers + -- the display area of the tab control. + r = tc~windowRect + tc~calcDisplayRect(r) + s = .Size~new(r~right - r~left, r~bottom - r~top) + + pb = self~newPushButton(IDC_PB_OWNERDRAW) + + -- Map the display area's position on the screen, to the client co-ordinates + -- of this control dialog. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + pb~setWindowPos(tc~hwnd, p~x, p~y, s~width, s~height, "SHOWWINDOW NOOWNERZORDER") + + + +-- When a new tab is selected, we have the owner-drawn button update itself. +-- This causes the button to redraw and the onDrawTabRect() method gets invoked, +-- which actually does the drawing. +::method onTabSelChange + button = self~newPushButton(IDC_PB_OWNERDRAW) + button~update + + +-- Fill the owner-drawn button with the color matching the tab's label and write +-- the name of the color. +::method onDrawTabRect + expose font2 font3 imageList iconsRemoved needWrite + use arg id + + button = self~newPushButton(id) + if button == .nil then return + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Each time the 'Gray' tab is selected, we remove the tab icons. Then, when + -- one of the other tabs is selected we set the image list back. + currentTab = tc~selected + if currentTab == 'Gray' then do + tc~setImageList(.nil) + iconsRemoved = .true + needWrite = .true + end + else do + if iconsRemoved then do + tc~setImageList(imageList) + iconsRemoved = .false + needWrite = .true + end + end + + -- Get the button's device context, create pen and brush, and assign pen, + -- brush and font to the device context. + dc = button~getDC + pen = button~createPen(1, "SOLID", 0) + brush = button~createBrush(tc~SelectedIndex + 1) + + oldPen = button~objectToDc(dc, pen) + oldBrush = button~objectToDc(dc, brush) + oldFont = button~fontToDC(dc, font2) + button~transparentText(dc) + + -- Draw a filled in rectangle, with a border of 5 around it, and write text. + size = button~getRealSize + button~rectangle(dc, 5, 5, size~width - 5, size~height - 5, "FILL") + button~writeDirect(dc, trunc(size~width / 4), trunc(size~height / 4), tc~Selected) + + -- Add informative text if needed. + if needWrite then do + button~fontToDC(dc, font3) + x = trunc(size~width / 4) + y = trunc(size~height / 2) + + if currentTab == 'Gray' then + button~writeDirect(dc, x, y, "(Tab icons are removed)") + else + button~writeDirect(dc, x, y, "(Tab icons are restored)") + needWrite = .false + end + + -- Restore pen, brush, and font, then release the device context. + button~objectToDc(dc, oldPen) + button~objectToDc(dc, oldBrush) + button~fontToDC(dc, oldFont) + button~opaqueText(dc) + + button~deleteObject(pen) + button~deleteObject(brush) + button~freeDC(dc) + +-- We use the leaving() method to clean up (delete) the fonts and the image list +-- we created. In this program there is really no need to do this. As soon as +-- the interpreter terminates, the OS cleans up the resources automatically. +-- The only time cleaning up resources makes sense is in a long-running program +-- that creates and ends a lot of dialogs. Then, over time, the memory usge of +-- the program would keep growing. +::method leaving + expose font2 font3 imageList + + self~deleteFont(font2) + self~deleteFont(font3) + imageList~release + +::class 'PropertySheetDemoDlg' subclass PropertySheetDialog + diff --git a/modules/windows/oodialog/propertysheet.tabControls/TabDemo.rex b/modules/windows/oodialog/propertysheet.tabControls/TabDemo.rex new file mode 100755 index 0000000..dc45118 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/TabDemo.rex @@ -0,0 +1,952 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Tab Control / Dialog Controls / ControlDialog Example + * + * This example demonstrates how to use the ControlDialog class to provide the + * pages / content of a Tab control. It is basically the same as the + * PropertySheetDemo.rex example, but uses a Tab control with ControlDialog + * objects rather than using a PropertySheetDialog. + * + * Much of the code is simply copied from the PropertySheetDemo.rex program. + */ + + -- To run correctly, this program needs to be able to find its support files. + -- But, we allow starting the program from anywhere. To do this we: + -- get the directory we are executing from using the locate() convenience + -- routine. This routine also sets the .application object's srcDir + -- attribute. We can then easily construct complete path names for any of our + -- support files. + sd = locate() + .application~setDefaults("O", sd"rc\PropertySheetDemo.h", .false) + + + -- The original version of this example would take a longish period of time to + -- appear on the screen. Too much was being done in the initDialog() method + -- of the .NewControlsDialog. To improve the time between starting the + -- program and the dialog's appearance on the screen, several steps were + -- taken. + -- + -- 1.) All dialogs were made ResDialog dialogs. + -- + -- 2.) The instantiation of the dialogs used for the pages of the tab control + -- was moved out of the initDialog() method and placed here. Some of the + -- work done in the initDialog() method was moved to the prep() method, + -- which is invoked before the dialog is started executing. + -- + -- 3.) The dialog is created with the VISIBLE style. This causes the dialog + -- to appear on the screen before the list view is populated, rather than + -- having the list view populated first and then showing the dialog. + -- + -- Instantiate all the control dialogs and pass them to the prep() method in + -- an array. + t1 = .ListViewDlg~new(sd"rc\PropertySheetDemo.dll", IDD_LISTVIEW_DLG) + t2 = .TreeViewDlg~new(sd"rc\PropertySheetDemo.dll", IDD_TREEVIEW_DLG) + t3 = .ProgressBarDlg~new(sd"rc\PropertySheetDemo.rc", IDD_PROGRESSBAR_DLG) + t4 = .TrackBarDlg~new(sd"rc\PropertySheetDemo.dll", IDD_TRACKBAR_DLG) + t5 = .TabDlg~new(sd"rc\PropertySheetDemo.dll", IDD_TAB_DLG) + + tabContent = .array~of(t1, t2, t3, t4, t5) + + -- Create the main dialog. + dlg = .NewControlsDialog~new(sd'rc\PropertySheetDemo.dll', IDD_NEWCONTROLS_DLG) + + -- Invoke the prep() methods of the list view and progress bar dialogs to do + -- some initial set up before we start executing the main dialog. Note that + -- the list view (t1) dialog needs to have its owner dialog set before + -- invoking the prep method. + t1~ownerDialog = dlg + t1~prep + t3~prep + + -- Invoke the main dialog's prep() method to do some initial set up before the + -- dialog is started executing. + dlg~prep(tabContent) + + -- Show and run the dialog. + dlg~execute('SHOWTOP', IDI_DLG_OODIALOG) + + return 0 + +::requires "ooDialog.cls" + +::class 'NewControlsDialog' subclass ResDialog + +::attribute tabContent + +/** prep() + * + * This method is invoked before the dialog is executed. It does some initial + * set up that would normally be done (by the author) in initDialog(). The + * tabContent argument is an array of the 5 ControlDialog dialogs used as the + * content for the 5 pages of the tab control. This array is saved in the + * tabContent attribute so the dialogs can be accessed when needed. + */ +::method prep + expose tabContent lastSelected havePositioned + use strict arg tabContent + + -- The havePositioned array is used to determine if the page dialogs have been + -- positioned or not. Mark all 5 dialogs as not having been positioned yet. + havePositioned = .array~of(.false, .false, .false, .false, .false) + + -- No tab has been selected yet + lastSelected = 0 + + -- Connect the event handling methods to the events we are interested in. + self~connectButtonEvent(IDC_PB_PREVIOUS, CLICKED, onPrevious) + self~connectButtonEvent(IDC_PB_NEXT, CLICKED, onNext) + self~connectTabEvent(IDC_TAB, SELCHANGE, onNewTab) + self~connectTabEvent(IDC_TAB, "KEYDOWN", "onTabKeyDown", 'SYNC') + + +/** initDialog() + * + * Initialize the underlying Windows dialog. This includes setting up the tab + * control tabs, executing the dialog used for the first tab, and positioning + * the dialog over the display area of the tab control. There are 5 + * .ControlDialog dialogs. The dialogs are used for the display + * area of the tab control, one control dialog for each tab of the tab control. + */ +::method initDialog + expose tabContent tabControl pbNext pbPrevious + + -- Start executing the control dialog for the first tab in the tab control. + -- We can not resize and reposition the control dialog until the underlying + -- dialog is created, so we get it started, then do our other tasks. + dlg = tabContent[1] + dlg~execute + + -- Add the tabs to the tab control. + tabControl = self~newTab(IDC_TAB) + tabControl~addSequence("List View", "Tree View", "Progress Bar", "Track Bar", "Tab") + + -- Save a reference to the push buttons. + pbNext = self~newPushButton(IDC_PB_NEXT) + pbPrevious = self~newPushButton(IDC_PB_PREVIOUS) + + -- Determine the position and size of the display area of the tab control. + self~calculateDisplayArea + + -- Position and show the control dialog used for the first page of the tab. + self~positionAndShow(1) + + +/** calculateDisplayArea() + * + * Tab controls contain two areas, the tabs themselves and the display area. + * The display area is where the content for each tab is drawn. + * + * We need to match the control dialog(s) size and position with the display + * area size and position. There are two approaches here: + * + * We could calculate the size of the largest dialog, resize the tab control to + * match, and position the control dialog over the display area. + * + * We can get the size and position of the tab control's display area and resize + * and reposition the control dialog(s) to match. This is the approach we use + * here. + */ +::method calculateDisplayArea private + expose tabControl displayRect + + -- Given a rectangle describing the tab control's size and position, the tab + -- control itself will calculate the display area's size and position. + r = tabControl~windowRect + tabControl~calcDisplayRect(r) + + -- Save the size of the display area, we need it later. + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Now we need to map the display area's position on the screen, to the client + -- co-ordinates of the main dialog. The control dialog(s) are children windows + -- of the main dialog, which is why we need to use the client-area of the + -- dialog, not the client area of the tab control. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Create our display rectangle. This is used in setWindowPosition(), which + -- takes a point / size rectangle. ooDialog defines a point / size rectangle + -- as using the left and top attributes for the position of the upper left + -- corner of a rectangle, using the right attribute for the width of the + -- rectangle, and using the bottom attribute for the height of the rectangle. + displayRect = .Rect~new(p~x, p~y, s~width, s~height) + + +/** positionAndShow() + * + * Used to resize and reposition one of the control dialogs so it occupies the + * display area of the tab control. + * + */ +::method positionAndShow private + expose tabControl tabContent displayRect lastSelected havePositioned + use strict arg index + + -- We can not position the control dialog until the underlying Windows dialog + -- is created. If the system is heavily loaded for some reason, this may not + -- have happened yet. We need to wait for it. + dlg = tabContent[index] + do i = 1 to 10 + if dlg~hwnd <> 0 then leave + z = SysSleep(.01) + end + + if dlg~hwnd == 0 then do + say "Error creating dialog for the tab with index:" index", aborting" + return self~cancel + end + + if lastSelected <> 0 then tabContent[lastSelected]~hide + + -- Now resize and reposition the control dialog to the tab control's display + -- area. We need to position the control dialog *above* the tab control in + -- the Z-order so that it shows. + dlg~setWindowPos(tabControl~hwnd, displayRect, "SHOWWINDOW NOOWNERZORDER") + + lastSelected = index + havePositioned[index] = .true + + self~checkButtons + + +::method onNewTab + expose tabControl tabContent havePositioned lastSelected + + index = tabControl~selectedIndex + 1 + dlg = tabContent[index] + + if havePositioned[index] then do + last = tabContent[lastSelected] + last~hide + dlg~show + lastSelected = index + end + else do + dlg~ownerDialog = self + dlg~execute + self~positionAndShow(index) + end + if index == 3 then dlg~activateThreads + + self~checkButtons + + +::method onNext unguarded + expose tabControl + + tabControl~selectIndex(tabControl~selectedIndex + 1) + self~onNewTab + + +::method goTo private unguarded + use strict arg tabControl, index + + tabControl~selectIndex(index) + self~onNewTab + + +::method onPrevious unguarded + expose tabControl + + tabControl~selectIndex(tabControl~selectedIndex - 1) + self~onNewTab + +::method onTabKeyDown unguarded + use arg id, vKey, tabControl + + lastTab = tabControl~items + + -- We have to reply or the message loop can not process messages and if the + -- dialog for the new tab has not been started yet, it can not execute. + reply 0 + + select + when vKey == .VK~N then self~onNext + when vKey == .VK~P then self~onPrevious + when vKey == .VK~home then self~goTo(tabControl, 0) + when vKey == .VK~end then self~goTo(tabControl, lastTab) + otherwise nop -- ignore all other keys + end + -- End select + + return + + +::method checkButtons private + expose tabControl pbNext pbPrevious + + index = tabControl~selectedIndex + 1 + if index == 1 then do + pbPrevious~disable + pbNext~enable + end + else if index == 5 then do + pbPrevious~enable + pbNext~disable + end + else do + pbPrevious~enable + pbNext~enable + end + + +::method cancel + expose tabContent + + do dlg over tabContent + dlg~endExecution(.false) + end + + return self~cancel:super + +::method ok + expose tabContent + + do dlg over tabContent + dlg~endExecution(.true) + end + + return self~ok:super + + + +::class 'ListViewDlg' subclass ResControlDialog + +::method initDialog + expose lv imageList listData + + -- Instantiate a Rexx list view object that represents the underlying + -- Windows list-view. The list-view style is report. + lv = self~newListView(IDC_LV_MAIN) + + -- Set the column headers + lv~insertColumn(0, "Symbol", 40) + lv~insertColumn(1, "Quote", 50) + lv~insertColumn(2, "Year high", 50) + lv~insertColumn(3, "Year low", 50) + lv~insertColumn(4, "Description", 120) + + lv~setImageList(imageList, SMALL) + + -- Fill the list-view with random data. + do row over listData + lv~addRow( , row[1], row[2], row[3], row[4], row[5], row[6]) + end + + -- Add full row select and the ability to drag and drop the columns to the + -- list-view. + lv~addExtendedStyle("FULLROWSELECT HEADERDRAGDROP") + + -- There is a known redrawing problem when a list view is used in a tab + -- control. ooDialog has an internal fix for that (see initUpdateListView.) + -- But, when the list view is the first page of the tab control, the list + -- view needs to have gained the focus before the dialog is covered up by + -- another window, for the fix to work. Assigning the focus here prevents + -- the very rare occurrence of a user opening the dialog, immediately + -- switching to another window, and then switching back to the dialog, and + -- the fix not working. + lv~assignFocus + +/** onActivate + * + * Invoked when a list-view item is double-clicked. We display a message and + * set the focus to the next item in the list. + */ +::method onActivate + expose lv + + selectedItem = lv~focused + symbol = lv~itemText(selectedItem) + price = lv~itemText(selectedItem, 1) + + question = "You have selected the stock with symbol" symbol". Do you want to order" || .endOfLine || - + "50 shares of stock at" price"?" + placeOrder = MessageDialog(question, self~hwnd, "Place Order for Stock", "YESNO", "QUESTION", "DEFBUTTON2" ) + + cost = 50 * price~substr(2) + if placeOrder == self~constDir["IDYES"] then do + j = MessageDialog("Okay, your bank account will be debited $"cost "dollars.", self~hwnd, - + "Order Confirmation", "OK", "INFORMATION") + end + else do + j = MessageDialog("That saved you $"cost "dollars.", self~hwnd, "Order Canceled", "OK", "EXCLAMATION") + end + + lv~deselect(selectedItem) + selectedItem += 1 + lv~focus(selectedItem) + lv~select(selectedItem) + + +/** onColumnClick() + * + * Invoked when a column header of the list-view is clicked. We just show a + * message box so that the user has some feedback. + */ +::method onColumnClick + use arg id, column + + msg = "Column" column + 1 "was clicked in control" id + j = MessageDialog(msg, self~hwnd, "List-View Notification") + + +/** prep() + * + * Does some initial set up for the list view dialog. This is moved out of the + * initDialog() method to, perhaps, help populate the list view a little + * quicker. + */ +::method prep + expose imageList listData + + -- Initialize the internal fix for the list-view redrawing problem when a + -- list-view is used in a tab control. + self~initUpdateListView(IDC_LV_MAIN) + + -- Create the image list for the list-view. The image list will consist of + -- 4 images. The images are used as the icons for each item in the list + -- view. Each item is assigned 1 image, at random, when the item is added + -- to the list-view. + -- + -- The list-view control is created without the SHAREIMAGES styles, so it + -- takes care of releasing the image list when the program ends. + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoListView.bmp") + imageList = .ImageList~create(.Size~new(16, 16), COLOR8, 4, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + + -- The image list makes a copy of the bitmap, so we can release it now + -- to free up some (small) amount of system resources. This is not + -- necessary, the OS will release the resource automatically when the + -- program ends. + image~release + end + + -- Create the data for each item (row) in the list view. The rows are + -- added to the list view in the initDialog() method + listData = .array~new(26) + do ch = "A"~c2d to "Z"~c2d + q = random(200) + yh = random(400) + yh = max(yh, q) + yl = random(100) + yl = min(yl, q) + row = .array~new(6) + row[1] = random(3) + row[2] = "_" || ch~d2c~copies(3) || "_" + row[3] = "$" || q + row[4] = "$" || yh + row[5] = "$" || yl + row[6] = ch~d2c~copies(3) "is a fictitious company." + listData~append(row) + end + + -- Connect 2 list-view events to Rexx methods in this dialog. The double- + -- click on a list-view item, and the click on a column header events. + self~connectListViewEvent(IDC_LV_MAIN, "ACTIVATE", "onActivate") + self~connectListViewEvent(IDC_LV_MAIN, "COLUMNCLICK") + + +::class 'TreeViewDlg' subclass ResControlDialog + +::method initDialog + + -- Instantiate a Rexx tree view object that represents the Windows tree-view + -- control. + tv = self~newTreeView(IDC_TV_MAIN) + + -- Create and set the ImageList for the tree view items + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoTreeView.bmp") + imageList = .ImageList~create(.Size~new(32, 32), COLOR8, 10, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + tv~setImageList(imageList, NORMAL) + image~release + end + + -- Add the tree view items. Toys will be the root (the first argument is + -- not omitted. Subitems are added by omitting the first arguments. The + -- number of arguments omitted indicates the depth of the subitem. + -- + -- The last numeric argument in some of the items is the index for the icon + -- for that item in the image list. Those items without a number will not + -- display an icon. + + tv~add("Toys", 1) + tv~add(, "Indoor", 14) + tv~add(, , "Boys", 19) + tv~add(, , , "Cowboys", 13) + tv~add(, , , "Cars", 8) + tv~add(, , , "Starwars", 9) + tv~add(, , "Girls", 0) + tv~add(, , , "Barby", 19) + tv~add(, , , "Painting", 15) + tv~add(, , , "Cooking", 13) + tv~add(, , "Adults", 17) + tv~add(, , , "Poker", 15) + tv~add(, , "Technical", 16) + tv~add(, , , "Racing cars", 8) + tv~add(, , , "Trains", 7) + tv~add(, "Outdoor", 11) + tv~add(, , "Water", 22) + tv~add(, , , "Ball", 5) + tv~add(, , , "Soft tennis", 6) + tv~add(, , "Sand", 12) + tv~add(, , , "Shovel", 12) + tv~add(, , , "Bucket", 19) + tv~add(, , , "Sandbox", 12) + tv~add(, , "Technical", 16) + tv~add(, , , "Trains", 7) + tv~add(, , , "Remote controlled", 8) + tv~add("Office Articles", 2) + tv~add( , "Tools", 16) + tv~add( , "Books", 19) + tv~add( , , "Introduction", 14) + tv~add( , , "Advanced Programming", 17) + tv~add( , , "Tips & Tricks", 16) + tv~add("Hardware", 4) + tv~add( , "Garden", 0) + tv~add( , "Handyman", 18) + tv~add( , "Household", 18) + tv~add("Furniture", 3) + tv~add( , "Standard", 12) + tv~add( , "Luxury", 21) + + -- Connecting the begin drag event and using the default tree drag handler + -- allows us to suppport drag and drop (using the default behaviour. + self~connectTreeViewEvent(IDC_TV_MAIN, "BeginDrag", "DefTreeDragHandler") + + +::class 'ProgressBarDlg' subclass RcControlDialog + +::method prep + expose threadsStarted processes + + threadsStarted = 0 + processes = .array~of('animateProgressA', 'animateProgressB', 'animateProgressC', - + 'animateProgressD', 'animateProgressE') + + +-- This message is sent to us by the owner dialog, the .NewControlsDialog dialog +-- to notify us that we are about to become visible. We use the notification to +-- start the progress bar animation threads. +::method activateThreads unguarded + expose threadsStarted processes + + reply 0 + + -- If no threads are running, start a thread to run each progress bar + -- asynchronously. + if threadsStarted < 1 then do + threadsStarted = processes~items + do methodName over processes + self~start(methodName) + end + end + +-- This is a generic method that simulates some type of processing that takes a +-- long time. The progress of this processing is displayed by the progress bar. +::method animateProgress unguarded + use arg progressBar, label, step, iterations, tsleep + + progressBar~setRange(0, iterations * step) + progressBar~setStep(step) + do i = 1 to iterations + progressBar~step + if (iterations * step == 100) then label~setText(i * step "%") + else label~setText(i * step) + + call msSleep tsleep + if \ self~isDialogActive then return + end + +-- The following 5 methods are started asynchronously to animate the progress +-- bars. +::method animateProgressA unguarded + expose threadsStarted pbA labelA + + if \ pbA~isA(.ProgressBar) then do + pbA = self~newProgressBar(IDC_PBAR_PROCESSA) + labelA = self~newStatic(IDC_ST_PERCENTA) + end + + self~animateProgress(pbA, labelA, 5, 20, 600) + threadsStarted -= 1 + +::method animateProgressB unguarded + expose threadsStarted pbB labelB + + if \ pbB~isA(.ProgressBar) then do + pbB = self~newProgressBar(IDC_PBAR_PROCESSB) + labelB = self~newStatic(IDC_ST_PERCENTB) + end + + self~animateProgress(pbB, labelB, 1, 100, 150) + threadsStarted -= 1 + +::method animateProgressC unguarded + expose threadsStarted pbC labelC + + if \ pbC~isA(.ProgressBar) then do + pbC = self~newProgressBar(IDC_PBAR_PROCESSC) + labelC = self~newStatic(IDC_ST_PERCENTC) + end + + self~animateProgress(pbC, labelC, 2, 50, 200) + threadsStarted -= 1 + +::method animateProgressD unguarded + expose threadsStarted pbD labelD + + if \ pbD~isA(.ProgressBar) then do + pbD = self~newProgressBar(IDC_PBAR_PROCESSD) + labelD = self~newStatic(IDC_ST_PERCENTD) + end + + self~animateProgress(pbD, labelD, 10, 40, 300) + threadsStarted -= 1 + +::method animateProgressE unguarded + expose threadsStarted pbE labelE + + if \ pbE~isA(.ProgressBar) then do + pbE = self~newProgressBar(IDC_PBAR_PROCESSE) + labelE = self~newStatic(IDC_ST_PERCENTE) + end + + self~animateProgress(pbE, labelE, 20, 50, 500) + threadsStarted -= 1 + + +::class 'TrackBarDlg' subclass ResControlDialog + +::method initDialog + expose font1 trackBars tbLabels + + -- As we initialize each track bar we'll stash the Rexx object in a table + -- for easy access later, indexed by its numeric resource id. The same + -- thing is done for the static control that is the label for the track bar. + trackBars = .table~new + tbLabels = .table~new + + -- For the horizonatal track bars we'll use a big font for the label. + font1 = self~CreateFontEx("Arial", 24, "BOLD") + + -- The symbolic IDs for the track bars / labels are named after the style + -- of the track bar. Vertical or horizontal and where the ticks are placed. + + -- Initialize the horizontal track bar with ticks on the bottom. + tb = self~newTrackBar(IDC_TB_HORZ_BOTTOM) + label = self~newStatic(IDC_ST_HORZ_BOTTOM) + + tb~setTickFrequency(10) + tb~setPos(20, .true) + label~setText(20) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTTOM] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the top. + tb = self~newTrackBar(IDC_TB_HORZ_TOP) + label = self~newStatic(IDC_ST_HORZ_TOP) + + tb~initRange(0, 200) + tb~setTickFrequency(50) + tb~setPos(40, .true) + label~setText(40) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_TOP] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_HORZ_BOTH) + label = self~newStatic(IDC_ST_HORZ_BOTH) + + tb~initSelRange(20, 60) + tb~setTickFrequency(10) + tb~setPos(80, .true) + label~setText(80) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the right. + tb = self~newTrackBar(IDC_TB_VERT_RIGHT) + label = self~newStatic(IDC_ST_VERT_RIGHT) + + tb~setTickFrequency(10) + tb~setPos(30, .true) + label~setText(30) + + id = self~constDir[IDC_TB_VERT_RIGHT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the left. + tb = self~newTrackBar(IDC_TB_VERT_LEFT) + label = self~newStatic(IDC_ST_VERT_LEFT) + + tb~setTickFrequency(10) + tb~initRange(0,400) + tb~setLineStep(5) + tb~setPageStep(50) + tb~setPos(90, .true) + label~setText(90) + + id = self~constDir[IDC_TB_VERT_LEFT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_VERT_BOTH) + label = self~newStatic(IDC_ST_VERT_BOTH) + + tb~setTickFrequency(5) + tb~setPos(70, .true) + label~setText(70) + + id = self~constDir[IDC_TB_VERT_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Connect the event notification that is sent when a track bar is moved to + -- the onEndTrack() method. That method will update the text label for the + -- track bar with the new postition. + self~connectTrackBarEvent(IDC_TB_HORZ_BOTH, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_TOP, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_BOTTOM, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_RIGHT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_LEFT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_BOTH, "EndTrack", "onEndTrack") + +-- Update the static contol that shows the position for a slider when the +-- user is done moving it. +::method onEndTrack + expose trackBars tbLabels + use arg code, hwndTrackBar + + -- hwndTrackBar is the handle to the track bar that was moved. Get its + -- resource ID and use that as an index into the table of track bar objects + -- and the table of the labels. + id = self~getControlID(hwndTrackBar) + tbLabels[id]~setText(trackBars[id]~pos) + +-- We use the leaving() method to clean up (delete) the font we created. In +-- this program there is really no need to do this. As soon as the interpreter +-- terminates, the OS cleans up the resources automatically. The only time +-- cleaning up resources makes sense is in a long-running program that creates +-- and ends a lot of dialogs. Then, over time, the memory usge of the program +-- would keep growing. +::method leaving + expose font1 + self~deleteFont(font1) + + +::class 'TabDlg' subclass ResControlDialog + +::method initDialog + expose font2 font3 imageList iconsRemoved needWrite pb + + -- Set the iconsRemoved and needWrite to false. These flags are used in + -- the OnDrawTabRect() method. + iconsRemoved = .false + needWrite = .false + + -- Connect the draw event of the owner-drawn button. This is sent when the + -- button needs to be drawn. Then connect the selection changed event of the + -- tab control. This is sent when the user clicks on a different tab. + self~connectDraw(IDC_PB_OWNERDRAW, "onDrawTabRect") + self~connectTabEvent(IDC_TAB_MAIN, "SELCHANGE", "onTabSelChange") + + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Create a font used to display the name of the color in the owner-drawn + -- button. Create another font used to display some informative text. + font2 = self~createFontEX("Arial", 48, "BOLD ITALIC") + font3 = self~createFontEx("Arial", 16, "BOLD") + + -- Add all the tabs, including the index into the image list for an icon for + -- each tab. + tc~AddFullSeq("Red", 0, ,"Green", 1, , "Moss", 2, , "Blue", 3, , "Purple", 4, , "Cyan", 5, , "Gray", 6) + + -- Create a COLORREF (pure white) and load our bitmap. The bitmap is a + -- series of 16x16 images, each one a colored letter. + cRef = .Image~colorRef(255, 255, 255) + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoTab.bmp") + + -- Create our image list, as a masked image list. + flags = 'COLOR24 MASK' + imageList = .ImageList~create(.Size~new(16, 16), flags, 10, 0) + if \image~isNull, \imageList~isNull then do + -- The bitmap is added and the image list deduces the number of images + -- from the width of the bitmap. For each image, the image list creates a + -- mask using the color ref. In essence, the mask is used to turn each + -- white pixel in the image to transparent. In this way, only the letter + -- part of the image shows and the rest of the image lets the under-lying + -- color show through. + imageList~addMasked(image, cRef) + tc~setImageList(imageList) + + -- The image list makes a copy of each image added to it. So, we can now + -- release the original image to free up some small amount of system + -- resoureces. + image~release + end + else do + iconsRemoved = .true + end + + -- Have the tab control calculate its display area's size and position. + r = tc~windowRect + tc~calcDisplayRect(r) + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Get the owner draw push button. We'll resize and position it so that it + -- completely takes up the display area of the tab control. + pb = self~newPushButton(IDC_PB_OWNERDRAW) + + -- Map the display area's position on the screen, to the client co-ordinates + -- of this control dialog. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Now resize and reposition the button so it exactly over-lays the display + -- area of the tab control. We specify that the tab control window is behind + -- the button and use the flag that prevents the button's owner window, this + -- z-order from changing. This leaves the tab control on top of the dialog, + -- and our push button on top of the tab control. Which of course is what we + -- want. + pb~setWindowPos(tc~hwnd, p~x, p~y, s~width, s~height, "SHOWWINDOW NOOWNERZORDER") + + + +-- When a new tab is selected, we have the owner-drawn button update itself. +-- This causes the button to redraw and the onDrawTabRect() method gets invoked, +-- which actually does the drawing. +::method onTabSelChange + expose pb + pb~update + + +-- Fill the owner-drawn button with the color matching the tab's label and write +-- the name of the color. +::method onDrawTabRect + expose font2 font3 imageList iconsRemoved needWrite + use arg id + + button = self~newPushButton(id) + if button == .nil then return + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Each time the 'Gray' tab is selected, we remove the tab icons. Then, when + -- one of the other tabs is selected we set the image list back. + currentTab = tc~selected + if currentTab == 'Gray' then do + tc~setImageList(.nil) + iconsRemoved = .true + needWrite = .true + end + else do + if iconsRemoved then do + tc~setImageList(imageList) + iconsRemoved = .false + needWrite = .true + end + end + + -- Get the button's device context, create pen and brush, and assign pen, + -- brush and font to the device context. + dc = button~getDC + pen = button~createPen(1, "SOLID", 0) + brush = button~createBrush(tc~SelectedIndex + 1) + + oldPen = button~objectToDc(dc, pen) + oldBrush = button~objectToDc(dc, brush) + oldFont = button~fontToDC(dc, font2) + button~transparentText(dc) + + -- Draw a filled in rectangle, with a border of 5 around it, and write text. + size = button~getRealSize + button~rectangle(dc, 5, 5, size~width - 5, size~height - 5, "FILL") + button~writeDirect(dc, trunc(size~width / 4), trunc(size~height / 4), tc~Selected) + + -- Add informative text if needed. + if needWrite then do + button~fontToDC(dc, font3) + x = trunc(size~width / 4) + y = trunc(size~height / 2) + + if currentTab == 'Gray' then + button~writeDirect(dc, x, y, "(Tab icons are removed)") + else + button~writeDirect(dc, x, y, "(Tab icons are restored)") + needWrite = .false + end + + -- Restore pen, brush, and font, then release the device context. + button~objectToDc(dc, oldPen) + button~objectToDc(dc, oldBrush) + button~fontToDC(dc, oldFont) + button~opaqueText(dc) + + button~deleteObject(pen) + button~deleteObject(brush) + button~freeDC(dc) + +-- We use the leaving() method to clean up (delete) the fonts and the image list +-- we created. In this program there is really no need to do this. As soon as +-- the interpreter terminates, the OS cleans up the resources automatically. +-- The only time cleaning up resources makes sense is in a long-running program +-- that creates and ends a lot of dialogs. Then, over time, the memory usge of +-- the program would keep growing. +::method leaving + expose font2 font3 imageList + + self~deleteFont(font2) + self~deleteFont(font3) + imageList~release + diff --git a/modules/windows/oodialog/propertysheet.tabControls/TabOwnerDemo.rex b/modules/windows/oodialog/propertysheet.tabControls/TabOwnerDemo.rex new file mode 100755 index 0000000..383564a --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/TabOwnerDemo.rex @@ -0,0 +1,786 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2018 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Tab Control / Dialog Controls / ControlDialog Example + * + * This example demonstrates how to use the ControlDialog class to populate a + * Tab control. It is basically the same as the PropertySheetDemo.rex example, + * but uses a Tab control with ControlDialog objects rather than using a + * PropertySheetDialog. + * + * Much of the code is simply copied from the PropertySheetDemo.rex program. + */ + + sd = locate() + .application~setDefaults("O", sd"rc\TabOwnerDemo.h", .false) + + -- Create a managed tab object that is composed of all the control dialogs for + -- a specific tab control in the tab owner dialog. + dlgs = .array~new(5) + + exArgs = .ControlDlgInfo~new( , .true, "List View", .Size~new(300, 250)) + dlgs[1] = .ListViewDlg~new(sd"rc\TabOwnerDemo.dll", IDD_LISTVIEW_DLG, , , exArgs) + + exArgs~title = 'Tree View' + dlgs[2] = .TreeViewDlg~new(sd"rc\TabOwnerDemo.dll", IDD_TREEVIEW_DLG, , , exArgs) + + exArgs~title = 'Progress Bar' + dlgs[3] = .ProgressBarDlg~new(sd"rc\TabOwnerDemo.dll", IDD_PROGRESSBAR_DLG, , , exArgs) + + exArgs~title = 'Track Bar' + dlgs[4] = .TrackBarDlg~new(sd"rc\TabOwnerDemo.dll", IDD_TRACKBAR_DLG, , , exArgs) + + exArgs~title = 'Tab' + dlgs[5] = .TabDlg~new(sd"rc\TabOwnerDemo.dll", IDD_TAB_DLG, , , exArgs) + + mt1 = .ManagedTab~new(IDC_TAB1, dlgs, "SELCHANGE") + + dlgs = .array~new(5) + + exArgs~Title = "Blank 1" + dlgs[1] = .BlankDlg~new(sd"rc\TabOwnerDemo.dll", IDD_BLANK_DLG, , , exArgs) + + exArgs~title = 'Blank 2' + dlgs[2] = .BlankDlg~new(sd"rc\TabOwnerDemo.dll", IDD_BLANK_DLG, , , exArgs) + + exArgs~title = 'Blank 3' + dlgs[3] = .BlankDlg~new(sd"rc\TabOwnerDemo.dll", IDD_BLANK_DLG, , , exArgs) + + exArgs~title = 'Blank 4' + dlgs[4] = .BlankDlg~new(sd"rc\TabOwnerDemo.dll", IDD_BLANK_DLG, , , exArgs) + + exArgs~title = 'Blank 5' + dlgs[5] = .BlankDlg~new(sd"rc\TabOwnerDemo.dll", IDD_BLANK_DLG, , , exArgs) + + mt2 = .ManagedTab~new(IDC_TAB2, dlgs) + + -- Create the main dialog. + exArgs = .TabOwnerDlgInfo~new(.array~of(mt1, mt2)) + dlg = .NewControlsDialog~new( , , exArgs) + + -- Show and run the dialog. + dlg~execute('SHOWTOP', IDI_DLG_OOREXX) + + return 0 + +::requires "ooDialog.cls" + +::class 'NewControlsDialog' subclass UserDialog inherit TabOwnerDialog + +::method init + + forward class (super) continue + if self~initCode <> 0 then return + + self~createCenter(640, 300, "TabOwner Example with ControlDialog objects", "", , "Arial", 9) + +::method defineDialog + + self~createTab(IDC_TAB1, 10, 5, 305, 265) + self~createTab(IDC_TAB2, 325, 5, 305, 265) + + self~createPushButton(IDC_PB_PREVIOUS, 10, 278, 60, 14, , "Previous Control", onPrevious) + self~createPushButton(IDC_PB_NEXT, 80, 278, 60, 14, , "Next Control", onNext) + self~createPushButton(IDOK, 500, 278, 60, 14, "DEFAULT", "Ok") + self~createPushButton(IDCANCEL, 570, 278, 60, 14, , "Cancel") + + +::method initDialog + expose tabControl pbNext pbPrevious +--say "Enter NewControlsDialog::initDialog()" + + -- Save a reference to the push buttons. + pbNext = self~newPushButton(IDC_PB_NEXT) + pbPrevious = self~newPushButton(IDC_PB_PREVIOUS) + tabControl = self~newTab(IDC_TAB1) + + pbPrevious~disable + +--say "Leave NewControlsDialog::initDialog()" + +::method tabOwnerSelChange unguarded + expose pbNext pbPrevious + use arg pageDlg, pageNumber, + + if pageNumber == 1 then do + pbPrevious~disable + pbNext~enable + end + else if pageNumber == 5 then do + pbPrevious~enable + pbNext~disable + end + else do + pbPrevious~enable + pbNext~enable + end + +::method onNext + expose tabControl + + tabControl~focus(tabControl~selectedIndex + 1) + self~checkButtons + + +::method onPrevious + expose tabControl + + tabControl~focus(tabControl~selectedIndex - 1) + self~checkButtons + + +::method checkButtons + expose tabControl pbNext pbPrevious + + index = tabControl~selectedIndex + 1 + if index == 1 then do + pbPrevious~disable + pbNext~enable + end + else if index == 5 then do + pbPrevious~enable + pbNext~disable + end + else do + pbPrevious~enable + pbNext~enable + end + + + +::class 'ListViewDlg' subclass ResControlDialog + +::method initDialog + expose lv +-- say "Enter ListViewDlg::initDialog" + + self~initUpdateListView(IDC_LV_MAIN) + + -- Instantiate a Rexx list view object that represents the underlying + -- Windows list-view. The list-view style is report. + lv = self~newListView(IDC_LV_MAIN) + + -- Set the column headers + lv~insertColumn(0, "Symbol", 40) + lv~insertColumn(1, "Quote", 50) + lv~insertColumn(2, "Year high", 50) + lv~insertColumn(3, "Year low", 50) + lv~insertColumn(4, "Description", 120) + + -- Set the images for the items in the list-view. The list-view control was + -- created without the SHAREIMAGES styles, so it takes care of releasing the + -- image list when the program ends. + image = .Image~getImage(.application~srcDir"rc\TabOwnerDemoListView.bmp") + imageList = .ImageList~create(.Size~new(16, 16), COLOR8, 4, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + lv~setImageList(imageList, SMALL) + + -- The image list makes a copy of the bitmap, so we can release it now + -- to free up some (small) amount of system resources. This is not + -- necessary, the OS will release the resource automatically when the + -- program ends. + image~release + end + + -- Fill the list-view with random data. + do ch = "A"~c2d to "Z"~c2d + q = random(200) + --call msSleep 1 + yh = random(400) + yh = max(yh, q) + yl = random(100) + yl = min(yl, q) + lv~addRow( , random(3), "_" || ch~d2c~copies(3) || "_", "$" || q, "$" || yh, "$" || yl, - + ch~d2c~copies(3) "is a fictitious company.") + end + + -- Add full row select and the ability to drag and drop the columns to the + -- list-view. + lv~addExtendedStyle("FULLROWSELECT HEADERDRAGDROP") + + -- Connect 2 list-view events to Rexx methods in this dialog. The double- + -- click on a list-view item, and the click on a column header events. + self~connectListViewEvent(IDC_LV_MAIN, "ACTIVATE", "onActivate") + self~connectListViewEvent(IDC_LV_MAIN, "COLUMNCLICK") + +-- say "Leave ListViewDlg::initDialog" + +-- Invoked when a list-view item is double-clicked. We display a message and +-- set the focus to the next item in the list. +::method onActivate + expose lv + + selectedItem = lv~focused + symbol = lv~itemText(selectedItem) + price = lv~itemText(selectedItem, 1) + + question = "You have selected the stock with symbol" symbol". Do you want to order" || .endOfLine || - + "50 shares of stock at" price"?" + placeOrder = MessageDialog(question, self~hwnd, "Place Order for Stock", "YESNO", "QUESTION", "DEFBUTTON2" ) + + cost = 50 * price~substr(2) + if placeOrder == self~constDir["IDYES"] then do + j = MessageDialog("Okay, your bank account will be debited $"cost "dollars.", self~hwnd, - + "Order Confirmation", "OK", "INFORMATION") + end + else do + j = MessageDialog("That saved you $"cost "dollars.", self~hwnd, "Order Canceled", "OK", "EXCLAMATION") + end + + lv~deselect(selectedItem) + selectedItem += 1 + lv~focus(selectedItem) + lv~select(selectedItem) + +-- Invoked when a column header of the list-view is clicked. We just show a +-- message box so that the user has some feedback. +::method OnColumnClick + use arg id, column + j = MessageDialog("Column" column + 1 "was clicked in control" id, self~hwnd, "List-View Notification") + +::method tabPageSetActive unguarded + use arg owner, tab + reply 0 + + +::class 'TreeViewDlg' subclass ResControlDialog + +::method initDialog + + -- Instantiate a Rexx tree view object that represents the Windows tree-view + -- control. + tv = self~newTreeView(IDC_TV_MAIN) + + -- Create and set the ImageList for the tree view items + image = .Image~getImage(.application~srcDir"rc\TabOwnerDemoTreeView.bmp") + imageList = .ImageList~create(.Size~new(32, 32), COLOR8, 10, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + tv~setImageList(imageList, NORMAL) + image~release + end + + -- Add the tree view items. Toys will be the root (the first argument is + -- not omitted. Subitems are added by omitting the first arguments. The + -- number of arguments omitted indicates the depth of the subitem. + -- + -- The last numeric argument in some of the items is the index for the icon + -- for that item in the image list. Those items without a number will not + -- display an icon. + + tv~add("Toys", 1) + tv~add(, "Indoor", 14) + tv~add(, , "Boys", 19) + tv~add(, , , "Cowboys", 13) + tv~add(, , , "Cars", 8) + tv~add(, , , "Starwars", 9) + tv~add(, , "Girls", 0) + tv~add(, , , "Barby", 19) + tv~add(, , , "Painting", 15) + tv~add(, , , "Cooking", 13) + tv~add(, , "Adults", 17) + tv~add(, , , "Poker", 15) + tv~add(, , "Technical", 16) + tv~add(, , , "Racing cars", 8) + tv~add(, , , "Trains", 7) + tv~add(, "Outdoor", 11) + tv~add(, , "Water", 22) + tv~add(, , , "Ball", 5) + tv~add(, , , "Soft tennis", 6) + tv~add(, , "Sand", 12) + tv~add(, , , "Shovel", 12) + tv~add(, , , "Bucket", 19) + tv~add(, , , "Sandbox", 12) + tv~add(, , "Technical", 16) + tv~add(, , , "Trains", 7) + tv~add(, , , "Remote controlled", 8) + tv~add("Office Articles", 2) + tv~add( , "Tools", 16) + tv~add( , "Books", 19) + tv~add( , , "Introduction", 14) + tv~add( , , "Advanced Programming", 17) + tv~add( , , "Tips & Tricks", 16) + tv~add("Hardware", 4) + tv~add( , "Garden", 0) + tv~add( , "Handyman", 18) + tv~add( , "Household", 18) + tv~add("Furniture", 3) + tv~add( , "Standard", 12) + tv~add( , "Luxury", 21) + + -- Connecting the begin drag event and using the default tree drag handler + -- allows us to suppport drag and drop (using the default behaviour. + self~connectTreeViewEvent(IDC_TV_MAIN, "BeginDrag", "DefTreeDragHandler") + +::method tabPageSetActive unguarded + use arg owner, tab + reply 0 + + +::class 'ProgressBarDlg' subclass ResControlDialog + +::method initDialog unguarded + expose threadsStarted processes + +--say 'ProgressBarDlg::initDialog() ENTER' + reply 0; + threadsStarted = 0 + processes = .array~of('animateProgressA', 'animateProgressB', 'animateProgressC', - + 'animateProgressD', 'animateProgressE') + self~activateThreads +--say 'ProgressBarDlg::initDialog() LEAVE' + + +-- This message is sent to us by the owner dialog, the .NewControlsDialog dialog +-- to notify us that we are about to become visible. We use the notification to +-- start the progress bar animation threads. +::method activateThreads unguarded + expose threadsStarted processes + use arg propSheet + + reply 0 + + -- If no threads are running, start a thread to run each progress bar + -- asynchronously. + if threadsStarted < 1 then do + threadsStarted = processes~items + do methodName over processes + self~start(methodName) + end + end + +-- This is the generic method that simulates some type of processing that takes +-- a long time. The progress of this processing is displayed by the progress +-- bar. to simulate a process of which the progress is displayed by a progress bar */ +::method animateProgress unguarded + use arg progressBar, label, step, iterations, tsleep + + progressBar~setRange(0, iterations * step) + progressBar~setStep(step) + do i = 1 to iterations + progressBar~step + if (iterations * step == 100) then label~setText(i * step "%") + else label~setText(i * step) + + call msSleep tsleep + if \ self~isDialogActive then return + end + +::method tabPageKillActive unguarded + use strict arg owner, tab + --say 'ProgressBarDlg::tabPageKillActive owner:' owner 'returning false' + return .true + +::method tabPageSetActive unguarded + use arg owner, tab + reply 0 + self~activateThreads + +-- The following 5 methods are started asynchronously to animate the progress +-- bars. +::method animateProgressA unguarded + expose threadsStarted pbA labelA + + if \ pbA~isA(.ProgressBar) then do + pbA = self~newProgressBar(IDC_PBAR_PROCESSA) + labelA = self~newStatic(IDC_ST_PERCENTA) + end + + self~animateProgress(pbA, labelA, 5, 20, 600) + threadsStarted -= 1 + +::method animateProgressB unguarded + expose threadsStarted pbB labelB + + if \ pbB~isA(.ProgressBar) then do + pbB = self~newProgressBar(IDC_PBAR_PROCESSB) + labelB = self~newStatic(IDC_ST_PERCENTB) + end + + self~animateProgress(pbB, labelB, 1, 100, 150) + threadsStarted -= 1 + +::method animateProgressC unguarded + expose threadsStarted pbC labelC + + if \ pbC~isA(.ProgressBar) then do + pbC = self~newProgressBar(IDC_PBAR_PROCESSC) + labelC = self~newStatic(IDC_ST_PERCENTC) + end + + self~animateProgress(pbC, labelC, 2, 50, 200) + threadsStarted -= 1 + +::method animateProgressD unguarded + expose threadsStarted pbD labelD + + if \ pbD~isA(.ProgressBar) then do + pbD = self~newProgressBar(IDC_PBAR_PROCESSD) + labelD = self~newStatic(IDC_ST_PERCENTD) + end + + self~animateProgress(pbD, labelD, 10, 40, 300) + threadsStarted -= 1 + +::method animateProgressE unguarded + expose threadsStarted pbE labelE + + if \ pbE~isA(.ProgressBar) then do + pbE = self~newProgressBar(IDC_PBAR_PROCESSE) + labelE = self~newStatic(IDC_ST_PERCENTE) + end + + self~animateProgress(pbE, labelE, 20, 50, 500) + threadsStarted -= 1 + + +::class 'TrackBarDlg' subclass ResControlDialog + +::method initDialog + expose font1 trackBars tbLabels +-- say "TrackBarDlg::initDialog ENTER" + -- As we initialize each track bar we'll stash the Rexx object in a table + -- for easy access later, indexed by its numeric resource id. The same + -- thing is done for the static control that is the label for the track bar. + trackBars = .table~new + tbLabels = .table~new + + -- For the horizonatal track bars we'll use a big font for the label. + font1 = self~CreateFontEx("Arial", 24, "BOLD") + + -- The symbolic IDs for the track bars / labels are named after the style + -- of the track bar. Vertical or horizontal and where the ticks are placed. + + -- Initialize the horizontal track bar with ticks on the bottom. + tb = self~newTrackBar(IDC_TB_HORZ_BOTTOM) + label = self~newStatic(IDC_ST_HORZ_BOTTOM) + + tb~setTickFrequency(10) + tb~setPos(20, .true) + label~setText(20) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTTOM] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the top. + tb = self~newTrackBar(IDC_TB_HORZ_TOP) + label = self~newStatic(IDC_ST_HORZ_TOP) + + tb~initRange(0, 200) + tb~setTickFrequency(50) + tb~setPos(40, .true) + label~setText(40) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_TOP] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_HORZ_BOTH) + label = self~newStatic(IDC_ST_HORZ_BOTH) + + tb~initSelRange(20, 60) + tb~setTickFrequency(10) + tb~setPos(80, .true) + label~setText(80) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the right. + tb = self~newTrackBar(IDC_TB_VERT_RIGHT) + label = self~newStatic(IDC_ST_VERT_RIGHT) + + tb~setTickFrequency(10) + tb~setPos(30, .true) + label~setText(30) + + id = self~constDir[IDC_TB_VERT_RIGHT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the left. + tb = self~newTrackBar(IDC_TB_VERT_LEFT) + label = self~newStatic(IDC_ST_VERT_LEFT) + + tb~setTickFrequency(10) + tb~initRange(0,400) + tb~setLineStep(5) + tb~setPageStep(50) + tb~setPos(90, .true) + label~setText(90) + + id = self~constDir[IDC_TB_VERT_LEFT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_VERT_BOTH) + label = self~newStatic(IDC_ST_VERT_BOTH) + + tb~setTickFrequency(5) + tb~setPos(70, .true) + label~setText(70) + + id = self~constDir[IDC_TB_VERT_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Connect the event notification that is sent when a track bar is moved to + -- the onEndTrack() method. That method will update the text label for the + -- track bar with the new postition. + self~connectTrackBarEvent(IDC_TB_HORZ_BOTH, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_TOP, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_BOTTOM, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_RIGHT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_LEFT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_BOTH, "EndTrack", "onEndTrack") + +-- say "TrackBarDlg::initDialog LEAVE" + + +-- Update the static contol that shows the position for a slider when the +-- user is done moving it. +::method onEndTrack + expose trackBars tbLabels + use arg code, hwndTrackBar + + -- hwndTrackBar is the handle to the track bar that was moved. Get its + -- resource ID and use that as an index into the table of track bar objects + -- and the table of the labels. + id = self~getControlID(hwndTrackBar) + tbLabels[id]~setText(trackBars[id]~pos) + +-- We use the leaving() method to clean up (delete) the font we created. In +-- this program there is really no need to do this. As soon as the interpreter +-- terminates, the OS cleans up the resources automatically. The only time +-- cleaning up resources makes sense is in a long-running program that creates +-- and ends a lot of dialogs. Then, over time, the memory usge of the program +-- would keep growing. +::method leaving + expose font1 + self~deleteFont(font1) + + + +::class 'TabDlg' subclass ResControlDialog + +::method initDialog + expose font2 font3 imageList iconsRemoved needWrite + + -- Set the iconsRemoved and needWrite to false. These flags are used in + -- the OnDrawTabRect() method. + iconsRemoved = .false + needWrite = .false + + -- Connect the draw event of the owner-drawn button. This is sent when the + -- button needs to be drawn. Then connect the selection changed event of the + -- tab control. This is sent when the user clicks on a different tab. + self~connectDraw(IDC_PB_OWNERDRAW, "onDrawTabRect") + self~connectTabEvent(IDC_TAB_MAIN, "SELCHANGE", "onTabSelChange") + + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Create a font used to display the name of the color in the owner-drawn + -- button. Create another font used to display some informative text. + font2 = self~createFontEX("Arial", 48, "BOLD ITALIC") + font3 = self~createFontEx("Arial", 16, "BOLD") + + -- Add all the tabs, including the index into the image list for an icon for + -- each tab. + tc~AddFullSeq("Red", 0, ,"Green", 1, , "Moss", 2, , "Blue", 3, , "Purple", 4, , "Cyan", 5, , "Gray", 6) + + -- Create a COLORREF (pure white) and load our bitmap. The bitmap is a + -- series of 16x16 images, each one a colored letter. + cRef = .Image~colorRef(255, 255, 255) + image = .Image~getImage(.application~srcDir"rc\TabOwnerDemoTab.bmp") + + -- Create our image list, as a masked image list. + flags = 'COLOR24 MASK' + imageList = .ImageList~create(.Size~new(16, 16), flags, 10, 0) + if \image~isNull, \imageList~isNull then do + -- The bitmap is added and the image list deduces the number of images + -- from the width of the bitmap. For each image, the image list creates a + -- mask using the color ref. In essence, the mask is used to turn each + -- white pixel in the image to transparent. In this way, only the letter + -- part of the image shows and the rest of the image lets the under-lying + -- color show through. + imageList~addMasked(image, cRef) + tc~setImageList(imageList) + + -- The image list makes a copy of each image added to it. So, we can now + -- release the original image to free up some small amount of system + -- resoureces. + image~release + end + else do + iconsRemoved = .true + end + + -- Have the tab control calculate its display area's size and position. + r = tc~windowRect + tc~calcDisplayRect(r) + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Get the owner draw push button. We'll resize and position it so that it + -- completely takes up the display area of the tab control. + pb = self~newPushButton(IDC_PB_OWNERDRAW) + + -- Map the display area's position on the screen, to the client co-ordinates + -- of this control dialog. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Now resize and reposition the button so it exactly over-lays the display + -- area of the tab control. We specify that the tab control window is behind + -- the button and use the flag that prevents the button's owner window, this + -- z-order from changing. This leaves the tab control on top of the dialog, + -- and our push button on top of the tab control. Which of course is what we + -- want. + pb~setWindowPos(tc~hwnd, p~x, p~y, s~width, s~height, "SHOWWINDOW NOOWNERZORDER") + + + +-- When a new tab is selected, we have the owner-drawn button update itself. +-- This causes the button to redraw and the onDrawTabRect() method gets invoked, +-- which actually does the drawing. +::method onTabSelChange + button = self~newPushButton(IDC_PB_OWNERDRAW) + button~update + + +-- Fill the owner-drawn button with the color matching the tab's label and write +-- the name of the color. +::method onDrawTabRect + expose font2 font3 imageList iconsRemoved needWrite + use arg id + + button = self~newPushButton(id) + if button == .nil then return + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Each time the 'Gray' tab is selected, we remove the tab icons. Then, when + -- one of the other tabs is selected we set the image list back. + currentTab = tc~selected + if currentTab == 'Gray' then do + tc~setImageList(.nil) + iconsRemoved = .true + needWrite = .true + end + else do + if iconsRemoved then do + tc~setImageList(imageList) + iconsRemoved = .false + needWrite = .true + end + end + + -- Get the button's device context, create pen and brush, and assign pen, + -- brush and font to the device context. + dc = button~getDC + pen = button~createPen(1, "SOLID", 0) + brush = button~createBrush(tc~SelectedIndex + 1) + + oldPen = button~objectToDc(dc, pen) + oldBrush = button~objectToDc(dc, brush) + oldFont = button~fontToDC(dc, font2) + button~transparentText(dc) + + -- Draw a filled in rectangle, with a border of 5 around it, and write text. + size = button~getRealSize + button~rectangle(dc, 5, 5, size~width - 5, size~height - 5, "FILL") + button~writeDirect(dc, trunc(size~width / 4), trunc(size~height / 4), tc~Selected) + + -- Add informative text if needed. + if needWrite then do + button~fontToDC(dc, font3) + x = trunc(size~width / 4) + y = trunc(size~height / 2) + + if currentTab == 'Gray' then + button~writeDirect(dc, x, y, "(Tab icons are removed)") + else + button~writeDirect(dc, x, y, "(Tab icons are restored)") + needWrite = .false + end + + -- Restore pen, brush, and font, then release the device context. + button~objectToDc(dc, oldPen) + button~objectToDc(dc, oldBrush) + button~fontToDC(dc, oldFont) + button~opaqueText(dc) + + button~deleteObject(pen) + button~deleteObject(brush) + button~freeDC(dc) + +-- We use the leaving() method to clean up (delete) the fonts and the image list +-- we created. In this program there is really no need to do this. As soon as +-- the interpreter terminates, the OS cleans up the resources automatically. +-- The only time cleaning up resources makes sense is in a long-running program +-- that creates and ends a lot of dialogs. Then, over time, the memory usge of +-- the program would keep growing. +::method leaving + expose font2 font3 imageList + + self~deleteFont(font2) + self~deleteFont(font3) + imageList~release + +::method tabPageSetActive unguarded + use arg owner + reply 0 + + + + +::class 'BlankDlg' subclass ResControlDialog + +::method initDialog + self~connectHelp(onHelp) + +::method onHelp unguarded +--say 'Got onHelp hwnd' self~hwnd diff --git a/modules/windows/oodialog/propertysheet.tabControls/UserTabDemo.rex b/modules/windows/oodialog/propertysheet.tabControls/UserTabDemo.rex new file mode 100755 index 0000000..06d51e1 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/UserTabDemo.rex @@ -0,0 +1,666 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * UserTabDemo.rex + */ + sd = locate() + .application~useGlobalConstDir('O', sd'rc\UserTabDemo.h') + .application~autoDetection(.false) + .application~defaultFont('Tahoma', 10) + + .constDir[IDC_TAB_MAIN] = 500 + + dlg = .UserTabDialog~new + dlg~execute + +::requires 'ooDialog.cls' + +::class 'UserTabDialog' public subclass UserDialog + +::method init + expose pages descriptions + + self~init:super + + descriptions = self~getDescriptions + + title = "Acme Health Clinic Patient Intake Form Version 1.00.0" + opts = 'MINIMIZEBOX MAXIMIZEBOX' + + if self~createCenter(500, 265, title, opts) then self~initCode = 0 + else self~initCode = 1 + + pages = .array~new(4) + + return self~initCode + + +::method defineDialog + + self~createPushButton(IDOK, 380, 240, 50, 15, "DEFAULT", 'O&k') + self~createPushButton(IDCANCEL, 440, 240, 50, 15, , '&Cancel') + + self~createTab(IDC_TAB_MAIN, 10, 10, 480, 220, 'FIXED FOCUSDOWN') + + self~connectTabEvent(IDC_TAB_MAIN, SELCHANGE, onSelChange) + + +::method initDialog unguarded + expose tab patientDlg contactsDlg insuranceDlg historyDlg dlgRect displayRect isPositioned + + self~connectKeyPress(Cancel, .VK~F3, "NONE" ) + self~connectKeyPress(Cancel, .VK~F3, "SHIFT") + + tab = self~newTab(IDC_TAB_MAIN) + + tabs = .array~of("Patient", "Contacts", "Insurance", "History") + do t over tabs + tab~insert( , t) + end + + tab~setSize(160,28) + + dlgRect = self~calcPageSize + displayRect = self~getDisplayRect + + isPositioned = .array~of(.false, .false, .false, .false) + + self~activatePatient + + +::method calcPageSize private + expose tab + + r = tab~windowRect + tab~calcDisplayRect(r) + + -- r is now the bounding rectangle of the display area of the tab control. + -- We want to convert this to a point size rectangle, in dialog units. The + -- different page dialogs will use this rectangle to set their initial size. + r~right = r~right - r~left + r~bottom = r~bottom - r~top + self~pixel2dlgUnit(r) + + return r + + +::method getDisplayRect private + expose tab + + r = tab~windowRect; + tab~calcDisplayRect(r); + + s = .Size~new(r~right - r~left, r~bottom - r~top) + + p = .Point~new(r~left, r~top) + self~screen2client(p) + + return .Rect~new(p~x, p~y, s~width, s~height) + + +::method onSelChange unguarded + expose tab patientDlg contactsDlg insuranceDlg historyDlg displayRect + + tabName = tab~selected + + select + when tabName == "Patient" then self~select(1) + when tabName == "Contacts" then self~select(2) + when tabName == "Insurance" then self~select(3) + when tabName == "History" then self~select(4) + otherwise nop + end + + +::method select private unguarded + expose tab patientDlg contactsDlg insuranceDlg historyDlg displayRect isPositioned dlgShowing + use arg page + + select + when page == 1 then do + dlgShowing~hideFast + patientDlg~showFast + dlgShowing = patientDlg + dlgShowing~update + end + + when page == 2 then do + if \ contactsDlg~isA(.PlainBaseDialog) then do + self~activateContacts + return + end + + dlgShowing~hideFast + + if \ isPositioned[page] then do + contactsDlg~setWindowPos(tab~hwnd, displayRect, "SHOWWINDOW NOREDRAW NOOWNERZORDER") + isPositioned[page] = .true + end + else do + contactsDlg~showFast + end + + dlgShowing = contactsDlg + dlgShowing~update + end + + when page == 3 then do + if \ insuranceDlg~isA(.PlainBaseDialog) then do + self~activateInsurance + return + end + + dlgShowing~hideFast + + if \ isPositioned[page] then do + insuranceDlg~setWindowPos(tab~hwnd, displayRect, "SHOWWINDOW NOREDRAW NOOWNERZORDER") + isPositioned[page] = .true + end + else do + insuranceDlg~showFast + end + + dlgShowing = insuranceDlg + dlgShowing~update + end + + when page == 4 then do + if \ historyDlg~isA(.PlainBaseDialog) then do + self~activateHistory + return + end + + dlgShowing~hideFast + + if \ isPositioned[page] then do + historyDlg~setWindowPos(tab~hwnd, displayRect, "SHOWWINDOW NOREDRAW NOOWNERZORDER") + isPositioned[page] = .true + end + else do + historyDlg~showFast + end + + dlgShowing = historyDlg + dlgShowing~update + end + + otherwise nop + end + -- End select + + return 0 + + +::method initialShowDlg unguarded + expose patientDlg tab displayRect isPositioned dlgShowing + + patientDlg~setWindowPos(tab~hwnd, displayRect, "SHOWWINDOW NOOWNERZORDER") + isPositioned[1] = .true + dlgShowing = patientDlg + + +::method activatePatient private unguarded + expose patientDlg dlgRect pages + + patientDlg = .PatientDlg~new(dlgRect, self) + patientDlg~execute + + pages[1] = patientdlg + + -- .01 seconds == 10000 microseconds + .Alarm~new(.TimeSpan~fromMicroseconds(20000), .message~new(self, "initialShowDlg")) + + +::method activateContacts private unguarded + expose contactsDlg dlgRect pages + + reply + + contactsDlg = .ContactsDlg~new(dlgRect, self) + contactsDlg~execute + + pages[2] = contactsDlg + + self~postOnSelChange(10) + + +::method activateInsurance private unguarded + expose insuranceDlg dlgRect pages + + reply + + insuranceDlg = .InsuranceDlg~new(dlgRect, self) + insuranceDlg~execute + + pages[3] = insuranceDlg + + self~postOnSelChange(10) + + +::method activateHistory private unguarded + expose historyDlg dlgRect pages descriptions + + reply + + historyDlg = .HistoryDlg~new(dlgRect, self, descriptions) + historyDlg~execute + + pages[4] = historyDlg + + self~postOnSelChange(10) + + +::method postOnSelChange private unguarded + use strict arg microseconds + + .Alarm~new(.TimeSpan~fromMicroseconds(microseconds), .message~new(self, "onSelChange")) + + +::method ok unguarded + expose pages + + do page over pages + if page \== .nil then page~endExecution(.true) + end + + return self~ok:super + + +/** cancel() + * + * A problem can happen if the user hits cancel immediately after selecting the + * History tab. The initDialog() method may be still executing and a syntax + * condition can be raised if the underlying Windows dialog is ended. To + * prevent this we check for that condition and sleep a little bit if it + * happens. + */ +::method cancel unguarded + expose pages + + do page over pages + if page \== .nil then do + if page~isA(.HistoryDlg), \ page~initDialogDone then do while \ page~initDialogDone + j = SysSleep(.5) + end + page~endExecution(.false) + end + end + return self~cancel:super + + +::method getDescriptions private + + d = .array~new + d[ 1] = 'Hearing loss / ringing in ears' + d[ 2] = 'Heart diease / circulatory proplems' + d[ 3] = 'Liver cancer / lung cancer' + d[ 4] = 'Breast cancer / uterine cancer' + d[ 5] = 'Jaundice, hepatitis' + d[ 6] = 'Kidney stones / kidney failure' + d[ 7] = 'High blood pressure / high chorlosterol' + d[ 8] = 'Gall bladder trouble (gallstones)' + d[ 9] = 'Anemia/blood disorder' + d[10] = 'Sugar or albumin in urine' + d[11] = 'Frequent or severe headache' + d[12] = 'Periods of unconsciousness' + d[13] = 'Chronic or frequent colds' + d[14] = 'Loss of memory or amnesia' + d[15] = 'Depression or excessive worry' + d[16] = 'Car, train, sea or air sickness' + + return d + + + +::class 'PatientDlg' subclass UserControlDialog + +::method init + use arg r, parent + + self~init:super( , , parent) + self~create(r~left, r~top, r~right, r~bottom) + +::method defineDialog + + self~createGroupBox( IDC_STATIC, 5, 5, 244, 65, , "Patient" ) + self~createStaticText( IDC_STATIC, 14, 16, 95, 8, LEFT , "Name (Last, First, Middle):" ) + self~createEdit( IDC_EDIT_NAME, 14, 26, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 136, 16, 105, 8, LEFT , "Also known as / Maiden name:" ) + self~createEdit( IDC_EDIT_AKA, 136, 26, 105, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 14, 43, 48, 8, LEFT , "Date of birth:" ) + self~createEdit( IDC_EDIT_DOB1, 14, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 33, 55, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DOB2, 44, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 64, 55, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DOB3, 74, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 102, 43, 22, 8, LEFT , "Age:" ) + self~createEdit( IDC_EDIT_AGE, 102, 53, 22, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 136, 43, 86, 8, LEFT , "Social Security Number:" ) + self~createEdit( IDC_EDIT_SSN1, 136, 53, 19, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 195, 54, 8, 8, CENTER , "-" ) + self~createEdit( IDC_EDIT_SSN2, 172, 53, 19, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 159, 54, 8, 8, CENTER , "-" ) + self~createEdit( IDC_EDIT_SSN3, 209, 53, 31, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 258, 6, 35, 37, , "Sex" ) + self~createRadioButton( IDC_RB_M, 269, 16, 15, 8, GROUP TAB , "M" ) + self~createRadioButton( IDC_RB_F, 269, 30, 15, 8, , "F" ) + self~createGroupBox( IDC_STATIC, 311, 6, 159, 37, , "Language" ) + self~createRadioButton( IDC_RB_CHINESE, 322, 16, 39, 8, GROUP TAB , "Chinese" ) + self~createRadioButton( IDC_RB_ENGLISH, 322, 30, 39, 8, , "English" ) + self~createRadioButton( IDC_RB_FRENCH, 374, 16, 39, 8, , "French" ) + self~createRadioButton( IDC_RB_GERMAN, 374, 30, 39, 8, , "German" ) + self~createRadioButton( IDC_RB_SPANISH, 422, 16, 39, 8, , "Spanish" ) + self~createRadioButton( IDC_RB_OTHER, 422, 30, 39, 8, , "Other" ) + self~createStaticText( IDC_STATIC, 258, 54, 30, 8, LEFT , "Religon:" ) + self~createEdit( IDC_EDIT_RELIGON, 289, 53, 72, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 373, 54, 30, 8, LEFT , "Church:" ) + self~createEdit( IDC_EDIT_CHURCH, 405, 53, 61, 12, AUTOSCROLLH ) + self~createGroupBox( IDC_STATIC, 5, 75, 184, 37, , "Race" ) + self~createRadioButton( IDC_RB_AFRICAN_AMERICAN, 14, 84, 68, 8, GROUP TAB , "African American" ) + self~createRadioButton( IDC_RB_NATIVE_AMERICAN, 14, 98, 68, 8, , "Native American" ) + self~createRadioButton( IDC_RB_ASIAN, 91, 84, 39, 8, , "Asian" ) + self~createRadioButton( IDC_RB_CAUCASIAN, 91, 98, 47, 8, , "Caucasian" ) + self~createRadioButton( IDC_RB_HISPANIC, 146, 84, 39, 8, , "Hispanic" ) + self~createRadioButton( IDC_RB_OTHER_RACE, 146, 98, 39, 8, , "Other" ) + self~createGroupBox( IDC_STATIC, 204, 75, 265, 37, , "Marital Status" ) + self~createRadioButton( IDC_RB_MARRIED, 214, 84, 41, 8, GROUP TAB , "Married" ) + self~createRadioButton( IDC_RB_SINGLE, 214, 98, 41, 8, , "Single" ) + self~createRadioButton( IDC_RB_NEVER_MARRIED, 269, 84, 65, 8, , "Never Married" ) + self~createRadioButton( IDC_RB_LEGALLY_SEPARATED, 269, 98, 73, 8, , "Legally Separated" ) + self~createRadioButton( IDC_RB_LIFEPARTNER, 351, 83, 53, 8, , "Life Partner" ) + self~createRadioButton( IDC_RB_DIVORCED, 415, 83, 48, 8, , "Divorced" ) + self~createRadioButton( IDC_RB_WIDOWED, 351, 98, 54, 8, , "Widowed" ) + self~createRadioButton( IDC_RB_OTHER_MARITAL, 415, 98, 39, 8, , "Other" ) + self~createGroupBox( IDC_STATIC, 5, 119, 144, 77, , "Address" ) + self~createStaticText( IDC_STATIC, 12, 132, 24, 8, RIGHT , "Street:" ) + self~createEdit( IDC_EDIT_PATIENT_ADDRESS, 38, 130, 107, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 12, 148, 24, 8, RIGHT , "City:" ) + self~createEdit( IDC_EDIT_PATIENT_CITY, 38, 146, 63, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 105, 148, 24, 8, RIGHT , "State:" ) + self~createEdit( IDC_EDIT_PATIENT_STATE, 131, 146, 13, 12, AUTOSCROLLH UPPERCASE ) + self~createStaticText( IDC_STATIC, 12, 164, 24, 8, RIGHT , "Zip:" ) + self~createEdit( IDC_EDIT_PATIENT_ZIP, 38, 162, 26, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 77, 164, 24, 8, RIGHT , "Email:" ) + self~createEdit( IDC_EDIT_EMAIL, 103, 162, 42, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 12, 180, 24, 8, RIGHT , "Phone:" ) + self~createEdit( IDC_EDIT_PATIENT_PHONE, 38, 178, 35, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 77, 180, 24, 8, RIGHT , "Cell:" ) + self~createEdit( IDC_EDIT_PATIENT_CELL, 103, 178, 42, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 165, 119, 208, 77, , "Employment" ) + self~createStaticText( IDC_STATIC, 168, 132, 34, 8, RIGHT , "Employer:" ) + self~createEdit( IDC_EDIT_EMPLOYER, 206, 130, 100, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 168, 147, 34, 8, RIGHT , "Street:" ) + self~createEdit( IDC_EDIT_EMPLOYER_STREET, 206, 145, 100, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 168, 163, 34, 8, RIGHT , "City:" ) + self~createEdit( IDC_EDIT_EMPLOYER_CITY, 206, 161, 60, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 269, 163, 21, 8, RIGHT , "State:" ) + self~createEdit( IDC_EDIT_EMPLOYER_STATE, 293, 161, 13, 12, AUTOSCROLLH UPPER ) + self~createStaticText( IDC_STATIC, 168, 180, 34, 8, RIGHT , "Zip:" ) + self~createEdit( IDC_EDIT_EMPLOYER_ZIP, 206, 178, 26, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 307, 133, 24, 8, RIGHT , "Phone:" ) + self~createEdit( IDC_EDIT_EMPLOYER_PHONE, 333, 131, 35, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 307, 147, 24, 8, RIGHT , "Ext:" ) + self~createEdit( IDC_EDIT_EMPLOYER_EXT, 333, 145, 35, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 238, 180, 43, 8, RIGHT , "Occupation:" ) + self~createEdit( IDC_EDIT_OCCUPATION, 283, 178, 84, 12, AUTOSCROLLH ) + self~createGroupBox( IDC_STATIC, 385, 119, 85, 77, , "Primary Care" ) + self~createStaticText( IDC_STATIC, 395, 132, 66, 8, LEFT , "Primary Physician:" ) + self~createEdit( IDC_EDIT_PHYSICIAN, 395, 145, 71, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 388, 163, 66, 8, RIGHT , "Phone - Extension:" ) + self~createEdit( IDC_EDIT_PHYSICIAN_PHONE, 395, 178, 71, 12, AUTOSCROLLH NUMBER ) + + + +::class 'ContactsDlg' subclass UserControlDialog + +::method init + use arg r, parent + + self~init:super( , , parent) + self~create(r~left, r~top, r~right, r~bottom) + +::method defineDialog + + self~createGroupBox( IDC_STATIC, 5, 5, 244, 192, , "Guarantor" ) + self~createStaticText( IDC_STATIC, 14, 16, 95, 8, LEFT , "Guarantor Name: " ) + self~createEdit( IDC_EDIT_NAME_G, 14, 26, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 136, 16, 105, 8, LEFT , "Relationship to patient:" ) + self~createEdit( IDC_EDIT_RELATION_G, 136, 26, 105, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 14, 43, 48, 8, LEFT , "Date of birth:" ) + self~createEdit( IDC_EDIT_DOB1_G, 14, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 33, 55, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DOB2_G, 44, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 64, 55, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DOB3_G, 74, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 102, 43, 22, 8, LEFT , "Age:" ) + self~createEdit( IDC_EDIT_AGE_G, 102, 53, 22, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 136, 43, 86, 8, LEFT , "Social Security Number:" ) + self~createEdit( IDC_EDIT_SSN1_G, 136, 53, 19, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 195, 54, 8, 8, CENTER , "-" ) + self~createEdit( IDC_EDIT_SSN2_G, 172, 53, 19, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 159, 54, 8, 8, CENTER , "-" ) + self~createEdit( IDC_EDIT_SSN3_G, 209, 53, 31, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 6, 76, 35, 45, , "Sex" ) + self~createRadioButton( IDC_RB_M_G, 17, 87, 15, 8, GROUP TAB , "M" ) + self~createRadioButton( IDC_RB_F_G, 17, 103, 15, 8, , "F" ) + self~createGroupBox( IDC_STATIC, 44, 76, 198, 45, , "Guarantor Employment" ) + self~createStaticText( IDC_STATIC, 47, 89, 41, 8, RIGHT , "Employer:" ) + self~createEdit( IDC_EDIT_EMPLOYER_G, 91, 87, 100, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 47, 105, 41, 8, RIGHT , "Occupation:" ) + self~createEdit( IDC_EDIT_OCCUPATION_G, 91, 103, 100, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 202, 90, 24, 8, RIGHT , "Phone:" ) + self~createEdit( IDC_EDIT_EMPLOYER_PHONE_G, 202, 103, 35, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 44, 127, 198, 70, , "Guarantor Address" ) + self~createStaticText( IDC_STATIC, 64, 140, 24, 8, RIGHT , "Street:" ) + self~createEdit( IDC_EDIT_ADDRESS_G, 91, 138, 143, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 64, 156, 24, 8, RIGHT , "City:" ) + self~createEdit( IDC_EDIT_CITY_G, 90, 154, 59, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 152, 156, 20, 8, RIGHT , "State:" ) + self~createEdit( IDC_EDIT_STATE_G, 175, 154, 13, 12, AUTOSCROLLH UPPER ) + self~createStaticText( IDC_STATIC, 189, 156, 15, 8, RIGHT , "Zip:" ) + self~createEdit( IDC_EDIT_ZIP_G, 207, 154, 26, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 64, 172, 24, 8, RIGHT , "Phone:" ) + self~createEdit( IDC_EDIT_PHONE_G, 90, 170, 51, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 148, 172, 24, 8, RIGHT , "Cell:" ) + self~createEdit( IDC_EDIT_CELL_G, 175, 170, 58, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 265, 5, 205, 91, , "Emergency Contact" ) + self~createStaticText( IDC_STATIC, 274, 16, 77, 8, LEFT , "Name: " ) + self~createEdit( IDC_EDIT_NAME_EC, 274, 26, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 274, 43, 77, 8, LEFT , "Relationship to patient:" ) + self~createEdit( IDC_EDIT_RELATION_EC, 274, 53, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 274, 69, 41, 8, LEFT , "Employer:" ) + self~createEdit( IDC_EDIT_EMPLOYER_EC, 274, 78, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 391, 16, 66, 8, LEFT , "Phone:" ) + self~createEdit( IDC_EDIT_PHONE_EC, 391, 26, 71, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 391, 43, 66, 8, LEFT , "Cell Phone:" ) + self~createEdit( IDC_EDIT_CELL_EC, 391, 53, 71, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 391, 69, 66, 8, RIGHT , "Employment Phone:" ) + self~createEdit( IDC_EDIT_EMPLOYER_PHONE_EC, 391, 78, 71, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 265, 106, 205, 91, , "Next of Kin" ) + self~createStaticText( IDC_STATIC, 274, 117, 77, 8, LEFT , "Name: " ) + self~createEdit( IDC_EDIT_NAME_NOK, 274, 127, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 274, 144, 77, 8, LEFT , "Relationship to patient:" ) + self~createEdit( IDC_EDIT_RELATION_NOK, 274, 154, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 274, 170, 41, 8, LEFT , "Employer:" ) + self~createEdit( IDC_EDIT_EMPLOYER_NOK, 274, 179, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 391, 117, 66, 8, LEFT , "Phone:" ) + self~createEdit( IDC_EDIT_PHONE_NOK, 391, 127, 71, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 391, 144, 66, 8, LEFT , "Cell Phone:" ) + self~createEdit( IDC_EDIT_CELL_NOK, 391, 154, 71, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 391, 170, 66, 8, RIGHT , "Employment Phone:" ) + self~createEdit( IDC_EDIT_EMPLOYER_PHONE_NOK, 391, 179, 71, 12, AUTOSCROLLH NUMBER ) + + + + +::class 'InsuranceDlg' subclass UserControlDialog + +::method init + use arg r, parent + + self~init:super( , , parent) + self~create(r~left, r~top, r~right, r~bottom) + + +::method defineDialog + + self~createGroupBox( IDC_STATIC, 5, 5, 225, 192, , "Primary Insurance" ) + self~createStaticText( IDC_STATIC, 28, 16, 95, 8, LEFT , "Insurance Company Name: " ) + self~createEdit( IDC_EDIT_NAME_PI, 28, 26, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 152, 16, 65, 8, LEFT , "Group" ) + self~createEdit( IDC_EDIT_GROUP_PI, 152, 26, 65, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 28, 43, 48, 8, LEFT , "Effectiv Date:" ) + self~createEdit( IDC_EDIT_DATE1_PI, 28, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 47, 55, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DATE2_PI, 58, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 78, 55, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DATE3_PI, 88, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 124, 43, 65, 8, LEFT , "Certificate Number:" ) + self~createEdit( IDC_EDIT_CERTIFICATE_PI, 124, 53, 93, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 20, 138, 198, 58, , "Subscriber" ) + self~createStaticText( IDC_STATIC, 23, 150, 41, 8, RIGHT , "Name:" ) + self~createEdit( IDC_EDIT_SUBSCRIBER_PI, 67, 148, 144, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 23, 166, 41, 8, RIGHT , "Employer:" ) + self~createEdit( IDC_EDIT_EMPLOYER_PI, 67, 164, 144, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 23, 184, 78, 8, RIGHT , "Relationship to patient:" ) + self~createEdit( IDC_EDIT_RELATION_PI, 104, 182, 107, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 19, 69, 198, 62, , "Insurance Company Address" ) + self~createStaticText( IDC_STATIC, 28, 82, 35, 8, RIGHT , "Street:" ) + self~createEdit( IDC_EDIT_ADDRESS_PI, 66, 80, 143, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 28, 98, 35, 8, RIGHT , "City:" ) + self~createEdit( IDC_EDIT_CITY_PI, 65, 96, 59, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 127, 98, 20, 8, RIGHT , "State:" ) + self~createEdit( IDC_EDIT_STATE_PI, 150, 96, 13, 12, AUTOSCROLLH UPPER ) + self~createStaticText( IDC_STATIC, 164, 98, 15, 8, RIGHT , "Zip:" ) + self~createEdit( IDC_EDIT_ZIP_PI, 182, 96, 26, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 28, 114, 35, 8, RIGHT , "Phone 1:" ) + self~createEdit( IDC_EDIT_PHONE1_PI, 65, 112, 51, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 116, 114, 31, 8, RIGHT , "Phone 2:" ) + self~createEdit( IDC_EDIT_PHONE2_PI, 150, 112, 58, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 245, 5, 225, 192, , "Secondary Insurance" ) + self~createStaticText( IDC_STATIC, 268, 16, 95, 8, LEFT , "Insurance Company Name: " ) + self~createEdit( IDC_EDIT_NAME_SI, 268, 26, 110, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 392, 16, 65, 8, LEFT , "Group" ) + self~createEdit( IDC_EDIT_GROUP_SI, 392, 26, 65, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 268, 43, 48, 8, LEFT , "Effectiv Date:" ) + self~createEdit( IDC_EDIT_DATE1_SI, 268, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 287, 53, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DATE2_SI, 298, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 318, 53, 8, 8, CENTER , "/" ) + self~createEdit( IDC_EDIT_DATE3_SI, 328, 53, 17, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 364, 43, 65, 8, LEFT , "Certificate Number:" ) + self~createEdit( IDC_EDIT_CERTIFICATE_SI, 364, 53, 93, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 259, 138, 198, 58, , "Subscriber" ) + self~createStaticText( IDC_STATIC, 263, 150, 41, 8, RIGHT, "Name:" ) + self~createEdit( IDC_EDIT_SUBSCRIBER_SI, 307, 148, 144, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 263, 166, 41, 8, RIGHT , "Employer:" ) + self~createEdit( IDC_EDIT_EMPLOYER_SI, 307, 164, 144, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 263, 184, 78, 8, RIGHT , "Relationship to patient:" ) + self~createEdit( IDC_EDIT_RELATION_SI, 343, 182, 107, 12, AUTOSCROLLH NUMBER ) + self~createGroupBox( IDC_STATIC, 259, 69, 198, 62, , "Insurance Company Address" ) + self~createStaticText( IDC_STATIC, 268, 80, 35, 8, RIGHT , "Street:" ) + self~createEdit( IDC_EDIT_ADDRESS_SI, 306, 80, 143, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 268, 96, 35, 8, RIGHT , "City:" ) + self~createEdit( IDC_EDIT_CITY_SI, 305, 96, 59, 12, AUTOSCROLLH ) + self~createStaticText( IDC_STATIC, 367, 96, 20, 8, RIGHT , "State:" ) + self~createEdit( IDC_EDIT_STATE_SI, 390, 96, 13, 12, AUTOSCROLLH UPPER ) + self~createStaticText( IDC_STATIC, 404, 96, 15, 8, RIGHT , "Zip:" ) + self~createEdit( IDC_EDIT_ZIP_SI, 422, 96, 26, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 268, 112, 35, 8, RIGHT , "Phone 1:" ) + self~createEdit( IDC_EDIT_PHONE1_SI, 305, 112, 51, 12, AUTOSCROLLH NUMBER ) + self~createStaticText( IDC_STATIC, 356, 112, 31, 8, RIGHT , "Phone 2:" ) + self~createEdit( IDC_EDIT_PHONE2_SI, 390, 112, 58, 12, AUTOSCROLLH NUMBER ) + + + +::class 'HistoryDlg' subclass UserControlDialog + +::attribute initDialogDone unguarded + +::method init + expose descriptions + use arg r, parent, descriptions + + self~init:super( , , parent) + + self~initDialogDone = .false + self~create(r~left, r~top, r~right, r~bottom) + +::method defineDialog + + gbText = "Indicate if you or anyone in your family has (or has had) any of these conditions:" + st1Txt = "Yourself" + st2Txt = "Family Member" + + self~createGroupBox( IDC_STATIC , 5, 5, 465, 192, , gbText) + self~createStaticText( IDC_STATIC , 6, 17, 229, 10, CENTER , st1Txt) + self~createListView( IDC_LV_SELF , 5, 30, 229, 167, TAB ALIGNLEFT SINGLESEL REPORT ) + self~createStaticText( IDC_STATIC , 241, 17, 229, 10, CENTER , st2Txt) + self~createListView( IDC_LV_FAMILY, 241, 30, 229, 167, TAB ALIGNLEFT SINGLESEL REPORT ) + +::method initDialog unguarded + expose lvSelf lvFamily descriptions + + lvSelf = self~newListView(IDC_LV_SELF) + + lvSelf~addExtendedStyle('CHECKBOXES') + + s = lvSelf~getRealSize + s~width -= (.SM~cxVscroll * 2) + + lvSelf~insertColumnPx(0, "Description", s~width) + + do d over descriptions + lvSelf~addRow( , , d) + end + + lvFamily = self~newListView(IDC_LV_FAMILY) + + lvFamily~addExtendedStyle('CHECKBOXES') + + s = lvFamily~getRealSize + s~width -= (.SM~cxVscroll * 2) + + lvFamily~insertColumnPx(0, "Description", s~width) + + do d over descriptions + lvFamily~addRow( , , d) + end + + self~initDialogDone = .true + diff --git a/modules/windows/oodialog/propertysheet.tabControls/oodListViews.rex b/modules/windows/oodialog/propertysheet.tabControls/oodListViews.rex new file mode 100755 index 0000000..2d2c63d --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/oodListViews.rex @@ -0,0 +1,1031 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: oodListViews.rex + * Type: Open Object Rexx (ooRexx) example + * Resources: oodListViews.rc, oodListViews1.bmp, oodListViews2.bmp + * + * Description: + * + * Demonstrates the different views possible in the list-view control. Shows + * how to use the ControlDialog class to populate each page in a tab + * control. Demonstrates some other list-view features, such as info tips, + * user item data, in place label editing, drag and drop in icon view, etc.. + * + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + srcDir = locate() + .application~useGlobalConstDir("O", srcDir'rc\oodListViews.h') + + dlg = .ListsDialog~new(srcDir"rc\oodListViews.rc", IDD_LISTVIEWS) + + if dlg~initCode <> 0 then do + say "Error instantiating the ListsDialog, aborting" + return 99 + end + + dlg~execute("SHOWTOP") + + return 0 + +::requires "ooDialog.cls" + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + ListsDialog Class - the main (top-level) dialog. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'ListsDialog' subclass RcDialog + +::method init + expose sd + + forward class (super) continue + + if self~initCode <> 0 then return self~initCode + + sd = locate() + + self~createImageLists + self~initRecords + + self~connectButtonEvent(IDC_PB_ADDRECORD, "CLICKED", "onAdd") + self~connectButtonEvent(IDC_PB_EDITRECORD, "CLICKED", "onEdit") + self~connectButtonEvent(IDC_PB_FORWARD, "CLICKED", "onForward") + self~connectButtonEvent(IDC_PB_BACKWARD, "CLICKED", "onBackward") + + self~connectButtonEvent(IDC_CK_INFOTIPS, "CLICKED", onCheckClicked) + + self~connectTabEvent(IDC_TAB, 'SELCHANGE', 'onNewTab') + + +::method initDialog + expose tabControl pageDialog smallIcons normalIcons records pbBackward pbForward ckInfoTips sd + + -- Set the Use Info Tips check box. + ckInfoTips = self~newCheckBox(IDC_CK_INFOTIPS) + ckInfoTips~check + + -- Disable the edit record push button. + self~newPushButton(IDC_PB_EDITRECORD)~disable + + -- Save a reference to the push buttons. + pbBackward = self~newPushButton(IDC_PB_BACKWARD) + pbForward = self~newPushButton(IDC_PB_Forward) + + -- We start on the first page, so going backwards is not possible. + pbBackward~disable + + -- Add the tabs to the tab control. + tabControl = self~newTab(IDC_TAB) + tabControl~addSequence("List", "Report", "Icon", "Small Icon") + + -- Get the display rectangle of the tab control. + displayRect = self~calculateDisplayArea(tabControl) + + -- The tab control is quite wide in relation to the default space the 4 tabs + -- occupy. Make the tabs wide enough to take up a little over 1/2 of the width + -- of the tab control. + w = (displayRect~right * (7 / 12)) % 4 + tabControl~setMinTabWidth(w) + + pageDialog = .PageDialog~new(sd"rc\oodListViews.rc", IDD_PAGE, , , , , self) + pageDialog~useInfoTips = .true + pageDialog~initialize(smallIcons, normalIcons, records) + + -- Use execute() to properly start a ControlDialog. + pageDialog~execute + self~positionAndShow(pageDialog, tabControl, displayRect) + + +/** calculateDisplayArea() + * + * Tab controls contain two areas, the tabs themselves and the display area. + * The display area is where the content for each tab is drawn. + * + * We need to match the control dialog(s) size and position with the display + * area size and position. There are two approaches here: + * + * We could calculate the size of the largest dialog, resize the tab control to + * match, and position the control dialog over the display area. + * + * We can get the size and position of the tab control's display area and resize + * and reposition the control dialog(s) to match. This is the approach we use + * here. + */ +::method calculateDisplayArea private + use strict arg tabControl + + -- Given a rectangle describing the tab control's size and position, the tab + -- control itself will calculate the display area's size and position. + r = tabControl~windowRect + tabControl~calcDisplayRect(r) + + -- Save the size of the display area, we need it later. + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Now we need to map the display area's position on the screen, to the client + -- co-ordinates of the main dialog. The control dialog(s) are children windows + -- of the main dialog, which is why we need to use the client-area of the + -- dialog, not the client area of the tab control. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Create our display rectangle. This is used in setWindowPosition(), which + -- takes a point / size rectangle. ooDialog defines a point / size rectangle + -- as using the left and top attributes for the position of the upper left + -- corner of a rectangle, using the right attribute for the width of the + -- rectangle, and using the bottom attribute for the height of the rectangle. + return .Rect~new(p~x, p~y, s~width, s~height) + + +/** positionAndShow() + * + * Used to resize and reposition the control dialog (PageDialog so it occupies + * the display area of the tab control. + */ +::method positionAndShow private + use strict arg dlg, tabControl, displayRect + + -- We can not position the control dialog until the underlying Windows dialog + -- is created and we have a valid window handle. This takes a small but + -- disecernable amount of time. The actual amount of time can vary widely and + -- depends on both the amount of concurrency going on in the interpreter and + -- the amount of multi-tasking going on in the operating system. + -- + -- We don't want to spin forever if there is some error in creating the + -- dialog, so we set a timeout here. However, it is very short and may not be + -- long enough. If it is not long enough, it is better to increase the time + -- sleeping rather than the loop counter. + do i = 1 to 10 + if dlg~hwnd <> 0 then leave + z = SysSleep(.005) + end + + if dlg~hwnd == 0 then do + say "Error creating dialog for the tab with index:" 1", aborting" + return self~cancel:super + end + + -- Now resize and reposition the control dialog to the tab control's display + -- area. We need to position the control dialog *above* the tab control in + -- the Z-order so that it shows. + dlg~setWindowPos(tabControl~hwnd, displayRect, "SHOWWINDOW NOOWNERZORDER") + + +/** onCheckClicked() + * + * This is the event handler for the CLICKED event of the Use Info Tips check + * box. Each time it is clicked, we update the Page dialog with its state. + */ +::method onCheckClicked unguarded + expose ckInfoTips pageDialog + + if ckInfoTips~checked then pageDialog~useInfoTips = .true + else pageDialog~useInfoTips = .false + + +/** onNewTab() + * + * This is the method we connected to the SELCHANGE event of the tab control. + * + * It is invoked when the user changes to a new tab using the tab control's + * interface. I.e. by clicking on a tab or by using the keyboard when the + * tab control has the focus. + * + * In general, there is usually a different control dialog for each page of + * the tab. In that usage, the programmer would hide the dialog of the old + * page and show the dialog of the new page. However, in this application we + * only use one control dialog. When the page is changed, we tell the page + * dialog to change the view style of the list view to produce the effect of + * changing pages. + */ +::method onNewTab unguarded + expose tabControl pageDialog + use arg ignore1, ignore2 + + pageDialog~refreshView(tabControl~selectedIndex + 1) + self~checkButtons + + +/** onForward() + * + * The event handle for the 'Forward' button's CLICKED event. We select the + * next tab in the tab control and then force the page to update by calling the + * 'onNewTab' method ourselfs. + * + * Note that we do not need to check that the selected index plus 1 is valid + * because the Forward button is disabled when we are on the last page. + */ +::method onForward + expose tabControl + + tabControl~selectIndex(tabControl~selectedIndex + 1) + self~onNewTab + + +/** onBackward() + * + * The event handle for the 'Backward' button's CLICKED event. Coments are the + * same as for the onForward() method above. + */ +::method onBackward + expose tabControl + + tabControl~selectIndex(tabControl~selectedIndex - 1) + self~onNewTab + + +/** onAdd() + * + * The event handle for the 'Add' button's CLICKED event. Here we display the + * address dialog which allows the user add a new record, which in turn will + * show up as a new item in the list-view. + */ +::method onAdd unguarded + expose pageDialog sd + + dlg = .AddressDialog~new(sd'rc\oodListViews.rc', IDD_ADDRESS) + + if dlg~initCode = 0 then do + if dlg~execute("SHOWTOP") == self~IDOK then do + + rec = .directory~new + rec~FirstName = dlg~IDC_EDIT_FNAME + rec~Lastname = dlg~IDC_EDIT_LNAME + rec~Street = dlg~IDC_EDIT_STREET + rec~City = dlg~IDC_EDIT_CITY + rec~State = dlg~IDC_EDIT_STATE + rec~ZipCode = dlg~IDC_EDIT_ZIPCODE + rec~Age = dlg~IDC_EDIT_AGE + rec~isEditable = dlg~IDC_CHK_EDITABLE + + if dlg~IDC_RB_MALE = 1 then rec~Sex = "M" + else rec~Sex = "F" + + -- Have the page dialog add the record to the list-view. + pageDialog~addRecord(rec) + end + end + + +/** onEdit() + * + * The event handle for the 'Edit' button's CLICKED event. Here we display the + * address dialog, but set its mode to edit, which allows the user to edit an + * existing record. + * + * The address dialog is set in edit mode by passing a record into init(). If + * the address dialog is ended with okay, then we update the record with the + * values the user entered and have the page dialog update the list-view item. + */ +::method onEdit unguarded + expose pageDialog sd + + rec = pageDialog~getSelectedRecord + + dlg = .AddressDialog~new(sd'rc\oodListViews.rc', IDD_ADDRESS, rec) + + if dlg~initCode = 0 then do + if dlg~execute("SHOWTOP") == self~IDOK then do + + rec~FirstName = dlg~IDC_EDIT_FNAME + rec~Lastname = dlg~IDC_EDIT_LNAME + rec~Street = dlg~IDC_EDIT_STREET + rec~City = dlg~IDC_EDIT_CITY + rec~State = dlg~IDC_EDIT_STATE + rec~ZipCode = dlg~IDC_EDIT_ZIPCODE + rec~Age = dlg~IDC_EDIT_AGE + rec~isEditable = dlg~IDC_CHK_EDITABLE + + if dlg~IDC_RB_MALE = 1 then rec~Sex = "M" + else rec~Sex = "F" + + -- Have the page dialog refresh, update, the item. + pageDialog~refreshSelectedItem + end + end + + +/** cancel() + * + * The user can not end a ControlDialog, so we need to end the page dialog + * here during cancel. Passing .false to endExecution() says the user + * canceled the main dialog. + */ +::method cancel + expose pageDialog + + -- Always use endExecution() to close a ControlDialog. + pageDialog~endExecution(.false) + return self~cancel:super + + +/** ok() + * + * The user can not end a ControlDialog, so we need to end the page dialog + * here during ok. Passing .true to endExecution() says the user closed the + * main dialog with ok. + */ +::method ok + expose pageDialog + + -- Always use endExecution() to close a ControlDialog. + pageDialog~endExecution(.true) + return self~ok:super + + +/** initAutoDetection() + * + * We turn off auto detection for this dialog. + */ +::method initAutoDetection + self~noAutoDetection + +/** checkButtons() + * + * Enables or disables the forwards / backwards buttons to fit the current + * page. I.e., if we are on the first page, the backwards button should be + * disabled, etc.. + */ +::method checkButtons private + expose tabControl pbForward pbBackward + + index = tabControl~selectedIndex + 1 + + if index == 1 then do + pbBackward~disable + pbForward~enable + end + else if index == 4 then do + pbBackward~enable + pbForward~disable + end + else do + pbBackward~enable + pbForward~enable + end + + +/** createImageLists() + * + * Create the small and large icon image lists. These will be used in the + * report, small icon, and icon views of the list-view. The small icon image + * list is used by both the report and the small icon views, normal icon image + * list is used by the icon view. + * + * In this program we create the initial records and image lists here, in the + * main dialog, and then pass the objects to the page dialog. The creation + * could just as well have been done in the page dialog itself. The example + * program does it this way to try and show that how you use a ControlDialog is + * very flexible. + */ +::method createImageLists private + expose smallIcons normalIcons sd + + small = .Image~getImage(sd"rc\oodListViews1.bmp") + tmpIL = .ImageList~create(.Size~new(16, 12), COLOR4, 4, 0) + if \small~isNull, \tmpIL~isNull then do + tmpIL~add(small) + small~release + smallIcons = tmpIL + end + else do + smallIcons = .nil + end + + normal = .Image~getImage(sd"rc\oodListViews2.bmp") + tmpIL = .ImageList~create(.Size~new(32, 32), COLOR4, 4, 0) + if \normal~isNull, \tmpIL~isNull then do + tmpIL~add(normal) + normal~release + normalIcons = tmpIL + end + else do + normalIcons = .nil + end + + +/** initRecords() + * + * Create 3 records to start with. The records could be pulled from a database. + * Here we just fake it. Each 'record' is put into an array and then the array + * is passed to the page dialog where is record is used to insert a single item + * into the list-view. + */ +::method initRecords private + expose records + + records = .array~new(3) + + rec = .directory~new + rec~FirstName = "Mike" + rec~Lastname = "Miller" + rec~Street = "432 Fifth Ave" + rec~City = "New York" + rec~State = "NY" + rec~ZipCode = "12897" + rec~Age = "35" + rec~Sex = "M" + rec~IsEditable = .false + records[1] = rec + + rec = .directory~new + rec~FirstName = "Sue" + rec~Lastname = "Thaxton" + rec~Street = "5179 Bellevue St" + rec~City = "Tucson" + rec~State = "AZ" + rec~ZipCode = "87340" + rec~Age = "30" + rec~Sex = "F" + rec~IsEditable = .true + records[2] = rec + + rec = .directory~new + rec~FirstName = "Dave" + rec~Lastname = "Hewitt" + rec~Street = "4932 Texas St" + rec~City = "San Diego" + rec~State = "CA" + rec~ZipCode = "92110" + rec~Age = "49" + rec~Sex = "M" + rec~IsEditable = .true + records[3] = rec + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + PageDialog Class +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'PageDialog' subclass RcControlDialog + +-- This attribute allows the parent dialog to notify us if the Use Info Tips +-- check box is checked or not. When it is not checked, we don't display any +-- info tips. +::attribute useInfoTips + +::method initialize + expose smallIcons normalIcons records haveSelection pbEdit + use strict arg smallIcons, normalIcons, records + + self~connectListViewEvent(IDC_LISTVIEW, "COLUMNCLICK") + self~connectListViewEvent(IDC_LISTVIEW, "ACTIVATE", "onActivate", .true) + self~connectListViewEvent(IDC_LISTVIEW, "DBLCLK", "onDoubleClick", .true) + self~connectListViewEvent(IDC_LISTVIEW, "BEGINDRAG", "DefListDragHandler") + self~connectListViewEvent(IDC_LISTVIEW, "BEGINEDIT", "onBeginEdit", .true) + self~connectListViewEvent(IDC_LISTVIEW, "ENDEDIT", , .true) + self~connectListViewEvent(IDC_LISTVIEW, "GETINFOTIP") + self~connectListViewEvent(IDC_LISTVIEW, "SELECTCHANGED") + + self~initUpdateListView(IDC_LISTVIEW) + + haveSelection = .false + pbEdit = self~ownerDialog~newPushButton(IDC_PB_EDITRECORD) + +::method initDialog + expose lv smallIcons normalIcons records ckInfoTips useInfoTips + + lv = self~newListView(IDC_LISTVIEW) + + if smallIcons <> .nil then lv~setImageList(smallIcons, SMALL) + if normalIcons <> .nil then lv~setImageList(normalIcons, NORMAL) + + lv~insertColumn(0, "Name", 50) + lv~insertColumn(1, "Street", 60) + lv~insertColumn(2, "City", 50) + lv~insertColumn(3, "State", 20) + lv~insertColumn(4, "Zip Code", 30) + lv~insertColumn(5, "Age", 20) + + do r over records + self~addRecord(r, .false) + end + + lv~addExtendedStyle("FULLROWSELECT DOUBLEBUFFER GRIDLINES INFOTIP") + + +/** refreshView() + * + * Invoked by the main dialog when the user has switched to a new tab in the tab + * control. + * + * Typically an application uses a different dialog for each page of a tab + * control. In this example program however, the different pages just show the + * different view types of a list-view. Therefore the same dialog, (and the same + * list-view,) are used for each page. When a new page is to be displayed, + * rather than switching to a different dialog, the current view of the list- + * view is simply changed to the correct view for that page. + */ +::method refreshView unguarded + expose lv + use strict arg index + + select + when index == 1 then lv~setView("LIST") + when index == 2 then lv~setView("REPORT") + when index == 3 then lv~setView("ICON") + when index == 4 then lv~setView("SMALLICON") + otherwise return .false + end + -- End select + + return .true + + +/** onBeginEdit() + * + * The event handler for the label begin edit event, invoked when the user + * initiates a label editing operation. + * + * When the label editing is initiated, the operating system creates and + * postitions a edit control, but doesn't show it. The system then sends the + * label begin edit notification. Here we have access to the edit control, + * which could be customized by using the typical methods of the edit object. + * + * In addition, the edit operation can be vetoed by returning false. I.e., + * return true to allow the editing, and false to disallow it. To demonstrate + * this, we check if the record is editable and if it is not we disallow the + * label editing operation by returning false from this event handler. + */ +::method onBeginEdit unguarded + use arg id, itemIndex, editCtrl, listViewCtrl + + rec = listViewCtrl~getItemData(itemIndex) + if rec~isEditable then return .true + + reply .false + + msg = "The record for" rec~FirstName rec~LastName 'can not be changed.' + title = "Label Edit Error" + j = MessageDialog(msg, self~hwnd, title, , "WARNING") + + return + + +/** onEndEdit() + * + * This is the event handler for the end label edit notification. It is invoked + * when the user ends the label editing operation. If the user canceled the + * operation, then the 'text' argument will be the .nil object. Otherwise it + * will be the text the user entered. + * + * We use this event to validate the label to a degree and to update the record + * for the item when the user edits the label. + */ +::method onEndEdit unguarded + use arg id, itemIndex, text, listViewCtrl + + if text == .nil then return .false + + if text~words == 2 & text~word(1)~right(1) == ',' then do + reply .true + + rec = listViewCtrl~getItemData(itemIndex) + rec~FirstName = text~word(2) + rec~LastName = text~word(1)~strip('T', ',') + + return + end + + reply .false + + msg = "The format for a record label must be" || .endOfLine || - + "last name, comma, first name. For" || .endOfLine || - + "example: Swift, Tom" || .endOfLine~copies(2) || - + "The change is rejected." + + title = "Label Editing Error" + j = MessageDialog(msg, self~hwnd, title, , "WARNING") + + return + + +/** onColumnClick() + * + * The event handler for a column click event, invoked when the user clicks on a + * column header when the list-view is in Report view. + * + * We use the event to demonstrate some of the list-view methods. + */ +::method onColumnClick unguarded + use arg id, column, listView + + -- Get the current width, in pixels, of the column clicked and then set its + -- width to 10 pixels more. + listView~setColumnWidthPx(column, listView~columnWidthPx(column) + 10) + + -- Display information about the column clicked. + d = .Directory~new + if listView~getColumnInfo(column, d) then do + tab = '09'x + msg = "Column Title:"tab d~text || .endOfLine || - + "Subitem index:"tab d~subitem || .endOfLine || - + "Column Width:"tab d~width || .endOfLine || - + "Allignment:"tab d~fmt || .endOfLine~copies(2) || - + "Note: each time you click on a column" || .endOfLine || - + "its width is increased." + j = MessageDialog(msg, self~hwnd, "Column Click Detected") + end + else do + msg = "An error ocurred getting the column information." + j = MessageDialog(msg, self~hwnd, "Windows API Error", "OK", "ERROR") + end + + +/** onDoubleClick() + * + * The event handler for a double clikc event, invoked when a list-view item is + * double clicked. + * + * We use the event to demonstrate: + * + * 1.) That a double click also activates an item and that the double click + * comes first. When you double click an item you will see a message box + * displaying the arguments to this method, the 'age increase' message box, + * and then a message box from the onActivate() method. + * + * 2.) Some of the list-view methods. + * + */ +::method onDoubleClick unguarded + use arg id, item, subitem, state, isSingleClick, listView + + tab = '09'x + tab2 = tab~copies(2) + true = self~booleanToText(isSingleClick) + msg = 'onDoubleClick()' || .endOfLine~copies(2) || - + 'id:'tab2 id || .endOfLine || - + 'item:'tab2 item || .endOfLine || - + 'subitem:'tab2 subitem || .endOfLine || - + 'state:'tab2 state || .endOfLine || - + 'single click:'tab true || .endOfLine || - + 'listView:'tab2 listView + + ret = MessageDialog(msg, self~hwnd, "onDoubleClick Method Invoked", OK, INFORMATION) + + -- Get the index of the item with the focus, use the index to retrieve the + -- item information and the text associated with it + index = listView~focused + + -- The item's information is returned in the .directory object passed in to + -- the getItemInfo() method. + d = .directory~new + listView~getItemInfo(index, d) + + parse value d~text with lastName ', ' firstName + + pronoun = 'his' + if d~image == 1 then pronoun = "her" + + age = listView~itemText(index, 5) + + msg = "You have double clicked on the item for" firstName lastName || "0d0a0d0a"x , + "Should" pronoun "age be increased by 1?" + + ret = MessageDialog(msg, self~hwnd, "Age Increment", YESNO, INFORMATION) + if ret == self~IDYES then do + age += 1 + listView~setItemText(index, 5, age) + + -- Now we need to update the age in the record for this item. We retrieve + -- the record from the user item data and update the age. + rec = listView~getItemData(index) + rec~age = age + end + + -- Deselect the focused item and move the focus to the first item + listView~deselect(index) + listView~focus(0) + return 0 + + +/** onActivate() + * + * The event handler for an activate event, invoked when a list-view item is + * activated. + * + * We use the event to demonstrate that a double click event also generates an + * activate event. We just print out the argument values here. + */ +::method onActivate unguarded + use arg id, ptr, nCode, listView + + tab = '09'x + msg = 'onActivate()' || .endOfLine~copies(2) || - + 'id:'tab id || .endOfLine || - + 'ptr:'tab ptr || .endOfLine || - + 'nCode:'tab nCode || .endOfLine || - + 'listView:'tab listView + + ret = MessageDialog(msg, self~hwnd, "onActivate Method Invoked", OK, INFORMATION) + + return 0 + + +/** onGetInfoTip() + * + * This is the event handler for the INFOTIP event. This method is invoked when + * the list-view wants the text for an info tip. + * + * If this method returns the empty string then no info tip will be shown. + * Otherwise, the info tip will contain the text sent back. + * + * The maxLen argument will be the maximum length allowed for the returned text. + * You should never assume what this length is, although it appears to usually + * be 1023. If the text sent back is longer than maxLen, it will automatically + * be truncated. + * + * Note that the original versions of this example did not use the user item + * data feature of the list-view. Instead they trackd the records through an + * array. When this example was updated to work with the user item data + * feature, this method was left as is, to show more than one way of associating + * a record with a list-view item. + */ +::method onGetInfoTip unguarded + expose lv records useInfoTips + use arg id, item, text, maxLen + + text = '' + + if useInfoTips then do + r = records[item + 1] + text = r~firstName r~lastName '('r~age')' || .endOfLine || - + r~street || .endOfLine || - + r~city',' r~state r~zipcode + end + + return text + + +/** onSelectionChanged() + * + * This is the event handler for the selection changed event. It is invoked + * each time the selection state of an item changes. We use this event to + * enable or disable the Edit Record push button. The button is only enabled + * when an item is selected, and that item is an editable record. When no item + * is selected, or if the selected item is not editable, then the push button is + * disabled. + * + * The event happens each time a selected item is deselected and each time an + * unselected item is selected. This means that quite often when an item is + * selected there are two events, the old selected item losing its selection and + * the newly selected item gaining the selection. + */ +::method onSelectChanged unguarded + expose haveSelection pbEdit + use arg id, itemIndex, state, lv + + if state == 'SELECTED' then haveSelection = .true + else if state == 'UNSELECTED' & lv~selected == -1 then haveSelection = .false + + if \ haveSelection then do + pbEdit~disable + end + else if state == 'SELECTED' then do + -- We have a selection and an item was just selected, see if it is editable: + rec = lv~getItemData(itemIndex) + if rec~isEditable then pbEdit~enable + else pbEdit~disable + end + + +::method booleanToText unguarded private + use strict arg boolean + if boolean == .true then return 'true' + else if boolean == .false then return 'false' + else return 'not a boolean' + + +/** addRecord() + * + * Used to add an item to the list view. + * + * Note that it does not matter what view the list-view is in. When the list- + * view is in report view, then all the information will be visible to the user. + * When it is in other views, only some of the information is visible to the + * user. + */ +::method addRecord unguarded + expose lv records counter + use strict arg rec, newRecord = .true + + iconSex = 0 + if rec~sex = "F" then iconSex = 1 + + index = lv~addRow(, iconSex, rec~lastName', 'rec~firstName, rec~street, rec~city, rec~state, rec~ZipCode, rec~age) + lv~setItemData(index, rec) + + if newRecord then records~append(rec) + + +/** getSelectedRecord() + * + * The owner dialog, the top-level dialog, invokes this method to get access to + * the data record of the currently selected item. + * + * Because the program only enables the 'Edit Record' button when an item that + * is editable is selected, we do not need to do a lot of checks here. We + * simply get the selected index, get the user item data for that index, and + * send the record back. + */ +::method getSelectedRecord + expose lv + return lv~getItemData(lv~selected) + + +/** refreshSelectedRecord() + * + * This method is invoked by the owner dialog to notify us that the data in a + * record has been changed. We simply get the record for the selected item and + * modify the item with the record data. + * + * Because of the way the program is structured, there must be a selected item. + * We check anyway that the selected index is value + */ +::method refreshSelectedItem + expose lv pbEdit + + index = lv~selected + if index == -1 then return .false + + rec = lv~getItemData(index) + + iconSex = 0 + if rec~sex = "F" then iconSex = 1 + + lv~modify(index, 0, rec~lastName', 'rec~firstName, iconSex) + lv~modify(index, 1, rec~street) + lv~modify(index, 2, rec~city) + lv~modify(index, 3, rec~state) + lv~modify(index, 4, rec~zipCode) + lv~modify(index, 5, rec~age) + + -- The is editable status of the record could have changed. + if rec~isEditable then pbEdit~enable + else pbEdit~disable + + return .true + + +/** leaving() + * + * The ooDialog framework invokes the leaving method automatically when a dialog + * is being ended. The default implementation does nothing. The method is + * intended to be over-ridden by the programmer, if desired, to provide the + * proper place to clean up resources. + * + * We use it here to release the image lists resources. This is not needed in + * this stand alone program. When the interpreter process ends, (which will + * happen now that the dialog is ending,) the operating system will free all the + * resources. The example program does this because ... because it is an + * example and this makes a good place to explain about the leaving() method. + */ +::method leaving + expose smallIcons normalIcons + if smallIcons \== .nil then smallIcons~release + if normalIcons \== .nil then normalIcons~release + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + AddressDialog Class +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'AddressDialog' subclass RcDialog + +::method init + expose rec + self~init:super(arg(1), arg(2)) + + if self~initCode <> 0 then return self~initCode + + if arg(3, 'E') then rec = arg(3) + else rec = .nil + + -- Initialize the data attributes. These attributes are added automatically + -- to this dialog by the ooDialog framework. The attributes are used to + -- reflect the state of the underlying dialog controls. + -- + -- If we have a record, we are in edit mode, otherwise we are in add mode. + if rec == .nil then do + self~IDC_RB_MALE = 1 + self~IDC_RB_FEMALE = 0 + self~IDC_EDIT_FNAME = '' + self~IDC_EDIT_LNAME = '' + self~IDC_EDIT_STREET = '' + self~IDC_EDIT_CITY = '' + self~IDC_EDIT_STATE = '' + self~IDC_EDIT_ZIPCODE = '' + self~IDC_EDIT_AGE = '' + self~IDC_CHK_EDITABLE = 1 + end + else do + if rec~Sex == 'M' then do + self~IDC_RB_MALE = 1 + self~IDC_RB_FEMALE = 0 + end + else do + self~IDC_RB_MALE = 0 + self~IDC_RB_FEMALE = 1 + end + self~IDC_EDIT_FNAME = rec~FirstName + self~IDC_EDIT_LNAME = rec~Lastname + self~IDC_EDIT_STREET = rec~Street + self~IDC_EDIT_CITY = rec~City + self~IDC_EDIT_STATE = rec~State + self~IDC_EDIT_ZIPCODE = rec~ZipCode + self~IDC_EDIT_AGE = rec~Age + self~IDC_CHK_EDITABLE = rec~isEditable + end + + return self~initCode + + +::method initDialog + + -- To help with data validation, restrict the number of characters the user + -- can type into these edit controls. Note that in the resource script, the + -- zip code and age edit controls are defined as numeric only. The state edit + -- control is defined as upper-case only. + self~newEdit(IDC_EDIT_STATE)~setLimit(2) + self~newEdit(IDC_EDIT_ZIPCODE)~setLimit(5) + self~newEdit(IDC_EDIT_AGE)~setLimit(3) + + +/** validate() + * + * The validate() method is invoked automatically by the ooDialog framework when + * the user closes a dialog with 'ok'. The default implementation simply + * returns true. The method is meant to be over-ridden by the programmer, if + * desired, to validate the user input is correct. The method must return .true + * or .false. When .true is returned, the dialog continues to close. If .false + * is returned, the dialog will not be closed. + * + * Here we do a bare minimum of validation. We just check that something has + * been entered for the first and last names. + */ +::method validate + + if self~namesEnteredOkay then return .true + + -- It's not very user friendly to prevent the user from closing the dialog + -- without letting him know why. + msg = "The last and first names must be specified for each new record." + title = "New Record Input Error" + j = MessageDialog(msg, self~hwnd, title, , "WARNING") + + -- Place the focus on the first edit control that has invalid data: + if self~newEdit(IDC_EDIT_FNAME)~getText~strip == "" then + self~focusControl(IDC_EDIT_FNAME) + else + self~focusControl(IDC_EDIT_LNAME) + + return .false + + +/* Simple convenience function to make validate() more readable */ +::method namesEnteredOkay private + if self~newEdit(IDC_EDIT_LNAME)~getText~strip == "" then return .false + if self~newEdit(IDC_EDIT_FNAME)~getText~strip == "" then return .false + return .true diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.dll b/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.dll new file mode 100644 index 0000000..7413e91 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.dll differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.h b/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.h new file mode 100644 index 0000000..c3bfa3f --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.h @@ -0,0 +1,78 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_NEWCONTROLS_DLG 105 +#define IDD_LISTVIEW_DLG 106 +#define IDD_TREEVIEW_DLG 107 +#define IDD_PROGRESSBAR_DLG 108 +#define IDD_TAB_DLG 109 +#define IDD_TRACKBAR_DLG 110 +#define IDC_TAB 200 +#define IDC_PB_PREVIOUS 201 +#define IDC_PB_NEXT 202 +#define IDC_LV_MAIN 1000 +#define IDC_TV_MAIN 1001 +#define IDC_PBAR_PROCESSA 1002 +#define IDC_PBAR_PROCESSB 1003 +#define IDC_PBAR_PROCESSC 1004 +#define IDC_PBAR_PROCESSD 1005 +#define IDC_PBAR_PROCESSE 1006 +#define IDC_TAB_MAIN 1007 +#define IDC_PB_OWNERDRAW 1008 +#define IDC_TB_HORZ_BOTH 1009 +#define IDC_TB_HORZ_TOP 1010 +#define IDC_TB_HORZ_BOTTOM 1011 +#define IDC_ST_HORZ_BOTTOM 1012 +#define IDC_ST_HORZ_TOP 1013 +#define IDC_ST_HORZ_BOTH 1014 +#define IDC_TB_VERT_RIGHT 1015 +#define IDC_ST_VERT_RIGHT 1016 +#define IDC_TB_VERT_LEFT 1017 +#define IDC_ST_VERT_LEFT 1018 +#define IDC_TB_VERT_BOTH 1019 +#define IDC_ST_VERT_BOTH 1020 +#define IDC_ST_PERCENTA 1121 +#define IDC_ST_PERCENTB 1122 +#define IDC_ST_PERCENTC 1123 +#define IDC_ST_PERCENTD 1124 +#define IDC_ST_PERCENTE 1125 +#define IDC_ST_FRAME_LEFT 1126 +#define IDC_ST_FRAME_RIGHT 1127 diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.rc b/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.rc new file mode 100644 index 0000000..b7727ee --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/PropertySheetDemo.rc @@ -0,0 +1,138 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "PropertySheetDemo.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_NEWCONTROLS_DLG DIALOG 0, 0, 325, 300 +STYLE DS_MODALFRAME | DS_SETFONT | DS_CENTER | WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_VISIBLE +CAPTION "Example using ControlDialog objects" +FONT 9, "Arial" +{ + CONTROL "Tab", IDC_TAB, WC_TABCONTROL, WS_TABSTOP, 10, 5, 305, 265 + PUSHBUTTON "Previous Control", IDC_PB_PREVIOUS, 10, 278, 60, 14 + PUSHBUTTON "Next Control", IDC_PB_NEXT, 80, 278, 60, 14 + DEFPUSHBUTTON "Ok", IDOK, 185, 278, 60, 14 + PUSHBUTTON "Cancel", IDCANCEL, 255, 278, 60, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_LISTVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "List View Control" +FONT 9, "Arial" +{ + CONTROL "ListView", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_REPORT, 7, 7, 286, 236 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PROGRESSBAR_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Progress Bar Control" +FONT 9, "Arial" +{ + CONTROL "Progress", IDC_PBAR_PROCESSA, PROGRESS_CLASS, PBS_VERTICAL, 37, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSB, PROGRESS_CLASS, PBS_VERTICAL, 86, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSC, PROGRESS_CLASS, PBS_VERTICAL, 135, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSD, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 182, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSE, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 236, 27, 13, 199 + LTEXT "100%", IDC_ST_PERCENTA, 34, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTB, 83, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTC, 132, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTD, 180, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTE, 234, 229, 21, 8, SS_LEFT + LTEXT "Process A", -1, 25, 12, 36, 8, SS_LEFT + LTEXT "Process B", -1, 74, 12, 36, 8, SS_LEFT + LTEXT "Process C", -1, 123, 12, 36, 8, SS_LEFT + LTEXT "Process D", -1, 170, 12, 36, 8, SS_LEFT + LTEXT "Process E", -1, 224, 12, 36, 8, SS_LEFT +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TAB_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Tab Control" +FONT 9, "Arial" +{ + CONTROL "Tab", IDC_TAB_MAIN, WC_TABCONTROL, WS_TABSTOP, 9, 19, 282, 215 + CONTROL "", IDC_PB_OWNERDRAW, WC_BUTTON, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 17, 63, 267, 162 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TRACKBAR_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Track Bar Control" +FONT 9, "Arial" +{ + CONTROL "Slider", IDC_TB_HORZ_BOTTOM, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS, 10, 30, 119, 20 + LTEXT "Text", IDC_ST_HORZ_BOTTOM, 41, 56, 60, 27, SS_LEFT + CONTROL "Slider", IDC_TB_HORZ_TOP, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_TOP, 10, 97, 119, 20 + LTEXT "Text", IDC_ST_HORZ_TOP, 41, 128, 60, 27, SS_LEFT + CONTROL "Slider", IDC_TB_HORZ_BOTH, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_BOTH | TBS_ENABLESELRANGE, 10, 168, 119, 32 + LTEXT "Text", IDC_ST_HORZ_BOTH, 41, 203, 60, 30, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_RIGHT, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_ENABLESELRANGE, 176, 33, 19, 192 + LTEXT "Text", IDC_ST_VERT_RIGHT, 177, 17, 22, 8, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_LEFT, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_TOP, 212, 33, 19, 192 + LTEXT "Text", IDC_ST_VERT_LEFT, 216, 17, 27, 8, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_BOTH, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_BOTH, 257, 33, 27, 192 + LTEXT "Text", IDC_ST_VERT_BOTH, 261, 17, 21, 8, SS_LEFT + CONTROL "", IDC_ST_FRAME_LEFT, WC_STATIC, SS_BLACKFRAME, 7, 7, 136, 236 + CONTROL "", IDC_ST_FRAME_RIGHT, WC_STATIC, SS_BLACKFRAME, 163, 7, 130, 236 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TREEVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Tree View Control" +FONT 9, "Arial" +{ + CONTROL "Tree", IDC_TV_MAIN, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, 7, 7, 286, 236 +} diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.dll b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.dll new file mode 100644 index 0000000..4046c83 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.dll differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.h b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.h new file mode 100644 index 0000000..a4815c2 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.h @@ -0,0 +1,77 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDC_TAB1 200 +#define IDC_TAB2 400 +#define IDC_PB_PREVIOUS 201 +#define IDC_PB_NEXT 202 +#define IDD_BLANK_DLG 105 +#define IDD_LISTVIEW_DLG 106 +#define IDD_TREEVIEW_DLG 107 +#define IDD_PROGRESSBAR_DLG 108 +#define IDD_TAB_DLG 109 +#define IDD_TRACKBAR_DLG 110 +#define IDC_LV_MAIN 1000 +#define IDC_TV_MAIN 1001 +#define IDC_PBAR_PROCESSA 1002 +#define IDC_PBAR_PROCESSB 1003 +#define IDC_PBAR_PROCESSC 1004 +#define IDC_PBAR_PROCESSD 1005 +#define IDC_PBAR_PROCESSE 1006 +#define IDC_TAB_MAIN 1007 +#define IDC_PB_OWNERDRAW 1008 +#define IDC_TB_HORZ_BOTH 1012 +#define IDC_TB_HORZ_TOP 1013 +#define IDC_TB_HORZ_BOTTOM 1014 +#define IDC_ST_HORZ_BOTTOM 1015 +#define IDC_ST_HORZ_TOP 1016 +#define IDC_ST_HORZ_BOTH 1017 +#define IDC_TB_VERT_RIGHT 1018 +#define IDC_ST_VERT_RIGHT 1019 +#define IDC_TB_VERT_LEFT 1020 +#define IDC_ST_VERT_LEFT 1021 +#define IDC_TB_VERT_BOTH 1022 +#define IDC_ST_VERT_BOTH 1023 +#define IDC_ST_PERCENTA 1102 +#define IDC_ST_PERCENTB 1103 +#define IDC_ST_PERCENTC 1104 +#define IDC_ST_PERCENTD 1105 +#define IDC_ST_PERCENTE 1106 diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.rc b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.rc new file mode 100644 index 0000000..d1d3df6 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemo.rc @@ -0,0 +1,135 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "TabOwnerDemo.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_BLANK_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Blank Dialog" +FONT 19, "Arial" +{ + PUSHBUTTON "Previous Control", IDC_PB_PREVIOUS, 5, 10, 60, 14 + PUSHBUTTON "Next Control", IDC_PB_NEXT, 75, 10, 60, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_LISTVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "List View Control" +FONT 9, "Arial" +{ + CONTROL "ListView", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_REPORT, 7, 7, 286, 236 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PROGRESSBAR_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Progress Bar Control" +FONT 9, "Arial" +{ + CONTROL "Progress", IDC_PBAR_PROCESSA, PROGRESS_CLASS, PBS_VERTICAL, 37, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSB, PROGRESS_CLASS, PBS_VERTICAL, 86, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSC, PROGRESS_CLASS, PBS_VERTICAL, 135, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSD, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 182, 27, 13, 199 + CONTROL "Progress", IDC_PBAR_PROCESSE, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 236, 27, 13, 199 + LTEXT "100%", IDC_ST_PERCENTA, 34, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTB, 83, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTC, 132, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTD, 180, 229, 21, 8, SS_LEFT + LTEXT "100%", IDC_ST_PERCENTE, 234, 229, 21, 8, SS_LEFT + LTEXT "Process A", -1, 25, 12, 36, 8, SS_LEFT + LTEXT "Process B", -1, 74, 12, 36, 8, SS_LEFT + LTEXT "Process C", -1, 123, 12, 36, 8, SS_LEFT + LTEXT "Process D", -1, 170, 12, 36, 8, SS_LEFT + LTEXT "Process E", -1, 224, 12, 36, 8, SS_LEFT +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TAB_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Tab Control" +FONT 9, "Arial" +{ + CONTROL "Tab", IDC_TAB_MAIN, WC_TABCONTROL, 0, 9, 19, 282, 215 + CONTROL "", IDC_PB_OWNERDRAW, WC_BUTTON, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 17, 63, 267, 162 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TRACKBAR_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Track Bar Control" +FONT 9, "Arial" +{ + CONTROL "Slider", IDC_TB_HORZ_BOTTOM, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS, 10, 30, 119, 20 + LTEXT "Text", IDC_ST_HORZ_BOTTOM, 41, 56, 60, 27, SS_LEFT + CONTROL "Slider", IDC_TB_HORZ_TOP, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_TOP, 10, 97, 119, 20 + LTEXT "Text", IDC_ST_HORZ_TOP, 41, 128, 60, 27, SS_LEFT + CONTROL "Slider", IDC_TB_HORZ_BOTH, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_BOTH | TBS_ENABLESELRANGE, 10, 168, 119, 32 + LTEXT "Text", IDC_ST_HORZ_BOTH, 41, 203, 60, 30, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_RIGHT, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_ENABLESELRANGE, 176, 33, 19, 192 + LTEXT "Text", IDC_ST_VERT_RIGHT, 177, 17, 22, 8, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_LEFT, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_TOP, 212, 33, 19, 192 + LTEXT "Text", IDC_ST_VERT_LEFT, 216, 17, 27, 8, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_BOTH, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_BOTH, 257, 33, 27, 192 + LTEXT "Text", IDC_ST_VERT_BOTH, 261, 17, 21, 8, SS_LEFT + CONTROL "", -1, WC_STATIC, SS_BLACKFRAME, 7, 7, 136, 236 + CONTROL "", -1, WC_STATIC, SS_BLACKFRAME, 163, 7, 130, 236 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TREEVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Tree View Control" +FONT 9, "Arial" +{ + CONTROL "Tree", IDC_TV_MAIN, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, 7, 7, 286, 236 +} diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoListView.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoListView.bmp new file mode 100644 index 0000000..2414bdb Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoListView.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoTab.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoTab.bmp new file mode 100644 index 0000000..7b305ce Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoTab.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoTreeView.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoTreeView.bmp new file mode 100644 index 0000000..19cb247 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/TabOwnerDemoTreeView.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/UserTabDemo.h b/modules/windows/oodialog/propertysheet.tabControls/rc/UserTabDemo.h new file mode 100644 index 0000000..8a53d54 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/UserTabDemo.h @@ -0,0 +1,159 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PATIENT 101 +#define IDD_CONTACTS 201 +#define IDD_INSURANCE 301 +#define IDD_HISTORY 401 +#define IDC_EDIT_RELIGON 1000 +#define IDC_LV_SELF 1001 +#define IDC_LV_FAMILY 1002 +#define IDC_EDIT_ADDRESS_PI 1006 +#define IDC_EDIT_NAME_PI 1007 +#define IDC_EDIT_GROUP_PI 1008 +#define IDC_EDIT_NAME 1013 +#define IDC_EDIT_AKA 1014 +#define IDC_EDIT_AGE 1016 +#define IDC_RB_M 1018 +#define IDC_RB_F 1019 +#define IDC_RB_CHINESE 1020 +#define IDC_RB_ENGLISH 1021 +#define IDC_RB_FRENCH 1022 +#define IDC_RB_GERMAN 1023 +#define IDC_RB_SPANISH 1024 +#define IDC_RB_OTHER 1025 +#define IDC_EDIT_DOB3 1040 +#define IDC_EDIT_DOB2 1041 +#define IDC_EDIT_DOB1 1042 +#define IDC_EDIT_SSN1 1044 +#define IDC_EDIT_SSN3 1045 +#define IDC_EDIT_SSN2 1046 +#define IDC_RB_AFRICAN_AMERICAN 1047 +#define IDC_RB_NATIVE_AMERICAN 1048 +#define IDC_RB_ASIAN 1049 +#define IDC_RB_CAUCASIAN 1050 +#define IDC_RB_HISPANIC 1051 +#define IDC_RB_OTHER_RACE 1052 +#define IDC_RB_MARRIED 1053 +#define IDC_RB_SINGLE 1054 +#define IDC_RB_NEVER_MARRIED 1055 +#define IDC_RB_LEGALLY_SEPARATED 1056 +#define IDC_RB_LIFEPARTNER 1057 +#define IDC_RB_WIDOWED 1058 +#define IDC_RB_DIVORCED 1059 +#define IDC_RB_OTHER_MARITAL 1060 +#define IDC_EDIT_CHURCH 1078 +#define IDC_EDIT_PATIENT_ADDRESS 1079 +#define IDC_EDIT_PATIENT_CITY 1080 +#define IDC_EDIT_PATIENT_STATE 1081 +#define IDC_EDIT_PATIENT_ZIP 1082 +#define IDC_EDIT_EMAIL 1083 +#define IDC_EDIT_PATIENT_PHONE 1084 +#define IDC_EDIT_PATIENT_CELL 1085 +#define IDC_EDIT_EMPLOYER 1086 +#define IDC_EDIT_EMPLOYER_STREET 1087 +#define IDC_EDIT_EMPLOYER_CITY 1088 +#define IDC_EDIT_EMPLOYER_STATE 1089 +#define IDC_EDIT_EMPLOYER_ZIP 1090 +#define IDC_EDIT_EMPLOYER_PHONE 1091 +#define IDC_EDIT_EMPLOYER_EXT 1092 +#define IDC_EDIT_OCCUPATION 1093 +#define IDC_EDIT_PHYSICIAN 1094 +#define IDC_EDIT_PHYSICIAN_PHONE 1095 +#define IDC_EDIT_NAME_G 1102 +#define IDC_EDIT_RELATION_G 1103 +#define IDC_EDIT_DOB1_G 1105 +#define IDC_EDIT_DOB2_G 1106 +#define IDC_EDIT_DOB3_G 1107 +#define IDC_EDIT_AGE_G 1108 +#define IDC_EDIT_SSN1_G 1109 +#define IDC_EDIT_SSN2_G 1110 +#define IDC_EDIT_SSN3_G 1111 +#define IDC_RB_M_G 1112 +#define IDC_RB_F_G 1113 +#define IDC_EDIT_EMPLOYER_G 1114 +#define IDC_EDIT_OCCUPATION_G 1115 +#define IDC_EDIT_EMPLOYER_PHONE_G 1116 +#define IDC_EDIT_ADDRESS_G 1117 +#define IDC_EDIT_CITY_G 1118 +#define IDC_EDIT_STATE_G 1119 +#define IDC_EDIT_ZIP_G 1120 +#define IDC_EDIT_PHONE_G 1121 +#define IDC_EDIT_CELL_G 1122 +#define IDC_EDIT_NAME_EC 1123 +#define IDC_EDIT_PHONE_EC 1124 +#define IDC_EDIT_RELATION_EC 1125 +#define IDC_EDIT_CELL_EC 1126 +#define IDC_EDIT_EMPLOYER_EC 1127 +#define IDC_EDIT_EMPLOYER_PHONE_EC 1128 +#define IDC_EDIT_NAME_NOK 1129 +#define IDC_EDIT_PHONE_NOK 1130 +#define IDC_EDIT_RELATION_NOK 1131 +#define IDC_EDIT_CELL_NOK 1132 +#define IDC_EDIT_EMPLOYER_NOK 1133 +#define IDC_EDIT_DATE1_PI 1134 +#define IDC_EDIT_EMPLOYER_PHONE_NOK 1134 +#define IDC_EDIT_DATE2_PI 1135 +#define IDC_EDIT_DATE3_PI 1136 +#define IDC_EDIT_CERTIFICATE_PI 1137 +#define IDC_EDIT_CITY_PI 1138 +#define IDC_EDIT_STATE_PI 1139 +#define IDC_EDIT_ZIP_PI 1140 +#define IDC_EDIT_PHONE1_PI 1141 +#define IDC_EDIT_PHONE2_PI 1142 +#define IDC_EDIT_SUBSCRIBER_PI 1143 +#define IDC_EDIT_EMPLOYER_PI 1144 +#define IDC_EDIT_RELATION_PI 1145 +#define IDC_EDIT_NAME_SI 1146 +#define IDC_EDIT_GROUP_SI 1147 +#define IDC_EDIT_DATE1_SI 1148 +#define IDC_EDIT_DATE2_SI 1149 +#define IDC_EDIT_DATE3_SI 1150 +#define IDC_EDIT_CERTIFICATE_SI 1151 +#define IDC_EDIT_SUBSCRIBER_SI 1152 +#define IDC_EDIT_EMPLOYER_SI 1153 +#define IDC_EDIT_RELATION_SI 1154 +#define IDC_EDIT_ADDRESS_SI 1155 +#define IDC_EDIT_CITY_SI 1156 +#define IDC_EDIT_STATE_SI 1157 +#define IDC_EDIT_ZIP_SI 1158 +#define IDC_EDIT_PHONE1_SI 1159 +#define IDC_EDIT_PHONE2_SI 1160 diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/UserTabDemo.rc b/modules/windows/oodialog/propertysheet.tabControls/rc/UserTabDemo.rc new file mode 100644 index 0000000..1c4e01b --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/UserTabDemo.rc @@ -0,0 +1,305 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "UserTabDemo.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CONTACTS DIALOGEX 0, 0, 475, 202 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CAPTION | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "Contacts" +FONT 10, "Tahoma", 400, 0, 0 +{ + GROUPBOX "Guarantor", IDC_STATIC, 5, 5, 244, 192 + LTEXT "Guarantor Name: ", IDC_STATIC, 14, 16, 95, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_G, 14, 26, 110, 12, ES_AUTOHSCROLL + LTEXT "Relationship to patient:", IDC_STATIC, 136, 16, 105, 8, SS_LEFT + EDITTEXT IDC_EDIT_RELATION_G, 136, 26, 105, 12, ES_AUTOHSCROLL + LTEXT "Date of birth:", IDC_STATIC, 14, 43, 48, 8, SS_LEFT + EDITTEXT IDC_EDIT_DOB1_G, 14, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 33, 55, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DOB2_G, 44, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 64, 55, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DOB3_G, 74, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Age:", IDC_STATIC, 102, 43, 22, 8, SS_LEFT + EDITTEXT IDC_EDIT_AGE_G, 102, 53, 22, 12, ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Social Security Number:", IDC_STATIC, 136, 43, 86, 8, SS_LEFT + EDITTEXT IDC_EDIT_SSN1_G, 136, 53, 19, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "-", IDC_STATIC, 195, 54, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_SSN2_G, 172, 53, 19, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "-", IDC_STATIC, 159, 54, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_SSN3_G, 209, 53, 31, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Sex", IDC_STATIC, 6, 76, 35, 45 + AUTORADIOBUTTON "M", IDC_RB_M_G, 17, 87, 15, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "F", IDC_RB_F_G, 17, 103, 15, 8 + GROUPBOX "Guarantor Employment", IDC_STATIC, 44, 76, 198, 45 + RTEXT "Employer:", IDC_STATIC, 47, 89, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_G, 91, 87, 100, 12, ES_AUTOHSCROLL + RTEXT "Occupation:", IDC_STATIC, 47, 105, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_OCCUPATION_G, 91, 103, 100, 12, ES_AUTOHSCROLL + RTEXT "Phone:", IDC_STATIC, 202, 90, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_PHONE_G, 202, 103, 35, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Guarantor Address", IDC_STATIC, 44, 127, 198, 70 + RTEXT "Street:", IDC_STATIC, 64, 140, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_ADDRESS_G, 91, 138, 143, 12, ES_AUTOHSCROLL + RTEXT "City:", IDC_STATIC, 64, 156, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_CITY_G, 90, 154, 59, 12, ES_AUTOHSCROLL + RTEXT "State:", IDC_STATIC, 152, 156, 20, 8, SS_RIGHT + EDITTEXT IDC_EDIT_STATE_G, 175, 154, 13, 12, ES_AUTOHSCROLL | ES_UPPERCASE + RTEXT "Zip:", IDC_STATIC, 189, 156, 15, 8, SS_RIGHT + EDITTEXT IDC_EDIT_ZIP_G, 207, 154, 26, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Phone:", IDC_STATIC, 64, 172, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PHONE_G, 90, 170, 51, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Cell:", IDC_STATIC, 148, 172, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_CELL_G, 175, 170, 58, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Emergency Contact", IDC_STATIC, 265, 5, 205, 91 + LTEXT "Name: ", IDC_STATIC, 274, 16, 77, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_EC, 274, 26, 110, 12, ES_AUTOHSCROLL + LTEXT "Relationship to patient:", IDC_STATIC, 274, 43, 77, 8, SS_LEFT + EDITTEXT IDC_EDIT_RELATION_EC, 274, 53, 110, 12, ES_AUTOHSCROLL + LTEXT "Employer:", IDC_STATIC, 274, 69, 41, 8, SS_LEFT + EDITTEXT IDC_EDIT_EMPLOYER_EC, 274, 78, 110, 12, ES_AUTOHSCROLL + LTEXT "Phone:", IDC_STATIC, 391, 16, 66, 8, SS_LEFT + EDITTEXT IDC_EDIT_PHONE_EC, 391, 26, 71, 12, ES_AUTOHSCROLL + LTEXT "Cell Phone:", IDC_STATIC, 391, 43, 66, 8, SS_LEFT + EDITTEXT IDC_EDIT_CELL_EC, 391, 53, 71, 12, ES_AUTOHSCROLL + RTEXT "Employment Phone:", IDC_STATIC, 391, 69, 66, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_PHONE_EC, 391, 78, 71, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Next of Kin", IDC_STATIC, 265, 106, 205, 91 + LTEXT "Name: ", IDC_STATIC, 274, 117, 77, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_NOK, 274, 127, 110, 12, ES_AUTOHSCROLL + LTEXT "Relationship to patient:", IDC_STATIC, 274, 144, 77, 8, SS_LEFT + EDITTEXT IDC_EDIT_RELATION_NOK, 274, 154, 110, 12, ES_AUTOHSCROLL + LTEXT "Employer:", IDC_STATIC, 274, 170, 41, 8, SS_LEFT + EDITTEXT IDC_EDIT_EMPLOYER_NOK, 274, 179, 110, 12, ES_AUTOHSCROLL + LTEXT "Phone:", IDC_STATIC, 391, 117, 66, 8, SS_LEFT + EDITTEXT IDC_EDIT_PHONE_NOK, 391, 127, 71, 12, ES_AUTOHSCROLL + LTEXT "Cell Phone:", IDC_STATIC, 391, 144, 66, 8, SS_LEFT + EDITTEXT IDC_EDIT_CELL_NOK, 391, 154, 71, 12, ES_AUTOHSCROLL + RTEXT "Employment Phone:", IDC_STATIC, 391, 170, 66, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_PHONE_NOK, 391, 179, 71, 12, ES_AUTOHSCROLL | ES_NUMBER +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_HISTORY DIALOGEX 0, 0, 475, 202 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CAPTION | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "History" +FONT 10, "Tahoma", 400, 0, 0 +{ + GROUPBOX "Indicate if you or anyone in your family has (or has had) any of these conditions:", IDC_STATIC, 5, 5, 465, 192 + CTEXT "Yourself", IDC_STATIC, 6, 17, 229, 10, SS_CENTER + CONTROL "", IDC_LV_SELF, WC_LISTVIEW, WS_TABSTOP | LVS_ALIGNLEFT | LVS_SINGLESEL | LVS_REPORT, 5, 30, 229, 167 + CTEXT "Family Member", IDC_STATIC, 241, 17, 229, 10, SS_CENTER + CONTROL "", IDC_LV_FAMILY, WC_LISTVIEW, WS_TABSTOP | LVS_ALIGNLEFT | LVS_SINGLESEL | LVS_REPORT, 241, 30, 229, 167 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_INSURANCE DIALOGEX 0, 0, 475, 202 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CAPTION | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "Insurance" +FONT 10, "Tahoma", 400, 0, 0 +{ + GROUPBOX "Primary Insurance", IDC_STATIC, 5, 5, 225, 192 + LTEXT "Insurance Company Name: ", IDC_STATIC, 28, 16, 95, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_PI, 28, 26, 110, 12, ES_AUTOHSCROLL + LTEXT "Group", IDC_STATIC, 152, 16, 65, 8, SS_LEFT + EDITTEXT IDC_EDIT_GROUP_PI, 152, 26, 65, 12, ES_AUTOHSCROLL + LTEXT "Effectiv Date:", IDC_STATIC, 28, 43, 48, 8, SS_LEFT + EDITTEXT IDC_EDIT_DATE1_PI, 28, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 47, 55, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DATE2_PI, 58, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 78, 55, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DATE3_PI, 88, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Certificate Number:", IDC_STATIC, 124, 43, 65, 8, SS_LEFT + EDITTEXT IDC_EDIT_CERTIFICATE_PI, 124, 53, 93, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Subscriber", IDC_STATIC, 20, 138, 198, 58 + RTEXT "Name:", IDC_STATIC, 23, 150, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_SUBSCRIBER_PI, 67, 148, 144, 12, ES_AUTOHSCROLL + RTEXT "Employer:", IDC_STATIC, 23, 166, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_PI, 67, 164, 144, 12, ES_AUTOHSCROLL + RTEXT "Relationship to patient:", IDC_STATIC, 23, 184, 78, 8, SS_RIGHT + EDITTEXT IDC_EDIT_RELATION_PI, 104, 182, 107, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Insurance Company Address", IDC_STATIC, 19, 69, 198, 62 + RTEXT "Street:", IDC_STATIC, 28, 82, 35, 8, SS_RIGHT + EDITTEXT IDC_EDIT_ADDRESS_PI, 66, 80, 143, 12, ES_AUTOHSCROLL + RTEXT "City:", IDC_STATIC, 28, 98, 35, 8, SS_RIGHT + EDITTEXT IDC_EDIT_CITY_PI, 65, 96, 59, 12, ES_AUTOHSCROLL + RTEXT "State:", IDC_STATIC, 127, 98, 20, 8, SS_RIGHT + EDITTEXT IDC_EDIT_STATE_PI, 150, 96, 13, 12, ES_AUTOHSCROLL | ES_UPPERCASE + RTEXT "Zip:", IDC_STATIC, 164, 98, 15, 8, SS_RIGHT + EDITTEXT IDC_EDIT_ZIP_PI, 182, 96, 26, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Phone 1:", IDC_STATIC, 28, 114, 35, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PHONE1_PI, 65, 112, 51, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Phone 2:", IDC_STATIC, 116, 114, 31, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PHONE2_PI, 150, 112, 58, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Secondary Insurance", IDC_STATIC, 245, 5, 225, 192 + LTEXT "Insurance Company Name: ", IDC_STATIC, 268, 16, 95, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_SI, 268, 26, 110, 12, ES_AUTOHSCROLL + LTEXT "Group", IDC_STATIC, 392, 16, 65, 8, SS_LEFT + EDITTEXT IDC_EDIT_GROUP_SI, 392, 26, 65, 12, ES_AUTOHSCROLL + LTEXT "Effectiv Date:", IDC_STATIC, 268, 43, 48, 8, SS_LEFT + EDITTEXT IDC_EDIT_DATE1_SI, 268, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 287, 53, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DATE2_SI, 298, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 318, 53, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DATE3_SI, 328, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Certificate Number:", IDC_STATIC, 364, 43, 65, 8, SS_LEFT + EDITTEXT IDC_EDIT_CERTIFICATE_SI, 364, 53, 93, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Subscriber", IDC_STATIC, 259, 138, 198, 58 + RTEXT "Name:", IDC_STATIC, 263, 150, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_SUBSCRIBER_SI, 307, 148, 144, 12, ES_AUTOHSCROLL + RTEXT "Employer:", IDC_STATIC, 263, 166, 41, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_SI, 307, 164, 144, 12, ES_AUTOHSCROLL + RTEXT "Relationship to patient:", IDC_STATIC, 263, 184, 78, 8, SS_RIGHT + EDITTEXT IDC_EDIT_RELATION_SI, 343, 182, 107, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Insurance Company Address", IDC_STATIC, 259, 69, 198, 62 + RTEXT "Street:", IDC_STATIC, 268, 80, 35, 8, SS_RIGHT + EDITTEXT IDC_EDIT_ADDRESS_SI, 306, 80, 143, 12, ES_AUTOHSCROLL + RTEXT "City:", IDC_STATIC, 268, 96, 35, 8, SS_RIGHT + EDITTEXT IDC_EDIT_CITY_SI, 305, 96, 59, 12, ES_AUTOHSCROLL + RTEXT "State:", IDC_STATIC, 367, 96, 20, 8, SS_RIGHT + EDITTEXT IDC_EDIT_STATE_SI, 390, 96, 13, 12, ES_AUTOHSCROLL | ES_UPPERCASE + RTEXT "Zip:", IDC_STATIC, 404, 96, 15, 8, SS_RIGHT + EDITTEXT IDC_EDIT_ZIP_SI, 422, 96, 26, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Phone 1:", IDC_STATIC, 268, 112, 35, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PHONE1_SI, 305, 112, 51, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Phone 2:", IDC_STATIC, 356, 112, 31, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PHONE2_SI, 390, 112, 58, 12, ES_AUTOHSCROLL | ES_NUMBER +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PATIENT DIALOGEX 0, 0, 475, 202 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CAPTION | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "Patient" +FONT 10, "Tahoma", 400, 0, 0 +{ + GROUPBOX "Patient", IDC_STATIC, 5, 5, 244, 65 + LTEXT "Name (Last, First, Middle):", IDC_STATIC, 14, 16, 95, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME, 14, 26, 110, 12, ES_AUTOHSCROLL + LTEXT "Also known as / Maiden name:", IDC_STATIC, 136, 16, 105, 8, SS_LEFT + EDITTEXT IDC_EDIT_AKA, 136, 26, 105, 12, ES_AUTOHSCROLL + LTEXT "Date of birth:", IDC_STATIC, 14, 43, 48, 8, SS_LEFT + EDITTEXT IDC_EDIT_DOB1, 14, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 33, 55, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DOB2, 44, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "/", IDC_STATIC, 64, 55, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_DOB3, 74, 53, 17, 12, ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Age:", IDC_STATIC, 102, 43, 22, 8, SS_LEFT + EDITTEXT IDC_EDIT_AGE, 102, 53, 22, 12, ES_AUTOHSCROLL | ES_NUMBER + LTEXT "Social Security Number:", IDC_STATIC, 136, 43, 86, 8, SS_LEFT + EDITTEXT IDC_EDIT_SSN1, 136, 53, 19, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "-", IDC_STATIC, 195, 54, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_SSN2, 172, 53, 19, 12, ES_AUTOHSCROLL | ES_NUMBER + CTEXT "-", IDC_STATIC, 159, 54, 8, 8, SS_CENTER + EDITTEXT IDC_EDIT_SSN3, 209, 53, 31, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Sex", IDC_STATIC, 258, 6, 35, 37 + AUTORADIOBUTTON "M", IDC_RB_M, 269, 16, 15, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "F", IDC_RB_F, 269, 30, 15, 8 + GROUPBOX "Language", IDC_STATIC, 311, 6, 159, 37 + AUTORADIOBUTTON "Chinese", IDC_RB_CHINESE, 322, 16, 39, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "English", IDC_RB_ENGLISH, 322, 30, 39, 8 + AUTORADIOBUTTON "French", IDC_RB_FRENCH, 374, 16, 39, 8 + AUTORADIOBUTTON "German", IDC_RB_GERMAN, 374, 30, 39, 8 + AUTORADIOBUTTON "Spanish", IDC_RB_SPANISH, 422, 16, 39, 8 + AUTORADIOBUTTON "Other", IDC_RB_OTHER, 422, 30, 39, 8 + LTEXT "Religon:", IDC_STATIC, 258, 54, 30, 8, SS_LEFT + EDITTEXT IDC_EDIT_RELIGON, 289, 53, 72, 12, ES_AUTOHSCROLL + LTEXT "Church:", IDC_STATIC, 373, 54, 30, 8, SS_LEFT + EDITTEXT IDC_EDIT_CHURCH, 405, 53, 61, 12, ES_AUTOHSCROLL + GROUPBOX "Race", IDC_STATIC, 5, 75, 184, 37 + AUTORADIOBUTTON "African American", IDC_RB_AFRICAN_AMERICAN, 14, 84, 68, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Native American", IDC_RB_NATIVE_AMERICAN, 14, 98, 68, 8 + AUTORADIOBUTTON "Asian", IDC_RB_ASIAN, 91, 84, 39, 8 + AUTORADIOBUTTON "Caucasian", IDC_RB_CAUCASIAN, 91, 98, 47, 8 + AUTORADIOBUTTON "Hispanic", IDC_RB_HISPANIC, 146, 84, 39, 8 + AUTORADIOBUTTON "Other", IDC_RB_OTHER_RACE, 146, 98, 39, 8 + GROUPBOX "Marital Status", IDC_STATIC, 204, 75, 265, 37 + AUTORADIOBUTTON "Married", IDC_RB_MARRIED, 214, 84, 41, 8, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Single", IDC_RB_SINGLE, 214, 98, 41, 8 + AUTORADIOBUTTON "Never Married", IDC_RB_NEVER_MARRIED, 269, 84, 65, 8 + AUTORADIOBUTTON "Legally Separated", IDC_RB_LEGALLY_SEPARATED, 269, 98, 73, 8 + AUTORADIOBUTTON "Life Partner", IDC_RB_LIFEPARTNER, 351, 83, 53, 8 + AUTORADIOBUTTON "Divorced", IDC_RB_DIVORCED, 415, 83, 48, 8 + AUTORADIOBUTTON "Widowed", IDC_RB_WIDOWED, 351, 98, 54, 8 + AUTORADIOBUTTON "Other", IDC_RB_OTHER_MARITAL, 415, 98, 39, 8 + GROUPBOX "Address", IDC_STATIC, 5, 119, 144, 77 + RTEXT "Street:", IDC_STATIC, 12, 132, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PATIENT_ADDRESS, 38, 130, 107, 12, ES_AUTOHSCROLL + RTEXT "City:", IDC_STATIC, 12, 148, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PATIENT_CITY, 38, 146, 63, 12, ES_AUTOHSCROLL + RTEXT "State:", IDC_STATIC, 105, 148, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PATIENT_STATE, 131, 146, 13, 12, ES_AUTOHSCROLL | ES_UPPERCASE + RTEXT "Zip:", IDC_STATIC, 12, 164, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PATIENT_ZIP, 38, 162, 26, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Email:", IDC_STATIC, 77, 164, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMAIL, 103, 162, 42, 12, ES_AUTOHSCROLL + RTEXT "Phone:", IDC_STATIC, 12, 180, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PATIENT_PHONE, 38, 178, 35, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Cell:", IDC_STATIC, 77, 180, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PATIENT_CELL, 103, 178, 42, 12, ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Employment", IDC_STATIC, 165, 119, 208, 77 + RTEXT "Employer:", IDC_STATIC, 168, 132, 34, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER, 206, 130, 100, 12, ES_AUTOHSCROLL + RTEXT "Street:", IDC_STATIC, 168, 147, 34, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_STREET, 206, 145, 100, 12, ES_AUTOHSCROLL + RTEXT "City:", IDC_STATIC, 168, 163, 34, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_CITY, 206, 161, 60, 12, ES_AUTOHSCROLL + RTEXT "State:", IDC_STATIC, 269, 163, 21, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_STATE, 293, 161, 13, 12, ES_AUTOHSCROLL | ES_UPPERCASE + RTEXT "Zip:", IDC_STATIC, 168, 180, 34, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_ZIP, 206, 178, 26, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Phone:", IDC_STATIC, 307, 133, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_PHONE, 333, 131, 35, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Ext:", IDC_STATIC, 307, 147, 24, 8, SS_RIGHT + EDITTEXT IDC_EDIT_EMPLOYER_EXT, 333, 145, 35, 12, ES_AUTOHSCROLL | ES_NUMBER + RTEXT "Occupation:", IDC_STATIC, 238, 180, 43, 8, SS_RIGHT + EDITTEXT IDC_EDIT_OCCUPATION, 283, 178, 84, 12, ES_AUTOHSCROLL + GROUPBOX "Primary Care", IDC_STATIC, 385, 119, 85, 77 + LTEXT "Primary Physician:", IDC_STATIC, 395, 132, 66, 8, SS_LEFT + EDITTEXT IDC_EDIT_PHYSICIAN, 395, 145, 71, 12, ES_AUTOHSCROLL + RTEXT "Phone - Extension:", IDC_STATIC, 388, 163, 66, 8, SS_RIGHT + EDITTEXT IDC_EDIT_PHYSICIAN_PHONE, 395, 178, 71, 12, ES_AUTOHSCROLL | ES_NUMBER +} diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews.h b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews.h new file mode 100644 index 0000000..4fb3605 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews.h @@ -0,0 +1,61 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_LISTVIEWS 100 +#define IDC_TAB 102 +#define IDC_PB_BACKWARD 103 +#define IDC_PB_FORWARD 105 +#define IDC_PB_ADDRECORD 107 +#define IDD_PAGE 200 +#define IDC_LISTVIEW 208 +#define IDD_ADDRESS 300 +#define IDC_RB_MALE 301 +#define IDC_RB_FEMALE 302 +#define IDC_EDIT_FNAME 303 +#define IDC_EDIT_LNAME 304 +#define IDC_EDIT_STREET 305 +#define IDC_EDIT_CITY 306 +#define IDC_EDIT_AGE 307 +#define IDC_EDIT_STATE 308 +#define IDC_EDIT_ZIPCODE 309 +#define IDC_PB_EDITRECORD 1001 +#define IDC_CK_INFOTIPS 1002 +#define IDC_CHK_EDITABLE 1003 diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews.rc b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews.rc new file mode 100644 index 0000000..3a965d7 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews.rc @@ -0,0 +1,97 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "oodListViews.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ADDRESS DIALOG 9, 23, 281, 140 +STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Add New Record" +FONT 10, "MS Shell Dlg" +{ + LTEXT "First name:", -1, 11, 26, 39, 8, SS_LEFT + EDITTEXT IDC_EDIT_FNAME, 54, 25, 71, 12, ES_AUTOHSCROLL + LTEXT "Last name:", -1, 134, 26, 40, 8, SS_LEFT + EDITTEXT IDC_EDIT_LNAME, 178, 25, 93, 12, ES_AUTOHSCROLL + LTEXT "Street:", -1, 11, 49, 38, 8, SS_LEFT + EDITTEXT IDC_EDIT_STREET, 54, 48, 217, 12 + LTEXT "City:", -1, 11, 69, 38, 8, SS_LEFT + EDITTEXT IDC_EDIT_CITY, 54, 68, 73, 12 + LTEXT "State:", -1, 134, 69, 21, 8, SS_LEFT + EDITTEXT IDC_EDIT_STATE, 159, 68, 19, 12, ES_UPPERCASE + LTEXT "Zip Code:", -1, 198, 69, 37, 8, SS_LEFT + EDITTEXT IDC_EDIT_ZIPCODE, 240, 68, 31, 12, ES_NUMBER | ES_UPPERCASE + LTEXT "Age:", -1, 11, 92, 19, 8, SS_LEFT + EDITTEXT IDC_EDIT_AGE, 54, 91, 23, 12, ES_NUMBER + AUTORADIOBUTTON "Male", IDC_RB_MALE, 100, 91, 27, 12, WS_GROUP + AUTORADIOBUTTON "Female", IDC_RB_FEMALE, 141, 91, 41, 12 + AUTOCHECKBOX "Record can be edited", IDC_CHK_EDITABLE, 11, 116, 84, 14, BS_VCENTER + DEFPUSHBUTTON "OK", IDOK, 155, 116, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 221, 117, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_LISTVIEWS DIALOG 0, 0, 400, 242 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "List Views" +FONT 10, "MS Shell Dlg" +{ + CONTROL "", IDC_TAB, WC_TABCONTROL, WS_TABSTOP, 10, 10, 380, 175 + AUTOCHECKBOX "Use Info Tips", IDC_CK_INFOTIPS, 10, 194, 81, 13 + PUSHBUTTON "Backward", IDC_PB_BACKWARD, 10, 218, 55, 14 + PUSHBUTTON "Forward", IDC_PB_FORWARD, 72, 218, 55, 14 + PUSHBUTTON "Add Record", IDC_PB_ADDRECORD, 134, 218, 55, 14 + PUSHBUTTON "Edit Record", IDC_PB_EDITRECORD, 197, 218, 55, 14 + DEFPUSHBUTTON "OK", IDOK, 275, 218, 55, 14 + PUSHBUTTON "Cancel", IDCANCEL, 335, 218, 55, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PAGE DIALOG 0, 0, 380, 160 +STYLE DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW +FONT 10, "MS Shell Dlg" +{ + CONTROL "", IDC_LISTVIEW, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_EDITLABELS | LVS_LIST | LVS_SHOWSELALWAYS, 3, 3, 368, 154 +} diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews1.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews1.bmp new file mode 100644 index 0000000..310956b Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews1.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews2.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews2.bmp new file mode 100644 index 0000000..1f18a03 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/oodListViews2.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoListView.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoListView.bmp new file mode 100644 index 0000000..2414bdb Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoListView.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoTab.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoTab.bmp new file mode 100644 index 0000000..7b305ce Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoTab.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoTreeView.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoTreeView.bmp new file mode 100644 index 0000000..19cb247 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/propertySheetDemoTreeView.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizard.h b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizard.h new file mode 100644 index 0000000..d027fa1 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizard.h @@ -0,0 +1,95 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +// Intro page dialog +#define IDC_ST_INTRO_MSG 210 +#define IDC_ST_INTRO_INFO 211 +#define IDC_ST_INTRO_LAST_MSG 212 + +// Cinemas page dialog +#define IDC_COMBO_CINEMAS 300 +#define IDC_RB_CINEMAS_FIRST 310 +#define IDC_RB_CINEMAS_UPTOWN 310 +#define IDC_RB_CINEMAS_PALO 311 +#define IDC_RB_CINEMAS_CHARLIES 312 +#define IDC_RB_CINEMAS_DRIVEIN 313 +#define IDC_RB_CINEMAS_GRAND 314 +#define IDC_RB_CINEMAS_BROADWAY 315 +#define IDC_RB_CINEMAS_LAST 315 + +// Days page dialog +#define IDC_COMBO_DAYS 400 +#define IDC_ST_MOVIE_BMP 401 +#define IDC_RB_DAYS_FIRST 410 +#define IDC_RB_DAYS_MONDAY 410 +#define IDC_RB_DAYS_TUESDAY 411 +#define IDC_RB_DAYS_WEDNESDAY 412 +#define IDC_RB_DAYS_THURSDAY 413 +#define IDC_RB_DAYS_FRIDAY 414 +#define IDC_RB_DAYS_SATURDAY 415 +#define IDC_RB_DAYS_SUNDAY 416 +#define IDC_RB_DAYS_LAST 416 + +// Ticket times page dialog +#define IDC_COMBO_TIMES 500 +#define IDC_ST_TIMES_THEATER 501 +#define IDC_ST_TIMES_DAY 502 +#define IDC_RB_TIMES_FIRST 510 +#define IDC_RB_TIMES_11 510 +#define IDC_RB_TIMES_17 511 +#define IDC_RB_TIMES_20 512 +#define IDC_RB_TIMES_22 513 +#define IDC_RB_TIMES_LAST 513 + + +// Completion page dialog +#define IDC_COMBO_COMPLETE 600 +#define IDC_ST_COMPLETE_MSG 601 +#define IDC_ST_COMPLETE_THEATER 602 +#define IDC_ST_COMPLETE_DAY 603 +#define IDC_ST_COMPLETE_TIME 604 +#define IDC_PB_TICKET_BMP 605 + + +#define IDD_FONT_PICKER 101 +#define IDC_COMBO_SIZE 1004 +#define IDC_COMBO_NAME 1005 + diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizard.rc b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizard.rc new file mode 100644 index 0000000..caefd11 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizard.rc @@ -0,0 +1,70 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include "ticketWizard.h" + +30 DIALOG 4, 12, 196, 143 +STYLE WS_CHILD | WS_VISIBLE | WS_BORDER +FONT 8, "System" +{ + CONTROL "MovieList", 31, "LISTBOX", LBS_NOTIFY | WS_BORDER | LBS_MULTIPLESEL | WS_BORDER | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 6, 20, 93, 105 + CONTROL "Produced", 32, "EDIT", WS_BORDER | WS_GROUP | WS_TABSTOP, 109, 23, 84, 12 + CONTROL "Star", 33, "EDIT", WS_BORDER | WS_GROUP | WS_TABSTOP, 109, 53, 84, 12 + CONTROL "Director", 34, "EDIT", WS_BORDER | WS_GROUP | WS_TABSTOP, 109, 83, 84, 12 + CONTROL "with", 35, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_GROUP | WS_TABSTOP, 109, 113, 84, 33 + GROUPBOX "The upcoming movies", -1, 3, 9, 99, 118, BS_GROUPBOX + LTEXT "Produced by:", -1, 109, 10, 60, 8 + LTEXT "Starring:", -1, 109, 40, 60, 8 + LTEXT "Director:", -1, 109, 70, 83, 8 + LTEXT "with:", -1, 109, 100, 60, 8 +} + +IDD_FONT_PICKER DIALOG 0, 0, 208, 95 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Font Selection" +FONT 8, "Ms Shell Dlg 2" +BEGIN + GROUPBOX "Select a font for the upcoming example program", IDC_STATIC, 7, 7, 194, 62 + CTEXT "Font Name:", IDC_STATIC, 13, 20, 80, 8 + CTEXT "Font Size:", IDC_STATIC, 116, 20, 80, 8 + COMBOBOX IDC_COMBO_NAME, 13, 33, 80, 40, WS_TABSTOP | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT + COMBOBOX IDC_COMBO_SIZE, 116, 33, 80, 40, WS_TABSTOP | WS_TABSTOP | CBS_DROPDOWNLIST | CBS_HASSTRINGS + DEFPUSHBUTTON "OK", IDOK, 96, 74, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 151, 74, 50, 14 +END diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardMovie.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardMovie.bmp new file mode 100644 index 0000000..51be677 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardMovie.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardRexxLA.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardRexxLA.bmp new file mode 100644 index 0000000..cf5cd65 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardRexxLA.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardTheater.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardTheater.bmp new file mode 100644 index 0000000..46221bd Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardTheater.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardTicket.bmp b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardTicket.bmp new file mode 100644 index 0000000..dd461d7 Binary files /dev/null and b/modules/windows/oodialog/propertysheet.tabControls/rc/ticketWizardTicket.bmp differ diff --git a/modules/windows/oodialog/propertysheet.tabControls/ticketWizard.rex b/modules/windows/oodialog/propertysheet.tabControls/ticketWizard.rex new file mode 100755 index 0000000..d6607d3 --- /dev/null +++ b/modules/windows/oodialog/propertysheet.tabControls/ticketWizard.rex @@ -0,0 +1,1275 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Propery Sheet / Wizard97 example + * + * This example demonstrates how to use the PropertySheetDialog to create a + * Wizard. There are two main wizard styles for a property sheet, the Wizard97 + * style and the Aero style. Wizard97 will run on any Windows version supported + * by ooRexx. The Aero wizard needs Windows Vista or later. + * + * This example creates all the pages as UserDialogs where the programmer lays + * each dialog template in the defineDialog() method. This is really rather + * tedious. It is much easier to use a resource editor, especially here where + * the programmer wants to create a number of page dialogs that are all the same + * size. + * + * However, it is a good opportunity to give examples of how to correctly + * convert between pixels and dialog units in the defineDialog() method to get + * the dialog template laid out correctly when different fonts are used for the + * dialog. To facilate that part of the example, the user is allowed to pick + * different fonts and font sizes for the wizard before it is displayed. This + * may not be the best sample program for that, because it is not possible, at + * this time, to change the font of the wizard itself. + * + * This is a rather complex program. The commenting is not 100%. Be sure to + * read the ooDialog documentation on the PropertySheetDialog to fully under- + * stand this program. + * + * Note: this program uses the public routine, locate(), to get the full path + * name to the directory this source code file is located. In places, the + * variable holding this value has been callously abbreviated to 'sd' which + * stands for source directory. + * + */ + + sd = locate() + .application~useGlobalConstDir('O', sd"rc\ticketWizard.h") + + -- Let the user select a font for the example program. + oldFont = setFont() + + -- We show a timed message to explain what the upcoming example is about. + -- This is a hold-over from the original ooRexx examples. The reality is, it + -- gets rather annoying after the first 2 or 3 times you run the example. I + -- would prefer to eliminate this code. + msg = "The upcoming dialog demonstrates a Wizard 97 style dialog." + title = "Wizard 97 Dialog" + dlg = .TimedMessage~new(msg, title, 2000) + dlg~execute + + -- First we create the dialogs for each page, and set any of the attributes + -- we need to. We want each dialog to be the same size. + outPageSize = .Size~new(267, 193) + inPageSize = .Size~new(267, 143) + + intro = .IntroDlg~new( , , "", "ooRexx Movie Ticket Selectitron") + intro~setSize(outPageSize) + + p1 = .MoviesDlg~new( , , "", "Movies") + p1~setSize(inPageSize) + p1~headerTitle = "Select the movie(s) you want tickets for." + p1~headerSubtitle = "When a movie is selected, information on the movie, such as director, actors, " - + "etc., will also be displayed." + + p2 = .CinemasDlg~new( , , "", "Cinemas" ) + p2~setSize(inPageSize) + p2~headerTitle = "Pick a movie theater for the movie(s)." + p2~headerSubtitle = "Pick a theater for each movie you've selected. Use the drop down list to switch movies. " - + "Theaters in your vicinity showing the movie(s) this week are listed. " + + p3 = .DaysDlg~new( , , "", "Days" ) + p3~setSize(inPageSize) + p3~headerTitle = "Choose a day to watch the movie(s)." + p3~headerSubtitle = "Use the drop down list to switch movies. Pick the day most suitable for the movie." + + p4 = .TicketDlg~new( , , "", "Ticket Information" ) + p4~setSize(inPageSize) + p4~headerTitle = "Validate your selections and indicate the time desired." + p4~headerSubtitle = "Pick a time for each movie selected. Ticket information for each movie can be displayed " - + "using the drop down list. To change any selections use the Back button." + + complete = .CompletionDlg~new( , , "", "Enjoy Your Movie") + complete~setSize(outPageSize) + + pages = .array~of(intro, p1, p2, p3, p4, complete) + + -- Create the property sheet using the dialog pages and set its attributes. + wizDlg = .TicketWizard97~new(pages, "Wizard97", "Let's Go To The Movies") + + wizDlg~header = .Image~getImage(sd"rc\ticketWizardTheater.bmp") + wizDlg~watermark = .Image~getImage(sd"rc\ticketWizardRexxLA.bmp") + + -- Execute the wizard. + wizDlg~execute + + ret = restoreFont(oldFont) + return + +::requires "ooDialog.cls" + +-- TicketWizard97 +-- The property sheet for the example program. Although the +-- PropertySheetDialog has a number of methods, we do not need to over-ride +-- any of the methods. So, we just need the class definition line here. +::class 'TicketWizard97' subclass PropertySheetDialog + + +-- IntroDlg +-- Dialog for first page (exterior page, introduction.) +::class 'IntroDlg' subclass UserPSPDialog + +::method defineDialog + + -- Watermark bitmap is 164 x 316. The wizard does not stretch the bitmap, + -- its size remains constant. So, the size taken up by the bitmap, in + -- dialog units, changes as the font size changes. Use pixel2dlgUnit() to + -- convert the pixel size of the watermark to the correct dialog units for + -- the font this dialog is using. + s = .Size~new(164, 314) + self~pixel2dlgUnit(s) + + x = s~width + 6 + y = 8 -- From the Wizard97 specification. + cx = self~sizeX - x -- To the right side of the template, the wizard automatically adds 14 dlus. + cy = 3 * 12 -- Using 12 point font, takes 3 lines for the msg. + + self~createStaticText(IDC_ST_INTRO_MSG, x, y, cx, cy, "", "") + + y += cy + 8 -- Space the next static 8 dlus below the first. + cy = 8 * 8 -- Arbitray height to fit the info text. + self~createStaticText(IDC_ST_INTRO_INFO, x, y, cx, cy, "", "") + + cy = 8 -- Normal font size height. + y = self~sizeY - 7 - cy -- From the Wizard97 specification, leave 7 dlus margin on bottom. + self~createStaticText(IDC_ST_INTRO_LAST_MSG, x, y, cx, cy, "", "") + +::method setActive unguarded + use arg propSheet + + -- Back button disabled, Next button enabled. + propSheet~setWizButtons("NEXT") + return 0 + +::method initDialog + + msg = "Welcome to the ooRexx Movie Ticket Selectitron Wizard" + font1 = self~createFontEx("Verdana", 12, "BOLD") -- From the Wizard97 specification. + + st1 = self~newStatic(IDC_ST_INTRO_MSG) + st1~setFont(font1) + st1~setText(msg) + + info = "This wizard will help you select a ticket, or tickets, for the movie(s) of your choice. For each" - + "ticket you will specify the theater and time for the movie you wish to see." || .endOfLine~copies(2) || - + "Tickets for any movies playing in the upcoming week are available. Select as many" - + "movies as you wish to see." + self~newStatic(IDC_ST_INTRO_INFO)~setText(info) + + msg = "Select the Next button to continue" + self~newStatic(IDC_ST_INTRO_LAST_MSG)~setText(msg) + +::method initAutoDetection + self~noAutoDetection + + +-- MoviesDlg +-- Dialog for second page (interior page, movie selection.) +::class 'MoviesDlg' subclass UserPSPDialog + +::method defineDialog + + x = 21 -- From the Wizard97 specification. + y = 1 -- From the Wizard97 specification, the Wizard + -- automatically adds a 7 dlu marging on all sides. + self~createGroupBox(-1, x, y, 113, 125, , "The upcoming movies") + self~createListBox(31, x + 10, y + 15, 93, 105, "MULTI NOTIFY GROUP", "MovieList") + + x += 125 + 10 + self~createStaticText(-1, x, y, 60, 8, , "Produced by:") + self~createEdit(32, x, y + 12, 84, 12, "READONLY GROUP", "Produced") + + y += 15 * 2 + self~createStaticText(-1, x, y, 60, 8, , "Starring:") + self~createEdit(33, x, y + 12, 84, 12, "READONLY GROUP", "Star") + + y += 15 * 2 + self~createStaticText(-1, x, y, 60, 8, , "Director:") + self~createEdit(34, x, y + 12, 84, 12, "READONLY GROUP", "Director") + + y += 15 * 2 + self~createStaticText(-1, x, y, 60, 8, , "With:") + self~createComboBox(35, x, y + 12, 84, 33, "LIST GROUP", "COMBOBOX") + + self~connectListBoxEvent(31, "SELCHANGE", "onMovieClick") + +::method pageCreate unguarded + self~setMovieData + return .true + +::method setMovieData private + expose movieData films lastSelected + + films = .array~of("Vertigo", "Taxi Driver", "Superman", "Larger than Life", - + "Hair", "Cinderella", "True Lies", "E.T.", "Twister", "Lawnmower Duel") + movieData = .table~new + + do i = 1 to films~items + d = .directory~new + movieData[films[i]] = d + end + + d = movieData[films[1]] + d~produced = "Paramount"; d~star = "Kim Novak"; d~director = "Alfred Hitchcock" + d~with = .array~of("James Stewart") + + d = movieData[films[2]] + d~produced = "Universal"; d~star = "Robert De Niro"; d~director = "Martin Scorsese" + d~with = .array~of("Jodie Foster", 'Albert Brooks', 'Harvey Keitel', 'Cybill Shepherd') + + d = movieData[films[3]] + d~produced = "Warner Bros"; d~star = "Christopher Reeves"; d~director = "Richard Donner" + d~with = .array~of('Marlon Brando', 'Gene Hackman', 'Margot Kidder') + + d = movieData[films[4]] + d~produced = "United Artists"; d~star = "The Elephant"; d~director = "Howard Franklin" + d~with = .array~of("Bill Murray") + + d = movieData[films[5]] + d~produced = "Hippies"; d~star = "John Savage"; d~director = "Milos Forman" + d~with = .array~of("Beverly D'Angelo", 'Dorsey Wright', 'Cheryl Barnes', 'Treat Williams', 'Annie Golden') + + d = movieData[films[6]] + d~produced = "Disney"; d~star = "Cinderella"; d~director = "Walt" + d~with = .array~of('Step mother', 'Witch', 'Prince', 'King') + + d = movieData[films[7]] + d~produced = "20. Century Fox"; d~star = "Arnold Schwarzenegger"; d~director = "James Cameron" + d~with = .array~of('Jamie Lee Curtis', 'Tom Arnold', 'Richard Harris') + + d = movieData[films[8]] + d~produced = "United Artists"; d~star = "The Extra-Terrestrial"; d~director = "Steven Spielberg" + d~with = .array~of('Henry Thomas', 'Drew Barrymore', 'Dee Wallace', 'Peter Coyote') + + d = movieData[films[9]] + d~produced = "Warner Bros"; d~star = "Helen Hunt"; d~director = "Jan De Bont" + d~with = .array~of("Bill Paxten") + + d = movieData[films[10]] + d~produced= "Sunset Mowers"; d~star = "The Lawn Mower"; d~director = "Mower Pusher" + d~with = .array~of('Lawn', 'Garden hose', 'Sprinkler', 'Shredder') + + self~movieList = 0 + +::method setActive unguarded + use arg propSheet + + propSheet~setWizButtons("BACK NEXT") + return 0 + +-- wizNext() +-- The user clicked the next button. If the user does not pick a movie, we +-- don't let her proceed to the next page. There is no point in using the +-- wizard without selecting a movie. We use wizNext() rather than +-- killActive() because killActive is invoked both when the user clicks the +-- Back and the Next buttons. If the user wants to go back to the intor page, +-- we don't want to put up an annoying message box. +::method wizNext + expose lb + use arg propSheet + + count = lb~selectedItems + if count < 1 then do + msg = "To purchase a ticket, you must select at".endOfLine"least one movie." + j = MessageDialog(msg, propSheet~hwnd, "ooRexx Movie Ticket Selectitron", "OK", "INFORMATION") + return -1 + end + + return 0 + +::method initDialog + expose films lb + + lb = self~newListBox(31) + do i = 1 to films~items + lb~add(films[i]) + end + + lb~deselectIndex + +::method onMovieClick unguarded + expose movieData + use arg , , id, nCode, listBox + + movieName = listBox~selected + + combo = self~newComboBox(35) + combo~deleteAll + + -- If no movie in the list box is selected, set eveything blank, otherwise, + -- set everything to match the selected movie. + if movieName == "" then do + self~newEdit(32)~setText("") + self~newEdit(33)~setText("") + self~newEdit(34)~setText("") + combo~add("") + end + else do + d = movieData[movieName] + self~newEdit(32)~setText(d~produced) + self~newEdit(33)~setText(d~star) + self~newEdit(34)~setText(d~director) + + do n over d~with + combo~add(n) + end + combo~selectIndex(1) + end + + return 0 + +::method queryFromSibling unguarded + expose lb films + use arg arg1, arg2, propSheet + + select + when arg2 == "FILMS" then do + -- arg1 is an array that we fill in with all the movies + arg1~empty + do i = 1 to films~items + arg1[i] = films[i] + end + end + + when arg2 == "SELECTED" then do + -- arg1 is a table, we set an index for each selected movie. Note that + -- the item for the + arg1~empty + currentSelectedMovies = self~getSelectedMovies + do i = 1 to currentSelectedMovies~items + arg1[currentSelectedMovies[i]] = .true + end + end + + when arg2 == "DATA" then do + -- arg1 is a table whose indexes are the films. Each item is a directory + -- indexes are theater, date, and time. The other pages fill in the + -- directory. We just make sure only the selected movies are in the + -- table. + arg1~empty + currentSelectedMovies = self~getSelectedMovies + + do movie over currentSelectedMovies + d = .directory~new + arg1[movie] = d + end + end + + otherwise do + -- We do not handle any other queries. + nop + end + end + -- End select + + return 0 + +::method getSelectedMovies unguarded + expose lb + + count = lb~selectedItems + if count < 1 then return .array~new + + a = .array~new(count) + indexes = lb~selectedIndexes + do i over indexes~makeArray(" ") + a~append(lb~getText(i)) + end + + return a + + + +-- CinemasDlg +-- Dialog for the third page (interior page, theater selection.) +::class 'CinemasDlg' subclass UserPSPdialog + +::method defineDialog + expose buttonTable + + x = 21; y = 1 + self~createStaticText(-1, x, y, 100, 8, , "Selected movies:") + self~createComboBox(IDC_COMBO_CINEMAS, x, y + 12, 170, 75, "LIST SORT", "COMBOBOX") + + y += 15 * 2 + self~createGroupBox(-1, x, y, 170, 105, "", "Theaters") + + y += 10; x += 10 + self~createRadioButton(IDC_RB_CINEMAS_UPTOWN, x, y, 145, 12, "TABSTOP", "&Uptown San Jose Cinemas") + + y += 15 + self~createRadioButton(IDC_RB_CINEMAS_PALO, x, y, 145, 12, "", "&Palo Alto News Scene") + + y += 15 + self~createRadioButton(IDC_RB_CINEMAS_CHARLIES, x, y, 145, 12, "", "&Charlie's Suburban Barn Theater") + + y += 15 + self~createRadioButton(IDC_RB_CINEMAS_DRIVEIN, x, y, 145, 12, "", "&Drive-in above Highway 101") + + y += 15 + self~createRadioButton(IDC_RB_CINEMAS_GRAND, x, y, 145, 12, "", "&Grand Black n White Movies Monterey") + + y += 15 + self~createRadioButton(IDC_RB_CINEMAS_BROADWAY, x, y, 145, 12, "", "&Broadway Cinema San Francisco") + + first = self~resolveSymbolicID(IDC_RB_CINEMAS_FIRST) + last = self~resolveSymbolicID(IDC_RB_CINEMAS_LAST) + + self~connectComboBoxEvent(IDC_COMBO_CINEMAS, "SELENDOK", "onComboUpdate") + do i = first to last + self~connectButtonEvent(i, "CLICKED", onRBClick) + end + + buttonTable = .table~new + buttonTable["Uptown San Jose Cinemas"] = IDC_RB_CINEMAS_UPTOWN + buttonTable["Palo Alto News Scene"] = IDC_RB_CINEMAS_PALO + buttonTable["Charlie's Suburban Barn Theater"] = IDC_RB_CINEMAS_CHARLIES + buttonTable["Drive-in above Highway 101"] = IDC_RB_CINEMAS_DRIVEIN + buttonTable["Grand Black n White Movies Monterey"] = IDC_RB_CINEMAS_GRAND + buttonTable["Broadway Cinema San Francisco"] = IDC_RB_CINEMAS_BROADWAY + +::method initDialog + expose filmArray movieTheaters selectedMovies movieCombo + + filmArray = .array~new(20) + self~propSheet~querySiblings(filmArray, "FILMS") + + movieTheaters = .table~new + do movie over filmArray + movieTheaters[movie] = .nil + end + + selectedMovies = .array~new + + movieCombo = self~newComboBox(IDC_COMBO_CINEMAS) + +::method setActive unguarded + expose filmArray movieTheaters selectedMovies movieCombo + use arg propSheet + + propSheet~setWizButtons("BACK NEXT") + + selected = .table~new + selectedMovies~empty + propSheet~querySiblings(selected, "SELECTED") + + movieCombo~deleteAll + + -- For every movie, check if it is now selected. If it is, we add it to the + -- selected moveies combo box. If it isn't, we mark that movie as not having + -- a movie theater selected. We don't care what the previous setting was. + do movie over filmArray + if selected~hasIndex(movie) then do + movieCombo~add(movie) + selectedMovies~append(movie) + end + else do + movieTheaters[movie] = .nil + end + end + + if selected~items > 0 then do + movieCombo~selectIndex(1) + movie = movieCombo~selected + self~setRadioButtons(movie) + end + + return 0 + +-- wizNext() +-- The user clicked the next button. If there is not a theater selected for +-- each selected movie, we warn the user. We use wizNext() rather than +-- killActive() because killActive is invoked both when the user clicks the +-- Back and the Next buttons. If the user is going back, we don't want to put +-- up an annoying message box. +::method wizNext unguarded + expose selectedMovies movieTheaters movieCombo + use arg propSheet + + do movie over selectedMovies + if movieTheaters[movie] == .nil then do + msg = "Warning. You have not selected a movie theater for all".endOfLine"selected movies." || - + .endOfLine~copies(2) || "Are you sure you want to go to the next page?" + title = "Theater Selection is not Complete" + buttons = "YESNO" + icon = "WARNING" + style = "DEFBUTTON2 TASKMODAL" + + ans = MessageDialog(msg, propSheet~dlgHandle, title, buttons, icon, style) + + if ans == .PlainBaseDialog~IDYES then return 0 + + movieCombo~select(movie) + self~setRadioButtons(movie) + return -1 + end + end + + return 0 + +::method queryFromSibling unguarded + expose movieTheaters + use arg arg1, arg2, propSheet + + select + when arg2 == "DATA" then do + -- arg1 is a table whose indexes are the films. Each item is a directory + -- indexes are theater, date, and time. We only fill in the theater index + -- for any movie in the table. We do not care what our status is for the + -- theater, we just fill it in. + + do movie over arg1 + d = arg1[movie] + d~theater = movieTheaters[movie] + end + end + + otherwise do + -- We do not handle any of the other queries. + nop + end + end + -- End select + + return 0 + +::method onComboUpdate + expose movieTheaters movieCombo + + movie = movieCombo~selected + self~setRadioButtons(movie) + +::method onRBClick + expose movieTheaters movieCombo + use arg id, hwnd + + movie = movieCombo~selected + movieTheaters[movie] = self~newRadioButton(id)~getText~changestr("&", "") + +::method setRadioButtons private + expose movieTheaters buttonTable + use arg movie + + movieTheater = movieTheaters[movie] + + if movieTheater == .nil then id = 0 + else id = buttonTable[movieTheater] + + .RadioButton~checkInGroup(self, IDC_RB_CINEMAS_FIRST, IDC_RB_CINEMAS_LAST, id) + + + +-- DaysDlg +-- Dialog for the fourth page (interior page, date selection.) +::class 'DaysDlg' subclass UserPSPdialog + +::method defineDialog + expose buttonTable + + dayNames = .array~of('&Monday', '&Tuesday', '&Wednesday', 'T&hursday', '&Friday', '&Saturday', 'S&unday') + + x = 21; y = 1 + self~createStaticText(-1, x, y, 100, 8, , "Selected movies:") + self~createComboBox(IDC_COMBO_DAYS, x, y + 12, 170, 75, "LIST SORT", "COMBOBOX") + + -- The space on this page is rather tight, so we try to make the group box as + -- narrow as possible without clipping any of the radio buttons. I like a + -- margin of 10 within the group box. + y += 15 * 2 + cx = self~calcWidthRadioButtons(dayNames) + cy = self~sizeY - y + self~createGroupBox(-1, x, y, cx + 20, cy, "", "Day for Movie") + + -- We create the radio buttons in a loop, so we take advantage of that to do + -- the button event connections and other related tasks. + buttonTable = .table~new + first = self~resolveSymbolicID(IDC_RB_DAYS_FIRST) + last = self~resolveSymbolicID(IDC_RB_DAYS_LAST) + + y += 10; x += 10 + do id = first to last + day = dayNames[id - first + 1] + + self~createRadioButton(id, x, y, cx, 12, "", day) + + self~connectButtonEvent(id, "CLICKED", onRBClick) + buttonTable[day~changestr("&", "")] = id + y += 14 + end + + -- The movie bitmap is 238 X 178, convert that to dialog units and place at + -- the lower right corner. + s = .Size~new(238, 178) + self~pixel2dlgUnit(s) + + x = self~sizeX - s~width + y = self~sizeY - s~height + self~createStaticImage(IDC_ST_MOVIE_BMP, x, y, s~width, s~height, "BITMAP SIZEIMAGE CENTERIMAGE") + + self~connectComboBoxEvent(IDC_COMBO_DAYS, "SELENDOK", "onComboUpdate") + +-- calcWidthRadioButtons() +-- Given an array of the labels for a group of radio buttons, calculates the +-- smallest width necessary for the buttons so that the widest label is not +-- clipped. +::method calcWidthRadioButtons private + use strict arg labels + + width = 0 + + do l over labels + size = self~getTextSizeDu(l) + if size~width > width then width = size~width + end + + -- There doesn't seem to be any direct way to find out the width of the radio + -- button bitmap, the little round circle. But, some of the MSDN doc + -- *suggests* that it is 10 x 10 in dlus. + width += 10 + return width + +::method initDialog + expose filmArray movieDays selectedMovies movieCombo + + sd = locate() + staticImage = self~newStatic(IDC_ST_MOVIE_BMP) + size = staticImage~getRealSize + image = .Image~getImage(sd'rc\ticketWizardMovie.bmp', BITMAP, size) + staticImage~setImage(image) + + filmArray = .array~new(20) + self~propSheet~querySiblings(filmArray, "FILMS") + + movieDays = .table~new + do movie over filmArray + movieDays[movie] = .nil + end + + selectedMovies = .array~new + movieCombo = self~newComboBox(IDC_COMBO_DAYS) + +::method setActive unguarded + expose movieCombo selectedMovies filmArray movieDays + use arg propSheet + + propSheet~setWizButtons("BACK NEXT") + + selected = .table~new + selectedMovies~empty + propSheet~querySiblings(selected, "SELECTED") + + movieCombo~deleteAll + + do movie over filmArray + if selected~hasIndex(movie) then do + selectedMovies~append(movie) + movieCombo~add(movie) + end + else do + movieDays[movie] = .nil + end + end + + if selected~items > 0 then do + movieCombo~selectIndex(1) + movie = movieCombo~selected + self~setRadioButtons(movie) + end + + return 0 + +-- wizNext() +-- We check if the user has set the day for each selected movie. If not, we +-- warn the user, let the user decide if he wants to continue or not. +::method wizNext unguarded + expose selectedMovies movieDays movieCombo + use arg propSheet + + do movie over selectedMovies + if movieDays[movie] == .nil then do + msg = "Warning. You have not selected a day to attend the" || .endOfLine || - + "movie for all selected movies." || .endOfLine~copies(2) || - + "Are you sure you want to go to the next page?" + title = "Date Selection is not Complete" + buttons = "YESNO" + icon = "WARNING" + style = "DEFBUTTON2 TASKMODAL" + + ans = MessageDialog(msg, propSheet~dlgHandle, title, buttons, icon, style) + + if ans == .PlainBaseDialog~IDYES then return 0 + + movieCombo~select(movie) + self~setRadioButtons(movie) + return -1 + end + end + + return 0 + +::method queryFromSibling unguarded + expose movieDays + use arg arg1, arg2, propSheet + + select + when arg2 == "DATA" then do + -- arg1 is a table whose indexes are the films. Each item is a directory + -- indexes are theater, date, and time. We only fill in the date index + -- for any movie in the table. We do not care what our status is for the + -- theater, we just fill it in. + + do movie over arg1 + d = arg1[movie] + d~date = movieDays[movie] + end + end + + otherwise do + -- We do not handle any of the other queries. + nop + end + end + -- End select + return 0 + +::method onComboUpdate + expose movieCombo + + movie = movieCombo~selected + self~setRadioButtons(movie) + +::method onRBClick + expose movieDays movieCombo + use arg id, hwnd + + movie = movieCombo~selected + movieDays[movie] = self~newRadioButton(id)~getText~changestr("&", "") + +::method setRadioButtons private + expose movieDays buttonTable + use arg movie + + movieDay = movieDays[movie] + + if movieDay == .nil then id = 0 + else id = buttonTable[movieDay] + + .RadioButton~checkInGroup(self, IDC_RB_DAYS_FIRST, IDC_RB_DAYS_LAST, id) + + + +-- TicketDlg +-- Dialog for the fifth page (interior page, time selection and review.) +::class 'TicketDlg' subclass UserPSPdialog + +::method defineDialog + expose buttonTable + + x = 21; y = 1 + self~createStaticText(-1, x, y, 100, 8, , "Selected movies:") + self~createComboBox(IDC_COMBO_TIMES, x, y + 12, 170, 75, "LIST SORT", "COMBOBOX") + + label = "Theater:" + size = self~getTextSizeDu(label) + + y += 15 *2 + x1 = x + size~width + 1 + cx1 = 170 - size~width - 1 + + self~createStaticText(-1, x, y + 2, size~width, size~height, "RIGHT", label) + self~createBlackFrame(-1, x1, y, cx1, size~height + 6, "") + self~createStaticText(IDC_ST_TIMES_THEATER, x1 + 4, y + 2, cx1 - 8, size~height, "", "") + + y += 20 + self~createStaticText(-1, x, y + 2, size~width, size~height, "RIGHT", "Date:") + self~createBlackFrame(-1, x1, y, cx1, size~height + 6, "") + self~createStaticText(IDC_ST_TIMES_DAY, x1 + 4, y + 2, cx1 - 8, size~height, "", "") + + y += size~height + 6 + 4 + cy = self~sizeY - y + self~createGroupBox(-1, x, y, 60, cy, "", "Time:") + + times = .array~of("11:00", "17:00", "20:00", "22:00") + buttonTable = .table~new + first = self~resolveSymbolicID(IDC_RB_TIMES_FIRST) + last = self~resolveSymbolicID(IDC_RB_TIMES_LAST) + + x += 10; y += 10; cx = 40; cy = 12 + do id = first to last + time = times[id - first + 1] + + self~createRadioButton(id, x, y, cx, cy, "", time) + + self~connectButtonEvent(id, "CLICKED", onRBClick) + buttonTable[time] = id + y +=15 + end + + self~connectComboBoxEvent(IDC_COMBO_TIMES, "SELENDOK", "onComboUpdate") + +::method initDialog + expose filmArray selectedMovies movieTimes movieData movieCombo staticTheater staticDay + + filmArray = .array~new(20) + self~propSheet~querySiblings(filmArray, "FILMS") + + movieTimes = .table~new + do movie over filmArray + movieTimes[movie] = .nil + end + + -- We also need a table to keep track of the selected theaters and days sent + -- to us from the Cinemas and Days pages. + movieData = .table~new + + selectedMovies = .array~new + + movieCombo = self~newComboBox(IDC_COMBO_TIMES) + staticTheater = self~newStatic(IDC_ST_TIMES_THEATER) + staticDay = self~newStatic(IDC_ST_TIMES_DAY) + +::method setActive unguarded + expose filmArray selectedMovies movieCombo movieTimes movieData + use arg propSheet + + propSheet~setWizButtons("BACK NEXT") + + propSheet~querySiblings(movieData, "DATA") + + selected = .table~new + selectedMovies~empty + movieCombo~deleteAll + + propSheet~querySiblings(selected, "SELECTED") + + do movie over filmArray + if selected~hasIndex(movie) then do + movieCombo~add(movie) + selectedMovies~append(movie) + end + else do + movieTimes[movie] = .nil + end + end + + if selected~items > 0 then do + movieCombo~selectIndex(1) + movie = movieCombo~selected + self~setMovieData(movie) + end + + return 0 + +-- wizNext() +-- This is the last page before completion. Here we do not let the user +-- proceed unless every selected movie has each item (theater, day, and time) +-- specified. +::method wizNext unguarded + expose selectedMovies movieTimes movieData movieCombo + use arg propSheet + + -- We make two loops over the selected movies. The first is to force the + -- user to select a time for very selected movie. Once that passes, we then + -- loop over the movie data and check that the day and theater is specified + -- for each selected movie. If we find a piece of information missing in the + -- second loop, we return the user to the proper page to fill in the info. + + do movie over selectedMovies + if movieTimes[movie] == .nil then do + msg = "You have not selected a time to attend the" || .endOfLine || - + "movie:" movie || .endOfLine~copies(2) || - + "You must specify a time to attend each movie." + title = "Time Selection is not Complete" + buttons = "OK" + icon = "EXCLAMATION" + + ans = MessageDialog(msg, propSheet~dlgHandle, title, buttons, icon) + + movieCombo~select(movie) + self~setMovieData(movie) + return -1 + end + end + + do movie over selectedMovies + d = movieData[movie] + if d~theater == .nil then do + msg = "You have not selected a theater for the" || .endOfLine || - + "movie:" movie || .endOfLine~copies(2) || - + "You must specify a theater, day, and time" || .endOfLine || - + "for each movie ticket." + title = "Ticket Information is not Complete" + buttons = "OK" + icon = "EXCLAMATION" + + ans = MessageDialog(msg, propSheet~dlgHandle, title, buttons, icon) + + -- Return the page index of the Cinemas page to switch to that page + return 3 + end + + if d~date == .nil then do + msg = "You have not selected a day to attend the" || .endOfLine || - + "movie:" movie || .endOfLine~copies(2) || - + "You must specify a theater, day, and time" || .endOfLine || - + "for each movie ticket." + title = "Ticket Information is not Complete" + buttons = "OK" + icon = "EXCLAMATION" + + ans = MessageDialog(msg, propSheet~dlgHandle, title, buttons, icon) + + -- Return the page index of the Days page to switch to that page + return 4 + end + end + + return 0 + +::method queryFromSibling unguarded + expose movieTimes + use arg arg1, arg2, propSheet + + select + when arg2 == "DATA" then do + do movie over arg1 + d = arg1[movie] + d~time = movieTimes[movie] + end + end + + otherwise do + nop + end + end + -- End select + + return 0 + +::method onComboUpdate + expose movieCombo + + movie = movieCombo~selected + self~setMovieData(movie) + +::method onRBClick + expose movieTimes movieCombo + use arg id, hwnd + + movie = movieCombo~selected + movieTimes[movie] = self~newRadioButton(id)~getText~changestr("&", "") + +::method setMovieData private + expose movieTimes buttonTable movieData staticTheater staticDay + use arg movie + + movieTime = movieTimes[movie] + + if movieTime == .nil then id = 0 + else id = buttonTable[movieTime] + + .RadioButton~checkInGroup(self, IDC_RB_TIMES_FIRST, IDC_RB_TIMES_LAST, id) + + d = movieData[movie] + + if d~theater == .nil then text = "==> No theater was selected" + else text = d~theater + staticTheater~setText(text) + + if d~date == .nil then text = "==> No day selected" + else text = d~date + staticDay~setText(text) + + + +-- CompletionDlg +-- Dialog for the sixth page (exterior page, review and finish.) +::class 'CompletionDlg' subclass UserPSPDialog + +::method defineDialog + expose sd + + sd = locate() + + -- Watermark bitmap is 164 x 316. The wizard does not stretch the bitmap, + -- its size remains constant. So, the width of the bitmap, in dialog units, + -- changes as the font changes. pixel2dlgUnit() will convert the pixel size + -- of the bitmap to the correct dialog units for the font in use by this + -- dialog. + s = .Size~new(164, 314) + self~pixel2dlgUnit(s) + + x = s~width + 6 -- 6 dlus right of the edge of the watermark bitmap. + y = 8 -- From the Wizard97 specification. + cx = self~sizeX - x -- To the right side of the template, the wizard automatically adds 14 dlus. + cy = 3 * 12 -- Using 12 point font, takes 3 lines for the msg. + + self~createStaticText(IDC_ST_COMPLETE_MSG, x, y, cx, cy, "", "") + + -- Things are a little crowded on this page, so only add 4 dlus of space + -- between the top message and the next control. (Contrast this to the + -- IntroDlg.) + y += cy + 4 + self~createStaticText(-1, x, y, 165, 8, , "Ticket information for your selected movie(s):") + self~createComboBox(IDC_COMBO_COMPLETE, x, y + 12, 165, 63, "LIST SORT PARTIAL", "COMBOBOX") + + label = "Theater:" + size = self~getTextSizeDu(label) + + y += 15 * 2 + x1 = x + size~width + 1 + cx1 = 165 - size~width - 1 + + self~createStaticText(-1, x, y + 2, size~width, size~height, "", label) + self~createBlackFrame(-1, x1, y, cx1, size~height + 6) + self~createStaticText(IDC_ST_COMPLETE_THEATER, x1 + 4, y + 2, cx1 - 8, size~height) + + y += 20 + self~createStaticText(-1, x, y + 2, size~width, size~height, "", "Date:") + self~createBlackFrame(-1, x1, y, cx1, size~height + 6) + self~createStaticText(IDC_ST_COMPLETE_DAY, x1 + 4, y + 2, cx1 - 8, size~height) + + y += 20 + self~createStaticText(-1, x, y + 2, size~width, size~height, "", "Time:") + self~createBlackFrame(-1, x1, y, cx1, size~height + 6) + self~createStaticText(IDC_ST_COMPLETE_TIME, x1 + 4, y + 2, cx1 - 8, size~height) + + -- ticket.bmp is 204 x 80 pixels, convert to dialog units and place it in + -- the lower left corner. At the x margin. + s = .Size~new(204, 80) + self~pixel2dlgUnit(s) + + y = self~sizeY - s~height - 4 + + if .DlgUtil~comCtl32Version < 6 then do + self~createBitmapButton(IDC_PB_TICKET_BMP, x, y, s~width, s~height, "FRAME USEPAL STRETCH GROUP", "Get the Ticket", - + 'onGetTicket', sd"rc\ticketWizardTicket.bmp") + end + else do + self~createPushButton(IDC_PB_TICKET_BMP, x, y, s~width, s~height, "GROUP", "", 'onGetTicket') + end + + self~connectComboBoxEvent(IDC_COMBO_COMPLETE, "SELENDOK", "onComboUpdate") + +::method initDialog + expose movieCombo staticTheater staticDay staticTime sd + + msg = "Thank You For Using the ooRexx Movie Ticket Selectitron Wizard" + font1 = self~createFontEx("Verdana", 12, "BOLD") + + st1 = self~newStatic(IDC_ST_COMPLETE_MSG) + st1~setFont(font1) + st1~setText(msg) + + movieCombo = self~newComboBox(IDC_COMBO_COMPLETE) + staticTheater = self~newStatic(IDC_ST_COMPLETE_THEATER) + staticDay = self~newStatic(IDC_ST_COMPLETE_DAY) + staticTime = self~newStatic(IDC_ST_COMPLETE_TIME) + + if .DlgUtil~comCtl32Version < 6 then return + + bmpButton = self~newPushButton(IDC_PB_TICKET_BMP) + size = bmpButton~getRealSize + size~width -= 10; + size~height -= 10; + + sd = locate() + image = .Image~getImage(sd'rc\ticketWizardTicket.bmp', BITMAP, size) + imageList = .ImageList~create(size, COLOR8, 1, 0) + imageList~add(image) + + align = CENTER + margin = .Rect~new(5) + bmpButton~setImageList(imageList, margin, align) + +::method setActive unguarded + expose movieCombo staticTheater staticDay staticTime info + use arg propSheet + + propSheet~setWizButtons("BACK FINISH") + + info = .table~new + movieCombo~deleteAll + + ret = propSheet~querySiblings(info, "DATA") + + do movie over info + movieCombo~add(movie) + end + + movieCombo~selectIndex(1) + movie = movieCombo~selected + self~setMovieData(movie) + + return 0 + +-- onGetTicket() +-- This method is invoked when the user pushes the fancy bitmap button. We +-- simply, programmatically, press the Finish button because the action to +-- take is the same. +::method onGetTicket unguarded + self~propSheet~pressButton("FINISH") + +-- wizFinish() +-- Invoked when the user presses the Finish button. We use the ticket +-- information to display a, (slightly,) fancy message to the user telling her +-- where and when she can get her ticket(s). +::method wizFinish unguarded + expose info + use arg propSheet + + indexes = info~allIndexes + count = indexes~items + + theaterFirst = info[indexes[1]]~theater + smallTab = " "~copies(4) + doubleSpace = .endOfLine~copies(2) + + if count == 1 then ticketWord = "ticket" + else ticketWord = count "tickets" + + msg = "You can pick your" ticketWord "up now at the" || doubleSpace || - + smallTab || theaterFirst || doubleSpace || - + "box office. Or at" + + if count > 1 then do + theaterList = "" + do i = 2 to count + index = indexes[i] + theaterList ||= smallTab || info[index]~theater || .endOfLine + end + + msg ||= " one of the following" || .endOfLine || - + "theaters:" || doubleSpace || - + theaterList || .endOfLine || - + "within an hour from now." || doubleSpace || doubleSpace + + cost = "$" || (count * 15) "dollars." + end + else do + msg ||= " any other convenient time." || doubleSpace || doubleSpace + cost = "$15 dollars." + end + + msg ||= "Your bank account is debited" cost + + title = "ooRexx Movie Ticket Selectitron" + buttons = "OK" + icon = "INFORMATION" + + ans = MessageDialog(msg, propSheet~dlgHandle, title, buttons, icon) + + return 0 + +::method onComboUpdate + expose movieCombo + + movie = movieCombo~selected + self~setMovieData(movie) + +::method setMovieData private + expose staticTheater staticDay staticTime info + use arg movie + + d = info[movie] + staticTheater~setText(d~theater) + staticDay~setText(d~date) + staticTime~setText(d~time) + + + +-- FontPicker +-- Dialog that allows the user to pick different fonts for the example program. +-- This lets the user see how defineDialog() works with different fonts. +::class 'FontPicker' subclass RcDialog + +::method initAutoDetection + self~noAutoDetection + +::method initDialog + expose nameCB sizeCB + + nameCB = self~newComboBox(IDC_COMBO_NAME) + sizeCB = self~newComboBox(IDC_COMBO_SIZE) + + names = .array~of("Default", "Tahoma", "Courier", "MS Sans Serif") + sizes = .array~of("Default", '8 point', '10 point', '12 point', '16 point') + + do name over names + nameCB~add(name) + end + nameCB~select("Default") + + do size over sizes + sizeCB~add(size) + end + sizeCB~select("Default") + +::method ok + expose nameCB sizeCB + + fontName = nameCB~selected + if fontName == "Default" then fontName = .PlainBaseDialog~getFontName + + fontSize = sizeCB~selected~word(1) + if fontSize == "Default" then fontSize = .PlainBaseDialog~getFontSize + + .PlainBaseDialog~setDefaultFont(fontName, fontSize) + return self~ok:super + + +::routine setFont + + oldFont = .directory~new + oldFont~name = .PlainBaseDialog~getFontName + oldFont~size = .PlainBaseDialog~getFontSize + + sd = locate() + dlg = .FontPicker~new(sd"rc\ticketWizard.rc", IDD_FONT_PICKER, , , , 6) + if dlg~initCode == 0 then do + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + end + + return oldFont + +::routine restoreFont + use strict arg oldFont + .PlainBaseDialog~setDefaultFont(oldFont~name, oldFont~size) + return oldFont + + diff --git a/modules/windows/oodialog/rc/AnimalGame.h b/modules/windows/oodialog/rc/AnimalGame.h new file mode 100644 index 0000000..ae47cae --- /dev/null +++ b/modules/windows/oodialog/rc/AnimalGame.h @@ -0,0 +1,67 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ANIMALS 103 +#define IDBMP_RHINO 201 +#define IDBMP_TIGER 202 +#define IDBMP_ELEPHANT 203 +#define IDBMP_MOOSE 204 +#define IDBMP_GOAT 205 +#define IDBMP_DOG 206 +#define IDBMP_SEAL 207 +#define IDBMP_HORSE 208 +#define IDBMP_KANGURU 209 +#define IDC_PB_RHINO 2001 +#define IDC_PB_TIGER 2002 +#define IDC_PB_ELEPHANT 2003 +#define IDC_PB_MOOSE 2004 +#define IDC_PB_GOAT 2005 +#define IDC_PB_DOG 2006 +#define IDC_PB_SEAL 2007 +#define IDC_PB_HORSE 2008 +#define IDC_EDIT_RHINO 2021 +#define IDC_EDIT_TIGER 2022 +#define IDC_EDIT_ELEPHANT 2023 +#define IDC_EDIT_MOOSE 2024 +#define IDC_EDIT_GOAT 2025 +#define IDC_EDIT_DOG 2026 +#define IDC_EDIT_SEAL 2027 +#define IDC_EDIT_HORSE 2028 diff --git a/modules/windows/oodialog/rc/AnimalGame.rc b/modules/windows/oodialog/rc/AnimalGame.rc new file mode 100644 index 0000000..d723b18 --- /dev/null +++ b/modules/windows/oodialog/rc/AnimalGame.rc @@ -0,0 +1,111 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "AnimalGame.h" + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_DOG BITMAP "..\\bmp\\chihuahu.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_ELEPHANT BITMAP "..\\bmp\\eleph2.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_GOAT BITMAP "..\\bmp\\goat.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_HORSE BITMAP "..\\bmp\\horse.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_KANGURU BITMAP "..\\bmp\\kanguru.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_MOOSE BITMAP "..\\bmp\\moose.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_RHINO BITMAP "..\\bmp\\rhinoce.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_SEAL BITMAP "..\\bmp\\sealion.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDBMP_TIGER BITMAP "..\\bmp\\tiger.bmp" + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ANIMALS DIALOG 1, 0, 393, 314 +STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "What animals are these?" +FONT 9, "Arial" +{ + EDITTEXT IDC_EDIT_RHINO, 10, 113, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_TIGER, 104, 113, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_ELEPHANT, 198, 113, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_MOOSE, 292, 113, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_GOAT, 10, 236, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_DOG, 104, 236, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_SEAL, 198, 236, 92, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_HORSE, 292, 236, 92, 13, ES_AUTOHSCROLL + PUSHBUTTON "Rhino", IDC_PB_RHINO, 10, 10, 92, 100, BS_BITMAP + PUSHBUTTON "Tiger", IDC_PB_TIGER, 104, 10, 92, 100, BS_BITMAP + PUSHBUTTON "Elephant", IDC_PB_ELEPHANT, 198, 10, 92, 100, BS_BITMAP + PUSHBUTTON "Moose", IDC_PB_MOOSE, 292, 10, 92, 100, BS_BITMAP + PUSHBUTTON "Goat", IDC_PB_GOAT, 10, 134, 92, 100, BS_BITMAP + PUSHBUTTON "Dog", IDC_PB_DOG, 104, 134, 92, 100, BS_BITMAP + PUSHBUTTON "Seal", IDC_PB_SEAL, 198, 134, 92, 100, BS_BITMAP + PUSHBUTTON "Horse", IDC_PB_HORSE, 292, 134, 92, 100, BS_BITMAP + PUSHBUTTON "Help Me", IDHELP, 10, 290, 50, 14 + GROUPBOX "Write in the name of each animal below its picture", IDC_STATIC, 75, 262, 239, 42 + LTEXT "Tips: Click on an animal's picture to get a hint. Click Ok when finished, or to see which answers are correct / incorrect.", IDC_STATIC, 92, 280, 217, 20, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 333, 271, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 333, 290, 50, 14 +} diff --git a/modules/windows/oodialog/rc/calculator.rc b/modules/windows/oodialog/rc/calculator.rc new file mode 100644 index 0000000..f64bd0a --- /dev/null +++ b/modules/windows/oodialog/rc/calculator.rc @@ -0,0 +1,117 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** +calculator.rc + +produced by IBM Object REXX Resource Workshop + +*****************************************************************************/ +#include + +#define DIALOG_1 100 +#define BNo1 101 +#define BNo2 102 +#define BNo3 103 +#define BNo4 104 +#define BNo5 105 +#define BNo6 106 +#define BNo7 107 +#define BNo8 108 +#define BNo9 109 +#define BNo0 110 +#define BCalc 111 +#define BClear 112 +#define TLine 113 +#define BSign 114 +#define BPoint 115 +#define BDivide 116 +#define BTimes 117 +#define BMinus 118 +#define BPlus 119 +#define BArcSin 120 +#define BSqrt 121 +#define BLog 122 +#define BPi 123 +#define BSinus 124 +#define BCosinus 125 +#define BTangens 126 +#define BArcCos 127 +#define BBackspace 128 +#define BArcTan 129 +#define BLog10 130 + +DIALOG_1 DIALOG 13, 20, 222, 212 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX +CAPTION "Calculator" +FONT 10, "MS Shell Dlg" +{ + EDITTEXT TLine, 13, 13, 188, 14, ES_READONLY | WS_BORDER | WS_TABSTOP + PUSHBUTTON "1", BNo1, 20, 39, 14, 14 + PUSHBUTTON "2", BNo2, 46, 39, 14, 14 + PUSHBUTTON "3", BNo3, 72, 39, 14, 14 + PUSHBUTTON "4", BNo4, 20, 65, 14, 14 + PUSHBUTTON "5", BNo5, 46, 65, 14, 14 + PUSHBUTTON "6", BNo6, 72, 65, 14, 14 + PUSHBUTTON "7", BNo7, 20, 91, 14, 14 + PUSHBUTTON "8", BNo8, 46, 91, 14, 14 + PUSHBUTTON "9", BNo9, 72, 91, 14, 14 + PUSHBUTTON "0", BNo0, 20, 117, 14, 14 + PUSHBUTTON "+/-", BSign, 46, 117, 14, 14 + PUSHBUTTON ".", BPoint, 72, 117, 14, 14 + PUSHBUTTON "/", BDivide, 111, 39, 14, 14 + PUSHBUTTON "*", BTimes, 111, 65, 14, 14 + PUSHBUTTON "-", BMinus, 111, 91, 14, 14 + PUSHBUTTON "+", BPlus, 111, 117, 14, 14 + PUSHBUTTON "Sqrt", BSqrt, 137, 39, 27, 14 + PUSHBUTTON "Log", BLog, 137, 65, 27, 14 + PUSHBUTTON "Log10", BLog10, 137, 91, 27, 14 + PUSHBUTTON "Pi", BPi, 137, 117, 27, 14 + PUSHBUTTON "<-", BBackspace, 177, 39, 24, 14 + PUSHBUTTON "Clear", BClear, 177, 65, 24, 14 + DEFPUSHBUTTON "=", BCalc, 177, 91, 24, 14 + PUSHBUTTON "Exit", IDOK, 177, 117, 24, 14 + PUSHBUTTON "Sin", BSinus, 20, 150, 27, 14 + PUSHBUTTON "Cos", BCosinus, 60, 150, 27, 14 + PUSHBUTTON "Tan", BTangens, 100, 150, 27, 14 + PUSHBUTTON "ArcSin", BArcSin, 20, 176, 27, 14 + PUSHBUTTON "ArcCos", BArcCos, 60, 176, 27, 14 + PUSHBUTTON "ArcTan", BArcTan, 100, 176, 27, 14 + LTEXT "ooRexx ooDialog Demo Calculator", -1, 152, 152, 50, 41 + CONTROL "", -1, "static", SS_GRAYFRAME | WS_CHILD | WS_VISIBLE, 13, 33, 81, 106 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 6, 7, 210, 197 +} diff --git a/modules/windows/oodialog/rc/exercise.rc b/modules/windows/oodialog/rc/exercise.rc new file mode 100644 index 0000000..537a320 --- /dev/null +++ b/modules/windows/oodialog/rc/exercise.rc @@ -0,0 +1,66 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/********************************************************************** + +exercise.rc + +produced by IBM Resource Workshop + +***********************************************************************/ +#include + +#define DIALOG_1 1 + +100 DIALOG 26, 28, 263, 163 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Exercise Dialog" +FONT 10, "MS Shell Dlg" +{ + CONTROL "Entryline", 10, "EDIT", WS_BORDER | WS_TABSTOP, 56, 8, 198, 14 + CONTROL "ComboBox", 11, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 59, 36, 193, 77 + AUTORADIOBUTTON "I &like OREXX", 12, 7, 66, 57, 12, BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "I &dont like OREXX", 13, 7, 79, 72, 12 + AUTOCHECKBOX "Checkbox", 14, 7, 98, 60, 12 + CONTROL "List", 15, "LISTBOX", LBS_STANDARD | WS_TABSTOP, 86, 63, 159, 57 + DEFPUSHBUTTON "OK", 1, 83, 139, 50, 14 + PUSHBUTTON "Cancel", 2, 143, 139, 50, 14 + PUSHBUTTON "Help", 9, 203, 139, 50, 14 + LTEXT "Field 1", -1, 9, 11, 43, 8 + LTEXT "Combo", -1, 9, 37, 44, 8 +} + diff --git a/modules/windows/oodialog/rc/ldvideo.h b/modules/windows/oodialog/rc/ldvideo.h new file mode 100644 index 0000000..50a5f96 --- /dev/null +++ b/modules/windows/oodialog/rc/ldvideo.h @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_VIDEO_DLG 102 +#define IDC_EDIT_TAPE_NO 1000 +#define IDC_EDIT_TAPE_LABEL 3002 +#define IDC_EDIT_FILM1 3003 +#define IDC_EDIT_FILM2 3004 +#define IDC_EDIT_FILM3 3005 +#define IDC_EDIT_FILM4 3006 +#define IDC_CB_LOCATION 3007 +#define IDC_LB_LENT_TO 3008 +#define IDC_CK_LONGPLAY 3009 +#define IDC_CK_HIFI 3010 +#define IDC_CK_WRITEPROTECT 3011 +#define IDC_RB_C120 3012 +#define IDC_RB_C180 3013 +#define IDC_RB_C240 3014 diff --git a/modules/windows/oodialog/rc/ldvideo.rc b/modules/windows/oodialog/rc/ldvideo.rc new file mode 100644 index 0000000..82c2b74 --- /dev/null +++ b/modules/windows/oodialog/rc/ldvideo.rc @@ -0,0 +1,81 @@ +/*----------------------------------------------------------------------------*/ +r/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "ldvideo.h" + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_VIDEO_DLG DIALOG 67, 32, 288, 251 +STYLE DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Video Archive" +FONT 10, "MS Shell Dlg" +{ + EDITTEXT IDC_EDIT_TAPE_NO, 64, 17, 42, 13, ES_AUTOHSCROLL + PUSHBUTTON "&Search", 3001, 110, 16, 37, 15 + EDITTEXT IDC_EDIT_TAPE_LABEL, 64, 37, 85, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_FILM1, 80, 72, 175, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_FILM2, 80, 92, 175, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_FILM3, 80, 111, 175, 13, ES_AUTOHSCROLL + EDITTEXT IDC_EDIT_FILM4, 80, 130, 175, 13, ES_AUTOHSCROLL + COMBOBOX IDC_CB_LOCATION, 80, 168, 119, 43, WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT + LISTBOX IDC_LB_LENT_TO, 80, 188, 119, 49, WS_TABSTOP | WS_HSCROLL | WS_VSCROLL | LBS_NOINTEGRALHEIGHT | LBS_SORT | LBS_NOTIFY + AUTOCHECKBOX "Long&play", IDC_CK_LONGPLAY, 172, 15, 45, 10 + AUTOCHECKBOX "&Hifi - quality", IDC_CK_HIFI, 172, 28, 53, 10 + AUTOCHECKBOX "&Writeprotect", IDC_CK_WRITEPROTECT, 172, 41, 55, 10 + AUTORADIOBUTTON "C120", IDC_RB_C120, 232, 15, 31, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "C180", IDC_RB_C180, 232, 27, 31, 10 + AUTORADIOBUTTON "C240", IDC_RB_C240, 232, 40, 31, 10 + DEFPUSHBUTTON "OK", 1, 217, 166, 50, 14 + PUSHBUTTON "Cancel", 2, 217, 188, 50, 14 + LTEXT "Tape&number", 2008, 18, 18, 43, 11, SS_LEFT + LTEXT "Tape label", 2006, 18, 38, 38, 11, SS_LEFT + LTEXT "Film &1", 2001, 36, 74, 23, 11, SS_LEFT + LTEXT "Film 2", 2002, 36, 93, 22, 11, SS_LEFT + LTEXT "Film 3", 2003, 36, 112, 23, 11, SS_LEFT + LTEXT "Film 4", 2004, 36, 131, 24, 11, SS_LEFT + LTEXT "&Location", 2005, 36, 169, 32, 11, SS_LEFT + LTEXT "Lent to", 2007, 36, 188, 26, 11, SS_LEFT + GROUPBOX "Specification", -1, 12, 4, 145, 51 + GROUPBOX "Titles", -1, 12, 61, 261, 89 + GROUPBOX "Location and Possession", -1, 12, 156, 261, 86 + GROUPBOX "Tape&information", -1, 165, 3, 105, 51, WS_GROUP +} diff --git a/modules/windows/oodialog/rc/oodStandardDialogs.h b/modules/windows/oodialog/rc/oodStandardDialogs.h new file mode 100644 index 0000000..e74f75c --- /dev/null +++ b/modules/windows/oodialog/rc/oodStandardDialogs.h @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDI_APP_ICON 500 +#define IDD_STDDLGS 103 +#define IDC_RB_CHECKLIST 1003 +#define IDC_RB_INPUTBOX 1006 +#define IDC_RB_INTEGERBOX 1007 +#define IDC_RB_MULTIINPUTBOX 1011 +#define IDC_RB_LISTCHOICE 1012 +#define IDC_RB_MULTILISTCHOICE 1013 +#define IDC_RB_PASSWORDBOX 1017 +#define IDC_RB_SINGLESELECTION 1018 +#define IDC_RB_TIMEDMESSAGE 1019 + +#define IDD_STDRTNS 104 +#define IDI_APP_ICON_R 600 +#define IDC_RB_CHECKLIST_R 1022 +#define IDC_RB_ASKDIALOG_R 1023 +#define IDC_RB_INPUTBOX_R 1024 +#define IDC_RB_INTEGERBOX_R 1025 +#define IDC_RB_MULTIINPUTBOX_R 1026 +#define IDC_RB_LISTCHOICE_R 1027 +#define IDC_RB_MULTILISTCHOICE_R 1028 +#define IDC_RB_PASSWORDBOX_R 1029 +#define IDC_RB_SINGLESELECTION_R 1030 +#define IDC_RB_TIMEDMESSAGE_R 1031 +#define IDC_RB_ERRORDIALOG_R 1032 +#define IDC_RB_FILENAMEDIALOG_R 1033 +#define IDC_RB_INFODIALOG_R 1034 +#define IDC_RB_MESSAGEDIALOG_R 1035 diff --git a/modules/windows/oodialog/rc/oodStandardDialogs.rc b/modules/windows/oodialog/rc/oodStandardDialogs.rc new file mode 100644 index 0000000..f6da8ea --- /dev/null +++ b/modules/windows/oodialog/rc/oodStandardDialogs.rc @@ -0,0 +1,95 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "oodStandardDialogs.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_STDDLGS DIALOGEX 0, 0, 413, 201 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "User Input Common Dialog Library" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + LTEXT "The ooDialog framework provides a number of easy to use dialogs that obtain user input in a standard way. These dialogs allow programmers to include simple graphical elements in their Rexx applications and collect user input in a standard way.", IDC_STATIC, 77, 10, 258, 37, SS_LEFT + GROUPBOX "Select the Common Dialog to Display", IDC_STATIC, 11, 58, 392, 107 + AUTORADIOBUTTON "CheckList Dialog", IDC_RB_CHECKLIST, 25, 79, 90, 10 + AUTORADIOBUTTON "InputBox Dialog", IDC_RB_INPUTBOX, 159, 79, 90, 10 + AUTORADIOBUTTON "Integer Dialog", IDC_RB_INTEGERBOX, 272, 79, 90, 10 + AUTORADIOBUTTON "ListChoice Dialog", IDC_RB_LISTCHOICE, 25, 107, 90, 10 + AUTORADIOBUTTON "MultiInputBox Dialog", IDC_RB_MULTIINPUTBOX, 159, 107, 90, 10 + AUTORADIOBUTTON "MultiListChoice Dialog", IDC_RB_MULTILISTCHOICE, 272, 107, 90, 10 + AUTORADIOBUTTON "PasswordBox Dialog", IDC_RB_PASSWORDBOX, 25, 134, 90, 10 + AUTORADIOBUTTON "SingleSelection Dialog", IDC_RB_SINGLESELECTION, 159, 134, 90, 10 + AUTORADIOBUTTON "TimedMessage Dialog", IDC_RB_TIMEDMESSAGE, 272, 134, 90, 10 + DEFPUSHBUTTON "Display Selected Dialog", IDOK, 161, 177, 90, 14 + PUSHBUTTON "Close", IDCANCEL, 353, 177, 50, 14 +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_STDRTNS DIALOGEX 0, 0, 413, 201 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "User Input Common Public Routines" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + LTEXT "The ooDialog framework provides a number of easy to use public routines that obtain user input in a standard way. These routines allow the use of simple graphical elements in Rexx applications that collect user input in a standard way.", IDC_STATIC, 10, 10, 393, 18, SS_LEFT + GROUPBOX "Select the Common Public Routine to Display", IDC_STATIC, 11, 33, 392, 139 + AUTORADIOBUTTON "AskDialog Routine", IDC_RB_ASKDIALOG_R, 25, 56, 90, 10 + AUTORADIOBUTTON "CheckList Routine", IDC_RB_CHECKLIST_R, 159, 56, 90, 10 + AUTORADIOBUTTON "ErrorDialog Routine", IDC_RB_ERRORDIALOG_R, 272, 56, 90, 10 + AUTORADIOBUTTON "FileNameDialog Routine", IDC_RB_FILENAMEDIALOG_R, 25, 79, 90, 10 + AUTORADIOBUTTON "InfoDialog Routine", IDC_RB_INFODIALOG_R, 159, 79, 90, 10 + AUTORADIOBUTTON "InputBox Routine", IDC_RB_INPUTBOX_R, 272, 79, 90, 10 + AUTORADIOBUTTON "IntegerBox Routine", IDC_RB_INTEGERBOX_R, 25, 103, 90, 10 + AUTORADIOBUTTON "ListChoice Routine", IDC_RB_LISTCHOICE_R, 159, 103, 90, 10 + AUTORADIOBUTTON "MessageDialog Routine", IDC_RB_MESSAGEDIALOG_R, 272, 103, 90, 10 + AUTORADIOBUTTON "MultiInputBox Routine", IDC_RB_MULTIINPUTBOX_R, 25, 128, 90, 10 + AUTORADIOBUTTON "MultiListChoice Routine", IDC_RB_MULTILISTCHOICE_R, 159, 128, 90, 10 + AUTORADIOBUTTON "PasswordBox Routine", IDC_RB_PASSWORDBOX_R, 272, 128, 90, 10 + AUTORADIOBUTTON "SingleSelection Routine", IDC_RB_SINGLESELECTION_R, 25, 152, 90, 10 + AUTORADIOBUTTON "TimedMessage Routine", IDC_RB_TIMEDMESSAGE_R, 159, 152, 90, 10 + DEFPUSHBUTTON "Display Selected Routine", IDOK, 161, 177, 90, 14 + PUSHBUTTON "Close", IDCANCEL, 353, 177, 50, 14 +} + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_APP_ICON_R ICON ".\\oodStandardRoutines.ico" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_APP_ICON ICON ".\\oodStandardDialog.ico" diff --git a/modules/windows/oodialog/rc/oodpbar.rc b/modules/windows/oodialog/rc/oodpbar.rc new file mode 100644 index 0000000..173dfb5 --- /dev/null +++ b/modules/windows/oodialog/rc/oodpbar.rc @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +oodpbar.rc + +*****************************************************************************/ + +#include + +#define IDD_ONE 100 +#define IDC_PBAR_A 110 +#define IDC_PBAR_B 111 +#define IDC_PBAR_C 112 +#define IDC_PBAR_D 113 +#define IDC_PBAR_E 114 + +IDD_ONE DIALOG 13, 25, 280, 180 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Progress Bars" +FONT 10, "MS Shell Dlg" +{ + CONTROL "", IDC_PBAR_A, "msctls_progress32", PBS_VERTICAL | WS_CHILD | WS_VISIBLE | WS_BORDER, 19, 22, 13, 130 + CONTROL "", IDC_PBAR_B, "msctls_progress32", PBS_SMOOTH | PBS_VERTICAL | WS_CHILD | WS_VISIBLE, 59, 22, 13, 130 + CONTROL "", IDC_PBAR_C, "msctls_progress32", PBS_VERTICAL | WS_CHILD | WS_VISIBLE | WS_BORDER, 99, 22, 13, 130 + CONTROL "", IDC_PBAR_D, "msctls_progress32", PBS_SMOOTH | PBS_VERTICAL | WS_CHILD | WS_VISIBLE, 139, 22, 13, 130 + CONTROL "", IDC_PBAR_E, "msctls_progress32", PBS_VERTICAL | WS_CHILD | WS_VISIBLE | WS_BORDER, 179, 22, 13, 130 + DEFPUSHBUTTON "Step", IDOK, 223, 13, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 223, 31, 50, 14 + PUSHBUTTON "Help", IDHELP, 223, 53, 50, 14 + LTEXT "0", 11, 14, 160, 18, 8 + LTEXT "0", 21, 54, 160, 18, 8 + LTEXT "0", 31, 94, 160, 18, 8 + LTEXT "0", 41, 136, 160, 18, 8 + LTEXT "0", 51, 175, 160, 18, 8 + LTEXT "100", -1, 14, 10, 22, 8 + LTEXT "100", -1, 54, 10, 26, 8 + LTEXT "100", -1, 94, 10, 26, 8 + LTEXT "100", -1, 135, 10, 26, 8 + LTEXT "100", -1, 175, 10, 26, 8 +} diff --git a/modules/windows/oodialog/rc/oophil1.rc b/modules/windows/oodialog/rc/oophil1.rc new file mode 100644 index 0000000..d259f74 --- /dev/null +++ b/modules/windows/oodialog/rc/oophil1.rc @@ -0,0 +1,70 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oophil1.rc The resource script for the set up dialog for oophil.rex + */ + +#include +#include + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +101 DIALOG 86, 68, 211, 125 +STYLE DS_MODALFRAME | DS_SETFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Philosophers' Forks Setup" +FONT 10, "MS Shell Dlg" +{ + EDITTEXT 101, 87, 11, 36, 12, ES_NUMBER + CONTROL "", 107, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_SETBUDDYINT, 111, 11, 12, 12 + EDITTEXT 102, 87, 37, 36, 12, ES_NUMBER + CONTROL "", 108, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_SETBUDDYINT, 111, 37, 12, 12 + EDITTEXT 103, 87, 62, 36, 12, ES_NUMBER + CONTROL "", 109, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY | UDS_SETBUDDYINT, 111, 62, 12, 12 + CONTROL "", -1, WC_STATIC, SS_BLACKFRAME, 134, 7, 68, 50 + AUTORADIOBUTTON "&Left hand first", 104, 137, 11, 60, 12 + AUTORADIOBUTTON "&Right hand first", 105, 137, 26, 62, 12 + AUTORADIOBUTTON "&Any hand first", 106, 137, 41, 59, 12 + LTEXT "&Sleeping time (100 ms)", -1, 7, 13, 76, 8, NOT WS_GROUP | SS_LEFT + LTEXT "&Eating time (100 ms)", -1, 7, 39, 71, 8, NOT WS_GROUP | SS_LEFT + LTEXT "&Number of repeats", -1, 7, 64, 71, 8, NOT WS_GROUP | SS_LEFT + CONTROL "", -1, WC_STATIC, SS_BLACKFRAME, 3, 85, 141, 34 + AUTO3STATE "Button", 110, 5, 87, 138, 30, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | NOT WS_TABSTOP + DEFPUSHBUTTON "OK", 1, 153, 64, 50, 14 + PUSHBUTTON "Cancel", 2, 153, 84, 50, 14 + PUSHBUTTON "&Help", 9, 153, 104, 50, 14 +} diff --git a/modules/windows/oodialog/rc/oophil2.rc b/modules/windows/oodialog/rc/oophil2.rc new file mode 100644 index 0000000..bb0d748 --- /dev/null +++ b/modules/windows/oodialog/rc/oophil2.rc @@ -0,0 +1,75 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog\Samples\rc\oophil2.rc Philosophers' Forks Animation */ +/*--------------------------------------------------------------------*/ + +#include + +100 DIALOG 0, 0, 282, 236 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Philosophers' Forks Animation" +FONT 10, "MS Shell Dlg" +{ + AUTO3STATE "Button", 101, 108, 4, 65, 65, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 102, 216, 33, 65, 65, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 103, 193, 145, 65, 65, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 104, 26, 145, 65, 65, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 105, 1, 33, 65, 65, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 106, 186, 31, 15, 38, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 107, 262, 145, 15, 38, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 108, 134, 192, 15, 38, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 109, 6, 145, 15, 38, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 110, 79, 31, 15, 38, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 111, 130, 71, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 112, 238, 99, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 113, 215, 211, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 114, 48, 211, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 115, 23, 99, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 120, 91, 94, 102, 70, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 121, 108, 71, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 122, 153, 71, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 131, 216, 99, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 132, 261, 99, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 141, 193, 211, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 142, 238, 211, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 151, 26, 211, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 152, 71, 211, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 161, 1, 99, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "Button", 162, 46, 99, 20, 19, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Stop", 1, 126, 170, 31, 14 +} diff --git a/modules/windows/oodialog/rc/sample.rc b/modules/windows/oodialog/rc/sample.rc new file mode 100644 index 0000000..84d3ea0 --- /dev/null +++ b/modules/windows/oodialog/rc/sample.rc @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog\Samples\rc\sample.rc ooDialog Samples Main */ +/*--------------------------------------------------------------------*/ + +#include + +100 DIALOG 4, 32, 465, 281 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Open Object Rexx ooDialog Samples" +FONT 10, "MS Shell Dlg" +{ + PUSHBUTTON "E&xit", 2, 8, 254, 50, 14 + PUSHBUTTON "About", 9, 68, 254, 50, 14 + AUTO3STATE "video", 101, 155, 15, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "pet", 102, 259, 15, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "philosoph", 103, 155, 83, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "inst", 104, 259, 83, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "walker", 105, 155, 151, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "bandit", 106, 259, 151, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "user", 107, 155, 217, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "category", 108, 259, 217, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "tree", 109, 363, 15, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "list", 110, 363, 83, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "bar", 111, 363, 151, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + AUTO3STATE "prop", 112, 363, 217, 85, 50, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP +} + diff --git a/modules/windows/oodialog/rc/walker.h b/modules/windows/oodialog/rc/walker.h new file mode 100644 index 0000000..6abba85 --- /dev/null +++ b/modules/windows/oodialog/rc/walker.h @@ -0,0 +1,55 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#define IDD_WALKER 100 +#define IDC_EDIT_MOVEX 101 +#define IDC_EDIT_MOVEY 102 +#define IDC_EDIT_DELAY 103 +#define IDC_CB_SMOOTH 104 +#define IDC_CB_GOTCHA 106 +#define IDC_PB_RESTART 107 +#define IDC_DRAW_BUTTON 105 + +#define ID_BMP_FIG1 201 +#define ID_BMP_FIG2 202 +#define ID_BMP_FIG3 203 +#define ID_BMP_FIG4 204 +#define ID_BMP_FIG5 205 +#define ID_BMP_FIG6 206 +#define ID_BMP_FIG7 207 +#define ID_BMP_FIG8 208 + diff --git a/modules/windows/oodialog/rc/walker.rc b/modules/windows/oodialog/rc/walker.rc new file mode 100644 index 0000000..ba633e7 --- /dev/null +++ b/modules/windows/oodialog/rc/walker.rc @@ -0,0 +1,71 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* samples\ooDialog\rc\walker.rc Animation demo */ +/*--------------------------------------------------------------------*/ + +#include +#include + +IDD_WALKER DIALOG 7, 19, 347, 255 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Animation Demonstration - Sprites with Open Object Rexx" +FONT 10, "MS Shell Dlg" +{ + EDITTEXT IDC_EDIT_MOVEX, 45, 23, 25, 12, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP + EDITTEXT IDC_EDIT_MOVEY, 118, 23, 25, 12, ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP + EDITTEXT IDC_EDIT_DELAY, 199, 23, 38, 12, WS_BORDER | WS_TABSTOP + AUTOCHECKBOX "&Smooth corner wrap", IDC_CB_SMOOTH, 260, 22, 77, 15 + AUTOCHECKBOX "&Quit on 'Got-cha'", IDC_CB_GOTCHA, 12, 237, 77, 15 + PUSHBUTTON "Restart", IDC_PB_RESTART, 230, 237, 50, 14, WS_DISABLED + DEFPUSHBUTTON "OK", IDOK, 290, 237, 50, 14 + CONTROL "Button1", IDC_DRAW_BUTTON, "BUTTON", BS_OWNERDRAW | WS_TABSTOP, 3, 62, 341, 164 + CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 1, 58, 345, 170 + LTEXT "Move &X:", -1, 12, 25, 30, 9 + LTEXT "Move &Y:", -1, 87, 25, 28, 9 + LTEXT "&Delay:", -1, 172, 24, 24, 10 + GROUPBOX "Move sequence", -1, 1, 6, 345, 40, BS_GROUPBOX | WS_CHILD | WS_VISIBLE +} + +ID_BMP_FIG1 BITMAP "..\\bmp\\wlkfig1.bmp" +ID_BMP_FIG2 BITMAP "..\\bmp\\wlkfig2.bmp" +ID_BMP_FIG3 BITMAP "..\\bmp\\wlkfig3.bmp" +ID_BMP_FIG4 BITMAP "..\\bmp\\wlkfig4.bmp" +ID_BMP_FIG5 BITMAP "..\\bmp\\wlkfig5.bmp" +ID_BMP_FIG6 BITMAP "..\\bmp\\wlkfig6.bmp" +ID_BMP_FIG7 BITMAP "..\\bmp\\wlkfig7.bmp" +ID_BMP_FIG8 BITMAP "..\\bmp\\wlkfig8.bmp" diff --git a/modules/windows/oodialog/res/AnimalGame.dll b/modules/windows/oodialog/res/AnimalGame.dll new file mode 100644 index 0000000..95990d3 Binary files /dev/null and b/modules/windows/oodialog/res/AnimalGame.dll differ diff --git a/modules/windows/oodialog/res/oowalk2.dll b/modules/windows/oodialog/res/oowalk2.dll new file mode 100644 index 0000000..2e5930e Binary files /dev/null and b/modules/windows/oodialog/res/oowalk2.dll differ diff --git a/modules/windows/oodialog/res/res.mak b/modules/windows/oodialog/res/res.mak new file mode 100644 index 0000000..6dc9932 --- /dev/null +++ b/modules/windows/oodialog/res/res.mak @@ -0,0 +1,71 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +#/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ +# NMAKE-compatible MAKE file for ooDialog resource DLLs + +rcflags_common = /DWIN32 /v + +all: oowalk2.dll AnimalGame.dll ..\propertySheet.tabControls\rc\PropertySheetDemo.dll \ + ..\propertySheet.tabControls\rc\TabOwnerDemo.dll ..\resizableDialogs\ResizingAdmin\rc\PropertySheetDemo.dll + +oowalk2.dll: oowalk2.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:$(@B).dll + +AnimalGame.dll: AnimalGame.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:$(@B).dll + +..\propertySheet.tabControls\rc\PropertySheetDemo.dll: PropertySheetDemo.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:..\propertySheet.tabControls\rc\$(@B).dll + +..\propertySheet.tabControls\rc\TabOwnerDemo.dll: TabOwnerDemo.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:..\propertySheet.tabControls\rc\$(@B).dll + +..\resizableDialogs\ResizingAdmin\rc\PropertySheetDemo.dll: PropertySheetDemo.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) -out:..\resizableDialogs\ResizingAdmin\rc\$(@B).dll + +# Create .res from .rc +oowalk2.res: ..\rc\walker.rc + rc $(rcflags_common) -r -fo$(@B).res ..\rc\walker.rc + +AnimalGame.res: ..\rc\AnimalGame.rc + rc $(rcflags_common) -r -fo$(@B).res ..\rc\AnimalGame.rc + +PropertySheetDemo.res: ..\propertySheet.tabControls\rc\PropertySheetDemo.rc + rc $(rcflags_common) -r -fo$(@B).res ..\propertySheet.tabControls\rc\PropertySheetDemo.rc + +TabOwnerDemo.res: ..\propertySheet.tabControls\rc\TabOwnerDemo.rc + rc $(rcflags_common) -r -fo$(@B).res ..\propertySheet.tabControls\rc\TabOwnerDemo.rc diff --git a/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemo.h b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemo.h new file mode 100644 index 0000000..ba1a58e --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemo.h @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* + * Symbolic resource IDs for the dlgAreaUDemo (dlgAreUDemo.rex and + * dlgAreaUDemoTwo.rex) programs. + */ + +#define IDC_ST_STATUS 111 +#define IDC_EDIT 112 +#define IDC_PB_0 113 +#define IDC_PB_1 114 +#define IDC_PB_2 115 +#define IDC_PB_3 116 +#define IDC_PB_4 117 +#define IDC_PB_5 118 +#define IDC_PB_6 119 diff --git a/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemo.rex b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemo.rex new file mode 100755 index 0000000..5ca13e7 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemo.rex @@ -0,0 +1,101 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2006-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* DlgAreaDemo.Rex -- Demonstrate DlgArea & DlgAreaU Classes -- Feb 2006 */ + +sd = locate() +.application~useGlobalConstDir("O", sd'dlgAreaUDemo.h') + +MyDlg=.MyDialog~new +MyDlg~execute('ShowTop') + +return 0 + +::requires "ooDialog.cls" +/* ========================================================================= */ +::class MyDialog Subclass UserDialog +/* ========================================================================= */ +::method init +/* ------------------------------------------------------------------------- */ + forward class (super) continue + success=self~createCenter(250,250,'My Resizable Dialog',, + 'ThickFrame MinimizeBox MaximizeBox',,, + 'MS Sans Serif',8) + if \success then do + self~initCode = 1 + return + end + + self~connectResize('OnResize', .true) + +/* ------------------------------------------------------------------------- */ +::method defineDialog +/* ------------------------------------------------------------------------- */ +expose u + +u=.dlgAreaU~new(self) /* whole dlg */ +if u~lastError \= .nil then call errorDialog u~lastError + +u~noResizePut(IDC_PB_0) +e=.dlgArea~new(u~x , u~y , u~w('70%'), u~h('90%')) /* edit area */ +s=.dlgArea~new(u~x , u~y('90%'), u~w('70%'), u~hr ) /* status area */ +b=.dlgArea~new(u~x('70%'), u~y , u~wr , u~hr ) /* button area */ + +self~createEdit(IDC_EDIT, e~x, e~y, e~w, e~h, 'multiline', 'text') +self~createStaticText(IDC_ST_STATUS, s~x, s~y, s~w, s~h, , 'Status info appears here') + +self~createPushButton(IDC_PB_0, b~x, b~y('00%'), b~w, b~h('9%'), , 'Button' 0, 'Button'||0) +self~createPushButton(IDC_PB_1, b~x, b~y('10%'), b~w, b~h('9%'), , 'Button' 1, 'Button'||1) +self~createPushButton(IDC_PB_2, b~x, b~y('20%'), b~w, b~h('9%'), , 'Button' 2, 'Button'||2) +self~createPushButton(IDC_PB_3, b~x, b~y('30%'), b~w, b~h('9%'), , 'Button' 3, 'Button'||3) +self~createPushButton(IDC_PB_4, b~x, b~y('40%'), b~w, b~h('9%'), , 'Button' 4, 'Button'||4) +self~createPushButton(IDC_PB_5, b~x, b~y('50%'), b~w, b~h('9%'), , 'Button' 5, 'Button'||5) +self~createPushButton(IDC_PB_6, b~x, b~y('60%'), b~w, b~h('9%'), , 'Button' 6, 'Button'||6) +self~createPushButton(IDOK, b~x, b~y('90%'), b~w, b~h('9%'), 'DEFAULT', 'Ok') + +/* ------------------------------------------------------------------------- */ +::method onResize +/* ------------------------------------------------------------------------- */ +expose u +use arg dummy,sizeinfo +u~resize(self,sizeinfo) + +/* ------------------------------------------------------------------------- */ +::method unknown +/* ------------------------------------------------------------------------- */ +use arg msgname, args +if msgname~abbrev("BUTTON") then + self~newStatic(IDC_ST_STATUS)~setText('You Pressed Button' msgname~right(1)) diff --git a/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemoThree.rex b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemoThree.rex new file mode 100755 index 0000000..0fcdf93 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemoThree.rex @@ -0,0 +1,282 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2006-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * DlgAreaDemoThree.Rex + * + * Demonstrates a second approach to resizable dialogs. Essentially what this + * approach does is to defer the redrawing of the dialog controls until the + * user has finished resizing the dialog. + * + * This example is exactly like DlgAreaDemoTwo.rex, except it also demonstrates + * how to prevent the user from resizing the dialog smaller than a minimum + * size. Look at the connectResizing() method in init() and the onResizing() + * method for the code that does this. + * + * To better understand this example completely, please read the header + * comments in the DlgAreaDemoTwo.rex example. + */ + + sd = locate() + .application~useGlobalConstDir("O", sd'dlgAreaUDemo.h') + + dlg = .ResizableDialog~new + dlg~execute('ShowTop') + + return 0 + +::requires "ooDialog.cls" + +::class 'ResizableDialog' subclass UserDialog + +::method init + + forward class (super) continue + success = self~createCenter(250, 250, 'My Flicker Free Resizable Dialog', - + 'ThickFrame MinimizeBox MaximizeBox', , - + 'MS Sans Serif', 8) + if \ success then do + self~initCode = 1 + return + end + + self~connectResize('onResize', .true) + self~connectResizing('onResizing') + self~connectSizeMoveEnded('onSizeMoveEnded') + + +::method defineDialog + expose u sizing minMaximized + + u = .dlgAreaU~new(self) + if u~lastError \= .nil then call errorDialog u~lastError + + -- Tell the DialogAreaU object to not invoke the update method. + u~updateOnResize = .false + + -- We use these variables to track when to redraw, or not. + sizing = .false + minMaximized = .false + + u~noResizePut(IDC_PB_0) + e = .dlgArea~new(u~x , u~y , u~w('70%'), u~h('90%')) -- edit area + s = .dlgArea~new(u~x , u~y('90%'), u~w('70%'), u~hr ) -- status area + b = .dlgArea~new(u~x('70%'), u~y , u~wr , u~hr ) -- button area + + self~createEdit('IDC_EDIT', e~x, e~y, e~w, e~h, 'multiline') + self~createStaticText('IDC_ST_STATUS', s~x, s~y, s~w, s~h, , 'Status info appears here') + + self~createPushButton('IDC_PB_0', b~x, b~y('00%'), b~w, b~h('9%'), , 'Button' 0 , 'Button'||0) + self~createPushButton('IDC_PB_1', b~x, b~y('10%'), b~w, b~h('9%'), , 'Button' 1 , 'Button'||1) + self~createPushButton('IDC_PB_2', b~x, b~y('20%'), b~w, b~h('9%'), , 'Button' 2 , 'Button'||2) + self~createPushButton('IDC_PB_3', b~x, b~y('30%'), b~w, b~h('9%'), , 'Button' 3 , 'Button'||3) + self~createPushButton('IDC_PB_4', b~x, b~y('40%'), b~w, b~h('9%'), , 'Button' 4 , 'Button'||4) + self~createPushButton('IDC_PB_5', b~x, b~y('50%'), b~w, b~h('9%'), , 'Button' 5 , 'Button'||5) + self~createPushButton('IDC_PB_6', b~x, b~y('60%'), b~w, b~h('9%'), , 'Button' 6 , 'Button'||6) + self~createPushButton('IDOK', b~x, b~y('90%'), b~w, b~h('9%'), 'DEFAULT', 'Ok') + + +::method initDialog + expose minWidth minHeight + + -- The underlying edit controls internally resize themselves as the dialog + -- they are contained in is resized. We don't want that, so we disable that + -- behavior in the underlying edit control. + self~newEdit(IDC_EDIT)~disableInternalResize + + -- We will restrict the minimum width and minimum height to our original + -- width and height + minWidth = self~pixelCX + minHeight = self~pixelCY + + +-- The RESIZING event happens when the user is resizing the dialog, but *before* +-- the size of the dialog is actually changed. The first arg is a .RECT object +-- that describes the new size. If we change the coordinates in the rectangle, +-- and reply .true. The new size of the dialog will be our changed coordinates. +-- +-- Here, if the new size is smaller than we want, we just change the rectangle +-- coordinates to our minimum size. The 'direction' argument tells us which +-- edge of the dialog the user is dragging. We use that to decide which +-- coordinate(s) to change. +-- +-- A maximum size for the dialog could be enforced in a similar way. +::method onResizing unguarded + expose minWidth minHeight + use arg r, direction + + select + when direction == 'TOP' then do + if r~bottom - r~top < minHeight then do + r~top = r~bottom - minHeight + return .true + end + end + when direction == 'BOTTOM' then do + if r~bottom - r~top < minHeight then do + r~bottom = r~top + minHeight + return .true + end + end + when direction == 'LEFT' then do + if r~right - r~left < minWidth then do + r~left = r~right - minWidth + return .true + end + end + when direction == 'RIGHT' then do + if r~right - r~left < minWidth then do + r~right = r~left + minWidth + return .true + end + end + when direction == 'BOTTOMLEFT' then do + didChange = .false + + if r~bottom - r~top < minHeight then do + r~bottom = r~top + minHeight + didChange = .true + end + + if r~right - r~left < minWidth then do + r~left = r~right - minWidth + didChange = .true + end + + return didChange + end + when direction == 'BOTTOMRIGHT' then do + didChange = .false + + if r~bottom - r~top < minHeight then do + r~bottom = r~top + minHeight + didChange = .true + end + + if r~right - r~left < minWidth then do + r~right = r~left + minWidth + didChange = .true + end + + return didChange + end + when direction == 'TOPLEFT' then do + didChange = .false + + if r~bottom - r~top < minHeight then do + r~top = r~bottom - minHeight + didChange = .true + end + + if r~right - r~left < minWidth then do + r~left = r~right - minWidth + didChange = .true + end + + return didChange + end + when direction == 'TOPRIGHT' then do + didChange = .false + + if r~bottom - r~top < minHeight then do + r~top = r~bottom - minHeight + didChange = .true + end + + if r~right - r~left < minWidth then do + r~right = r~left + minWidth + didChange = .true + end + + return didChange + end + otherwise + nop + end + -- End select + return .false + +::method onResize unguarded + expose u sizing minMaximized lastSizeInfo + use arg sizingType, sizeinfo + + -- Save the size information so we know the final size of the dialog. + lastSizeInfo = sizeInfo + + -- The size / move ended event does not occur when the user maximizes, + -- minimizes, or restores from maximized / minimized. Because of that, we + -- need to redraw the client area under those conditions. + + if sizingType == self~SIZE_MAXIMIZED | sizingType == self~SIZE_MINIMIZED then do + minMaximized = .true + if sizingType == self~SIZE_MAXIMIZED then do + u~resize(self, sizeinfo) + self~redrawClient(.true) + end + end + else if sizingType == self~SIZE_RESTORED, minMaximized then do + minMaximized = .false + u~resize(self, sizeinfo) + self~redrawClient(.true) + end + else do + -- We are resizing now. + sizing = .true + end + + return 0 + + +::method onSizeMoveEnded unguarded + expose u sizing lastSizeInfo + + -- If we were resizing, force the dialog controls to redraw themselves. + if sizing then do + u~resize(self, lastSizeInfo) + self~redrawClient(.true) + end + + -- We are not resizing anymore. + sizing = .false + return 0 + + +::method unknown + use arg msgName, args + + if msgName~abbrev("BUTTON") then + self~newStatic(IDC_ST_STATUS)~setText('You Pressed Button' msgName~right(1)) diff --git a/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemoTwo.rex b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemoTwo.rex new file mode 100755 index 0000000..fc8cffe --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/DialogAreaU/dlgAreaUDemoTwo.rex @@ -0,0 +1,194 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2006-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * DlgAreaDemoTwo.Rex + * + * Demonstrates a second approach to resizable dialogs. Essentially what this + * approach does is to defer the redrawing of the dialog controls until the + * user has finished resizing the dialog. + * + * By default, the DialogAreaU class calls a dialog method (the update method) + * that forces all the dialog controls to redraw themselves every time a resize + * event ocurrs. This causes the constant flicker seen in DlgAreaDemo.rex. + * + * The approach taken here is to tell the DialogAreaU object to *not* invoke + * the update method during the resize event. This is done by setting the + * updateOnResize attribute to false in the DialogAreaU object. + * + * Then we connect the size / move ended event to a method in our dialog. This + * event is called exactly once when the user has stopped resizing or moving + * the dialog. + * + * We keep track of whether the user is resizing, or not. When we get the size + * move ended event, if the user was resizing, we invoke the redrawClient + * method of the dialog, forcing all the dialog controls to redraw themselves + * in their new, final, position. + * + * This eliminates the flicker, but also makes it appear as though the dialog + * controls are not changing while the user is actively resizing. When the + * user stops resizing, the dialog controls "magically" appear in their new + * size and position. + * + * Which approach is better is probably a matter of personal preference. + * + * After some use of this example program, a refinement to the above algorithm + * was made. This is what is used now. Since no repainting of the dialog + * controls is done until the last resize event, there is no sense in re- + * calculating the size and position of each control on every resize event. + * + * Rather than invoke u~resize(self, sizeinfo) every single time in onResize() + * u~resize is only invoked when the dialog client area is going to be forced + * to redraw. + */ + + sd = locate() + .application~useGlobalConstDir("O", sd'dlgAreaUDemo.h') + + dlg = .ResizableDialog~new + dlg~execute('ShowTop') + + return 0 + +::requires "ooDialog.cls" + +::class 'ResizableDialog' subclass UserDialog + +::method init + + forward class (super) continue + success = self~createCenter(250, 250, 'My Flicker Free Resizable Dialog', - + 'ThickFrame MinimizeBox MaximizeBox', , - + 'MS Sans Serif', 8) + if \ success then do + self~initCode = 1 + return + end + + self~connectResize('onResize', .true) + self~connectSizeMoveEnded('onSizeMoveEnded') + + +::method defineDialog + expose u sizing minMaximized + + u = .dlgAreaU~new(self) + if u~lastError \= .nil then call errorDialog u~lastError + + -- Tell the DialogAreaU object to not invoke the update method. + u~updateOnResize = .false + + -- We use these variables to track when to redraw, or not. + sizing = .false + minMaximized = .false + + u~noResizePut(IDC_PB_0) + e = .dlgArea~new(u~x , u~y , u~w('70%'), u~h('90%')) -- edit area + s = .dlgArea~new(u~x , u~y('90%'), u~w('70%'), u~hr ) -- status area + b = .dlgArea~new(u~x('70%'), u~y , u~wr , u~hr ) -- button area + + self~createEdit(IDC_EDIT, e~x, e~y, e~w, e~h, 'multiline') + self~createStaticText(IDC_ST_STATUS, s~x, s~y, s~w, s~h, , 'Status info appears here') + + self~createPushButton(IDC_PB_0, b~x, b~y('00%'), b~w, b~h('9%'), , 'Button' 0 , 'Button'||0) + self~createPushButton(IDC_PB_1, b~x, b~y('10%'), b~w, b~h('9%'), , 'Button' 1 , 'Button'||1) + self~createPushButton(IDC_PB_2, b~x, b~y('20%'), b~w, b~h('9%'), , 'Button' 2 , 'Button'||2) + self~createPushButton(IDC_PB_3, b~x, b~y('30%'), b~w, b~h('9%'), , 'Button' 3 , 'Button'||3) + self~createPushButton(IDC_PB_4, b~x, b~y('40%'), b~w, b~h('9%'), , 'Button' 4 , 'Button'||4) + self~createPushButton(IDC_PB_5, b~x, b~y('50%'), b~w, b~h('9%'), , 'Button' 5 , 'Button'||5) + self~createPushButton(IDC_PB_6, b~x, b~y('60%'), b~w, b~h('9%'), , 'Button' 6 , 'Button'||6) + self~createPushButton(IDOK, b~x, b~y('90%'), b~w, b~h('9%'), 'DEFAULT', 'Ok') + + +::method initDialog + + -- The underlying edit controls internally resize themselves as the dialog + -- they are contained in is resized. We don't want that, so we disable that + -- behavior in the underlying edit control. + self~newEdit(IDC_EDIT)~disableInternalResize + + +::method onResize unguarded + expose u sizing minMaximized lastSizeInfo + use arg sizingType, sizeinfo + + -- Save the size information so we know the final size of the dialog. + lastSizeInfo = sizeInfo + + -- The size / move ended event does not occur when the user maximizes, + -- minimizes, or restores from maximized / minimized. Because of that, we + -- need to redraw the client area under those conditions. + + if sizingType == self~SIZE_MAXIMIZED | sizingType == self~SIZE_MINIMIZED then do + minMaximized = .true + if sizingType == self~SIZE_MAXIMIZED then do + u~resize(self, sizeinfo) + self~redrawClient(.true) + end + end + else if sizingType == self~SIZE_RESTORED, minMaximized then do + minMaximized = .false + u~resize(self, sizeinfo) + self~redrawClient(.true) + end + else do + -- We are resizing now. + sizing = .true + end + + return 0 + + +::method onSizeMoveEnded unguarded + expose u sizing lastSizeInfo + + -- If we were resizing, force the dialog controls to redraw themselves. + if sizing then do + u~resize(self, lastSizeInfo) + self~redrawClient(.true) + end + + -- We are not resizing anymore. + sizing = .false + return 0 + + +::method unknown + use arg msgName, args + + if msgName~abbrev("BUTTON") then + self~newStatic(IDC_ST_STATUS)~setText('You Pressed Button' msgName~right(1)) diff --git a/modules/windows/oodialog/resizableDialogs/ReadMe.txt b/modules/windows/oodialog/resizableDialogs/ReadMe.txt new file mode 100644 index 0000000..b234805 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ReadMe.txt @@ -0,0 +1,20 @@ + + + Resizable Dialogs + ================= + + +There are 2 basic ways to produce resizable dialogs in ooDialog. + +One way is to use the DlgArea and its subclass, DlgAreaU. Note that the +DlgArea class in itself does not produce a resizable dialog. It is the +DlgAreaU subclass that effectively allows resizing. + +The other way is to have a dialog class inherit the ResizingAdmin +subclass. + +This subdirectory tree contains two subdirectories that contain example +programs showing how to use both methods. Not surprisingly, the +subdirectory, DlgAreaU contains examples using the DlgAreaU method and +the subdirectory, ResizingAdmin, contains examples showing how to use +the ResizingAdmin mixin class to produce resizable dialogs. diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/PropertySheetDemo.rex b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/PropertySheetDemo.rex new file mode 100755 index 0000000..61d8048 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/PropertySheetDemo.rex @@ -0,0 +1,922 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Propery Sheet / Dialog Controls Example + * + * This example demonstrates how to use the PropertySheetDialog and has examples + * of using 5 dialog controls, the: List View, Tree View, Progress Bar, Track + * Bar, and Tab. + * + * Note that this example is meant to demonstrate creating a resizable + * PropertySheetDialog dialog. It is exactly the same as the + * + * oodialog\propertySheet.tabControls\PropertySheetDemo.rex + * + * example, except it is resizable. + */ + + sd = locate() + .application~setDefaults("O", sd"rc\PropertySheetDemo.h", .false) + + -- Create the 5 dialog pages. + p1 = .ListViewDlg~new(sd"rc\PropertySheetDemo.rc", IDD_LISTVIEW_DLG) + p2 = .TreeViewDlg~new(sd"rc\PropertySheetDemo.rc", IDD_TREEVIEW_DLG) + p3 = .ProgressBarDlg~new(sd"rc\PropertySheetDemo.rc", IDD_PROGRESSBAR_DLG) + p4 = .TrackBarDlg~new(sd"rc\PropertySheetDemo.rc", IDD_TRACKBAR_DLG) + p5 = .TabDlg~new(sd"rc\PropertySheetDemo.rc", IDD_TAB_DLG) + + -- Create the PropertySheetDialog using an array of the 5 dialog pages. The + -- order of the pages in the array will be the order of the pages in the tab + -- control of the property sheet. + pages = .array~of(p1, p2, p3, p4, p5) + propDlg = .PropertySheetDemoDlg~new(pages, "NOAPPLYNOW", "ooRexx Property Sheet with Controls") + + -- Do any customization of the property sheet dialog by setting the values of + -- the appropriate attributes. However, for this example we do not do any + -- customization. + + -- Show the property sheet. + propDlg~execute + + return 0 + +::requires "ooDialog.cls" + +::class 'ListViewDlg' subclass RcPSPDialog inherit ResizingAdmin + +::method defineSizing + + -- The only control in this dialog is the list-view. We define its sizing + -- so that each edge of the list-view maintains the same distance to its + -- corresponding edeg of the dialog: + self~controlSizing(IDC_LV_MAIN, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + -- A value must be returned from the defineSizing() method. O allows the + -- dialog to continue, any other value is a failure and the dialog will be + -- ended. + return 0 + + +::method initDialog + expose lv + + -- Instantiate a Rexx list view object that represents the underlying + -- Windows list-view. The list-view style is report. + lv = self~newListView(IDC_LV_MAIN) + + -- Set the column headers + lv~insertColumn(0, "Symbol", 40) + lv~insertColumn(1, "Quote", 50) + lv~insertColumn(2, "Year high", 50) + lv~insertColumn(3, "Year low", 50) + lv~insertColumn(4, "Description", 120) + + -- Set the images for the items in the list-view. The list-view control was + -- created without the SHAREIMAGES styles, so it takes care of releasing the + -- image list when the program ends. + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoListView.bmp") + imageList = .ImageList~create(.Size~new(16, 16), COLOR8, 4, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + lv~setImageList(imageList, SMALL) + + -- The image list makes a copy of the bitmap, so we can release it now + -- to free up some (small) amount of system resources. This is not + -- necessary, the OS will release the resource automatically when the + -- program ends. + image~release + end + + -- Fill the list-view with random data. + do ch = "A"~c2d to "Z"~c2d + q = random(200) + yh = random(400) + yh = max(yh, q) + yl = random(100) + yl = min(yl, q) + lv~addRow( , random(3), "_" || ch~d2c~copies(3) || "_", "$" || q, "$" || yh, "$" || yl, - + ch~d2c~copies(3) "is a fictitious company.") + end + + -- Add full row select and the ability to drag and drop the columns to the + -- list-view. + lv~addExtendedStyle("FULLROWSELECT HEADERDRAGDROP") + + -- Connect 2 list-view events to Rexx methods in this dialog. The double- + -- click on a list-view item, and the click on a column header events. + self~connectListViewEvent(IDC_LV_MAIN, "ACTIVATE", "onActivate") + self~connectListViewEvent(IDC_LV_MAIN, "COLUMNCLICK") + +-- Invoked when a list-view item is double-clicked. We display a message and +-- set the focus to the next item in the list. +::method onActivate + expose lv + + selectedItem = lv~focused + symbol = lv~itemText(selectedItem) + price = lv~itemText(selectedItem, 1) + + question = "You have selected the stock with symbol" symbol". Do you want to order" || .endOfLine || - + "50 shares of stock at" price"?" + placeOrder = MessageDialog(question, self~hwnd, "Place Order for Stock", "YESNO", "QUESTION", "DEFBUTTON2" ) + + cost = 50 * price~substr(2) + if placeOrder == self~constDir["IDYES"] then do + j = MessageDialog("Okay, your bank account will be debited $"cost "dollars.", self~hwnd, - + "Order Confirmation", "OK", "INFORMATION") + end + else do + j = MessageDialog("That saved you $"cost "dollars.", self~hwnd, "Order Canceled", "OK", "EXCLAMATION") + end + + lv~deselect(selectedItem) + selectedItem += 1 + lv~focus(selectedItem) + lv~select(selectedItem) + +-- Invoked when a column header of the list-view is clicked. We just show a +-- message box so that the user has some feedback. +::method OnColumnClick + use arg id, column + j = MessageDialog("Column" column + 1 "was clicked in control" id, self~hwnd, "List-View Notification") + + + +::class 'TreeViewDlg' subclass RcPSPDialog inherit ResizingAdmin + +::method initDialog + + -- Instantiate a Rexx tree view object that represents the Windows tree-view + -- control. + tv = self~newTreeView(IDC_TV_MAIN) + + -- Create and set the ImageList for the tree view items + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoTreeView.bmp") + imageList = .ImageList~create(.Size~new(32, 32), COLOR8, 10, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + tv~setImageList(imageList, NORMAL) + image~release + end + + -- Add the tree view items. Toys will be the root (the first argument is + -- not omitted. Subitems are added by omitting the first arguments. The + -- number of arguments omitted indicates the depth of the subitem. + -- + -- The last numeric argument in some of the items is the index for the icon + -- for that item in the image list. Those items without a number will not + -- display an icon. + + tv~add("Toys", 1) + tv~add(, "Indoor", 14) + tv~add(, , "Boys", 19) + tv~add(, , , "Cowboys", 13) + tv~add(, , , "Cars", 8) + tv~add(, , , "Starwars", 9) + tv~add(, , "Girls", 0) + tv~add(, , , "Barby", 19) + tv~add(, , , "Painting", 15) + tv~add(, , , "Cooking", 13) + tv~add(, , "Adults", 17) + tv~add(, , , "Poker", 15) + tv~add(, , "Technical", 16) + tv~add(, , , "Racing cars", 8) + tv~add(, , , "Trains", 7) + tv~add(, "Outdoor", 11) + tv~add(, , "Water", 22) + tv~add(, , , "Ball", 5) + tv~add(, , , "Soft tennis", 6) + tv~add(, , "Sand", 12) + tv~add(, , , "Shovel", 12) + tv~add(, , , "Bucket", 19) + tv~add(, , , "Sandbox", 12) + tv~add(, , "Technical", 16) + tv~add(, , , "Trains", 7) + tv~add(, , , "Remote controlled", 8) + tv~add("Office Articles", 2) + tv~add( , "Tools", 16) + tv~add( , "Books", 19) + tv~add( , , "Introduction", 14) + tv~add( , , "Advanced Programming", 17) + tv~add( , , "Tips & Tricks", 16) + tv~add("Hardware", 4) + tv~add( , "Garden", 0) + tv~add( , "Handyman", 18) + tv~add( , "Household", 18) + tv~add("Furniture", 3) + tv~add( , "Standard", 12) + tv~add( , "Luxury", 21) + + -- Connecting the begin drag event and using the default tree drag handler + -- allows us to suppport drag and drop (using the default behaviour. + self~connectTreeViewEvent(IDC_TV_MAIN, "BeginDrag", "DefTreeDragHandler") + + +::class 'ProgressBarDlg' subclass RcPSPDialog inherit ResizingAdmin + +-- Define the sizing for the controls. Note that for the progress bars, we want +-- to use the default sizing so that they resize proportionally. But, we want +-- the static labels to be fixed in size and pinned to the progress bar the +-- label is for. +-- +-- The individual sizing for a control is added to the sizing table in the order +-- the sizings are defined. Then, during a resize event, the windows are sized +-- in the order they occur in the table. For any control sizing definition, the +-- pin to window has to *precede* the control in the table. Otherwise resizing +-- would not work correctly. +-- +-- What this means is that we can not pin a static control to its progress bar +-- unless the progress bar is already in the table. The defaultSizing() method +-- allows us to put a control in to the table with a minimum amount of typing. +-- +-- We also show both ways of defing the edges of a control. Using individual +-- method calls for each edge, or using the single method call, controlSizing(). +::method defineSizing + + self~noMinSize + + self~useDefaultSizing(IDC_PBAR_PROCESSA) + self~useDefaultSizing(IDC_PBAR_PROCESSB) + self~useDefaultSizing(IDC_PBAR_PROCESSC) + self~useDefaultSizing(IDC_PBAR_PROCESSD) + self~useDefaultSizing(IDC_PBAR_PROCESSE) + + self~controlLeft( IDC_ST_PROCESSA, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSA) + self~controlTop( IDC_ST_PROCESSA, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSA) + self~controlRight( IDC_ST_PROCESSA, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSA, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSB, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSB) + self~controlTop( IDC_ST_PROCESSB, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSB) + self~controlRight( IDC_ST_PROCESSB, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSB, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSC, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSC) + self~controlTop( IDC_ST_PROCESSC, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSC) + self~controlRight( IDC_ST_PROCESSC, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSC, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSD, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSD) + self~controlTop( IDC_ST_PROCESSD, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSD) + self~controlRight( IDC_ST_PROCESSD, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSD, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSE, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSE) + self~controlTop( IDC_ST_PROCESSE, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSE) + self~controlRight( IDC_ST_PROCESSE, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSE, 'MYTOP', 'TOP') + + self~controlSizing(IDC_ST_PERCENTA, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSA), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSA), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTB, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSB), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSB), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTC, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSC), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSC), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTD, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSD), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSD), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTE, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSE), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSE), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + return 0 + + + +::method initDialog + expose threadsStarted processes + + threadsStarted = 0 + processes = .array~of('animateProgressA', 'animateProgressB', 'animateProgressC', - + 'animateProgressD', 'animateProgressE') + + +-- The setActive event notification is sent by the property sheet to the page +-- that is about to become the active page. It is sent before the page is +-- visible. This allows the page to do any initialization necessary. For this +-- program, we use the notification to start the progress bar animation threads. +::method setActive unguarded + expose threadsStarted processes + use arg propSheet + + reply 0 + + -- If no threads are running, start a thread to run each progress bar + -- asynchronously. + if threadsStarted < 1 then do + threadsStarted = processes~items + do methodName over processes + self~start(methodName) + end + end + +-- This is the generic method that simulates some type of processing that takes +-- a long time. The progress of this processing is displayed by the progress +-- bar. to simulate a process of which the progress is displayed by a progress bar */ +::method animateProgress unguarded + use arg progressBar, label, step, iterations, tsleep + + progressBar~setRange(0, iterations * step) + progressBar~setStep(step) + do i = 1 to iterations + progressBar~step + if (iterations * step == 100) then label~setText(i * step "%") + else label~setText(i * step) + + call msSleep tsleep + if \ self~isDialogActive then return + end + +-- The following 5 methods are started asynchronously to animate the progress +-- bars. +::method animateProgressA unguarded + expose threadsStarted pbA labelA + + if \ pbA~isA(.ProgressBar) then do + pbA = self~newProgressBar(IDC_PBAR_PROCESSA) + labelA = self~newStatic(IDC_ST_PERCENTA) + end + + self~animateProgress(pbA, labelA, 5, 20, 600) + threadsStarted -= 1 + +::method animateProgressB unguarded + expose threadsStarted pbB labelB + + if \ pbB~isA(.ProgressBar) then do + pbB = self~newProgressBar(IDC_PBAR_PROCESSB) + labelB = self~newStatic(IDC_ST_PERCENTB) + end + + self~animateProgress(pbB, labelB, 1, 100, 150) + threadsStarted -= 1 + +::method animateProgressC unguarded + expose threadsStarted pbC labelC + + if \ pbC~isA(.ProgressBar) then do + pbC = self~newProgressBar(IDC_PBAR_PROCESSC) + labelC = self~newStatic(IDC_ST_PERCENTC) + end + + self~animateProgress(pbC, labelC, 2, 50, 200) + threadsStarted -= 1 + +::method animateProgressD unguarded + expose threadsStarted pbD labelD + + if \ pbD~isA(.ProgressBar) then do + pbD = self~newProgressBar(IDC_PBAR_PROCESSD) + labelD = self~newStatic(IDC_ST_PERCENTD) + end + + self~animateProgress(pbD, labelD, 10, 40, 300) + threadsStarted -= 1 + +::method animateProgressE unguarded + expose threadsStarted pbE labelE + + if \ pbE~isA(.ProgressBar) then do + pbE = self~newProgressBar(IDC_PBAR_PROCESSE) + labelE = self~newStatic(IDC_ST_PERCENTE) + end + + self~animateProgress(pbE, labelE, 20, 50, 500) + threadsStarted -= 1 + + +::class 'TrackBarDlg' subclass RcPSPDialog inherit ResizingAdmin + +-- Define the sizing of the controls. Here, we have the 2 static frames that +-- surround the trackbars grow proportionally to the dialog, which is the +-- deault. Then we pin the controls inside of a static frame to the static +-- frame. +-- +-- For the horizontal trackbars, it makes sense for them to stretch horizontally +-- as the dialog widens. But there is no point in them stretching vertially as +-- the dialog get taller. The actual part of the control that is drawn keeps +-- the same vertical height. +-- +-- The reverse is true for the vertical trackbars, they should stretch +-- vertically and remain fixed horizontally. +-- +-- All the static labels should remain fixed in size. The labels for the +-- horizontal trackbars are pinned to the bottoms of their trackbars and pinned +-- proportionally to the left of their trackbars. The labels for the vertical +-- trackbars are pinned to the top of their trackbars and to the center of their +-- trackbars. +-- +-- For the horizontal trackbars: the top trakbar is pinned to the top of its +-- frame, the bottom to the bottom of its frame, and the middle trackbar is +-- pinned to the vertical center of its frame. +-- +-- For the vertical trackbars: the left trackbar is pinned to the left of its +-- frame, the right is pinned to the right of its frame, and the middle trackbar +-- is pinned to the horizontal center of its frame. +::method defineSizing + + self~noMinSize + + self~useDefaultSizing(IDC_ST_FRAME_LEFT) + + self~controlLeft( IDC_TB_HORZ_BOTTOM, 'STATIONARY', 'LEFT', IDC_ST_FRAME_LEFT) + self~controlTop( IDC_TB_HORZ_BOTTOM, 'STATIONARY', 'TOP', IDC_ST_FRAME_LEFT) + self~controlRight( IDC_TB_HORZ_BOTTOM, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_LEFT) + self~controlBottom(IDC_TB_HORZ_BOTTOM, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_HORZ_BOTTOM, 'PROPORTIONAL', 'LEFT', IDC_TB_HORZ_BOTTOM) + self~controlTop( IDC_ST_HORZ_BOTTOM, 'STATIONARY', 'BOTTOM', IDC_TB_HORZ_BOTTOM) + self~controlRight( IDC_ST_HORZ_BOTTOM, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_HORZ_BOTTOM, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_HORZ_TOP, 'STATIONARY', 'LEFT', IDC_ST_FRAME_LEFT) + self~controlTop( IDC_TB_HORZ_TOP, 'STATIONARY', 'YCENTER', IDC_ST_FRAME_LEFT) + self~controlRight( IDC_TB_HORZ_TOP, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_LEFT) + self~controlBottom(IDC_TB_HORZ_TOP, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_HORZ_TOP, 'PROPORTIONAL', 'LEFT', IDC_TB_HORZ_TOP) + self~controlTop( IDC_ST_HORZ_TOP, 'STATIONARY', 'BOTTOM', IDC_TB_HORZ_TOP) + self~controlRight( IDC_ST_HORZ_TOP, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_HORZ_TOP, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_HORZ_BOTH, 'STATIONARY', 'LEFT', IDC_ST_FRAME_LEFT) + self~controlTop( IDC_TB_HORZ_BOTH, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_LEFT) + self~controlRight( IDC_TB_HORZ_BOTH, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_LEFT) + self~controlBottom(IDC_TB_HORZ_BOTH, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_HORZ_BOTH, 'PROPORTIONAL', 'LEFT', IDC_TB_HORZ_BOTH) + self~controlTop( IDC_ST_HORZ_BOTH, 'STATIONARY', 'BOTTOM', IDC_TB_HORZ_BOTH) + self~controlRight( IDC_ST_HORZ_BOTH, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_HORZ_BOTH, 'MYTOP', 'TOP') + + self~useDefaultSizing(IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_TB_VERT_RIGHT, 'STATIONARY', 'LEFT', IDC_ST_FRAME_RIGHT) + self~controlTop( IDC_TB_VERT_RIGHT, 'STATIONARY', 'TOP', IDC_ST_FRAME_RIGHT) + self~controlRight( IDC_TB_VERT_RIGHT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_TB_VERT_RIGHT, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_ST_VERT_RIGHT, 'STATIONARY', 'XCENTER', IDC_TB_VERT_RIGHT) + self~controlTop( IDC_ST_VERT_RIGHT, 'STATIONARY', 'TOP', IDC_TB_VERT_RIGHT) + self~controlRight( IDC_ST_VERT_RIGHT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_VERT_RIGHT, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_VERT_LEFT, 'STATIONARY', 'XCENTER', IDC_ST_FRAME_RIGHT) + self~controlTop( IDC_TB_VERT_LEFT, 'STATIONARY', 'TOP', IDC_ST_FRAME_RIGHT) + self~controlRight( IDC_TB_VERT_LEFT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_TB_VERT_LEFT, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_ST_VERT_LEFT, 'STATIONARY', 'XCENTER', IDC_TB_VERT_LEFT) + self~controlTop( IDC_ST_VERT_LEFT, 'STATIONARY', 'TOP', IDC_TB_VERT_LEFT) + self~controlRight( IDC_ST_VERT_LEFT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_VERT_LEFT, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_VERT_BOTH, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_RIGHT) + self~controlTop( IDC_TB_VERT_BOTH, 'STATIONARY', 'TOP', IDC_ST_FRAME_RIGHT) + self~controlRight( IDC_TB_VERT_BOTH, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_TB_VERT_BOTH, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_ST_VERT_BOTH, 'STATIONARY', 'XCENTER', IDC_TB_VERT_BOTH) + self~controlTop( IDC_ST_VERT_BOTH, 'STATIONARY', 'TOP', IDC_TB_VERT_BOTH) + self~controlRight( IDC_ST_VERT_BOTH, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_VERT_BOTH, 'MYTOP', 'TOP') + + return 0 + + +::method initDialog + expose font1 trackBars tbLabels + + -- As we initialize each track bar we'll stash the Rexx object in a table + -- for easy access later, indexed by its numeric resource id. The same + -- thing is done for the static control that is the label for the track bar. + trackBars = .table~new + tbLabels = .table~new + + -- For the horizonatal track bars we'll use a big font for the label. + font1 = self~CreateFontEx("Arial", 24, "BOLD") + + -- The symbolic IDs for the track bars / labels are named after the style + -- of the track bar. Vertical or horizontal and where the ticks are placed. + + -- Initialize the horizontal track bar with ticks on the bottom. + tb = self~newTrackBar(IDC_TB_HORZ_BOTTOM) + label = self~newStatic(IDC_ST_HORZ_BOTTOM) + + tb~setTickFrequency(10) + tb~setPos(20, .true) + label~setText(20) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTTOM] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the top. + tb = self~newTrackBar(IDC_TB_HORZ_TOP) + label = self~newStatic(IDC_ST_HORZ_TOP) + + tb~initRange(0, 200) + tb~setTickFrequency(50) + tb~setPos(40, .true) + label~setText(40) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_TOP] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_HORZ_BOTH) + label = self~newStatic(IDC_ST_HORZ_BOTH) + + tb~initSelRange(20, 60) + tb~setTickFrequency(10) + tb~setPos(80, .true) + label~setText(80) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the right. + tb = self~newTrackBar(IDC_TB_VERT_RIGHT) + label = self~newStatic(IDC_ST_VERT_RIGHT) + + tb~setTickFrequency(10) + tb~setPos(30, .true) + label~setText(30) + + id = self~constDir[IDC_TB_VERT_RIGHT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the left. + tb = self~newTrackBar(IDC_TB_VERT_LEFT) + label = self~newStatic(IDC_ST_VERT_LEFT) + + tb~setTickFrequency(10) + tb~initRange(0,400) + tb~setLineStep(5) + tb~setPageStep(50) + tb~setPos(90, .true) + label~setText(90) + + id = self~constDir[IDC_TB_VERT_LEFT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_VERT_BOTH) + label = self~newStatic(IDC_ST_VERT_BOTH) + + tb~setTickFrequency(5) + tb~setPos(70, .true) + label~setText(70) + + id = self~constDir[IDC_TB_VERT_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Connect the event notification that is sent when a track bar is moved to + -- the onEndTrack() method. That method will update the text label for the + -- track bar with the new postition. + self~connectTrackBarEvent(IDC_TB_HORZ_BOTH, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_TOP, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_BOTTOM, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_RIGHT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_LEFT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_BOTH, "EndTrack", "onEndTrack") + +-- Update the static contol that shows the position for a slider when the +-- user is done moving it. +::method onEndTrack + expose trackBars tbLabels + use arg code, hwndTrackBar + + -- hwndTrackBar is the handle to the track bar that was moved. Get its + -- resource ID and use that as an index into the table of track bar objects + -- and the table of the labels. + id = self~getControlID(hwndTrackBar) + tbLabels[id]~setText(trackBars[id]~pos) + +-- We use the leaving() method to clean up (delete) the font we created. In +-- this program there is really no need to do this. As soon as the interpreter +-- terminates, the OS cleans up the resources automatically. The only time +-- cleaning up resources makes sense is in a long-running program that creates +-- and ends a lot of dialogs. Then, over time, the memory usge of the program +-- would keep growing. +::method leaving + expose font1 + self~deleteFont(font1) + + +::class 'TabDlg' subclass RcPSPDialog inherit ResizingAdmin + +::method defineSizing + + self~controlSizing(IDC_TAB_MAIN, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + return 0 + + +::method initDialog + expose font2 font3 imageList iconsRemoved needWrite pb tc + + -- Set the iconsRemoved and needWrite to false. These flags are used in + -- the OnDrawTabRect() method. + iconsRemoved = .false + needWrite = .false + + -- Connect the draw event of the owner-drawn button. This is sent when the + -- button needs to be drawn. Then connect the selection changed event of the + -- tab control. This is sent when the user clicks on a different tab. + self~connectDraw(IDC_PB_OWNERDRAW, "onDrawTabRect") + self~connectTabEvent(IDC_TAB_MAIN, "SELCHANGE", "onTabSelChange") + + pb = self~newPushButton(IDC_PB_OWNERDRAW) + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Create a font used to display the name of the color in the owner-drawn + -- button. Create another font used to display some informative text. + font2 = self~createFontEX("Arial", 48, "BOLD ITALIC") + font3 = self~createFontEx("Arial", 16, "BOLD") + + -- Add all the tabs, including the index into the image list for an icon for + -- each tab. + tc~AddFullSeq("Red", 0, ,"Green", 1, , "Moss", 2, , "Blue", 3, , "Purple", 4, , "Cyan", 5, , "Gray", 6) + + -- Create a COLORREF (pure white) and load our bitmap. The bitmap is a + -- series of 16x16 images, each one a colored letter. + cRef = .Image~colorRef(255, 255, 255) + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoTab.bmp") + + -- This is sort of a trick. The ooDialog framework invokes the initDialog() + -- method when it is notified by the Windows PropertySheet that it is + -- creating the dialog for a page. But, the operating system does not size + -- and position the dialog until the ooDialog framework returns from the + -- notification. So, at this exact point of execution, this dialog has not + -- been sized and positioned. If we call placeButton() and then return from + -- initDialog(), the button is not sized and positioned correctly, because + -- this dialog has not been sized and positioned by the PropertySheet yet. + -- + -- Instead, we return from initDialog() here, by using an early reply. Then + -- we continue to create our imag list and invoke placeButton(). By the time + -- placeButton() executes, this dialog has been sized and positioned, and our + -- button sized and positioned correctly. + reply 0 + + -- Create our image list, as a masked image list. + flags = 'COLOR24 MASK' + imageList = .ImageList~create(.Size~new(16, 16), flags, 10, 0) + if \image~isNull, \imageList~isNull then do + -- The bitmap is added and the image list deduces the number of images + -- from the width of the bitmap. For each image, the image list creates a + -- mask using the color ref. In essence, the mask is used to turn each + -- white pixel in the image to transparent. In this way, only the letter + -- part of the image shows and the rest of the image lets the under-lying + -- color show through. + imageList~addMasked(image, cRef) + tc~setImageList(imageList) + + -- The image list makes a copy of each image added to it. So, we can now + -- release the original image to free up some small amount of system + -- resoureces. + image~release + end + else do + iconsRemoved = .true + end + + self~placeButton + + + +-- We will position and size the owner-draw button so that it exactly covers +-- the display area of the tab control. +::method placeButton unguarded + expose tc pb + + -- We could be invoked before the underlying dialog has been created. + if \ tc~isA(.Tab) then return 0 + + r = tc~windowRect + tc~calcDisplayRect(r) + s = .Size~new(r~right - r~left, r~bottom - r~top) + + + -- Map the display area's position on the screen, to the client co-ordinates + -- of this control dialog. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + pb~setWindowPos(tc~hwnd, p~x, p~y, s~width, s~height, "SHOWWINDOW NOOWNERZORDER") + + return + + +-- When a new tab is selected, we have the owner-drawn button update itself. +-- This causes the button to redraw and the onDrawTabRect() method gets invoked, +-- which actually does the drawing. +::method onTabSelChange + button = self~newPushButton(IDC_PB_OWNERDRAW) + button~update + + +-- Fill the owner-drawn button with the color matching the tab's label and write +-- the name of the color. +::method onDrawTabRect + expose font2 font3 imageList iconsRemoved needWrite + use arg id + + button = self~newPushButton(id) + if button == .nil then return + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Each time the 'Gray' tab is selected, we remove the tab icons. Then, when + -- one of the other tabs is selected we set the image list back. + currentTab = tc~selected + if currentTab == 'Gray' then do + tc~setImageList(.nil) + iconsRemoved = .true + needWrite = .true + end + else do + if iconsRemoved then do + tc~setImageList(imageList) + iconsRemoved = .false + needWrite = .true + end + end + + -- Get the button's device context, create pen and brush, and assign pen, + -- brush and font to the device context. + dc = button~getDC + pen = button~createPen(1, "SOLID", 0) + brush = button~createBrush(tc~SelectedIndex + 1) + + oldPen = button~objectToDc(dc, pen) + oldBrush = button~objectToDc(dc, brush) + oldFont = button~fontToDC(dc, font2) + button~transparentText(dc) + + -- Draw a filled in rectangle, with a border of 5 around it, and write text. + size = button~getRealSize + button~rectangle(dc, 5, 5, size~width - 5, size~height - 5, "FILL") + button~writeDirect(dc, trunc(size~width / 4), trunc(size~height / 4), tc~Selected) + + -- Add informative text if needed. + if needWrite then do + button~fontToDC(dc, font3) + x = trunc(size~width / 4) + y = trunc(size~height / 2) + + if currentTab == 'Gray' then + button~writeDirect(dc, x, y, "(Tab icons are removed)") + else + button~writeDirect(dc, x, y, "(Tab icons are restored)") + needWrite = .false + end + + -- Restore pen, brush, and font, then release the device context. + button~objectToDc(dc, oldPen) + button~objectToDc(dc, oldBrush) + button~fontToDC(dc, oldFont) + button~opaqueText(dc) + + button~deleteObject(pen) + button~deleteObject(brush) + button~freeDC(dc) + +-- We use the leaving() method to clean up (delete) the fonts and the image list +-- we created. In this program there is really no need to do this. As soon as +-- the interpreter terminates, the OS cleans up the resources automatically. +-- The only time cleaning up resources makes sense is in a long-running program +-- that creates and ends a lot of dialogs. Then, over time, the memory usge of +-- the program would keep growing. +::method leaving + expose font2 font3 imageList + + self~deleteFont(font2) + self~deleteFont(font3) + imageList~release + +::class 'PropertySheetDemoDlg' subclass PropertySheetDialog inherit ResizingAdmin + +-- Define the sizing for the controls in the property sheet dialog. Note that +-- the control ID for the tab control is provided by a constant from the +-- PropertySheetDialog class. The Ok and Cancel push buttons have the usual IDs +-- supplied by the operatting system. +-- +-- We set the sizing for the tab control so that it keeps a fixed margin all the +-- way around it. This makes the tab control expand to take up as much space in +-- the dialog as it can. The buttons are fixed in size and pinned to the bottom +-- right corner of the dialog. +::method defineSizing + + self~controlSizing(self~IDC_TAB_IN_PROPSHEET, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + self~controlSizing(IDCANCEL, - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Pin the left of the Ok button to the left of the Cancel button + self~controlSizing(IDOK, - + .array~of('STATIONARY', 'LEFT', IDCANCEL), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + ret = self~wantSizeEnded('onSizeEnded', .true) + + return 0; + + + +-- The onSizeEnded() method is invoked when the user has resized the dialog and +-- that sizing is ended. At this point the TabDlg dialog needs to recalculate +-- and position the owner-drawn button. +::method onSizeEnded unguarded + self~pages[5]~placeButton + return 0 + + diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/TabDemo.rex b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/TabDemo.rex new file mode 100755 index 0000000..fe329e1 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/TabDemo.rex @@ -0,0 +1,1294 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** Tab Control / Dialog Controls / ControlDialog Example + * + * This example demonstrates how to use the ControlDialog class to provide the + * pages / content of a Tab control. It is basically the same as the + * PropertySheetDemo.rex example, but uses a Tab control with ControlDialog + * objects rather than using a PropertySheetDialog. + * + * Note that this example is meant to demonstrate creating a resizable dialog + * that has a tab control with ControlDialog dialogs as pages. It is exactly + * the same as the + * + * oodialog\propertySheet.tabControls\TabDemo.rex + * + * example, except it is resizable. + */ + + sd = locate() + .application~setDefaults("O", sd"rc\PropertySheetDemo.h", .false) + + -- The original version of this example would take a longish period of time to + -- appear on the screen. Too much was being done in the initDialog() method + -- of the .NewControlsDialog. To improve the time between starting the + -- program and the dialog's appearance on the screen, several steps were + -- taken. + -- + -- 1.) All dialogs were made ResDialog dialogs. + -- + -- 2.) The instantiation of the dialogs used for the pages of the tab control + -- was moved out of the initDialog() method and placed here. Some of the + -- work done in the initDialog() method was moved to the prep() method, + -- which is invoked before the dialog is started executing. + -- + -- 3.) The dialog is created with the VISIBLE style. This causes the dialog + -- to appear on the screen before the list view is populated, rather than + -- having the list view populated first and then showing the dialog. + -- + -- Instantiate all the control dialogs and pass them to the prep() method in + -- an array. + t1 = .ListViewDlg~new(sd"rc\PropertySheetDemo.dll", IDD_LISTVIEW_DLG) + t2 = .TreeViewDlg~new(sd"rc\PropertySheetDemo.dll", IDD_TREEVIEW_DLG) + t3 = .ProgressBarDlg~new(sd"rc\PropertySheetDemo.rc", IDD_PROGRESSBAR_DLG) + t4 = .TrackBarDlg~new(sd"rc\PropertySheetDemo.dll", IDD_TRACKBAR_DLG) + t5 = .TabDlg~new(sd"rc\PropertySheetDemo.dll", IDD_TAB_DLG) + + tabContent = .array~of(t1, t2, t3, t4, t5) + + -- Create the main dialog. + dlg = .NewControlsDialog~new(sd'rc\PropertySheetDemo.dll', IDD_NEWCONTROLS_DLG) + + -- Invoke the prep() methods of the list view and progress bar dialogs to do + -- some initial set up before we start executing the main dialog. Note that + -- the list view (t1) dialog needs to have its owner dialog set before + -- invoking the prep method. + t1~ownerDialog = dlg + t1~prep + t3~prep + + -- Invoke the main dialog's prep() method to do some initial set up before the + -- dialog is started executing. + dlg~prep(tabContent) + + -- Show and run the dialog. + dlg~execute('SHOWTOP', IDI_DLG_OODIALOG) + + return 0 + +::requires "ooDialog.cls" + +::class 'NewControlsDialog' subclass ResDialog inherit ResizingAdmin + +::attribute tabContent + +::method defineSizing + + -- In order for the ResizingAdmin to properly size ControlDialog dialogs + -- used as pages in a tab control, it must be informed of the dialogs and + -- what tab control they are in. We do that by creating an array of their + -- IDs and pass the tab control's resource ID and the array to the + -- pagedTab() method. + -- + -- Note that the dialog IDs must be the dlgID attribute of the dialogs. In + -- this case the resource ID of the dialog has the same value as the dlgID + -- attribute, but this is not always the case. Please read the doc tor the + -- dlgID attribute in the ooDialog reference manual to understand this. + + dlgIDs = .array~of(IDD_LISTVIEW_DLG, IDD_TREEVIEW_DLG, IDD_PROGRESSBAR_DLG, - + IDD_TRACKBAR_DLG, IDD_TAB_DLG) + self~pagedTab(IDC_TAB, dlgIDs) + + -- Now, we have 5 controls in this the main dialog. The tab control and 4 + -- push buttons. We define the sizing for all edges of the tab control at + -- one time. We want the tab control edges to remain the same distance + -- from each corresponding edge of the dialog. So we use a stationary pin + -- type. The pin to window is the dialog, which is the default, so we do + -- not need to specify the third index in the array. + self~controlSizing(IDC_TAB, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + -- For the 4 push buttons, we want them to remain fixed in size, with the + -- Previous and Next buttons pinned to the bottom left of the dialog and the + -- Ok and Cancel buttons pinned to the right bottom of the dialog. + -- + -- There is probably some clever use of the default sizing that could reduce + -- the number of lines of code here, but it is sometimes better to just + -- spell everything out in code so that it is obvious what is happening. + + self~controlSizing(IDC_PB_PREVIOUS, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Pin the left of the Next button to the right of the Previous button + self~controlSizing(IDC_PB_NEXT, - + .array~of('STATIONARY', 'RIGHT', IDC_PB_PREVIOUS), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Ror the Ok and Cancel buttons, we just do a sort of 'mirror-image' of + -- what we just did for the Previous and Next buttons. + + self~controlSizing(IDCANCEL, - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Pin the left of the Ok button to the left of the Cancel button + self~controlSizing(IDOK, - + .array~of('STATIONARY', 'LEFT', IDCANCEL), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- We register to recieve a notification when the sizing of the dialog has + -- ended. We need this event so we can invoke the placeButton() method in + -- our child, TabDlg, dialog. In the TabDlg dialog, there is an owner-drawn + -- button that serves as the context of the tab control. That button needs + -- to be sized and positioned so that it completely occupies the display + -- rectangle of the tab control. Besides the initial sizing of the button, + -- the sizing also has to take place every time the size of dialog has + -- changed. The placeButton() method does the sizing, but the TabDlg dialog + -- has no way to know *when* the sizing should be done. Only this, the main + -- dialog, has a way to know when the sizing should take place. + self~wantSizeEnded('onSizeEnded', .true) + + -- We must return 0 from this method to continue. + return 0 + +/** prep() + * + * This method is invoked before the dialog is executed. It does some initial + * set up that would normally be done (by the author) in initDialog(). The + * tabContent argument is an array of the 5 ControlDialog dialogs used as the + * content for the 5 pages of the tab control. This array is saved in the + * tabContent attribute so the dialogs can be accessed when needed. + */ +::method prep + expose tabContent lastSelected havePositioned + use strict arg tabContent + + -- The havePositioned array is used to determine if the page dialogs have been + -- positioned or not. Mark all 5 dialogs as not having been positioned yet. + havePositioned = .array~of(.false, .false, .false, .false, .false) + + -- No tab has been selected yet + lastSelected = 0 + + -- Connect the event handling methods to the events we are interested in. + self~connectButtonEvent(IDC_PB_PREVIOUS, CLICKED, onPrevious) + self~connectButtonEvent(IDC_PB_NEXT, CLICKED, onNext) + self~connectTabEvent(IDC_TAB, SELCHANGE, onNewTab) + + +/** initDialog() + * + * Initialize the underlying Windows dialog. This includes setting up the tab + * control tabs, executing the dialog used for the first tab, and positioning + * the dialog over the display area of the tab control. There are 5 + * .ControlDialog dialogs. The dialogs are used for the display + * area of the tab control, one control dialog for each tab of the tab control. + */ +::method initDialog + expose tabContent tabControl pbNext pbPrevious needCalculation + + needCalculation = .true + + -- Start executing the control dialog for the first tab in the tab control. + -- We can not resize and reposition the control dialog until the underlying + -- dialog is created, so we get it started, then do our other tasks. + dlg = tabContent[1] + dlg~execute + + -- Add the tabs to the tab control. + tabControl = self~newTab(IDC_TAB) + tabControl~addSequence("List View", "Tree View", "Progress Bar", "Track Bar", "Tab") + + -- Save a reference to the push buttons. + pbNext = self~newPushButton(IDC_PB_NEXT) + pbPrevious = self~newPushButton(IDC_PB_PREVIOUS) + + -- Position and show the control dialog used for the first page of the tab. + self~positionAndShow(1) + + +/** calculateDisplayArea() + * + * Tab controls contain two areas, the tabs themselves and the display area. + * The display area is where the content for each tab is drawn. + * + * We need to match the control dialog(s) size and position with the display + * area size and position. There are two approaches here: + * + * We could calculate the size of the largest dialog, resize the tab control to + * match, and position the control dialog over the display area. + * + * We can get the size and position of the tab control's display area and resize + * and reposition the control dialog(s) to match. This is the approach we use + * here. + */ +::method calculateDisplayArea private + expose tabControl displayRect + + -- Given a rectangle describing the tab control's size and position, the tab + -- control itself will calculate the display area's size and position. + r = tabControl~windowRect + tabControl~calcDisplayRect(r) + + -- Save the size of the display area, we need it later. + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Now we need to map the display area's position on the screen, to the client + -- co-ordinates of the main dialog. The control dialog(s) are children windows + -- of the main dialog, which is why we need to use the client-area of the + -- dialog, not the client area of the tab control. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Create our display rectangle. This is used in setWindowPosition(), which + -- takes a point / size rectangle. ooDialog defines a point / size rectangle + -- as using the left and top attributes for the position of the upper left + -- corner of a rectangle, using the right attribute for the width of the + -- rectangle, and using the bottom attribute for the height of the rectangle. + displayRect = .Rect~new(p~x, p~y, s~width, s~height) + + +/** positionAndShow() + * + * Used to resize and reposition one of the control dialogs so it occupies the + * display area of the tab control. + * + */ +::method positionAndShow private + expose tabControl tabContent displayRect lastSelected havePositioned needCalculation + use strict arg index + + -- We can not position the control dialog until the underlying Windows dialog + -- is created. If the system is heavily loaded for some reason, this may not + -- have happened yet. We need to wait for it. + dlg = tabContent[index] + do i = 1 to 10 + if dlg~hwnd <> 0 then leave + z = SysSleep(.01) + end + + if dlg~hwnd == 0 then do + say "Error creating dialog for the tab with index:" index", aborting" + return self~cancel + end + + if lastSelected <> 0 then tabContent[lastSelected]~hide + + -- Determine the position and size of the display area of the tab control. + -- Note: in the non-resizable example program, we only calculate the display + -- rect once. Here we need to calculate it every time the dialog has been + -- resized. To avoid calculating the display rectangle over and over when it + -- is not needed, we track when the dialog has been resized using the + -- needCalculation variable and only do the calculation when necessary. + if needCalculation then do + self~calculateDisplayArea + needCalculation = .false + end + + -- Now resize and reposition the control dialog to the tab control's display + -- area. We need to position the control dialog *above* the tab control in + -- the Z-order so that it shows. + dlg~setWindowPos(tabControl~hwnd, displayRect, "SHOWWINDOW NOOWNERZORDER") + + -- Normally this redraw is not needed. But, for resizable dialogs, when the + -- main dialog is resized before the page dialog has been started, when the + -- page dialog is started and sized to the display rect, it does not always + -- paint correctly. Invoking the redraw() method seems to fix that problem. + -- Here we use the start() method to invoke redraw() on another thread, which + -- seems to fix things the best. + self~start('REDRAW') + + lastSelected = index + havePositioned[index] = .true + + self~checkButtons + + +-- The onSizeEnded() method is invoked when the user has resized the dialog and +-- that sizing is ended. At this point the TabDlg dialog needs to recalculate +-- and position the owner-drawn button. Also, at this point we need to +-- recalculate the display +::method onSizeEnded unguarded + expose tabContent needCalculation + + needCalculation = .true + + tabContent[5]~placeButton + + return 0 + + +::method onNewTab + expose tabControl tabContent havePositioned lastSelected + + index = tabControl~selectedIndex + 1 + dlg = tabContent[index] + + if havePositioned[index] then do + last = tabContent[lastSelected] + last~hide + dlg~show + lastSelected = index + end + else do + dlg~ownerDialog = self + dlg~execute + self~positionAndShow(index) + if index == 5 then dlg~placeButton + end + + -- The activateThreads() method only starts the threads running when they are + -- not already running. So, we just invoke the method every time the dialog + -- is shown. That way if they had already been activated, but finished, they + -- are restarted when the dialog is shown. + if index == 3 then dlg~activateThreads + + self~checkButtons + + +::method onNext + expose tabControl + + tabControl~selectIndex(tabControl~selectedIndex + 1) + self~onNewTab + + +::method onPrevious + expose tabControl + + tabControl~selectIndex(tabControl~selectedIndex - 1) + self~onNewTab + + +::method checkButtons private + expose tabControl pbNext pbPrevious + + index = tabControl~selectedIndex + 1 + if index == 1 then do + pbPrevious~disable + pbNext~enable + end + else if index == 5 then do + pbPrevious~enable + pbNext~disable + end + else do + pbPrevious~enable + pbNext~enable + end + + +::method cancel + expose tabContent + + do dlg over tabContent + dlg~endExecution(.false) + end + + return self~cancel:super + +::method ok + expose tabContent + + do dlg over tabContent + dlg~endExecution(.true) + end + + return self~ok:super + + + +::class 'ListViewDlg' subclass ResControlDialog inherit ResizingAdmin + +::method defineSizing + + -- The only control in this dialog is the list-view. We define its sizing + -- so that each edge of the list-view maintains the same distance to its + -- corresponding edeg of the dialog: + self~controlSizing(IDC_LV_MAIN, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + -- A value must be returned from the defineSizing() method. O allows the + -- dialog to continue, any other values is a failure and the dialog will be + -- ended. + return 0 + + +::method initDialog + expose lv imageList listData + + -- Instantiate a Rexx list view object that represents the underlying + -- Windows list-view. The list-view style is report. + lv = self~newListView(IDC_LV_MAIN) + + -- Set the column headers + lv~insertColumn(0, "Symbol", 40) + lv~insertColumn(1, "Quote", 50) + lv~insertColumn(2, "Year high", 50) + lv~insertColumn(3, "Year low", 50) + lv~insertColumn(4, "Description", 120) + + lv~setImageList(imageList, SMALL) + + -- Fill the list-view with random data. + do row over listData + lv~addRow( , row[1], row[2], row[3], row[4], row[5], row[6]) + end + + -- Add full row select and the ability to drag and drop the columns to the + -- list-view. + lv~addExtendedStyle("FULLROWSELECT HEADERDRAGDROP") + + -- There is a known redrawing problem when a list view is used in a tab + -- control. ooDialog has an internal fix for that (see initUpdateListView.) + -- But, when the list view is the first page of the tab control, the list + -- view needs to have gained the focus before the dialog is covered up by + -- another window, for the fix to work. Assigning the focus here prevents + -- the very rare occurrence of a user opening the dialog, immediately + -- switching to another window, and then switching back to the dialog, and + -- the fix not working. + lv~assignFocus + +/** onActivate + * + * Invoked when a list-view item is double-clicked. We display a message and + * set the focus to the next item in the list. + */ +::method onActivate + expose lv + + selectedItem = lv~focused + symbol = lv~itemText(selectedItem) + price = lv~itemText(selectedItem, 1) + + question = "You have selected the stock with symbol" symbol". Do you want to order" || .endOfLine || - + "50 shares of stock at" price"?" + placeOrder = MessageDialog(question, self~hwnd, "Place Order for Stock", "YESNO", "QUESTION", "DEFBUTTON2" ) + + cost = 50 * price~substr(2) + if placeOrder == self~constDir["IDYES"] then do + j = MessageDialog("Okay, your bank account will be debited $"cost "dollars.", self~hwnd, - + "Order Confirmation", "OK", "INFORMATION") + end + else do + j = MessageDialog("That saved you $"cost "dollars.", self~hwnd, "Order Canceled", "OK", "EXCLAMATION") + end + + lv~deselect(selectedItem) + selectedItem += 1 + lv~focus(selectedItem) + lv~select(selectedItem) + + +/** onColumnClick() + * + * Invoked when a column header of the list-view is clicked. We just show a + * message box so that the user has some feedback. + */ +::method onColumnClick + use arg id, column + + msg = "Column" column + 1 "was clicked in control" id + j = MessageDialog(msg, self~hwnd, "List-View Notification") + + +/** prep() + * + * Does some initial set up for the list view dialog. This is moved out of the + * initDialog() method to, perhaps, help populate the list view a little + * quicker. + */ +::method prep + expose imageList listData + + -- Initialize the internal fix for the list-view redrawing problem when a + -- list-view is used in a tab control. + self~initUpdateListView(IDC_LV_MAIN) + + -- Create the image list for the list-view. The image list will consist of + -- 4 images. The images are used as the icons for each item in the list + -- view. Each item is assigned 1 image, at random, when the item is added + -- to the list-view. + -- + -- The list-view control is created without the SHAREIMAGES styles, so it + -- takes care of releasing the image list when the program ends. + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoListView.bmp") + imageList = .ImageList~create(.Size~new(16, 16), COLOR8, 4, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + + -- The image list makes a copy of the bitmap, so we can release it now + -- to free up some (small) amount of system resources. This is not + -- necessary, the OS will release the resource automatically when the + -- program ends. + image~release + end + + -- Create the data for each item (row) in the list view. The rows are + -- added to the list view in the initDialog() method + listData = .array~new(26) + do ch = "A"~c2d to "Z"~c2d + q = random(200) + yh = random(400) + yh = max(yh, q) + yl = random(100) + yl = min(yl, q) + row = .array~new(6) + row[1] = random(3) + row[2] = "_" || ch~d2c~copies(3) || "_" + row[3] = "$" || q + row[4] = "$" || yh + row[5] = "$" || yl + row[6] = ch~d2c~copies(3) "is a fictitious company." + listData~append(row) + end + + -- Connect 2 list-view events to Rexx methods in this dialog. The double- + -- click on a list-view item, and the click on a column header events. + self~connectListViewEvent(IDC_LV_MAIN, "ACTIVATE", "onActivate") + self~connectListViewEvent(IDC_LV_MAIN, "COLUMNCLICK") + + +::class 'TreeViewDlg' subclass ResControlDialog inherit ResizingAdmin + +-- ::method defineSizing + -- The tree-view is the only control in this dialog. We could take the same + -- approach we did in the ListViewDlg and stationary pin the edges of the + -- tree-view to the edges of the dialog so that the tree-view takes up as + -- much space as possible. But, the default proportional pinning of the + -- edges actually looks good for this dialog. So, we just use the default + -- sizing. + + +::method initDialog + + -- Instantiate a Rexx tree view object that represents the Windows tree-view + -- control. + tv = self~newTreeView(IDC_TV_MAIN) + + -- Create and set the ImageList for the tree view items + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoTreeView.bmp") + imageList = .ImageList~create(.Size~new(32, 32), COLOR8, 10, 0) + if \image~isNull, \imageList~isNull then do + imageList~add(image) + tv~setImageList(imageList, NORMAL) + image~release + end + + -- Add the tree view items. Toys will be the root (the first argument is + -- not omitted. Subitems are added by omitting the first arguments. The + -- number of arguments omitted indicates the depth of the subitem. + -- + -- The last numeric argument in some of the items is the index for the icon + -- for that item in the image list. Those items without a number will not + -- display an icon. + + tv~add("Toys", 1) + tv~add(, "Indoor", 14) + tv~add(, , "Boys", 19) + tv~add(, , , "Cowboys", 13) + tv~add(, , , "Cars", 8) + tv~add(, , , "Starwars", 9) + tv~add(, , "Girls", 0) + tv~add(, , , "Barby", 19) + tv~add(, , , "Painting", 15) + tv~add(, , , "Cooking", 13) + tv~add(, , "Adults", 17) + tv~add(, , , "Poker", 15) + tv~add(, , "Technical", 16) + tv~add(, , , "Racing cars", 8) + tv~add(, , , "Trains", 7) + tv~add(, "Outdoor", 11) + tv~add(, , "Water", 22) + tv~add(, , , "Ball", 5) + tv~add(, , , "Soft tennis", 6) + tv~add(, , "Sand", 12) + tv~add(, , , "Shovel", 12) + tv~add(, , , "Bucket", 19) + tv~add(, , , "Sandbox", 12) + tv~add(, , "Technical", 16) + tv~add(, , , "Trains", 7) + tv~add(, , , "Remote controlled", 8) + tv~add("Office Articles", 2) + tv~add( , "Tools", 16) + tv~add( , "Books", 19) + tv~add( , , "Introduction", 14) + tv~add( , , "Advanced Programming", 17) + tv~add( , , "Tips & Tricks", 16) + tv~add("Hardware", 4) + tv~add( , "Garden", 0) + tv~add( , "Handyman", 18) + tv~add( , "Household", 18) + tv~add("Furniture", 3) + tv~add( , "Standard", 12) + tv~add( , "Luxury", 21) + + -- Connecting the begin drag event and using the default tree drag handler + -- allows us to suppport drag and drop (using the default behaviour. + self~connectTreeViewEvent(IDC_TV_MAIN, "BeginDrag", "DefTreeDragHandler") + + +::class 'ProgressBarDlg' subclass RcControlDialog inherit ResizingAdmin + +-- Define the sizing for the controls. Note that for the progress bars, we want +-- to use the default sizing so that they resize proportionally. But, we want +-- the static labels to be fixed in size and pinned to the progress bar the +-- label is for. +-- +-- The individual sizing for a control is added to the sizing table in the order +-- the sizings are defined. Then, during a resize event, the windows are sized +-- in the order they occur in the table. For any control sizing definition, the +-- pin to window has to *precede* the control in the table. Otherwise resizing +-- would not work correctly. +-- +-- What this means is that we can not pin a static control to its progress bar +-- unless the progress bar is already in the table. The defaultSizing() method +-- allows us to put a control in to the table with a minimum amount of typing. +-- +-- We also show both ways of defing the edges of a control. Using individual +-- method calls for each edge, or using the single method call, controlSizing(). +::method defineSizing + + self~noMinSize + + self~useDefaultSizing(IDC_PBAR_PROCESSA) + self~useDefaultSizing(IDC_PBAR_PROCESSB) + self~useDefaultSizing(IDC_PBAR_PROCESSC) + self~useDefaultSizing(IDC_PBAR_PROCESSD) + self~useDefaultSizing(IDC_PBAR_PROCESSE) + + self~controlLeft( IDC_ST_PROCESSA, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSA) + self~controlTop( IDC_ST_PROCESSA, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSA) + self~controlRight( IDC_ST_PROCESSA, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSA, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSB, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSB) + self~controlTop( IDC_ST_PROCESSB, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSB) + self~controlRight( IDC_ST_PROCESSB, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSB, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSC, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSC) + self~controlTop( IDC_ST_PROCESSC, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSC) + self~controlRight( IDC_ST_PROCESSC, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSC, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSD, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSD) + self~controlTop( IDC_ST_PROCESSD, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSD) + self~controlRight( IDC_ST_PROCESSD, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSD, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_PROCESSE, 'STATIONARY', 'XCENTER', IDC_PBAR_PROCESSE) + self~controlTop( IDC_ST_PROCESSE, 'STATIONARY', 'TOP', IDC_PBAR_PROCESSE) + self~controlRight( IDC_ST_PROCESSE, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_PROCESSE, 'MYTOP', 'TOP') + + self~controlSizing(IDC_ST_PERCENTA, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSA), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSA), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTB, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSB), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSB), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTC, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSC), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSC), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTD, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSD), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSD), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PERCENTE, - + .array~of('STATIONARY', 'XCENTER', IDC_PBAR_PROCESSE), - + .array~of('STATIONARY', 'BOTTOM', IDC_PBAR_PROCESSE), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + return 0 + + +::method prep + expose threadsStarted processes + + threadsStarted = 0 + processes = .array~of('animateProgressA', 'animateProgressB', 'animateProgressC', - + 'animateProgressD', 'animateProgressE') + + +-- This message is sent to us by the owner dialog, the .NewControlsDialog dialog +-- to notify us that we are about to become visible. We use the notification to +-- start the progress bar animation threads. +::method activateThreads unguarded + expose threadsStarted processes + + reply 0 + + -- If no threads are running, start a thread to run each progress bar + -- asynchronously. + if threadsStarted < 1 then do + threadsStarted = processes~items + do methodName over processes + self~start(methodName) + end + end + +-- This is a generic method that simulates some type of processing that takes a +-- long time. The progress of this processing is displayed by the progress bar. +::method animateProgress unguarded + use arg progressBar, label, step, iterations, tsleep + + progressBar~setRange(0, iterations * step) + progressBar~setStep(step) + do i = 1 to iterations + progressBar~step + if (iterations * step == 100) then label~setText(i * step "%") + else label~setText(i * step) + + call msSleep tsleep + if \ self~isDialogActive then return + end + +-- The following 5 methods are started asynchronously to animate the progress +-- bars. +::method animateProgressA unguarded + expose threadsStarted pbA labelA + + if \ pbA~isA(.ProgressBar) then do + pbA = self~newProgressBar(IDC_PBAR_PROCESSA) + labelA = self~newStatic(IDC_ST_PERCENTA) + end + + self~animateProgress(pbA, labelA, 5, 20, 600) + threadsStarted -= 1 + +::method animateProgressB unguarded + expose threadsStarted pbB labelB + + if \ pbB~isA(.ProgressBar) then do + pbB = self~newProgressBar(IDC_PBAR_PROCESSB) + labelB = self~newStatic(IDC_ST_PERCENTB) + end + + self~animateProgress(pbB, labelB, 1, 100, 150) + threadsStarted -= 1 + +::method animateProgressC unguarded + expose threadsStarted pbC labelC + + if \ pbC~isA(.ProgressBar) then do + pbC = self~newProgressBar(IDC_PBAR_PROCESSC) + labelC = self~newStatic(IDC_ST_PERCENTC) + end + + self~animateProgress(pbC, labelC, 2, 50, 200) + threadsStarted -= 1 + +::method animateProgressD unguarded + expose threadsStarted pbD labelD + + if \ pbD~isA(.ProgressBar) then do + pbD = self~newProgressBar(IDC_PBAR_PROCESSD) + labelD = self~newStatic(IDC_ST_PERCENTD) + end + + self~animateProgress(pbD, labelD, 10, 40, 300) + threadsStarted -= 1 + +::method animateProgressE unguarded + expose threadsStarted pbE labelE + + if \ pbE~isA(.ProgressBar) then do + pbE = self~newProgressBar(IDC_PBAR_PROCESSE) + labelE = self~newStatic(IDC_ST_PERCENTE) + end + + self~animateProgress(pbE, labelE, 20, 50, 500) + threadsStarted -= 1 + + +::class 'TrackBarDlg' subclass ResControlDialog inherit ResizingAdmin + +-- Define the sizing of the controls. Here, we have the 2 static frames that +-- surround the trackbars grow proportionally to the dialog, which is the +-- deault. Then we pin the controls inside of a static frame to the static +-- frame. +-- +-- For the horizontal trackbars, it makes sense for them to stretch horizontally +-- as the dialog widens. But there is no point in them stretching vertially as +-- the dialog get taller. The actual part of the control that is drawn keeps +-- the same vertical height. +-- +-- The reverse is true for the vertical trackbars, the should stretch vertically +-- and remain fixed horizontally. +-- +-- All the static labels should remain fixed in size. The labels for the +-- horizontal trackbars are pinned to the bottoms of their trackbars and pinned +-- proportionally to the left of their trackbars. The labels for the vertical +-- trackbars are pinned to the top of their trackbars and to the center of their +-- trackbars. +-- +-- For the horizontal trackbars: the top trakbar is pinned to the top of its +-- frame, the bottom to the bottom of its frame, and the middle trackbar is +-- pinned to the vertical center of its frame. +-- +-- For the vertical trackbars: the left trackbar is pinned to the left of its +-- frame, the right is pinned to the right of its frame, and the middle trackbar +-- is pinned to the horizontal center of its frame. +::method defineSizing + + self~noMinSize + + self~useDefaultSizing(IDC_ST_FRAME_LEFT) + + self~controlLeft( IDC_TB_HORZ_BOTTOM, 'STATIONARY', 'LEFT', IDC_ST_FRAME_LEFT) + self~controlTop( IDC_TB_HORZ_BOTTOM, 'STATIONARY', 'TOP', IDC_ST_FRAME_LEFT) + self~controlRight( IDC_TB_HORZ_BOTTOM, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_LEFT) + self~controlBottom(IDC_TB_HORZ_BOTTOM, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_HORZ_BOTTOM, 'PROPORTIONAL', 'LEFT', IDC_TB_HORZ_BOTTOM) + self~controlTop( IDC_ST_HORZ_BOTTOM, 'STATIONARY', 'BOTTOM', IDC_TB_HORZ_BOTTOM) + self~controlRight( IDC_ST_HORZ_BOTTOM, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_HORZ_BOTTOM, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_HORZ_TOP, 'STATIONARY', 'LEFT', IDC_ST_FRAME_LEFT) + self~controlTop( IDC_TB_HORZ_TOP, 'STATIONARY', 'YCENTER', IDC_ST_FRAME_LEFT) + self~controlRight( IDC_TB_HORZ_TOP, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_LEFT) + self~controlBottom(IDC_TB_HORZ_TOP, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_HORZ_TOP, 'PROPORTIONAL', 'LEFT', IDC_TB_HORZ_TOP) + self~controlTop( IDC_ST_HORZ_TOP, 'STATIONARY', 'BOTTOM', IDC_TB_HORZ_TOP) + self~controlRight( IDC_ST_HORZ_TOP, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_HORZ_TOP, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_HORZ_BOTH, 'STATIONARY', 'LEFT', IDC_ST_FRAME_LEFT) + self~controlTop( IDC_TB_HORZ_BOTH, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_LEFT) + self~controlRight( IDC_TB_HORZ_BOTH, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_LEFT) + self~controlBottom(IDC_TB_HORZ_BOTH, 'MYTOP', 'TOP') + + self~controlLeft( IDC_ST_HORZ_BOTH, 'PROPORTIONAL', 'LEFT', IDC_TB_HORZ_BOTH) + self~controlTop( IDC_ST_HORZ_BOTH, 'STATIONARY', 'BOTTOM', IDC_TB_HORZ_BOTH) + self~controlRight( IDC_ST_HORZ_BOTH, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_HORZ_BOTH, 'MYTOP', 'TOP') + + self~useDefaultSizing(IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_TB_VERT_RIGHT, 'STATIONARY', 'LEFT', IDC_ST_FRAME_RIGHT) + self~controlTop( IDC_TB_VERT_RIGHT, 'STATIONARY', 'TOP', IDC_ST_FRAME_RIGHT) + self~controlRight( IDC_TB_VERT_RIGHT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_TB_VERT_RIGHT, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_ST_VERT_RIGHT, 'STATIONARY', 'XCENTER', IDC_TB_VERT_RIGHT) + self~controlTop( IDC_ST_VERT_RIGHT, 'STATIONARY', 'TOP', IDC_TB_VERT_RIGHT) + self~controlRight( IDC_ST_VERT_RIGHT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_VERT_RIGHT, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_VERT_LEFT, 'STATIONARY', 'XCENTER', IDC_ST_FRAME_RIGHT) + self~controlTop( IDC_TB_VERT_LEFT, 'STATIONARY', 'TOP', IDC_ST_FRAME_RIGHT) + self~controlRight( IDC_TB_VERT_LEFT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_TB_VERT_LEFT, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_ST_VERT_LEFT, 'STATIONARY', 'XCENTER', IDC_TB_VERT_LEFT) + self~controlTop( IDC_ST_VERT_LEFT, 'STATIONARY', 'TOP', IDC_TB_VERT_LEFT) + self~controlRight( IDC_ST_VERT_LEFT, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_VERT_LEFT, 'MYTOP', 'TOP') + + self~controlLeft( IDC_TB_VERT_BOTH, 'STATIONARY', 'RIGHT', IDC_ST_FRAME_RIGHT) + self~controlTop( IDC_TB_VERT_BOTH, 'STATIONARY', 'TOP', IDC_ST_FRAME_RIGHT) + self~controlRight( IDC_TB_VERT_BOTH, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_TB_VERT_BOTH, 'STATIONARY', 'BOTTOM', IDC_ST_FRAME_RIGHT) + + self~controlLeft( IDC_ST_VERT_BOTH, 'STATIONARY', 'XCENTER', IDC_TB_VERT_BOTH) + self~controlTop( IDC_ST_VERT_BOTH, 'STATIONARY', 'TOP', IDC_TB_VERT_BOTH) + self~controlRight( IDC_ST_VERT_BOTH, 'MYLEFT', 'LEFT') + self~controlBottom(IDC_ST_VERT_BOTH, 'MYTOP', 'TOP') + + return 0 + + + +::method initDialog + expose font1 trackBars tbLabels + + -- As we initialize each track bar we'll stash the Rexx object in a table + -- for easy access later, indexed by its numeric resource id. The same + -- thing is done for the static control that is the label for the track bar. + trackBars = .table~new + tbLabels = .table~new + + -- For the horizonatal track bars we'll use a big font for the label. + font1 = self~CreateFontEx("Arial", 24, "BOLD") + + -- The symbolic IDs for the track bars / labels are named after the style + -- of the track bar. Vertical or horizontal and where the ticks are placed. + + -- Initialize the horizontal track bar with ticks on the bottom. + tb = self~newTrackBar(IDC_TB_HORZ_BOTTOM) + label = self~newStatic(IDC_ST_HORZ_BOTTOM) + + tb~setTickFrequency(10) + tb~setPos(20, .true) + label~setText(20) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTTOM] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the top. + tb = self~newTrackBar(IDC_TB_HORZ_TOP) + label = self~newStatic(IDC_ST_HORZ_TOP) + + tb~initRange(0, 200) + tb~setTickFrequency(50) + tb~setPos(40, .true) + label~setText(40) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_TOP] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the horizontal track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_HORZ_BOTH) + label = self~newStatic(IDC_ST_HORZ_BOTH) + + tb~initSelRange(20, 60) + tb~setTickFrequency(10) + tb~setPos(80, .true) + label~setText(80) + label~setFont(font1) + + id = self~constDir[IDC_TB_HORZ_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the right. + tb = self~newTrackBar(IDC_TB_VERT_RIGHT) + label = self~newStatic(IDC_ST_VERT_RIGHT) + + tb~setTickFrequency(10) + tb~setPos(30, .true) + label~setText(30) + + id = self~constDir[IDC_TB_VERT_RIGHT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the left. + tb = self~newTrackBar(IDC_TB_VERT_LEFT) + label = self~newStatic(IDC_ST_VERT_LEFT) + + tb~setTickFrequency(10) + tb~initRange(0,400) + tb~setLineStep(5) + tb~setPageStep(50) + tb~setPos(90, .true) + label~setText(90) + + id = self~constDir[IDC_TB_VERT_LEFT] + trackBars[id] = tb + tbLabels[id] = label + + -- Initialize the vertical track bar with ticks on the both sides. + tb = self~newTrackBar(IDC_TB_VERT_BOTH) + label = self~newStatic(IDC_ST_VERT_BOTH) + + tb~setTickFrequency(5) + tb~setPos(70, .true) + label~setText(70) + + id = self~constDir[IDC_TB_VERT_BOTH] + trackBars[id] = tb + tbLabels[id] = label + + -- Connect the event notification that is sent when a track bar is moved to + -- the onEndTrack() method. That method will update the text label for the + -- track bar with the new postition. + self~connectTrackBarEvent(IDC_TB_HORZ_BOTH, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_TOP, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_HORZ_BOTTOM, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_RIGHT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_LEFT, "EndTrack", "onEndTrack") + self~connectTrackBarEvent(IDC_TB_VERT_BOTH, "EndTrack", "onEndTrack") + +-- Update the static contol that shows the position for a slider when the +-- user is done moving it. +::method onEndTrack + expose trackBars tbLabels + use arg code, hwndTrackBar + + -- hwndTrackBar is the handle to the track bar that was moved. Get its + -- resource ID and use that as an index into the table of track bar objects + -- and the table of the labels. + id = self~getControlID(hwndTrackBar) + tbLabels[id]~setText(trackBars[id]~pos) + +-- We use the leaving() method to clean up (delete) the font we created. In +-- this program there is really no need to do this. As soon as the interpreter +-- terminates, the OS cleans up the resources automatically. The only time +-- cleaning up resources makes sense is in a long-running program that creates +-- and ends a lot of dialogs. Then, over time, the memory usge of the program +-- would keep growing. +::method leaving + expose font1 + self~deleteFont(font1) + + +::class 'TabDlg' subclass ResControlDialog inherit ResizingAdmin + +::method defineSizing + + self~controlSizing(IDC_TAB_MAIN, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + return 0 + + +::method initDialog + expose font2 font3 imageList iconsRemoved needWrite pb tc + + -- Set the iconsRemoved and needWrite to false. These flags are used in + -- the OnDrawTabRect() method. + iconsRemoved = .false + needWrite = .false + + -- Connect the draw event of the owner-drawn button. This is sent when the + -- button needs to be drawn. Then connect the selection changed event of the + -- tab control. This is sent when the user clicks on a different tab. + self~connectDraw(IDC_PB_OWNERDRAW, "onDrawTabRect") + self~connectTabEvent(IDC_TAB_MAIN, "SELCHANGE", "onTabSelChange") + + pb = self~newPushButton(IDC_PB_OWNERDRAW) + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Create a font used to display the name of the color in the owner-drawn + -- button. Create another font used to display some informative text. + font2 = self~createFontEX("Arial", 48, "BOLD ITALIC") + font3 = self~createFontEx("Arial", 16, "BOLD") + + -- Add all the tabs, including the index into the image list for an icon for + -- each tab. + tc~AddFullSeq("Red", 0, ,"Green", 1, , "Moss", 2, , "Blue", 3, , "Purple", 4, , "Cyan", 5, , "Gray", 6) + + -- Create a COLORREF (pure white) and load our bitmap. The bitmap is a + -- series of 16x16 images, each one a colored letter. + cRef = .Image~colorRef(255, 255, 255) + image = .Image~getImage(.application~srcDir"rc\propertySheetDemoTab.bmp") + + -- Create our image list, as a masked image list. + flags = 'COLOR24 MASK' + imageList = .ImageList~create(.Size~new(16, 16), flags, 10, 0) + if \image~isNull, \imageList~isNull then do + -- The bitmap is added and the image list deduces the number of images + -- from the width of the bitmap. For each image, the image list creates a + -- mask using the color ref. In essence, the mask is used to turn each + -- white pixel in the image to transparent. In this way, only the letter + -- part of the image shows and the rest of the image lets the under-lying + -- color show through. + imageList~addMasked(image, cRef) + tc~setImageList(imageList) + + -- The image list makes a copy of each image added to it. So, we can now + -- release the original image to free up some small amount of system + -- resoureces. + image~release + end + else do + iconsRemoved = .true + end + + -- In a stand-alone dialog, we would size and position the content of the + -- tab control here. But, this dialog is itself the content of the tab + -- control in the main dialog. And, at this point, the main dialog has not + -- sized and positioned us. + -- + -- If we call placeButton() at this point, the button won't be sized + -- correctly, because we are not yet sized. Rather, for this program, the + -- main dialog invokes our placeButton() method at the proper time. Only + -- the main dialog knows what that proper time is. + + +-- This method sizes the owner-drawn button so that it is the size of the +-- display rectangle of the tab control. The process has to be done after this +-- dialog has been sized and positioned by the main dialog. This dialog can not +-- know when that has happened, only the main dialog knows that. So, it is the +-- main dialog that invokes this method. +::method placeButton unguarded + expose pb tc + + -- We could be invoked before the underlying dialog has been created. + if \ tc~isA(.Tab) then return 0 + + -- Have the tab control calculate its display area's size and position. + r = tc~windowRect + tc~calcDisplayRect(r) + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Map the display area's position on the screen, to the client co-ordinates + -- of this control dialog. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Now resize and reposition the button so it exactly over-lays the display + -- area of the tab control. We specify that the tab control window is behind + -- the button and use the flag that prevents the button's owner window, this + -- z-order from changing. This leaves the tab control on top of the dialog, + -- and our push button on top of the tab control. Which of course is what we + -- want. + pb~setWindowPos(tc~hwnd, p~x, p~y, s~width, s~height, "SHOWWINDOW NOOWNERZORDER") + + return 0 + + +-- When a new tab is selected, we have the owner-drawn button update itself. +-- This causes the button to redraw and the onDrawTabRect() method gets invoked, +-- which actually does the drawing. +::method onTabSelChange + expose pb + pb~update + + +-- Fill the owner-drawn button with the color matching the tab's label and write +-- the name of the color. +::method onDrawTabRect + expose font2 font3 imageList iconsRemoved needWrite + use arg id + + button = self~newPushButton(id) + if button == .nil then return + tc = self~newTab(IDC_TAB_MAIN) + if tc == .nil then return + + -- Each time the 'Gray' tab is selected, we remove the tab icons. Then, when + -- one of the other tabs is selected we set the image list back. + currentTab = tc~selected + if currentTab == 'Gray' then do + tc~setImageList(.nil) + iconsRemoved = .true + needWrite = .true + end + else do + if iconsRemoved then do + tc~setImageList(imageList) + iconsRemoved = .false + needWrite = .true + end + end + + -- Get the button's device context, create pen and brush, and assign pen, + -- brush and font to the device context. + dc = button~getDC + pen = button~createPen(1, "SOLID", 0) + brush = button~createBrush(tc~SelectedIndex + 1) + + oldPen = button~objectToDc(dc, pen) + oldBrush = button~objectToDc(dc, brush) + oldFont = button~fontToDC(dc, font2) + button~transparentText(dc) + + -- Draw a filled in rectangle, with a border of 5 around it, and write text. + size = button~getRealSize + button~rectangle(dc, 5, 5, size~width - 5, size~height - 5, "FILL") + button~writeDirect(dc, trunc(size~width / 4), trunc(size~height / 4), tc~Selected) + + -- Add informative text if needed. + if needWrite then do + button~fontToDC(dc, font3) + x = trunc(size~width / 4) + y = trunc(size~height / 2) + + if currentTab == 'Gray' then + button~writeDirect(dc, x, y, "(Tab icons are removed)") + else + button~writeDirect(dc, x, y, "(Tab icons are restored)") + needWrite = .false + end + + -- Restore pen, brush, and font, then release the device context. + button~objectToDc(dc, oldPen) + button~objectToDc(dc, oldBrush) + button~fontToDC(dc, oldFont) + button~opaqueText(dc) + + button~deleteObject(pen) + button~deleteObject(brush) + button~freeDC(dc) + +-- We use the leaving() method to clean up (delete) the fonts and the image list +-- we created. In this program there is really no need to do this. As soon as +-- the interpreter terminates, the OS cleans up the resources automatically. +-- The only time cleaning up resources makes sense is in a long-running program +-- that creates and ends a lot of dialogs. Then, over time, the memory usge of +-- the program would keep growing. +::method leaving + expose font2 font3 imageList + + self~deleteFont(font2) + self~deleteFont(font3) + imageList~release + diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/augmentedResize.rex b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/augmentedResize.rex new file mode 100755 index 0000000..3442d23 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/augmentedResize.rex @@ -0,0 +1,306 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * The augmentedResize.rex example has the same initial dialog layout as the + * basicResize.rex example. However, to give a better appearance to the dialog + * as it is enlarged or shrunk, the precise way each dialog control is to be + * changed is defined in the program code. + * + * All code that defines the sizing of the resizable dialog has to be defined + * in the defineSizing() method. This method is invoked automatically by the + * ooDialog framework. The default implementation of the method does nothing. + * The method is meant to be over-ridden by the programmer to change the + * default sizing parameters of the ResizingAdmin class. The method is invoked + * before the underlying dialog is created. The programmer can not inovke any + * method that requires the underlying dialog to exist from the defineSizing() + * method. + */ + + -- Get the directory our source code files are located in. + sd = locate() + + -- Use the global .constDir, only, for symbolic IDs, load the symbols from + -- the basicResize.h file. + .application~setDefaults('O', sd'rc\basicResize.h', .false) + + dlg = .ResizableDlg~new(sd"rc\basicResize.rc", IDD_RESIZABLE) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +-- Inherit the ResizingAdmin class to make resizing available. +::class 'ResizableDlg' subclass RcDialog inherit ResizingAdmin + +/** defineSizing() + * + * This method is invoked automatically by the ooDialog framework. A default + * implmentation is provided. That implmentation does not do anything. To + * change how the default implmentation works, the program must over-ride the + * defineSizing() method and invoke ResizingAdmin methods to change the + * defaults. + * + * Each dialog control must be referenced by its resource ID. The ID can be + * numeric or symbolic. This is no different than any other use of ooDialog. + * + * The basic premise of the resizing admin is that each side, left, top, right, + * etc., of every control window can be "pinned" to the side of another window. + * By default each side is pinned to a side of the dialog window itself. But, + * any side of a dialog control window can be pinned to a side of any other + * dialog control in the dialog. + * + * There are several different "types" of pins. The programmer defines the + * "sizing" of any dialog control by defining how each "edge" of the control + * should be sized. The definition consists of: the id of the control, which + * side of the control is to be pined, which side of another window the control + * edge is pinned to, the type of the pin, and the ID of the other window. For + * instance: + * + * The left side of a button control could be "pinned" to the left side of the + * dialog window using a 'proportional' pin. + * + * or + * + * The right side of a list-view control could be "pinned" the left side of an + * edit control using a 'stationary' pin. + * + * The control windows are identified by the resource ID of the control. The + * dialog window is identified by a special constant provided by the + * ResizingAdmin class, the IDC_DEFAULT_PINTO_WINDOW constant. + * + * The edges (sides) of windows are identified by the keywords: LEFT, TOP, + * RIGHT, and BOTTOM. In addition there are two other edge keywords: XCENTER + * and YCENTER. + * + * XCENTER specifies that the edge is pinned to the horizontal center of the + * pinned to edge. YCENTER specifies that the edge is pinned to the vertical + * center of the pinned to edge. + * + * The types of pins are identified by the kewords: PROPORTIONAL, STATIONARY, + * MYTOP, and MYLEFT. + * + * PROPORTIONAL : The distance between the edge and the pinned to edge grows, + * (or shrinks,) proportionally to the size of the pinned to + * window. + * + * STATIONARY : The distance between the edge and the pinned to edge remains + * equal to what it was when the dialog was initially created. + * + * MYLEFT : A special keyword, can only be used for the right edge of a + * control. Pins the right edge of the control to its left + * edge. This has the effect of keeping the width of the + * control constant. + * + * MYTOP : A special keyword, can only be used for the bottom edge of a + * control. Pins the bottom edge of the control to its top + * edge. This has the effect of keeping the height of the + * control constant. + * + * The ooDialog framework uses an algorithm to resize / reposition the dialog + * control windows that virtually eliminates flicker. This code requires that + * the sizing for every control in the dialog be specified. When the underlying + * dialog is first created, the framework enumerates every dialog control. If a + * a control did not have its sizing defined by the programmer, the framework + * assigns the default sizing to the control and adds the sizing definition to + * the end of the sizing definitions list. + * + * When the sizing event notification is received, the ooDialog framework + * resizes and repositions every dialog control in the order of the sizing + * defintions in the list. + * + * Because of this, any "pinned to" window must come before the window that pins + * to it in the list. I.e., if a side of a list-view control is to be "pinned" + * to the left side of an edit control, the sizing definition for the edit + * control must be specified before the sizing definition for the list-view is + * specified. Sizing definitions are placed in the list in the order the + * programmer defines the control sizing. The sizing definitions for all + * controls not defined by the programmer are appended to the end of the list, + * in the order they are enumerated by the operating system. + * + * The code in the following defineSizing() method shows how to apply the above + * explanation. The ooDialog reference manual should be consulted for the + * complete documentation on the ResizingAdmin class. + */ +::method defineSizing + + -- Assign the IDC_DEFAULT_PINTO_WINDOW constant to a short variable name. + -- This is just done here to keep the code a little more readable. In + -- addition, IDC_DEFAULT_PINTO_WINDOW is the default. In almost all cases, + -- IDC_DEFAULT_PINTO_WINDOW can simply be omitted. + + ID_DLG = self~IDC_DEFAULT_PINTO_WINDOW + + -- The sizing for each edge of a dialog control can be specified + -- individually. Here we define the sizing for the list-view. It is pinned + -- to the left top corner and right bottom corner of the dialog. This means + -- the pixel distance between the edges of the list-view and the edges of + -- the dialog will remain constant. + + self~controlLeft(IDC_LV_MAIN, 'STATIONARY', 'LEFT', ID_DLG) + self~controlTop(IDC_LV_MAIN, 'STATIONARY', 'TOP', ID_DLG) + self~controlRight(IDC_LV_MAIN, 'STATIONARY', 'RIGHT', ID_DLG) + self~controlBottom(IDC_LV_MAIN, 'STATIONARY', 'BOTTOM', ID_DLG) + + -- The complete sizing for a single control can be specified at one time. + -- The first argument must be the resource ID of the control. Following + -- that are four arguments defining the sizing for the 4 edges of the + -- control. The must be in order: left top right bottom. However, each + -- argument is optional. If it is omitted, the default sizing for that edge + -- is used. + -- + -- Each of the 4 arguments must be an array. The fist item in the array is + -- required and is the type of pin. The second item in the array is also + -- required. It is the edge of the other window that the edge of the + -- control is pinned to. The third item in the array is the id of the + -- window that the control's edge is pinned to. This item can be omitted, + -- it defaults to the dialog window. + -- + -- This definition pins the Test push button to the right top corner of the + -- dialog. Since it is a 'stationary' pin the push button will 'stay' in + -- place. The right side of the button is pinned to its own left side. + -- This makes the width of the button constant, it will not change as the + -- dialog is sized. The bottom edge of the button is pinned to its top. + -- This makes the height of the button constant. + -- + -- Note that when the pin type is MYLEFT or MYRIGHT, the other 2 + -- specifications, the edge and window, are always ignored. However, the + -- controlSizing() method requires that the first 2 items in the array not + -- be omitted. + self~controlSizing(IDC_PB_TEST, - + .array~of('STATIONARY', 'RIGHT', IDC_LV_MAIN), - + .array~of('STATIONARY', 'TOP'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- The following just defines the sizing for all of the rest of the + -- controls. + + self~controlSizing(IDC_GB_TEST, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'BOTTOM', IDC_LV_MAIN), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_EDIT_LABELS, - + .array~of('PROPORTIONAL', 'LEFT', IDC_GB_TEST), - + .array~of('STATIONARY', 'TOP', IDC_GB_TEST), - + .array~of('STATIONARY', 'RIGHT', IDC_GB_TEST), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_LABELS, - + .array~of('STATIONARY', 'LEFT', IDC_EDIT_LABELS), - + .array~of('STATIONARY', 'TOP', IDC_GB_TEST), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_NAMES, - + .array~of('STATIONARY', 'LEFT', IDC_GB_TEST), - + .array~of('STATIONARY', 'TOP', IDC_GB_TEST), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_EDIT_NAMES, - + .array~of('STATIONARY', 'LEFT', IDC_ST_NAMES), - + .array~of('STATIONARY', 'TOP', IDC_GB_TEST), - + .array~of('STATIONARY', 'LEFT', IDC_ST_LABELS), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_ST_PLACES, - + .array~of('STATIONARY', 'LEFT', IDC_GB_TEST), - + .array~of('STATIONARY', 'TOP', IDC_GB_TEST), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDC_EDIT_PLACES, - + .array~of('STATIONARY', 'LEFT', IDC_ST_PLACES), - + .array~of('STATIONARY', 'TOP', IDC_GB_TEST), - + .array~of('STATIONARY', 'LEFT', IDC_EDIT_NAMES), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDOK, - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDCANCEL, - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + return 0 + + +/** initDialog() + * + * This is just a typical initDialog() method. We merely put some items into + * the list-view to give the dialog some texture. + */ +::method initDialog + + self~newGroupBox(IDC_GB_TEST)~setText('Group Box Stationary Left / Right') + + list = self~newListView(IDC_LV_MAIN) + list~setView('REPORT') + + columnNames = .array~of("Line", "Number") + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~InsertColumn(0, "Row (Column 1)", 95) + list~InsertColumn(1, "Column 2", 95) + list~InsertColumn(2, "Column 3", 95) + + do i = 1 to 200 + list~addRow(i, , "Line" i, "Column" 2, "Column" 3) + end diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/basicResize.rex b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/basicResize.rex new file mode 100755 index 0000000..c228375 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/basicResize.rex @@ -0,0 +1,66 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A basic example of using the ResizingAdmin mixin class to produce a resizable + * dialog. The example shows that any dialog can be made resizable, simply by + * inheriting ResizingAdmin, and doing nothing else. + * + * The defaults for ResizingAdmin will resize all controls in the dialog + * proportionally. This works well for any dialog, in that all controls will + * show without overlap. + */ + + sd = locate() + + -- Use the global .constDir for symbolic IDs, load them from basicResize.h + .application~setDefaults('O', sd'rc\basicResize.h', .false) + + dlg = .ResizableDlg~new(sd"rc\basicResize.rc", IDD_RESIZABLE) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +-- Inherit ResingAdmin, voila, the dialog is resizable. +::class 'ResizableDlg' subclass RcDialog inherit ResizingAdmin + diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/gbStationary.rex b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/gbStationary.rex new file mode 100755 index 0000000..4888a2e --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/gbStationary.rex @@ -0,0 +1,244 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * The gbStationary.rex example uses a very similar dialog to the one used in + * the augmentedResize.rex example. It then does a few things differently to + * demonstrate how some of the other methods of the ResizingAdmin class work. + * It also is used to show how the XCENTER and YCENTER pin types work. + * + * These are some of the differences to note. + * + * 1.) The 3 push buttons in the dialog use the XCENTER and YCENTER pin types. + * The Test push button uses the YCENTER pin type to center it vertically with + * the list-view control. The Ok and Cancel push buttons use the XCENTER pin + * type to center themselves horizontally within the dialog window. + * + * 2.) The list-view control starts in the Icon view instead of the report + * view. When the dialog is resized, the list-view does not rearrange the + * items. This may look "wrong" to some people. So, this example uses that + * as an opportunity to show the wantSizeEnded() method. The programmer can + * use that method to have the ooDialog framework invoke a method in the Rexx + * dialog when the user has finished resizing the dialog. In this program, we + * use that notification to do a many rearranging of the list-view items. The + * push button in the center right of the dialog can be used to toggle the + * behaviour back in forth to do the automatic rearranging or to not do the + * rearranging. This allows you to see what the dialog looks like either way. + * + * 3.) In the augmentedResize.rex example, the group box and the controls with + * in the group box keep the same height but stretch horizontally as the dialog + * gets wider. In this example, the group box and the controls within it keep + * the same size ans the dialog changes size and they remain fixed to the left + * side of the dialog and the bottom of the list-view. Since these are the + * majority of the controls in this dialog, the default sizing is set to those + * values, and the sizing for the individual controls is omitted. This reduces + * the actual number of lines the programer has to type. + * + * 4.) By default the minimum size of the dialog is set to its initial size + * when it first is created, and the maximum size is unlimited. This example + * removes any minimum size restriction and sets a maximum size to slightly + * smaller than the screen. Note that the ability to maximize or minimize the + * dialog is set by the presence or absence of the minimize or maximize buttons + * and has nothing to do with the minimum or maximum size. However, if the + * dialog has a maximize button and a maximum size smaller than the screen is + * set, the maximize button will maximize the dialog to the set size. If the + * dialog has a minimize button, it behaves the same with or without a minimum + * size set. Note also that the operating system will not let the user size a + * window smaller than the height of the caption bar plus the sizing borders, + * or smaller than the width of the system menu icon and buttons in the caption + * bar, even if the size is set to 1 x 1 pixels. + */ + + sd = locate() + .application~setDefaults('O', sd'rc\gbStationary.h', .false) + say sd"rc\gbStationary.rc" + dlg = .ResizableDlg~new(sd"rc\gbStationary.rc", IDD_RESIZABLE) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +-- Make the dialog resizable by inheriting the ResizingAdmin class. +::class 'ResizableDlg' subclass RcDialog inherit ResizingAdmin + +/** defineSizing() + * + * Define the sizing needed for our controls. Please read the commets for this + * method in the augmentedResize.rex example for a lengthy description of this + * method. + */ +::method defineSizing + + ID_DLG = self~IDC_DEFAULT_PINTO_WINDOW + + self~controlSizing(IDC_LV_MAIN, - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'TOP'), - + .array~of('STATIONARY', 'RIGHT'), - + .array~of('STATIONARY', 'BOTTOM') - + ) + + -- Note the YCENTER keyword for the top edge of the push button. The effect + -- of this is to center the top edge with the center of the pin to window, + -- the list-view in this case. + + self~controlSizing(IDC_PB_TEST, - + .array~of('STATIONARY', 'RIGHT', IDC_LV_MAIN), - + .array~of('STATIONARY', 'YCENTER', IDC_LV_MAIN), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- Here we set the default sizing for the left top to be the left side of the + -- dialog and the bottom of the list-view. The default sizing for the right + -- bottom is set to the same thing. Every control edge not specifically + -- assigned a value in this program will be assigned the default sizing when + -- the underlying dialog is created. + -- + -- The control edges not defined here are all the edges of the group box, the + -- 3 edit controls and the 3 labels for those controls. The effect of this + -- then is to pin those controls to the left bottom of the list-view and to + -- keep them fixed in size. For this dialog, this actually makes the most + -- sense. At least to the author. ;-) + + self~defaultSizing(.array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'BOTTOM', IDC_LV_MAIN), - + .array~of('STATIONARY', 'LEFT'), - + .array~of('STATIONARY', 'BOTTOM', IDC_LV_MAIN) - + ) + + -- The Ok and Cancel buttons are specified explicitly. Note that the XCENTER + -- edge keyword has the effect of keeping the 2 buttons centered horizonatally + -- in the dialog. + self~controlSizing(IDOK, - + .array~of('STATIONARY', 'XCENTER'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + self~controlSizing(IDCANCEL, - + .array~of('STATIONARY', 'XCENTER'), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'LEFT'), - + .array~of('MYTOP', 'TOP') - + ) + + -- We specify that we want the size ended notification to be sent to us, using + -- the method name of onSizeEnded and that we will return a value from that + -- method. + self~wantSizeEnded(onSizeEnded, .true) + + -- We also connect the test push button. Then when the dialog is showing, you + -- can toggle between rearranging the list-view item when the user has ended + -- sizing, and not. To see the difference. + self~connectButtonEvent(IDC_PB_TEST, 'CLICKED', onPbPushed) + + return 0 + + +/** initDialog() + * + * A pretty typical initDialog() method, we add some items to the list-view and + * set up the initial state for the push button. + * + */ +::method initDialog + expose list arrangeWhenSizeEnds pushButton + + -- Set the initial state so that when a sizing operation ends, the items in + -- the list-view are automatically rearranged. + arrangeWhenSizeEnds = .true + pushButton = self~newPushButton(IDC_PB_TEST) + pushButton~setText('Do Arrange') + + + -- Get the size of the work area of the screen and make our maximum size 15 + -- pixels smaller on each side. Then set the minimum size to no minimum. + workArea = .SPI~workArea + maxSize = .Size~new(workArea~right - workArea~left - 15, workArea~bottom - workArea~top - 15) + + self~maxSize = maxSize + self~noMinSize + + -- Fill the list-view with items. + list = self~newListView(IDC_LV_MAIN) + + columnNames = .array~of("Line", "Number") + list~addExtendedStyle("FULLROWSELECT GRIDLINES CHECKBOXES HEADERDRAGDROP") + + list~InsertColumn(0, "Row (Column 1)", 95) + list~InsertColumn(1, "Column 2", 95) + list~InsertColumn(2, "Column 3", 95) + + do i = 1 to 200 + list~addRow(i, , "Line" i, "Column" 2, "Column" 3) + end + + +/** onPbPushed() + * + * The button was pushed, toggle our state. + */ +::method onPbPushed unguarded + expose arrangeWhenSizeEnds pushButton + + -- Toggle our state + arrangeWhenSizeEnds = \ arrangeWhenSizeEnds + if arrangeWhenSizeEnds then pushButton~setText('Do Arrange') + else pushButton~setText('No Arrange') + + +/** onSizeEnded() + * + * The event handler for the sizing ended notification. We look at the value of + * the flag and either tell the list-view to rearrange its items, or not. + * + * Note that we must return a value, because we said we would, but the actual + * value is ignored. The main purpose of having the ooDialog framework wait for + * the return is to "sync" our code execution with the actions of the user. + */ +::method onSizeEnded unguarded + expose list arrangeWhenSizeEnds + + if arrangeWhenSizeEnds then list~arrange + return 0 diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.dll b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.dll new file mode 100644 index 0000000..7413e91 Binary files /dev/null and b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.dll differ diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h new file mode 100644 index 0000000..fcedc39 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.h @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_NEWCONTROLS_DLG 105 +#define IDD_LISTVIEW_DLG 106 +#define IDD_TREEVIEW_DLG 107 +#define IDD_PROGRESSBAR_DLG 108 +#define IDD_TAB_DLG 109 +#define IDD_TRACKBAR_DLG 110 +#define IDC_TAB 200 +#define IDC_PB_PREVIOUS 201 +#define IDC_PB_NEXT 202 +#define IDC_LV_MAIN 1000 +#define IDC_TV_MAIN 1001 +#define IDC_PBAR_PROCESSA 1002 +#define IDC_PBAR_PROCESSB 1003 +#define IDC_PBAR_PROCESSC 1004 +#define IDC_PBAR_PROCESSD 1005 +#define IDC_PBAR_PROCESSE 1006 +#define IDC_TAB_MAIN 1007 +#define IDC_PB_OWNERDRAW 1008 +#define IDC_TB_HORZ_BOTH 1009 +#define IDC_TB_HORZ_TOP 1010 +#define IDC_TB_HORZ_BOTTOM 1011 +#define IDC_ST_HORZ_BOTTOM 1012 +#define IDC_ST_HORZ_TOP 1013 +#define IDC_ST_HORZ_BOTH 1014 +#define IDC_TB_VERT_RIGHT 1015 +#define IDC_ST_VERT_RIGHT 1016 +#define IDC_TB_VERT_LEFT 1017 +#define IDC_ST_VERT_LEFT 1018 +#define IDC_TB_VERT_BOTH 1019 +#define IDC_ST_VERT_BOTH 1020 +#define IDC_ST_PERCENTA 1121 +#define IDC_ST_PERCENTB 1122 +#define IDC_ST_PERCENTC 1123 +#define IDC_ST_PERCENTD 1124 +#define IDC_ST_PERCENTE 1125 +#define IDC_ST_FRAME_LEFT 1126 +#define IDC_ST_FRAME_RIGHT 1127 +#define IDC_ST_PROCESSA 1128 +#define IDC_ST_PROCESSB 1129 +#define IDC_ST_PROCESSC 1130 +#define IDC_ST_PROCESSD 1131 +#define IDC_ST_PROCESSE 1132 diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc new file mode 100644 index 0000000..1a80e40 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/PropertySheetDemo.rc @@ -0,0 +1,137 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "PropertySheetDemo.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_LISTVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "List View Control" +FONT 9, "Arial" +{ + CONTROL "ListView", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_REPORT, 7, 7, 286, 236 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_NEWCONTROLS_DLG DIALOG 0, 0, 325, 300 +STYLE DS_CENTER | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Example using ControlDialog objects" +FONT 9, "Arial" +{ + CONTROL "Tab", IDC_TAB, WC_TABCONTROL, WS_TABSTOP, 10, 5, 305, 265 + PUSHBUTTON "Previous Control", IDC_PB_PREVIOUS, 10, 278, 60, 14 + PUSHBUTTON "Next Control", IDC_PB_NEXT, 80, 278, 60, 14 + DEFPUSHBUTTON "Ok", IDOK, 185, 278, 60, 14 + PUSHBUTTON "Cancel", IDCANCEL, 255, 278, 60, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PROGRESSBAR_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Progress Bar Control" +FONT 9, "Arial" +{ + CTEXT "Process A", IDC_ST_PROCESSA, 26, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSA, PROGRESS_CLASS, PBS_VERTICAL, 36, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTA, 32, 229, 21, 8, SS_LEFT + CTEXT "Process B", IDC_ST_PROCESSB, 79, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSB, PROGRESS_CLASS, PBS_VERTICAL, 89, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTB, 85, 229, 21, 8, SS_LEFT + CTEXT "Process C", IDC_ST_PROCESSC, 132, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSC, PROGRESS_CLASS, PBS_VERTICAL, 142, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTC, 139, 229, 21, 8, SS_LEFT + CTEXT "Process D", IDC_ST_PROCESSD, 184, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSD, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 195, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTD, 192, 229, 21, 8, SS_LEFT + CTEXT "Process E", IDC_ST_PROCESSE, 236, 12, 35, 8, SS_LEFT + CONTROL "Progress", IDC_PBAR_PROCESSE, PROGRESS_CLASS, WS_BORDER | PBS_SMOOTH | PBS_VERTICAL, 248, 27, 13, 199 + CTEXT "100%", IDC_ST_PERCENTE, 244, 229, 21, 8, SS_LEFT +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TAB_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Tab Control" +FONT 9, "Arial" +{ + CONTROL "Tab", IDC_TAB_MAIN, WC_TABCONTROL, WS_TABSTOP, 5, 5, 290, 240 + CONTROL "", IDC_PB_OWNERDRAW, WC_BUTTON, WS_TABSTOP | BS_OWNERDRAW, 17, 63, 267, 162 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TRACKBAR_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Track Bar Control" +FONT 9, "Arial" +{ + CONTROL "", IDC_ST_FRAME_LEFT, WC_STATIC, SS_BLACKFRAME, 7, 7, 136, 236 + CONTROL "Slider", IDC_TB_HORZ_BOTTOM, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS, 10, 30, 119, 20 + LTEXT "Text", IDC_ST_HORZ_BOTTOM, 41, 56, 60, 27, SS_LEFT + CONTROL "Slider", IDC_TB_HORZ_TOP, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_TOP, 10, 97, 119, 20 + LTEXT "Text", IDC_ST_HORZ_TOP, 41, 128, 60, 27, SS_LEFT + CONTROL "Slider", IDC_TB_HORZ_BOTH, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_BOTH | TBS_ENABLESELRANGE, 10, 168, 119, 32 + LTEXT "Text", IDC_ST_HORZ_BOTH, 41, 203, 60, 30, SS_LEFT + CONTROL "", IDC_ST_FRAME_RIGHT, WC_STATIC, SS_BLACKFRAME, 163, 7, 130, 236 + CONTROL "Slider", IDC_TB_VERT_RIGHT, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_ENABLESELRANGE, 176, 33, 19, 192 + LTEXT "Text", IDC_ST_VERT_RIGHT, 177, 17, 22, 8, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_LEFT, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_TOP, 212, 33, 19, 192 + LTEXT "Text", IDC_ST_VERT_LEFT, 216, 17, 27, 8, SS_LEFT + CONTROL "Slider", IDC_TB_VERT_BOTH, TRACKBAR_CLASS, WS_TABSTOP | TBS_AUTOTICKS | TBS_VERT | TBS_BOTH, 257, 33, 27, 192 + LTEXT "Text", IDC_ST_VERT_BOTH, 261, 17, 21, 8, SS_LEFT +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_TREEVIEW_DLG DIALOG 6, 15, 300, 250 +STYLE DS_SHELLFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD | WS_TABSTOP +CAPTION "Tree View Control" +FONT 9, "Arial" +{ + CONTROL "Tree", IDC_TV_MAIN, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_SHOWSELALWAYS, 7, 7, 286, 236 +} diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/basicResize.h b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/basicResize.h new file mode 100644 index 0000000..f2eba66 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/basicResize.h @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_RESIZABLE 101 +#define IDC_GB_TEST 1000 +#define IDC_EDIT_NAMES 1005 +#define IDC_ST_NAMES 1006 +#define IDC_ST_LABELS 1009 +#define IDC_EDIT_LABELS 1010 +#define IDC_ST_PLACES 1013 +#define IDC_EDIT_PLACES 1014 +#define IDC_PB_TEST 1015 +#define IDC_LV_MAIN 1016 diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/basicResize.rc b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/basicResize.rc new file mode 100644 index 0000000..1c58b5b --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/basicResize.rc @@ -0,0 +1,62 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "basicResize.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_RESIZABLE DIALOGEX 0, 0, 335, 281 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Basic Resizable Dialog" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_ICON, 10, 10, 259, 169 + PUSHBUTTON "Test", IDC_PB_TEST, 275, 10, 50, 14 + GROUPBOX "Group Box Proportional", IDC_GB_TEST, 13, 186, 289, 66, 0, WS_EX_TRANSPARENT + LTEXT "Names:", IDC_ST_NAMES, 26, 206, 24, 10, SS_LEFT + EDITTEXT IDC_EDIT_NAMES, 55, 203, 95, 14, ES_AUTOHSCROLL + LTEXT "Labels:", IDC_ST_LABELS, 168, 206, 24, 10, SS_LEFT + EDITTEXT IDC_EDIT_LABELS, 196, 203, 95, 14, ES_AUTOHSCROLL + LTEXT "Places:", IDC_ST_PLACES, 25, 228, 24, 10, SS_LEFT + EDITTEXT IDC_EDIT_PLACES, 55, 225, 95, 14, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", IDOK, 220, 257, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 275, 257, 50, 14 +} diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/gbStationary.h b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/gbStationary.h new file mode 100644 index 0000000..f2eba66 --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/gbStationary.h @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_RESIZABLE 101 +#define IDC_GB_TEST 1000 +#define IDC_EDIT_NAMES 1005 +#define IDC_ST_NAMES 1006 +#define IDC_ST_LABELS 1009 +#define IDC_EDIT_LABELS 1010 +#define IDC_ST_PLACES 1013 +#define IDC_EDIT_PLACES 1014 +#define IDC_PB_TEST 1015 +#define IDC_LV_MAIN 1016 diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/gbStationary.rc b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/gbStationary.rc new file mode 100644 index 0000000..6886b6a --- /dev/null +++ b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/gbStationary.rc @@ -0,0 +1,61 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "gbStationary.h" + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_RESIZABLE DIALOGEX 0, 0, 335, 301 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_TABSTOP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Resizable Dialog" +FONT 8, "Ms Shell Dlg", 400, 0, 1 +{ + CONTROL "", IDC_LV_MAIN, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_ICON, 10, 10, 259, 170 + PUSHBUTTON "Test", IDC_PB_TEST, 275, 95, 50, 14 + GROUPBOX "Group Box Stationary", IDC_GB_TEST, 13, 186, 289, 66, 0, WS_EX_TRANSPARENT + LTEXT "Names:", IDC_ST_NAMES, 26, 206, 24, 10, SS_LEFT + EDITTEXT IDC_EDIT_NAMES, 55, 203, 95, 14, ES_AUTOHSCROLL + LTEXT "Labels:", IDC_ST_LABELS, 168, 206, 24, 10, SS_LEFT + EDITTEXT IDC_EDIT_LABELS, 196, 203, 95, 14, ES_AUTOHSCROLL + LTEXT "Places:", IDC_ST_PLACES, 25, 228, 24, 10, SS_LEFT + EDITTEXT IDC_EDIT_PLACES, 55, 225, 95, 14, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", IDOK, 143, 257, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 143, 277, 50, 14 +} diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoListView.bmp b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoListView.bmp new file mode 100644 index 0000000..2414bdb Binary files /dev/null and b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoListView.bmp differ diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoTab.bmp b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoTab.bmp new file mode 100644 index 0000000..7b305ce Binary files /dev/null and b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoTab.bmp differ diff --git a/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoTreeView.bmp b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoTreeView.bmp new file mode 100644 index 0000000..19cb247 Binary files /dev/null and b/modules/windows/oodialog/resizableDialogs/ResizingAdmin/rc/propertySheetDemoTreeView.bmp differ diff --git a/modules/windows/oodialog/sample.rex b/modules/windows/oodialog/sample.rex new file mode 100755 index 0000000..c0a1cf4 --- /dev/null +++ b/modules/windows/oodialog/sample.rex @@ -0,0 +1,143 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*--------------------------------------------------------------------------*/ +/* */ +/* samples\ooDialog\sample.rex ooDialog Samples - Main */ +/* */ +/*--------------------------------------------------------------------------*/ + + + -- Ensure we can find our resource files. + srcDir = locate() + + d = .SampleDlg~new(srcDir"rc\sample.rc", 100) + if d~initCode <> 0 then do + return 99 + end + d~execute("SHOWTOP") + return 0 + + +/*---------------------------- requires ------------------------------*/ + +::requires "ooDialog.cls" +::requires 'samplesSetup.rex' + +/*---------------------------- main dialog ---------------------------*/ + +::class 'SampleDlg' subclass RcDialog + +::method initDialog + sd = .application~srcDir + self~installBitmapButton(101, "VIDEO", sd"bmp\s2arch.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(102, "PET", sd"bmp\s2anim.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(103, "PHIL", sd"bmp\s2philf.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(104, "GRAPHD", sd"bmp\s2scroll.bmp",,,,"FRAME STRETCH") + self~installBitmapButton(105, "WALKER", sd"bmp\s2walker.bmp",,,,"FRAME STRETCH") + self~installBitmapButton(106, "BANDIT", sd"bmp\s2jack.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(107, "USER", sd"bmp\s2input.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(108, "WIZ97", sd"bmp\s2mov.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(109, "TREE", sd"bmp\s2tree.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(110, "LIST", sd"bmp\s2list.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(111, "PROGRESS", sd"bmp\s2prog.bmp" ,,,,"FRAME STRETCH") + self~installBitmapButton(112, "PROPERTY", sd"bmp\s2prop.bmp" ,,,,"FRAME STRETCH") + self~backgroundBitmap(sd"bmp\s2backg.bmp", "USEPAL") + +::method video + self~loadApp("oovideo.rex") + +::method pet + self~loadApp("AnimalGame.rex", 3000) + +::method phil + self~loadApp("oophil.rex") + +::method walker + self~loadApp("oowalk2.rex") + +::method bandit + self~loadApp("oobandit.rex", 3300) + +::method graphd + self~loadApp("oograph.rex", 3000) + +::method user + self~loadApp("oodStandardDialogs.rex", 2800) + +::method wiz97 + self~loadApp(.application~srcDir"propertySheet.tabControls\ticketWizard.rex") + +::method tree + self~loadApp(.application~srcDir"controls\TreeView\treeViewCustomDraw.rex") + +::method list + self~loadApp(.application~srcDir"propertySheet.tabControls\oodListViews.rex") + +::method progress + self~loadApp("oodpbar.rex") + +::method property + self~loadApp(.application~srcDir"propertySheet.tabControls\PropertySheetDemo.rex") + + +::method cancel + call play "byebye.wav" + self~cancel:super + return 0 + +::method ok + self~cancel + +::method help /* About button */ + call play "sample.wav", "YES" + d = .TimedMessage~new("Illustration of ooDialog Function", , + "Open Object Rexx ooDialog Samples", 5000) + d~execute + return 0 + +::method loadApp + use arg appname, pauseTime = 2000 + ret = play("start.wav", "yes") + d = .TimedMessage~new("Application will be started, please wait","Samples", pauseTime) + d~execute + + call (appname) + + /* make sure main window is enabled and the topmost window */ + self~enable + self~toTheTop diff --git a/modules/windows/oodialog/samplesSetup.rex b/modules/windows/oodialog/samplesSetup.rex new file mode 100755 index 0000000..5ca1d3e --- /dev/null +++ b/modules/windows/oodialog/samplesSetup.rex @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Contains common set up code for a number of the ooDialog sample programs. + * All we do here is set up the sound path. + * + * This file is intended to be used in a ::requires directive by the sample + * programs that need this common code. + */ + + -- Add the wav subdirectory to the sound path environment variable. The wav + -- directory is a subdirectory of this program file's location that contains + -- the wave files played in the programs that require this file. + pgmDir = locate() + env = 'ENVIRONMENT' + win = value('WINDIR', , env) + if .OS~isAtLeastVista then do + media = win'\Media' + win = win';'media + end + sp = value('SOUNDPATH', , env) + sp = value('SOUNDPATH', win';'pgmDir'WAV;'sp, env) + +::requires "ooDialog.cls" diff --git a/modules/windows/oodialog/simple/ChangeFont.rex b/modules/windows/oodialog/simple/ChangeFont.rex new file mode 100755 index 0000000..bfdbf1e --- /dev/null +++ b/modules/windows/oodialog/simple/ChangeFont.rex @@ -0,0 +1,127 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Simple Dialog showing how to: create a font. change the font of a control, + * manage buttons to prevent the user from getting the dialog in the wrong + * state. + * + * In this simple dialog, we don't want to manage the creation of lots of fonts, + * so after the user creates the first new font, we disable the button. That + * way the user can not create a new font thousands of times. + */ + + dlg = .FileViewDialog~new + if dlg~initCode <> 0 then do + say "Dialog initialization failed. Program Abort." + return 99 + end + + dlg~create(30, 30, 260, 180, "File Viewing Dialog", "VISIBLE") + dlg~execute("SHOWTOP") + +return 0 +-- End of entry point. + +::requires "ooDialog.cls" + +::class 'FileViewDialog' subclass UserDialog + +::method defineDialog + + self~autoDetect = .false + self~constDir[IDC_EDIT] = 110 + self~constDir[IDC_PB_OPEN] = 111 + self~constDir[IDC_PB_CHANGE_FONT] = 112 + + styles = "VSCROLL HSCROLL MULTILINE" + self~createEdit(IDC_EDIT, 5, 5, 250, 150, styles) + + self~createPushButton(IDC_PB_OPEN, 5, 160, 35, 15, , "Open", onOpen) + self~createPushButton(IDC_PB_CHANGE_FONT, 50, 160, 45, 15, , "Change Font", onFont) + self~createPushButton(IDOK, 220, 160, 35, 15, "DEFAULT", "OK") + +::method initDialog + expose editControl newFont + + newFont = .nil + editControl = self~newEdit(IDC_EDIT) + + helpMsg = "Use the Open button to open a text file" || .endOfLine || - + "and then use the Change Font button to" || .endOfLine || - + "change the font." + + editControl~setText(helpMsg) + self~newPushButton(IDC_PB_CHANGE_FONT)~disable + +::method onOpen + expose editControl newFont + + editControl~setText("") + + -- Have the open file dialog start in the same directory as the location of + -- this program. + parse source . . programSrc + startDirectory = fileSpec('L', programSrc) + + fileName = fileNameDialog(startDirectory, self~dlgHandle, , 1, "Open a File for Editing") + if fileName == 0 then return + + fObj = .stream~new(fileName) + fObj~open + if fObj~state \== 'READY' then return self~abort + + text = fObj~charin(1, fObj~chars) + fObj~close + + editControl~setText(text) + if newFont == .nil then self~newPushButton(IDC_PB_CHANGE_FONT)~enable + +::method onFont + expose editControl newFont + + newFont = self~createFontEx("Courier", 12) + editControl~setFont(newFont) + self~newPushButton(IDC_PB_CHANGE_FONT)~disable + +::method leaving + expose newFont + if newFont \= .nil then self~deleteFont(newFont) + +::method abort private + j = errorDialog("There is an unexplained error. Program Abort") + return self~cancel diff --git a/modules/windows/oodialog/simple/ReadMe.txt b/modules/windows/oodialog/simple/ReadMe.txt new file mode 100644 index 0000000..4c2c8ec --- /dev/null +++ b/modules/windows/oodialog/simple/ReadMe.txt @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. Simple ooDialog Example Programs + ------------------------------------ + + This directory contains example ooDialog programs that are intended to be + simple enough to not require any comment. They are short and only + demonstrate a few things. They should encourage the user to read the + ooDialog documentation to better understand the areas the programs are + concerned with. + + - SimpleUpDown.rex + + Shows how to create an up down control in a user dialog and initialize + it. + + - ChangeFont.rex + + Shows how to create a new font correctly and how to change the font of + a dialog control using the created font. It is also an example of a + multi-line edit control and shows how to enable and disable buttons. + + - SimpleMonthCalendar.rex + + Shows how to use a month calendar control in a rc dialog and how to + respond to selected date changes. diff --git a/modules/windows/oodialog/simple/SimpleMonthCalendar.h b/modules/windows/oodialog/simple/SimpleMonthCalendar.h new file mode 100644 index 0000000..8be5a7e --- /dev/null +++ b/modules/windows/oodialog/simple/SimpleMonthCalendar.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_MONTHCAL 101 +#define IDC_ST_BIRTHDATE 1004 +#define IDC_MC 1005 diff --git a/modules/windows/oodialog/simple/SimpleMonthCalendar.rc b/modules/windows/oodialog/simple/SimpleMonthCalendar.rc new file mode 100644 index 0000000..1a6f838 --- /dev/null +++ b/modules/windows/oodialog/simple/SimpleMonthCalendar.rc @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include "SimpleMonthCalendar.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_MONTHCAL DIALOG 0, 0, 254, 124 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Simple Month Calendar" +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_MC, MONTHCAL_CLASS, WS_TABSTOP, 7, 7, 147, 105 + CONTROL "Pick you birth date.", IDC_STATIC, WC_STATIC, NOT WS_GROUP | SS_CENTER | SS_CENTERIMAGE, 169, 10, 75, 23 + CONTROL "", IDC_ST_BIRTHDATE, WC_STATIC, NOT WS_GROUP | SS_CENTER | SS_CENTERIMAGE, 169, 58, 75, 23 + CONTROL "OK", IDOK, WC_BUTTON, WS_TABSTOP | BS_DEFPUSHBUTTON, 194, 100, 50, 14 +} diff --git a/modules/windows/oodialog/simple/SimpleMonthCalendar.rex b/modules/windows/oodialog/simple/SimpleMonthCalendar.rex new file mode 100755 index 0000000..25bd044 --- /dev/null +++ b/modules/windows/oodialog/simple/SimpleMonthCalendar.rex @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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 program displays a month calendar control in a small dialog and prompts + * the user to pick their birthday. Each time the user selects a new date, that + * date is shown in a static text control. + */ + + sd = locate() + dlg = .SimpleMonthCalendar~new(sd"simpleMonthCalendar.rc", IDD_MONTHCAL, , sd"simpleMonthCalendar.h" ) + dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +return 0 +-- End of entry point. + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::class 'SimpleMonthCalendar' subclass RcDialog + +::method initDialog + expose dateText + + self~connectMonthCalendarEvent(IDC_MC, "SELECT", onSelect) + + mc = self~newMonthCalendar(IDC_MC) + r = .Rect~new + + mc~getMinRect(r) + w = mc~getMaxTodayWidth + r~right = max(r~right, w) + + mc~resizeTo(r~right, r~bottom) + + dateText = self~newStatic(IDC_ST_BIRTHDATE) + +::method onSelect unguarded + expose dateText + use arg startDate, endDate + + dateText~setText(self~formatDate(startDate)) + return 0 + +::method formatDate private + use strict arg date + + return date~monthName date~standardDate~right(2)~strip('L', 0)',' date~standardDate~left(4) diff --git a/modules/windows/oodialog/simple/SimpleUpDown.rex b/modules/windows/oodialog/simple/SimpleUpDown.rex new file mode 100755 index 0000000..d167455 --- /dev/null +++ b/modules/windows/oodialog/simple/SimpleUpDown.rex @@ -0,0 +1,81 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2009-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * A simple UserDialog with an UpDown control. + */ + + .application~autoDetection(.false) + + dlg = .SimpleDialog~new + + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'SimpleDialog' subclass UserDialog + +::method init + forward class (super) continue + + self~addSymbolicIDs + + self~create(30, 30, 147, 69, "Simple UpDown Control", , "CENTER") + + +::method defineDialog + + self~createStatic(IDC_STATIC, 20, 21, 40, 12, "TEXT RIGHT", "Spin Me:") + self~createEdit(IDC_EDIT_BUDDY, 62, 20, 65, 12, "RIGHT NUMBER") + self~createUpDown(IDC_UPD, 81, 26, 12, 16, "WRAP ARROWKEYS AUTOBUDDY SETBUDDYINT") + self~createPushButton(IDOK, 22, 45, 50, 14, "DEFAULT", "Ok") + self~createPushButton(IDCANCEL, 77, 45, 50, 14, , "Cancel") + +::method initDialog + + upDown = self~newUpDown(IDC_UPD) + upDown~setRange(1, 20000) + upDown~setPosition(1000) + + +::method addSymbolicIDs private + + self~constDir[IDC_UPD] = 200 + self~constDir[IDC_EDIT_BUDDY] = 205 + diff --git a/modules/windows/oodialog/sysinfo/sysInfo.h b/modules/windows/oodialog/sysinfo/sysInfo.h new file mode 100644 index 0000000..07be3f5 --- /dev/null +++ b/modules/windows/oodialog/sysinfo/sysInfo.h @@ -0,0 +1,40 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2010-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#define SYSINFO_DLG 100 +#define IDC_CB_COMPONENTS 200 +#define IDC_LB_DATA 210 diff --git a/modules/windows/oodialog/sysinfo/sysinfo.rc b/modules/windows/oodialog/sysinfo/sysinfo.rc new file mode 100644 index 0000000..f9962e6 --- /dev/null +++ b/modules/windows/oodialog/sysinfo/sysinfo.rc @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2021 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** +sysinfo.rc + +*****************************************************************************/ + +#include +#include + +SYSINFO_DLG DIALOG 80, 40, 213, 201 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "System Information" +FONT 10, "MS Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 158, 180, 50, 14 + LTEXT "System Component", -1, 4, 6, 68, 12 + COMBOBOX IDC_CB_COMPONENTS, 75, 4, 132, 108, CBS_DROPDOWNLIST | WS_TABSTOP + LISTBOX IDC_LB_DATA, 4, 24, 204, 150, LBS_STANDARD | WS_HSCROLL +} + diff --git a/modules/windows/oodialog/sysinfo/sysinfo.rex b/modules/windows/oodialog/sysinfo/sysinfo.rex new file mode 100755 index 0000000..bd62c99 --- /dev/null +++ b/modules/windows/oodialog/sysinfo/sysinfo.rex @@ -0,0 +1,219 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: sysinfo.rex + * Type: Open Object Rexx Script using ooDialog and OLE + * Resource: sysinfo.rc + * + * Description: + * Demo application for inspecting some system properties using WMI + * + * WMI is the acronym for Windows Management Instrumentation. Full documentation + * of WMI can be found in the Windows SDK which Microsoft provides free of + * charge. You can also locate this documentation on the web. A google search + * of: + * + * "MSDN Windows Management Instrumentation" + * + * will lead you straight to the documentation + */ + + sd = locate() + .application~setDefaults("O", sd'sysInfo.h', .false) + + sysInfoDlg = .SystemClass~new(sd'sysinfo.rc', SYSINFO_DLG) + if sysInfoDlg~initCode == 0 then do + sysInfoDlg~execute("SHOWTOP") + end + +return 0 + + +::requires "ooDialog.cls" + +::class 'SystemClass' subclass RcDialog + +::method initDialog + expose cb lb componentQueue queueHasData userHasQuit + + -- Connect the selection change event of the combo box to a method in this + -- dialog. + self~connectComboBoxEvent(IDC_CB_COMPONENTS, "SELCHANGE", selectionChange) + + -- Fill the combo box with the names of the WMI classes we will display. + cb = self~newComboBox(IDC_CB_COMPONENTS) + if cb \= .nil then do + cb~add("Win32_BootConfiguration") + cb~add("Win32_ComputerSystem") + cb~add("Win32_Environment") + cb~add("Win32_OperatingSystem") + cb~add("Win32_Printer") + cb~add("Win32_Process") + cb~add("Win32_Processor") + cb~add("Win32_Service") + end + + lb = self~newListBox(IDC_LB_DATA) + cb~select("Win32_ComputerSystem") + + componentQueue = .queue~new + queueHasData = .false + userHasQuit = .false + doneProcessing = .true + self~start("queueProcessor") + + self~addToQueue("Win32_ComputerSystem") + + +::method queueProcessor unguarded + expose queueHasData componentQueue lb userHasQuit doneProcessing + + doneProcessing = .false + + do forever + if userHasQuit then leave + + guard on when queueHasData + + if userHasQuit then leave + + component = componentQueue~pull + do while component \== .nil + if userHasQuit then leave + + -- Change the cursor to the hour glass cursor to indicate we are processing + -- and the user should be patient. + self~showHourGlass + + WMIObject = .OLEObject~getObject("WinMgmts:") + + if WMIObject \== .nil, component \== "" then do + if userHasQuit then leave + + lb~deleteAll + objects = WMIObject~instancesOf(component) + + do instance over objects + if userHasQuit then leave + + -- Please note: these objects offer a lot more information than is + -- displayed here. For simplicity's sake only the name and description + -- (if available) are shown. + + name = instance~name + desc = instance~description + if ((name = desc) | (desc = .nil)) then + lb~add(name) + else + lb~add(name "("desc")") + end + + end + -- Restore the cursor to its original shape and position. + self~showHourGlass(.false) + + component = componentQueue~pull + end + queueHasData = .false + end + + doneProcessing = .true + +::method selectionChange unguarded + expose cb lb + + component = cb~selected + self~addToQueue(component) + + return 0 + +::method ok unguarded + expose userHasQuit queueHasData doneProcessing + + userHasQuit = .true + queueHasData = .true + + guard on when doneProcessing + + return self~ok:super + +::method cancel unguarded + expose userHasQuit queueHasData doneProcessing + + userHasQuit = .true + queueHasData = .true + + guard on when doneProcessing + + return self~cancel:super + +::method addToQueue private + expose queueHasData componentQueue + use strict arg component + + componentQueue~queue(component) + queueHasData = .true + + +::method showHourGlass private + expose lb oldCursorPosition oldCursor + use strict arg show = .true + + mouse = .Mouse~new(lb) + + if show then do + -- Save the current cursor position. Change the list box's cursor shape to + -- the hour glass and save the old shape. + oldCursorPosition = mouse~getCursorPos + oldCursor = mouse~wait + + -- Get the current size and position of the list box. + p = lb~getRealPos + s = lb~getRealSize + + -- Set the point object to the midpoint of the list box and position the + -- cursor at that posiiion + p~incr(s~width % 2, s~height % 2) + mouse~setCursorPos(p) + end + else do + mouse~restoreCursor(oldCursor) + mouse~setCursorPos(oldCursorPosition) + end + diff --git a/modules/windows/oodialog/tutorial/add.bmp b/modules/windows/oodialog/tutorial/add.bmp new file mode 100644 index 0000000..340ab50 Binary files /dev/null and b/modules/windows/oodialog/tutorial/add.bmp differ diff --git a/modules/windows/oodialog/tutorial/drawing1.rex b/modules/windows/oodialog/tutorial/drawing1.rex new file mode 100755 index 0000000..d752748 --- /dev/null +++ b/modules/windows/oodialog/tutorial/drawing1.rex @@ -0,0 +1,93 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: drawing1.rex + * Type: Open Object REXX Script + * + * Description: Example demonstrating drawing functionality. + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"drawings.rc", 100) +if dlg~initCode <> 0 then return 99 +dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'MyDialogClass' subclass RcDialog + +::method init + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~connectButtonEvent(11, "CLICKED", "circle") + self~connectButtonEvent(12, "CLICKED", "myRectangle") + + return self~initCode + + +::method circle + + dc = self~getControlDC(10) + pen = self~createPen(5, "SOLID", 1) + oldPen = self~objectToDc(dc, pen) + + self~drawArc(dc, 10, 10, 320, 200) + + self~objectToDc(dc, oldPen) + self~deleteObject(pen) + self~freeControlDC(10, dc) + + +::method myRectangle + + dc = self~getControlDC(10) + pen = self~createPen(10, "DOT", 2) + oldPen = self~ObjectToDc(dc, pen) + + self~rectangle(dc, 10, 10, 320, 200) + + self~objectToDc(dc, oldPen) + self~deleteObject(pen) + self~freeControlDC(10, dc) + + diff --git a/modules/windows/oodialog/tutorial/drawing2.rex b/modules/windows/oodialog/tutorial/drawing2.rex new file mode 100755 index 0000000..dc4f919 --- /dev/null +++ b/modules/windows/oodialog/tutorial/drawing2.rex @@ -0,0 +1,152 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: drawing2.rex + * Type: Open Object REXX Script + * + * Description: Example demonstrating drawing functionality. + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"drawings.rc", 100) +if dlg~initCode <> 0 then return 99 +dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'MyDialogClass' subclass RcDialog + +::attribute graphicObject + +::method init + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~connectButtonEvent(11, "CLICKED", "circle") + self~connectButtonEvent(12, "CLICKED", "myRectangle") + self~connectDraw(10, "drawIt") + + self~graphicObject = "NONE" + + return self~initCode + + +::method drawIt + use arg id + + if self~graphicObject = "NONE" then return 0 + + dc = self~getControlDC(10) + + if self~graphicObject = "CIRCLE" then do + pen = self~createPen(5, "SOLID", 1) + end + else do + pen = self~createPen(8, "SOLID", 2) + end + + oldPen = self~objectToDc(dc, pen) + + properties = .directory~new + properties~weight = 700 + properties~italic = .true + + font = self~createFontEx("Arial", 24, properties) + oldFont = self~fontToDC(dc, font) + + self~transparentText(dc) + + self~getTextAlign(dc) + + if self~graphicObject = "CIRCLE" then do + -- Get the size of the bounding rectangle for the text we are going to + -- write, in this DC: + size = self~getTextExtent(dc, self~graphicObject) + + -- Get the midpoint of the circle we are about to draw; + pos = .Point~new(((300 - 10) % 2) + 10, ((200 - 10) % 2) + 10) + + -- Now adjust the pos point to specify where to write the text, in order + -- to center it in the circle: + pos~x -= size~width % 2 + pos~y -= size~height % 2 + + -- Draw the circle. + self~drawArc(dc, 10, 10, 300, 200) + end + else do + -- Do the same calculations for the position to write the text as we did + -- above for CIRCLE: + size = self~getTextExtent(dc, self~graphicObject) + + pos = .Point~new(((320 - 10) % 2) + 10, ((200 - 10) % 2) + 10) + pos~x -= size~width % 2 + pos~y -= size~height % 2 + + -- Draw the rectangle. + self~rectangle(dc, 10, 10, 320, 200) + end + + -- Write the text at the position we calculated above. + self~writeDirect(dc, pos~x, pos~y, self~graphicObject) + + self~fontToDC(dc, oldFont) + self~deleteFont(font) + + self~objectToDc(dc, oldPen) + self~deleteObject(pen) + + self~opaqueText(dc) + self~freeControlDC(10, dc) + + return .true + + +::method circle + self~graphicObject = "CIRCLE" + self~redrawControl(10, 1) + + +::method myRectangle + self~graphicObject = "RECTANGLE" + self~redrawControl(10, 1) + diff --git a/modules/windows/oodialog/tutorial/drawing3.rex b/modules/windows/oodialog/tutorial/drawing3.rex new file mode 100755 index 0000000..2243720 --- /dev/null +++ b/modules/windows/oodialog/tutorial/drawing3.rex @@ -0,0 +1,137 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: drawing3.rex + * Type: Open Object REXX Script + * + * Description: Example demonstrating drawing functionality, using the + * extended arguments sent to the DRAW event handler. + */ + + sd = locate() + dlg = .MyDialogClass~new(sd"drawings.rc", 100) + if dlg~initCode <> 0 then return 99 + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'MyDialogClass' subclass RcDialog + +::attribute graphicObject + +::method init + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~connectButtonEvent(11, "CLICKED", "circle") + self~connectButtonEvent(12, "CLICKED", "myRectangle") + self~connectDraw(10, "drawIt", .true) + + self~graphicObject = "NONE" + + return self~initCode + + +::method drawIt unguarded + use arg id, lp, drawObj, itemID, flags, dc, r, itemData + + if self~graphicObject = "NONE" then return .true + + if self~graphicObject = "CIRCLE" then do + pen = drawObj~createPen(5, "SOLID", 1) + end + else do + pen = drawObj~createPen(8, "SOLID", 2) + end + + oldPen = drawObj~objectToDc(dc, pen) + + properties = .directory~new + properties~weight = 700 + properties~italic = .true + + font = drawObj~createFontEx("Arial", 24, properties) + oldFont = drawObj~fontToDC(dc, font) + + drawObj~transparentText(dc) + + -- Get the midpoint of the button rectangle and set the text align to center + pos = .Point~new(r~right % 2, r~bottom % 2) + oldAlign = drawObj~setTextAlign(dc, 'CENTER BASELINE NOUPDATECP') + + -- Get a draw rectangle indented 5 from the button's area. + dr = .Rect~new(r~left + 5, r~top + 5, r~right - 10, r~bottom - 10) + + if self~graphicObject = "CIRCLE" then do + -- Draw the circle, within our draw rectangle + drawObj~drawArc(dc, dr~left, dr~top, dr~right, dr~bottom) + end + else do + -- Draw the rectangle, indented like the circle above. + drawObj~rectangle(dc, dr~left, dr~top, dr~right, dr~bottom) + end + + -- Write the text at the position we calculated above. + drawObj~writeDirect(dc, pos~x, pos~y, self~graphicObject) + + -- Now restore the DC so it is the same as passed into us. + drawObj~setTextAlign(dc, oldAlign) + drawObj~fontToDC(dc, oldFont) + drawObj~objectToDc(dc, oldPen) + + drawObj~opaqueText(dc) + + drawObj~deleteFont(font) + drawObj~deleteObject(pen) + + return .true + + +::method circle unguarded + self~graphicObject = "CIRCLE" + self~redrawControl(10, 1) + + +::method myRectangle unguarded + self~graphicObject = "RECTANGLE" + self~redrawControl(10, 1) + diff --git a/modules/windows/oodialog/tutorial/drawing4.rex b/modules/windows/oodialog/tutorial/drawing4.rex new file mode 100755 index 0000000..7815d90 --- /dev/null +++ b/modules/windows/oodialog/tutorial/drawing4.rex @@ -0,0 +1,112 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: drawing3.rex + * Type: Open Object REXX Script + * + * Description: Example demonstrating drawing functionality, using the + * extended arguments sent to the DRAW event handler. + */ + + dlg = .OwnerDrawDlg~new + if dlg~initCode <> 0 then return 99 + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'OwnerDrawDlg' subclass UserDialog + +::method init + + forward class (super) continue + self~create(6, 15, 187, 135, "Owner-drawn Button Dialog", "CENTER") + + self~connectDraw(10, "drawIt", .true) + +::method defineDialog + self~createPushButton(10, 6, 6, 175, 123, "OWNER", "") + +::method drawIt unguarded + use arg id, lp, drawObj, itemID, flags, dc, r, itemData + + -- Uncomment these lines for some insight as to what is happeninge to seen when the event handler is executed: + -- say id lp drawObj itemID flags dc r itemData + -- say 'Draw It' + + -- Create a pen to draw a circle with. + pen = drawObj~createPen(5, "SOLID", 1) + oldPen = drawObj~objectToDc(dc, pen) + + -- Create a font to use to draw text with. + properties = .directory~new + properties~weight = 700 + properties~italic = .true + + font = drawObj~createFontEx("Arial", 24, properties) + oldFont = drawObj~fontToDC(dc, font) + + drawObj~transparentText(dc) + + -- Get the midpoint of the button rectangle and set the text align to center + pos = .Point~new(r~right % 2, r~bottom % 2) + oldAlign = drawObj~setTextAlign(dc, 'CENTER BASELINE NOUPDATECP') + + -- Get a rectangle indented 5 from the button's area. + dr = .Rect~new(r~left + 5, r~top + 5, r~right - 10, r~bottom - 10) + + -- Draw a circle, within the rectangle + drawObj~drawArc(dc, dr~left, dr~top, dr~right, dr~bottom) + + -- Write some text at the position we calculated above. + drawObj~writeDirect(dc, pos~x, pos~y, 'Circle') + + -- Now restore the DC so it is the same as passed into us. + drawObj~setTextAlign(dc, oldAlign) + drawObj~fontToDC(dc, oldFont) + drawObj~objectToDc(dc, oldPen) + + drawObj~opaqueText(dc) + + drawObj~deleteFont(font) + drawObj~deleteObject(pen) + + return .true + diff --git a/modules/windows/oodialog/tutorial/drawing5.rex b/modules/windows/oodialog/tutorial/drawing5.rex new file mode 100755 index 0000000..8ed6710 --- /dev/null +++ b/modules/windows/oodialog/tutorial/drawing5.rex @@ -0,0 +1,153 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2014-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: drawing5.rex + * Type: Open Object REXX Script + * + * Description: Example demonstrating drawing functionality, using the + * extended arguments sent to the DRAW event handler. + * + * Draws and updates the time, implementing a simple clock + * interface. + */ + + dlg = .OwnerDrawDlg~new + if dlg~initCode <> 0 then return 99 + dlg~execute("SHOWTOP") + +return 0 + +::requires "ooDialog.cls" + +::class 'OwnerDrawDlg' subclass UserDialog + +::method init + expose timeFont circlePen pleaseQuit + + forward class (super) continue + self~create(6, 15, 187, 135, "Owner-drawn Button Dialog", "CENTER") + + self~connectDraw(10, "drawIt", .true) + + -- Create a font to use to draw text with. + properties = .directory~new + properties~weight = 700 + properties~italic = .true + timeFont = self~createFontEx("Arial", 24, properties) + + -- Create a pen to draw a circle with. + circlePen = self~createPen(5, "SOLID", 1) + + pleaseQuit = .false + +::method defineDialog + self~createPushButton(10, 6, 6, 175, 123, "OWNER", "") + +::method initDialog + expose oneSecond oneSecondAlarm drawSurface + + drawSurface = self~newPushButton(10) + oneSecond = .TimeSpan~fromSeconds(1) + timerMsg = .Message~new(self, paint) + oneSecondAlarm = .Alarm~new(oneSecond, timerMsg) + + +::method paint unguarded + expose oneSecond oneSecondAlarm drawSurface pleaseQuit + + if pleaseQuit then return + + reply + drawSurface~update + + timerMsg = .Message~new(self, paint) + oneSecondAlarm = .Alarm~new(oneSecond, timerMsg) + +::method drawIt unguarded + expose timeFont circlePen + use arg id, lp, drawObj, itemID, flags, dc, r, itemData + + now = .DateTime~new~normalTime + + -- Uncomment these lines for some insight as to what is happeninge to seen when the event handler is executed: + -- say id lp drawObj itemID flags dc r itemData + -- say 'Draw It' + + -- Erases the entire drawing surface, this could be improved, maybe, by only + -- erasing what needs to be erased. + self~rectangle(dc, r~left, r~top, r~right, r~bottom, 'FILL') + + oldPen = drawObj~objectToDc(dc, circlePen) + oldFont = drawObj~fontToDC(dc, timeFont) + + drawObj~transparentText(dc) + + -- Get the midpoint of the button rectangle and set the text align to center + pos = .Point~new(r~right % 2, r~bottom % 2) + oldAlign = drawObj~setTextAlign(dc, 'CENTER BASELINE NOUPDATECP') + + -- Get a rectangle indented 5 from the button's area. + dr = .Rect~new(r~left + 5, r~top + 5, r~right - 10, r~bottom - 10) + + -- Draw a circle, within the rectangle + drawObj~drawArc(dc, dr~left, dr~top, dr~right, dr~bottom) + + -- Write the time at the position we calculated above. + drawObj~writeDirect(dc, pos~x, pos~y, now) + + -- Now restore the DC so it is the same as passed into us. + drawObj~setTextAlign(dc, oldAlign) + drawObj~fontToDC(dc, oldFont) + drawObj~objectToDc(dc, oldPen) + drawObj~opaqueText(dc) + + return .true + +::method leaving + expose timeFont circlePen + self~deleteFont(timeFont) + self~deleteObject(circlePen) + + +::method cancel unguarded + expose pleaseQuit oneSecondAlarm + pleaseQuit = .true + oneSecondAlarm~cancel + return self~cancel:super + diff --git a/modules/windows/oodialog/tutorial/drawings.rc b/modules/windows/oodialog/tutorial/drawings.rc new file mode 100644 index 0000000..9c5a08f --- /dev/null +++ b/modules/windows/oodialog/tutorial/drawings.rc @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +drawings.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 187, 135 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ooDialog Drawings" +FONT 8, "System" +{ + PUSHBUTTON "Button", 10, 6, 6, 176, 104, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Circle", 11, 7, 115, 50, 14 + PUSHBUTTON "&Rectangle", 12, 67, 115, 50, 14 + DEFPUSHBUTTON "Leave", 1, 129, 115, 50, 14 +} + diff --git a/modules/windows/oodialog/tutorial/employe1.rc b/modules/windows/oodialog/tutorial/employe1.rc new file mode 100644 index 0000000..f6763a7 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe1.rc @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe1.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 50, 11, 177, 12 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 50, 30, 174, 55 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 28, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 39, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 37, 12 + DEFPUSHBUTTON "OK", IDOK, 69, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 125, 123, 50, 14 + PUSHBUTTON "Help", IDHELP, 180, 123, 50, 14 + LTEXT "Person:", -1, 10, 12, 34, 8 + LTEXT "City:", -1, 10, 32, 34, 8 + LTEXT "Profession:", -1, 10, 53, 42, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 +} + diff --git a/modules/windows/oodialog/tutorial/employe1.rex b/modules/windows/oodialog/tutorial/employe1.rex new file mode 100755 index 0000000..bc73be0 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe1.rex @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe1.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .UserDialog~new +if dlg~initCode <> 0 then exit +if dlg~load(sd"employe1.rc", 100) \= 0 then exit +if dlg~execute("SHOWTOP") = 1 then do + say dlg~name + say dlg~city + say dlg~profession + say dlg~male + say dlg~female + say dlg~married +end + +::requires "ooDialog.cls" + diff --git a/modules/windows/oodialog/tutorial/employe2.rc b/modules/windows/oodialog/tutorial/employe2.rc new file mode 100644 index 0000000..1ae5f3c --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe2.rc @@ -0,0 +1,70 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe2.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 50, 11, 177, 12 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 50, 30, 174, 55 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 28, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 39, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 37, 12 + PUSHBUTTON "&Print", 10, 8, 123, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 69, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 125, 123, 50, 14 + PUSHBUTTON "Help", IDHELP, 180, 123, 50, 14 + LTEXT "Person:", -1, 10, 12, 34, 8 + LTEXT "City:", -1, 10, 32, 34, 8 + LTEXT "Profession:", -1, 10, 53, 42, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 +} + diff --git a/modules/windows/oodialog/tutorial/employe2.rex b/modules/windows/oodialog/tutorial/employe2.rex new file mode 100755 index 0000000..b1cf60e --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe2.rex @@ -0,0 +1,72 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe2.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe1.rc", 100) +if dlg~initCode <> 0 then exit + +if dlg~execute("SHOWTOP") = 1 then do + say dlg~name + say dlg~city + say dlg~profession + say dlg~male + say dlg~female + say dlg~married +end + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") diff --git a/modules/windows/oodialog/tutorial/employe3.rc b/modules/windows/oodialog/tutorial/employe3.rc new file mode 100644 index 0000000..3258255 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe3.rc @@ -0,0 +1,72 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe3.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 42, 11, 167, 12 + CONTROL "", 11, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 219, 8, 10, 17 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 30, 167, 56 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 28, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 39, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 37, 12 + PUSHBUTTON "&Add", 12, 204, 29, 26, 14 + PUSHBUTTON "&Print", 10, 8, 123, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 69, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 125, 123, 50, 14 + PUSHBUTTON "Help", IDHELP, 180, 123, 50, 14 + LTEXT "Person:", -1, 10, 12, 28, 8 + LTEXT "City:", -1, 10, 32, 19, 8 + LTEXT "Profession:", -1, 10, 53, 39, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 +} + diff --git a/modules/windows/oodialog/tutorial/employe3.rex b/modules/windows/oodialog/tutorial/employe3.rex new file mode 100755 index 0000000..caae665 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe3.rex @@ -0,0 +1,75 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe3.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe2.rc", 100) +if dlg~initCode <> 0 then exit + +dlg~execute("SHOWTOP") + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */ + +::method print + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + say title self~name addition + say "City:" self~city + say "Profession:" self~profession diff --git a/modules/windows/oodialog/tutorial/employe4.rc b/modules/windows/oodialog/tutorial/employe4.rc new file mode 100644 index 0000000..f0a837a --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe4.rc @@ -0,0 +1,72 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe4.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 42, 11, 167, 12 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 30, 167, 56 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 26, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 34, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 37, 12 + PUSHBUTTON "&Add", 12, 212, 28, 23, 21 + PUSHBUTTON "&Print", 10, 8, 123, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 66, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 124, 123, 50, 14 + LTEXT "Person:", -1, 10, 12, 27, 8 + LTEXT "City:", -1, 10, 32, 16, 8 + LTEXT "Profession:", -1, 10, 53, 39, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 + SCROLLBAR 11, 219, 8, 9, 17, SBS_VERT + PUSHBUTTON "Help", IDHELP, 180, 123, 50, 14 +} + diff --git a/modules/windows/oodialog/tutorial/employe4.rex b/modules/windows/oodialog/tutorial/employe4.rex new file mode 100755 index 0000000..812db3e --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe4.rex @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe4.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe2.rc", 100) +if dlg~initCode <> 0 then exit + +dlg~execute("SHOWTOP") + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */ + +::method print + self~getData + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~profession diff --git a/modules/windows/oodialog/tutorial/employe4validate.rex b/modules/windows/oodialog/tutorial/employe4validate.rex new file mode 100755 index 0000000..95dda3c --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe4validate.rex @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe4valid.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe2.rc", 100) +if dlg~initCode <> 0 then exit + +dlg~execute("SHOWTOP") + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */ + +::method print + self~getData + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x ||, + "Profession:" self~profession + +::method validate + if self~getControlData(21)~strip = "" then do + call infoDialog "An unnamed employee is not accepted!" + return .false /* dialog cannot be closed */ + end + else do + return .true /* dialog can be closed */ + end diff --git a/modules/windows/oodialog/tutorial/employe5.rc b/modules/windows/oodialog/tutorial/employe5.rc new file mode 100644 index 0000000..bd688cc --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe5.rc @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe5.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 42, 11, 167, 12 + CONTROL "", 11, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 219, 8, 10, 17 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 30, 167, 56 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 26, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 34, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 37, 12 + PUSHBUTTON "&Add", 12, 212, 28, 23, 21 + PUSHBUTTON "&Print", 10, 8, 123, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 63, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 118, 123, 50, 14 + PUSHBUTTON "&List Employees", 13, 174, 123, 56, 14 + LTEXT "Person:", -1, 10, 12, 27, 8 + LTEXT "City:", -1, 10, 32, 16, 8 + LTEXT "Profession:", -1, 10, 53, 39, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 +} + + +101 DIALOG 6, 15, 278, 144 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "List of Employees" +FONT 8, "System" +{ + DEFPUSHBUTTON "OK", IDOK, 226, 127, 50, 14 + CONTROL "List", 101, "LISTBOX", LBS_NOTIFY | WS_BORDER | WS_BORDER | WS_VSCROLL, 3, 16, 272, 103 + LTEXT "Name", -1, 5, 7, 26, 8 + LTEXT "Profession", -1, 101, 7, 60, 8 + LTEXT "City", -1, 201, 7, 60, 8 +} + diff --git a/modules/windows/oodialog/tutorial/employe5.rex b/modules/windows/oodialog/tutorial/employe5.rex new file mode 100755 index 0000000..78e6a2d --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe5.rex @@ -0,0 +1,127 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe5.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe3.rc", 100) +if dlg~initCode <> 0 then exit +dlg~execute("SHOWTOP") + +exit + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog + +::attribute employees +::attribute empCount +::attribute empCurrent + +::method init + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~employees = .array~new(10) + self~empCount = 1 + self~empCurrent = 1 + self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */ + self~connectButtonEvent(12, "CLICKED", "Add") /* connect button 12 with a method */ + + return self~initCode + +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + +::method print + self~getData + + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~name + +::method add + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = self~getControlData(21) + self~employees[self~empCount]['CITY'] = self~getControlData(22) + self~employees[self~empCount]['PROFESSION'] = self~getControlData(23) + + if self~getControlData(31) = 1 then sex = 1 + else sex = 2 + self~employees[self~empCount]['SEX'] = sex + + self~employees[self~empCount]['MARRIED'] = self~getControlData(41) + self~empCount += 1 + self~empCurrent = self~empCount + self~setControlData(21, ""); + + +::method set + self~setControlData(21, self~employees[self~empCurrent]['NAME']) + self~setControlData(22, self~employees[self~empCurrent]['CITY']) + self~setControlData(23, self~employees[self~empCurrent]['PROFESSION']) + + if self~employees[self~empCurrent]['SEX'] = 1 then do + self~setControlData(31, 1) + self~setControlData(32, 0) + end + else do + self~setControlData(31, 0) + self~setControlData(32, 1) + end + self~setControlData(41, self~employees[self~empCurrent]['MARRIED']) + + diff --git a/modules/windows/oodialog/tutorial/employe6.rc b/modules/windows/oodialog/tutorial/employe6.rc new file mode 100644 index 0000000..9d09dd1 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe6.rc @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe6.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 42, 11, 167, 12 + CONTROL "", 11, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 219, 8, 10, 17 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 30, 167, 56 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 26, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 34, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 37, 12 + PUSHBUTTON "&Add", 12, 212, 28, 23, 21 + PUSHBUTTON "&Print", 10, 8, 123, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 63, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 118, 123, 50, 14 + PUSHBUTTON "&List Employees", 13, 174, 123, 56, 14 + LTEXT "Person:", -1, 10, 12, 27, 8 + LTEXT "City:", -1, 10, 32, 16, 8 + LTEXT "Profession:", -1, 10, 53, 39, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 +} + + +101 DIALOG 6, 15, 278, 144 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "List of Employees" +FONT 8, "System" +{ + DEFPUSHBUTTON "OK", IDOK, 226, 127, 50, 14 + CONTROL "List", 101, "LISTBOX", LBS_NOTIFY | WS_BORDER | LBS_USETABSTOPS | LBS_MULTICOLUMN | WS_BORDER | WS_VSCROLL, 3, 16, 272, 103 + LTEXT "Name", -1, 5, 7, 26, 8 + LTEXT "Profession", -1, 101, 7, 60, 8 + LTEXT "City", -1, 201, 7, 60, 8 +} + diff --git a/modules/windows/oodialog/tutorial/employe6.rex b/modules/windows/oodialog/tutorial/employe6.rex new file mode 100755 index 0000000..86885b9 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe6.rex @@ -0,0 +1,164 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe6.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe3.rc", 100) +if dlg~initCode <> 0 then exit +dlg~execute("SHOWTOP") + +exit + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog + +::attribute employees +::attribute empCount +::attribute empCurrent + +::method init + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~employees = .array~new(10) + self~empCount = 1 + self~empCurrent = 1 + self~connectButtonEvent(10, "CLICKED", "Print") /* connect button 10 with a method */ + self~connectButtonEvent(12, "CLICKED", "Add") /* connect button 12 with a method */ + self~connectUpDownEvent(11, "DELTAPOS", onEmpChange) + + return self~initCode + + +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + + +::method onEmpChange + use arg curPos, increment + + if increment > 0 then self~empNext + else self~empPrev + + return .UpDown~deltaPosReply + + +::method print + self~getData + + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~name + +::method add + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = self~getControlData(21) + self~employees[self~empCount]['CITY'] = self~getControlData(22) + self~employees[self~empCount]['PROFESSION'] = self~getControlData(23) + + if self~getControlData(31) = 1 then sex = 1 + else sex = 2 + self~employees[self~empCount]['SEX'] = sex + + self~employees[self~empCount]['MARRIED'] = self~getControlData(41) + self~empCount = self~empCount + 1 + self~empCurrent = self~empCount + self~setControlData(21, ""); + + self~newUpDown(11)~setRange(1, self~empCount) + self~newUpDown(11)~setPosition(self~empCount) + + +::method set + self~setControlData(21, self~employees[self~empCurrent]['NAME']) + self~setControlData(22, self~employees[self~empCurrent]['CITY']) + self~setControlData(23, self~employees[self~empCurrent]['PROFESSION']) + + if self~employees[self~empCurrent]['SEX'] = 1 then do + self~setControlData(31, 1) + self~setControlData(32, 0) + end + else do + self~setControlData(31, 0) + self~setControlData(32, 1) + end + + self~setControlData(41, self~employees[self~empCurrent]['MARRIED']) + +::method empPrev + if self~empCount = 1 then return + if self~empCurrent > 1 then do + self~empCurrent = self~empCurrent - 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the bottom.", "Info", 1000 + end + +::method empNext + if self~empCount = 1 then return + if self~empCurrent < self~empCount-1 then do + self~empCurrent = self~empCurrent + 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the top.", "Info", 1000 + end + diff --git a/modules/windows/oodialog/tutorial/employe7.h b/modules/windows/oodialog/tutorial/employe7.h new file mode 100644 index 0000000..2887749 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe7.h @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_EMPLOYEES7 206 +#define IDD_EMPLOYEE_LIST 207 +#define IDM_MENUBAR 208 +#define IDC_GB1 1000 +#define IDC_CB_CITY 1001 +#define IDC_UPD 1002 +#define IDC_LB_POSITION 1003 +#define IDC_EDIT_NAME 1004 +#define IDC_PB_ADD 1005 +#define IDC_RB_MALE 1006 +#define IDC_RB_FEMALE 1007 +#define IDC_CHK_MARRIED 1008 +#define IDC_PB_PRINT 1009 +#define IDC_GB2 1010 +#define IDC_LB_EMPLOYEES_LIST 1010 +#define IDC_PB_LIST 1011 +#define IDC_RB_ADD 1014 +#define IDC_RB_BROWSE 1015 +#define IDM_ADD 40000 +#define IDM_PRINT 40001 +#define IDM_LIST 40002 +#define IDM_ABOUT 40003 diff --git a/modules/windows/oodialog/tutorial/employe7.rc b/modules/windows/oodialog/tutorial/employe7.rc new file mode 100644 index 0000000..83b1d0b --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe7.rc @@ -0,0 +1,108 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "employe7.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDM_MENUBAR MENU +{ + POPUP "&File" + { + MENUITEM "&Cancel", IDCANCEL + MENUITEM "E&xit", IDOK + } + POPUP "&Employees" + { + MENUITEM "&Add", IDM_ADD + MENUITEM "&Print", IDM_PRINT + MENUITEM SEPARATOR + MENUITEM "&List", IDM_LIST, GRAYED + } + POPUP "&Help" + { + MENUITEM SEPARATOR + MENUITEM "&About", IDM_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_EMPLOYEE_LIST DIALOG 6, 15, 278, 117 +STYLE DS_CENTER | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Acme Software - List of Employees" +FONT 12, "Courier New" +{ + LISTBOX IDC_LB_EMPLOYEES_LIST, 10, 22, 258, 66, WS_VSCROLL | LBS_USETABSTOPS | LBS_NOTIFY + LTEXT "Name", -1, 10, 7, 26, 8, SS_LEFT + LTEXT "Profession", -1, 101, 7, 60, 8, SS_LEFT + LTEXT "City", -1, 201, 7, 60, 8, SS_LEFT + DEFPUSHBUTTON "OK", IDOK, 218, 93, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_EMPLOYEES7 DIALOG 6, 15, 235, 184 +STYLE DS_CENTER | DS_MODALFRAME | DS_SETFONT | WS_CAPTION | WS_POPUP | WS_SYSMENU +CAPTION "Acme Software - Employees Version 7" +FONT 10, "Tahoma" +{ + GROUPBOX "Mode", IDC_GB2, 165, 10, 60, 44, WS_GROUP + AUTORADIOBUTTON "&Adding", IDC_RB_ADD, 174, 20, 46, 12, WS_TABSTOP + AUTORADIOBUTTON "&Browsing", IDC_RB_BROWSE, 174, 37, 46, 12 + LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME, 40, 20, 120, 12 + CONTROL "", IDC_UPD, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 150, 20, 10, 12 + LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT + COMBOBOX IDC_CB_CITY, 40, 37, 120, 56, WS_TABSTOP | WS_TABSTOP | CBS_DROPDOWNLIST + LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT + LISTBOX IDC_LB_POSITION, 10, 68, 150, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY + GROUPBOX "Statistics", IDC_GB1, 165, 65, 60, 66, WS_GROUP + AUTORADIOBUTTON "&Male", IDC_RB_MALE, 174, 80, 46, 12, WS_TABSTOP + AUTORADIOBUTTON "&Female", IDC_RB_FEMALE, 174, 95, 46, 12 + AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED, 174, 112, 46, 12, WS_GROUP + PUSHBUTTON "A&dd", IDC_PB_ADD, 165, 135, 60, 14 + PUSHBUTTON "&Print", IDC_PB_PRINT, 10, 160, 45, 14 + PUSHBUTTON "&List Employees", IDC_PB_LIST, 60, 160, 65, 14 + DEFPUSHBUTTON "D&one", IDOK, 130, 160, 45, 14 + PUSHBUTTON "&Cancel", IDCANCEL, 180, 160, 45, 14 +} diff --git a/modules/windows/oodialog/tutorial/employe7.rex b/modules/windows/oodialog/tutorial/employe7.rex new file mode 100755 index 0000000..e24edc8 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe7.rex @@ -0,0 +1,196 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe7.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe8.rc", 100) +if dlg~initCode <> 0 then exit +dlg~execute("SHOWTOP") + +exit + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog + +::attribute employees +::attribute empCount +::attribute empCurrent + +::method init + expose sd + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + sd = .application~srcDir + + self~employees = .array~new(10) + self~empCount = 1 + self~empCurrent = 1 + self~connectButtonEvent(10, "CLICKED", "print") + self~connectUpDownEvent(11, "DELTAPOS", onEmpChange) + + -- The 'Add' button in this dialog will use an image list to display a + -- bitmap for the surface of the button, rather than text. The image list + -- is created now and assigned to the button in initDialog() + self~createImageList + self~connectButtonEvent(12, "CLICKED", "add") + + -- Using a background bitmap for the dialog is a rather archic method, left + -- over from the previous millenium. It is seldom seen in modern dialogs. + -- Most likely you will not find the appearance of this dialog very + -- appealing. + self~backgroundBitmap(sd"logo.bmp") + + return self~initCode + + +::method createImageList private + expose imageList sd + + size = .Size~new(45, 41) + imageList = .ImageList~create(size, 'COLOR8 MASK', 1) + + cRef = .Image~colorRef(255, 255, 255) + image = .Image~getImage(sd'add.bmp') + imageList~addMasked(image, cRef) + + +::method initDialog + expose imageList + + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + + -- Assign the image list to the 'Add' button. + margin = .Rect~new(2) + self~newPushButton(12)~setImageList(imageList, margin) + + +::method onEmpChange + use arg curPos, increment + + if increment > 0 then self~empNext + else self~empPrev + + return .UpDown~deltaPosReply + + +::method print + self~getData + + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~name + +::method add + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = self~getControlData(21) + self~employees[self~empCount]['CITY'] = self~getControlData(22) + self~employees[self~empCount]['PROFESSION'] = self~getControlData(23) + + if self~getControlData(31) = 1 then sex = 1 + else sex = 2 + self~employees[self~empCount]['SEX'] = sex + + self~employees[self~empCount]['MARRIED'] = self~getControlData(41) + self~empCount = self~empCount + 1 + self~empCurrent = self~empCount + self~setControlData(21, ""); + + self~newUpDown(11)~setRange(1, self~empCount) + self~newUpDown(11)~setPosition(self~empCount) + + +::method set + self~setControlData(21, self~employees[self~empCurrent]['NAME']) + self~setControlData(22, self~employees[self~empCurrent]['CITY']) + self~setControlData(23, self~employees[self~empCurrent]['PROFESSION']) + + if self~employees[self~empCurrent]['SEX'] = 1 then do + self~setControlData(31, 1) + self~setControlData(32, 0) + end + else do + self~setControlData(31, 0) + self~setControlData(32, 1) + end + + self~setControlData(41, self~employees[self~empCurrent]['MARRIED']) + +::method empPrev + if self~empCount = 1 then return + if self~empCurrent > 1 then do + self~empCurrent = self~empCurrent - 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the bottom.", "Info", 1000 + end + +::method empNext + if self~empCount = 1 then return + if self~empCurrent < self~empCount-1 then do + self~empCurrent = self~empCurrent + 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the top.", "Info", 1000 + end + diff --git a/modules/windows/oodialog/tutorial/employe8.rc b/modules/windows/oodialog/tutorial/employe8.rc new file mode 100644 index 0000000..2cd95a7 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe8.rc @@ -0,0 +1,72 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +employe8.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 241, 141 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Employees" +FONT 8, "System" +{ + CONTROL "Name", 21, "EDIT", WS_BORDER | WS_TABSTOP, 42, 11, 167, 12 + CONTROL "", 11, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 219, 8, 10, 17 + CONTROL "City", 22, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 30, 167, 56 + CONTROL "Profession", 23, "LISTBOX", LBS_STANDARD, 73, 52, 156, 65 + AUTORADIOBUTTON "&Male", 31, 12, 71, 26, 12 + AUTORADIOBUTTON "&Female", 32, 12, 84, 34, 12 + AUTOCHECKBOX "M&arried", 41, 12, 99, 36, 12 + PUSHBUTTON "&Add", 12, 207, 28, 23, 21, BS_BITMAP + PUSHBUTTON "&Print", 10, 8, 123, 50, 14 + DEFPUSHBUTTON "OK", IDOK, 66, 123, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 124, 123, 50, 14 + LTEXT "Person:", -1, 10, 12, 27, 8 + LTEXT "City:", -1, 10, 32, 16, 8 + LTEXT "Profession:", -1, 10, 53, 39, 8 + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 9, 68, 47, 45 + PUSHBUTTON "Help", IDHELP, 180, 123, 50, 14 +} + diff --git a/modules/windows/oodialog/tutorial/employe8.rex b/modules/windows/oodialog/tutorial/employe8.rex new file mode 100755 index 0000000..e0fc36a --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe8.rex @@ -0,0 +1,231 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe8.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe5.rc", 100) +if dlg~initCode <> 0 then exit +dlg~execute("SHOWTOP") + +exit + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog + +::attribute employees +::attribute empCount +::attribute empCurrent + +::method init + expose font + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + font = 0 + + self~employees = .array~new(10) + self~empCount = 1 + self~empCurrent = 1 + self~connectButtonEvent(10, "CLICKED", "print") /* connect button 10 with a method */ + self~connectButtonEvent(12, "CLICKED", "add") /* connect button 12 with a method */ + self~connectUpDownEvent(11, "DELTAPOS", onEmpChange) + self~connectButtonEvent(13, "CLICKED", "empList") + + return self~initCode + + +::method initDialog + expose font + + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + + additional = .directory~new + additional~weight = 600 + font = self~createFontEx("Script", 16, additional) + self~setControlFont(1, font) + + self~disableItem(11) + self~disableItem(13) + + +::method onEmpChange + use arg curPos, increment + + if increment > 0 then self~empNext + else self~empPrev + + return .UpDown~deltaPosReply + + +::method print + self~getData + + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~name + +::method add + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = self~getControlData(21) + self~employees[self~empCount]['CITY'] = self~getControlData(22) + self~employees[self~empCount]['PROFESSION'] = self~getControlData(23) + + if self~getControlData(31) = 1 then sex = 1 + else sex = 2 + self~employees[self~empCount]['SEX'] = sex + + self~employees[self~empCount]['MARRIED'] = self~getControlData(41) + self~empCount = self~empCount + 1 + self~empCurrent = self~empCount + self~setControlData(21, ""); + + self~newUpDown(11)~setRange(1, self~empCount) + self~newUpDown(11)~setPosition(self~empCount) + + self~enableItem(11) + self~enableItem(13) + + +::method set + self~setControlData(21, self~employees[self~empCurrent]['NAME']) + self~setControlData(22, self~employees[self~empCurrent]['CITY']) + self~setControlData(23, self~employees[self~empCurrent]['PROFESSION']) + + if self~employees[self~empCurrent]['SEX'] = 1 then do + self~setControlData(31, 1) + self~setControlData(32, 0) + end + else do + self~setControlData(31, 0) + self~setControlData(32, 1) + end + + self~setControlData(41, self~employees[self~empCurrent]['MARRIED']) + +::method empPrev + if self~empCount = 1 then return + if self~empCurrent > 1 then do + self~empCurrent = self~empCurrent - 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the bottom.", "Info", 1000 + end + +::method empNext + if self~empCount = 1 then return + if self~empCurrent < self~empCount-1 then do + self~empCurrent = self~empCurrent + 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the top.", "Info", 1000 + end + +::method empList + lDlg = .EmployeeListClass~new(.application~srcDir"employe5.rc", 101) + lDlg~parent = self + lDlg~execute("SHOWTOP") + + +::method fillList + use arg subdlg, id + + column1 = 24 + column2 = 29 + + do i = 1 to self~empCount - 1 + if self~employees[i]['SEX'] = 1 then title = "Mr." + else title = "Ms." + addstring = title self~employees[i]['NAME'] + + spacebetween = column1 - self~employees[i]['NAME']~length - 5 + + if spacebetween > 0 then addstring = addstring || " "~copies(spacebetween) + addstring = addstring || " "self~employees[i]['PROFESSION'] + + spacebetween = column2 - self~employees[i]['PROFESSION']~length - 5 + if spacebetween > 0 then addstring = addstring || " "~copies(spacebetween) + addstring = addstring || " "self~employees[i]['CITY'] + + subdlg~addListEntry(id, addstring) + end + +::method Leaving + expose font + if font \= 0 then self~DeleteFont(font) + + +::class 'EmployeeListClass' subclass RcDialog + +::method parent attribute + +::method initDialog + expose font + + font = self~createFontEx("Courier", 14) + self~setControlFont(101, font) + + self~parent~fillList(self, 101) + +::method leaving + expose font + self~deleteFont(font) diff --git a/modules/windows/oodialog/tutorial/employe9.rex b/modules/windows/oodialog/tutorial/employe9.rex new file mode 100755 index 0000000..3e3b405 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe9.rex @@ -0,0 +1,197 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe9.rex + * Type: Open Object REXX Script + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe6.rc", 100) +if dlg~initCode <> 0 then exit +dlg~execute("SHOWTOP") + +exit + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog + +::attribute employees +::attribute empCount +::attribute empCurrent + +::method init + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~employees = .array~new(10) + self~empCount = 1 + self~empCurrent = 1 + self~connectButtonEvent(10, "CLICKED", "print") /* connect button 10 with a method */ + self~connectButtonEvent(12, "CLICKED", "add") /* connect button 12 with a method */ + self~connectUpDownEvent(11, "DELTAPOS", onEmpChange) + self~connectButtonEvent(13, "CLICKED", "empList") + + return self~initCode + + +::method initDialog + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + self~disableItem(11) + self~disableItem(13) + + +::method onEmpChange + use arg curPos, increment + + if increment > 0 then self~empNext + else self~empPrev + + return .UpDown~deltaPosReply + + +::method print + self~getData + + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~name + +::method add + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = self~getControlData(21) + self~employees[self~empCount]['CITY'] = self~getControlData(22) + self~employees[self~empCount]['PROFESSION'] = self~getControlData(23) + + if self~getControlData(31) = 1 then sex = 1 + else sex = 2 + self~employees[self~empCount]['SEX'] = sex + + self~employees[self~empCount]['MARRIED'] = self~getControlData(41) + self~empCount = self~empCount + 1 + self~empCurrent = self~empCount + self~setControlData(21, ""); + + self~newUpDown(11)~setRange(1, self~empCount) + self~newUpDown(11)~setPosition(self~empCount) + + self~enableItem(11) + self~enableItem(13) + + +::method set + self~setControlData(21, self~employees[self~empCurrent]['NAME']) + self~setControlData(22, self~employees[self~empCurrent]['CITY']) + self~setControlData(23, self~employees[self~empCurrent]['PROFESSION']) + + if self~employees[self~empCurrent]['SEX'] = 1 then do + self~setControlData(31, 1) + self~setControlData(32, 0) + end + else do + self~setControlData(31, 0) + self~setControlData(32, 1) + end + + self~setControlData(41, self~employees[self~empCurrent]['MARRIED']) + +::method empPrev + if self~empCount = 1 then return + if self~empCurrent > 1 then do + self~empCurrent = self~empCurrent - 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the bottom.", "Info", 1000 + end + +::method empNext + if self~empCount = 1 then return + if self~empCurrent < self~empCount-1 then do + self~empCurrent = self~empCurrent + 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the top.", "Info", 1000 + end + +::method empList + lDlg = .EmployeeListClass~new(.application~srcDir"employe6.rc", 101) + lDlg~parent = self + lDlg~execute("SHOWTOP") + + +::method fillList + use arg subdlg, id + + do i = 1 to self~empCount - 1 + if self~employees[i]['SEX'] = 1 then title = "Mr." + else title = "Ms." + addstring = title self~employees[i]['NAME'] + addstring = addstring || "9"x || self~employees[i]['PROFESSION'] + addstring = addstring || "9"x || self~employees[i]['CITY'] + subdlg~addListEntry(id, addstring) + end + + +::class EmployeeListClass subclass RcDialog + +::method parent attribute + +::method initDialog + self~parent~fillList(self, 101) + self~setListTabulators(101, 98, 198) diff --git a/modules/windows/oodialog/tutorial/employe9menuDyn.rex b/modules/windows/oodialog/tutorial/employe9menuDyn.rex new file mode 100755 index 0000000..5a19311 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employe9menuDyn.rex @@ -0,0 +1,239 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe9menuDyn.rex + * Type: Open Object REXX Script + * + * Description: Adds a menu, created dynamically, to the Employees application. + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"employe6.rc", 100) +if dlg~initCode <> 0 then exit +dlg~execute("SHOWTOP") + +exit + +::requires "ooDialog.cls" + +::class MyDialogClass subclass RcDialog + +::attribute employees +::attribute empCount +::attribute empCurrent + +::method init + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~employees = .array~new(10) + self~empCount = 1 + self~empCurrent = 1 + self~connectButtonEvent(10, "CLICKED", "print") /* connect button 10 with a method */ + self~connectButtonEvent(12, "CLICKED", "add") /* connect button 12 with a method */ + self~connectUpDownEvent(11, "DELTAPOS", onEmpChange) + self~connectButtonEvent(13, "CLICKED", "empList") + self~defineMenu + + return self~initCode + + +::method defineMenu private + expose menuBar + + empPopup = .PopupMenu~new(200) + empPopup~insertItem(202, 202, "&Print") + empPopup~insertItem(202, 204, "&List", "GRAYED") + empPopup~insertSeparator(202, 203) + empPopup~insertItem(202, 201, "&Add") + + ctrlPopup = .PopupMenu~new(210) + ctrlPopup~insertItem(211, 211, "E&xit") + ctrlPopup~insertItem(211, 214, "&About") + ctrlPopup~insertSeparator(211, 213) + ctrlPopup~insertItem(211, 212, "&Cancel") + + menuBar = .BinaryMenuBar~new(.nil, 300) + menuBar~insertPopup(200, 200, empPopup, "&Employees") + menuBar~insertPopup(200, 210, ctrlPopup, "&Control") + + menuBar~connectCommandEvent(201, add, self) + menuBar~connectCommandEvent(202, print, self) + menuBar~connectCommandEvent(204, empList, self) + menuBar~connectCommandEvent(211, ok, self) + menuBar~connectCommandEvent(212, cancel, self) + menuBar~connectCommandEvent(214, about, self) + + +::method initDialog + expose menuBar + + self~city = "New York" + self~male = 1 + self~female = 0 + self~addComboEntry(22, "Munich") + self~addComboEntry(22, "New York") + self~addComboEntry(22, "San Francisco") + self~addComboEntry(22, "Stuttgart") + self~addListEntry(23, "Business Manager") + self~addListEntry(23, "Software Developer") + self~addListEntry(23, "Broker") + self~addListEntry(23, "Police Man") + self~addListEntry(23, "Lawyer") + self~disableItem(11) + self~disableItem(13) + + menuBar~attachTo(self, 1) + + +::method onEmpChange + use arg curPos, increment + + if increment > 0 then self~empNext + else self~empPrev + + return .UpDown~deltaPosReply + + +::method print + self~getData + + if self~male = 1 then title = "Mr." + else title = "Ms." + if self~married = 1 then addition = " (married) " + else addition = "" + + call infoDialog title self~name addition || "A"x || "City:" self~city || "A"x || - + "Profession:" self~name + +::method add + expose menuBar + + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = self~getControlData(21) + self~employees[self~empCount]['CITY'] = self~getControlData(22) + self~employees[self~empCount]['PROFESSION'] = self~getControlData(23) + + if self~getControlData(31) = 1 then sex = 1 + else sex = 2 + self~employees[self~empCount]['SEX'] = sex + + self~employees[self~empCount]['MARRIED'] = self~getControlData(41) + self~empCount = self~empCount + 1 + self~empCurrent = self~empCount + self~setControlData(21, ""); + + self~newUpDown(11)~setRange(1, self~empCount) + self~newUpDown(11)~setPosition(self~empCount) + + self~enableItem(11) + self~enableItem(13) + + menuBar~enable(204) + + +::method set + self~setControlData(21, self~employees[self~empCurrent]['NAME']) + self~setControlData(22, self~employees[self~empCurrent]['CITY']) + self~setControlData(23, self~employees[self~empCurrent]['PROFESSION']) + + if self~employees[self~empCurrent]['SEX'] = 1 then do + self~setControlData(31, 1) + self~setControlData(32, 0) + end + else do + self~setControlData(31, 0) + self~setControlData(32, 1) + end + + self~setControlData(41, self~employees[self~empCurrent]['MARRIED']) + +::method empPrev + if self~empCount = 1 then return + if self~empCurrent > 1 then do + self~empCurrent = self~empCurrent - 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the bottom.", "Info", 1000 + end + +::method empNext + if self~empCount = 1 then return + if self~empCurrent < self~empCount-1 then do + self~empCurrent = self~empCurrent + 1 + self~newUpDown(11)~setPosition(self~empCount) + self~set + end + else do + call TimedMessage "You reached the top.", "Info", 1000 + end + +::method empList + lDlg = .EmployeeListClass~new(.application~srcDir"employe6.rc", 101) + lDlg~parent = self + lDlg~execute("SHOWTOP") + + +::method fillList + use arg subdlg, id + + do i = 1 to self~empCount - 1 + if self~employees[i]['SEX'] = 1 then title = "Mr." + else title = "Ms." + addstring = title self~employees[i]['NAME'] + addstring = addstring || "9"x || self~employees[i]['PROFESSION'] + addstring = addstring || "9"x || self~employees[i]['CITY'] + subdlg~addListEntry(id, addstring) + end + + +::method About + call infoDialog "This sample demonstrates ooDialog menus." + + +::class EmployeeListClass subclass RcDialog + +::method parent attribute + +::method initDialog + self~parent~fillList(self, 101) + self~setListTabulators(101, 98, 198) diff --git a/modules/windows/oodialog/tutorial/employee10menuRc.rex b/modules/windows/oodialog/tutorial/employee10menuRc.rex new file mode 100755 index 0000000..fedc007 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employee10menuRc.rex @@ -0,0 +1,300 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employe9menuRc.rex + * Type: Open Object REXX Script + * + * Description: Adds a menu, obtained from the .rc script, to the Employees + * application. Continues the refinement / enhancement of the + * application. + */ + + sd = locate() + .application~setDefaults('O', sd'employe7.h', .false) + + dlg = .MyDialogClass~new(sd"employe7.rc", IDD_EMPLOYEES7) + if dlg~initCode <> 0 then return 99 + dlg~execute("SHOWTOP") + +return 0 + + +::requires "ooDialog.cls" + +::class 'MyDialogClass' subclass RcDialog + +::attribute employees +::attribute empCount + +::method init + expose menuBar sd + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~employees = .array~new(10) + self~empCount = 0 + + self~connectButtonEvent(IDC_PB_PRINT, "CLICKED", "onPrint") + self~connectButtonEvent(IDC_PB_ADD, "CLICKED", "onAdd") + self~connectButtonEvent(IDC_PB_LIST, "CLICKED", "onList") + self~connectButtonEvent(IDC_RB_ADD, "CLICKED", "onAdding") + self~connectButtonEvent(IDC_RB_BROWSE, "CLICKED", "onBrowsing") + + self~connectEditEvent(IDC_EDIT_NAME, "CHANGE", onNameChange) + self~connectUpDownEvent(IDC_UPD, "DELTAPOS", onEmpChange) + + sd = .application~srcDir + menuBar = .ScriptMenuBar~new(sd"employe7.rc", IDM_MENUBAR, 0) + menuBar~connectCommandEvent(IDM_ADD, "onAdd", self) + menuBar~connectCommandEvent(IDM_PRINT, "onPrint", self) + menuBar~connectCommandEvent(IDM_LIST, "onList", self) + menuBar~connectCommandEvent(IDM_ABOUT, "about", self) + + return self~initCode + +::method initDialog + expose cbCity lbPosition menuBar + + cbCity = self~newComboBox(IDC_CB_CITY) + cbCity~add("Munich") + cbCity~add("New York") + cbCity~add("San Francisco") + cbCity~add("Stuttgart") + cbCity~add("San Diego") + cbCity~add("Tucson") + cbCity~add("Houston") + cbCity~add("Los Angeles") + + lbPosition = self~newListBox(IDC_LB_POSITION) + lbPosition~add("Business Manager") + lbPosition~add("Engineering Manager") + lbPosition~add("Software Developer") + lbPosition~add("Software QA") + lbPosition~add("Accountant") + lbPosition~add("Security") + lbPosition~add("Secretary") + lbPosition~add("Recptionist") + lbPosition~add("Lab Manager") + lbPosition~add("Lawyer") + lbPosition~add("CEO") + + menuBar~attachTo(self, 1) + + self~setControls + self~defaultForm + + +::method onPrint + expose cbCity lbPosition rbMale chkMarried editName + + title = "Acme Software - Employee:" + + if rbMale~checked then msg = "Mr." + else msg = "Ms." + msg ||= editName~getText + + if chkMarried~checked then msg ||= " (married) " + msg ||= "A"x || "City:" cbCity~selected || "A"x || "Profession:" lbPosition~selected + + j = MessageDialog(msg, self~hwnd, title, , INFORMATION) + +::method onAdd + expose cbCity lbPosition rbMale chkMarried editName pbList upDown rbBrowse + + self~empCount += 1 + self~employees[self~empCount] = .directory~new + self~employees[self~empCount]['NAME'] = editName~getText + self~employees[self~empCount]['CITY'] = cbCity~selected + self~employees[self~empCount]['POSITION'] = lbPosition~selected + + if rbMale~checked then sex = 1 + else sex = 2 + + self~employees[self~empCount]['SEX'] = sex + self~employees[self~empCount]['MARRIED'] = chkMarried~checked + + upDown~setRange(1, self~empCount) + if self~empCount == 1 then do + rbBrowse~enable + upDown~setPosition(1) + end + + self~defaultForm + +::method onNameChange + expose menuBar editName rbAdd pbAdd pbPrint + + if rbAdd~checked then do + if editName~getText~strip~length == 0 then do + pbAdd~disable + pbPrint~disable + menuBar~disable(IDM_ADD) + menuBar~disable(IDM_PRINT) + end + else do + pbAdd~enable + pbPrint~enable + menuBar~enable(IDM_ADD) + menuBar~enable(IDM_PRINT) + end + end + +::method onEmpChange + use arg curPos, increment + + self~setEmpRecord(curPos + increment) + return .UpDown~deltaPosReply + +::method onAdding + self~defaultForm + +::method onBrowsing + expose upDown pbAdd menuBar + + pbAdd~disable + menuBar~disable(IDM_ADD) + upDown~enable + self~setEmpRecord(upDown~getPosition) + +::method setEmpRecord + expose upDown editName cbCity lbPosition rbMale rbFemale chkMarried + use strict arg emp + + if emp < 1 then return self~noRecord('bottom') + else if emp > upDown~getRange~max then return self~noRecord('top') + + editName~setText(self~employees[emp]['NAME']) + + cbCity~select(self~employees[emp]['CITY']) + lbPosition~select(self~employees[emp]['POSITION']) + + if self~employees[emp]['SEX'] = 1 then do + rbMale~check + rbFemale~uncheck + end + else do + rbFemale~check + rbMale~uncheck + end + + if self~employees[emp]['MARRIED'] then chkMarried~check + else chkMarried~uncheck + + +::method onList + expose sd + lDlg = .EmployeeListClass~new(sd"employe7.rc", IDD_EMPLOYEE_LIST) + lDlg~parent = self + lDlg~execute("SHOWTOP") + + +::method fillList + use strict arg list + do id = 1 to self~empCount + if self~employees[id]['SEX'] = 1 then title = "Mr."; else title = "Ms." + addstring = title self~employees[id]['NAME'] + addstring = addstring || "9"x || self~employees[id]['POSITION'] + addstring = addstring || "9"x || self~employees[id]['CITY'] + list~insert(id, addstring) + end + +::method about + call infoDialog "Sample to demonstrate ooDialog menus." + +::method setControls private + expose rbMale rbFemale rbAdd rbBrowse chkMarried editName pbList pbAdd pbPrint upDown + + pbAdd = self~newPushButton(IDC_PB_ADD) + pbList = self~newPushButton(IDC_PB_LIST) + pbPrint = self~newPushButton(IDC_PB_PRINT) + rbMale = self~newRadioButton(IDC_RB_MALE) + rbFemale = self~newRadioButton(IDC_RB_FEMALE) + rbAdd = self~newRadioButton(IDC_RB_ADD) + rbBrowse = self~newRadioButton(IDC_RB_BROWSE) + chkMarried = self~newCheckBox(IDC_CHK_MARRIED) + editName = self~newEdit(IDC_EDIT_NAME) + upDown = self~newUpDown(IDC_UPD) + +::method defaultForm private + expose menuBar cbCity lbPosition rbMale rbFemale rbAdd rbBrowse chkMarried - + editName pbAdd pbList pbPrint upDown + + editName~setText("") + cbCity~select("New York") + lbPosition~select("Software Developer") + + rbMale~check + rbFemale~uncheck + chkMarried~uncheck + + rbAdd~check + pbAdd~disable + pbPrint~disable + menuBar~disable(IDM_ADD) + menuBar~disable(IDM_PRINT) + upDown~disable + + editName~assignFocus + + if self~empCount < 1 then do + pbList~disable + rbBrowse~disable + upDown~setRange(0, 0) + upDown~setPosition(0) + end + else do + pbList~enable + menuBar~enable(IDM_LIST) + end + +::method noRecord private + use strict arg direction + return MessageDialog('At the' direction 'of the records', self~hwnd, - + 'Employee Records') + + +::class 'EmployeeListClass' subclass RcDialog + +::attribute parent + +::method initDialog + lb = self~newListBox(IDC_LB_EMPLOYEES_LIST) + self~parent~fillList(lb) + lb~setTabulators(90, 190) diff --git a/modules/windows/oodialog/tutorial/employee11tab.h b/modules/windows/oodialog/tutorial/employee11tab.h new file mode 100644 index 0000000..1ba1e2b --- /dev/null +++ b/modules/windows/oodialog/tutorial/employee11tab.h @@ -0,0 +1,82 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_EMPLOYEES_LIST 207 +#define IDD_EMPLOYEES_BROWSE 208 +#define IDD_EMPLOYEES_ADD 209 +#define IDD_EMPLOYEES_EDIT 210 +#define IDM_CONTEXT_MENUBAR 212 +#define IDC_GB1 1000 +#define IDC_LV_EMPLOYEES 1001 +#define IDC_PB_PRINT_A 1001 +#define IDC_PB_PRINT_E 1002 +#define IDC_UPD 1002 +#define IDC_PB_ADD_A 1003 +#define IDC_PB_PRINT_B 1003 +#define IDC_PB_RESET_E 1003 +#define IDC_PB_SAVE_E 1004 +#define IDC_EDIT_NAME_B 1005 +#define IDC_CB_CITY_B 1009 +#define IDC_LB_POSITION_B 1011 +#define IDC_RB_MALE_B 1012 +#define IDC_RB_FEMALE_B 1013 +#define IDC_CHK_MARRIED_B 1014 +#define IDC_CHK_FULLTIME_B 1015 +#define IDC_EDIT_NAME_A 1016 +#define IDC_CB_CITY_A 1017 +#define IDC_LB_POSITION_A 1018 +#define IDC_RB_MALE_A 1019 +#define IDC_RB_FEMALE_A 1020 +#define IDC_CHK_MARRIED_A 1021 +#define IDC_CHK_FULLTIME_A 1022 +#define IDC_EDIT_NAME_E 1023 +#define IDC_CB_CITY_E 1024 +#define IDC_LB_POSITION_E 1025 +#define IDC_RB_MALE_E 1026 +#define IDC_RB_FEMALE_E 1027 +#define IDC_CHK_MARRIED_E 1028 +#define IDC_CHK_FULLTIME_E 1029 +#define IDM_POP_CONTEXT 40000 +#define IDM_EDIT 40001 +#define IDM_ADD 40002 +#define IDM_BROWSE 40003 +#define IDM_DELETE 40004 +#define IDM_SEP1 40005 +#define IDM_SEP2 40006 diff --git a/modules/windows/oodialog/tutorial/employee11tab.rc b/modules/windows/oodialog/tutorial/employee11tab.rc new file mode 100644 index 0000000..2668321 --- /dev/null +++ b/modules/windows/oodialog/tutorial/employee11tab.rc @@ -0,0 +1,136 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#include +#include +#include +#include "employee11tab.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDM_CONTEXT_MENUBAR MENUEX +{ + POPUP "Context", IDM_POP_CONTEXT, 0, 0 + { + MENUITEM "&Browse Employees...", IDM_BROWSE, 0, 0 + MENUITEM "", IDM_SEP1, MFT_SEPARATOR, 0 + MENUITEM "&Add Employee...", IDM_ADD, 0, 0 + MENUITEM "&Edit Employee...", IDM_EDIT, 0, 0 + MENUITEM "", IDM_SEP2, MFT_SEPARATOR, 0 + MENUITEM "&Delete Employee...", IDM_DELETE, 0, 0 + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_EMPLOYEES_ADD DIALOG 0, 0, 227, 160 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "Add Employees" +FONT 10, "Tahoma" +{ + LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_A, 40, 20, 102, 12 + LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT + COMBOBOX IDC_CB_CITY_A, 40, 37, 102, 56, WS_TABSTOP | CBS_DROPDOWNLIST + LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT + LISTBOX IDC_LB_POSITION_A, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY + GROUPBOX "Statistics", IDC_GB1, 153, 16, 64, 80, WS_GROUP + AUTORADIOBUTTON "&Male", IDC_RB_MALE_A, 161, 27, 40, 12, WS_TABSTOP + AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_A, 161, 42, 40, 12 + AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_A, 161, 59, 40, 12, WS_GROUP + AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_A, 161, 78, 40, 12, WS_GROUP + PUSHBUTTON "Add", IDC_PB_ADD_A, 167, 117, 50, 14 + PUSHBUTTON "Print", IDC_PB_PRINT_A, 167, 136, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_EMPLOYEES_BROWSE DIALOG 0, 0, 227, 160 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "Browse Employees" +FONT 10, "Tahoma" +{ + LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_B, 40, 20, 102, 12, ES_READONLY + CONTROL "", IDC_UPD, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_AUTOBUDDY, 132, 20, 10, 12 + LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT + COMBOBOX IDC_CB_CITY_B, 40, 37, 102, 56, WS_TABSTOP | WS_DISABLED | CBS_DROPDOWNLIST + LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT + LISTBOX IDC_LB_POSITION_B, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | WS_DISABLED | LBS_SORT | LBS_NOTIFY + GROUPBOX "Statistics", IDC_GB1, 153, 16, 64, 80, WS_GROUP + AUTORADIOBUTTON "&Male", IDC_RB_MALE_B, 161, 27, 40, 12, WS_TABSTOP | WS_DISABLED + AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_B, 161, 42, 40, 12, WS_DISABLED + AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_B, 161, 59, 40, 12, WS_GROUP | WS_DISABLED + AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_B, 161, 78, 40, 12, WS_GROUP | WS_DISABLED + PUSHBUTTON "Print", IDC_PB_PRINT_B, 167, 136, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_EMPLOYEES_EDIT DIALOG 0, 0, 227, 160 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "Edit Employees" +FONT 10, "Tahoma" +{ + LTEXT "Person:", -1, 12, 20, 30, 8, SS_LEFT + EDITTEXT IDC_EDIT_NAME_E, 40, 20, 102, 12 + LTEXT "City:", -1, 12, 37, 16, 8, SS_LEFT + COMBOBOX IDC_CB_CITY_E, 40, 37, 102, 56, WS_TABSTOP | CBS_DROPDOWNLIST + LTEXT "Position:", -1, 12, 58, 30, 8, SS_LEFT + LISTBOX IDC_LB_POSITION_E, 10, 68, 132, 82, WS_TABSTOP | WS_VSCROLL | LBS_SORT | LBS_NOTIFY + GROUPBOX "Statistics", IDC_GB1, 153, 16, 64, 80, WS_GROUP + AUTORADIOBUTTON "&Male", IDC_RB_MALE_E, 161, 27, 40, 12, WS_TABSTOP + AUTORADIOBUTTON "&Female", IDC_RB_FEMALE_E, 161, 42, 40, 12 + AUTOCHECKBOX "Ma&rried", IDC_CHK_MARRIED_E, 161, 59, 40, 12, WS_GROUP + AUTOCHECKBOX "Full Time", IDC_CHK_FULLTIME_E, 161, 78, 40, 12, WS_GROUP + PUSHBUTTON "Reset", IDC_PB_RESET_E, 167, 98, 50, 14 + PUSHBUTTON "Save", IDC_PB_SAVE_E, 167, 117, 50, 14 + PUSHBUTTON "Print", IDC_PB_PRINT_E, 167, 136, 50, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_EMPLOYEES_LIST DIALOG 0, 0, 227, 160 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW | WS_TABSTOP +CAPTION "List Employees" +FONT 10, "Tahoma" +{ + CONTROL "", IDC_LV_EMPLOYEES, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SHOWSELALWAYS | LVS_SINGLESEL | LVS_REPORT, 10, 10, 207, 140 +} diff --git a/modules/windows/oodialog/tutorial/employee11tab.rex b/modules/windows/oodialog/tutorial/employee11tab.rex new file mode 100755 index 0000000..891024f --- /dev/null +++ b/modules/windows/oodialog/tutorial/employee11tab.rex @@ -0,0 +1,1058 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: employee11tab.rex + * Type: Open Object REXX Script + * + * Description: Example to demonstrate the property sheet dialog class. + */ + + sd = locate() + + -- Note to self, we do not use data attributes in this app, need explanation. + .application~setDefaults("O", sd"employee11tab.h", .false) + + -- Create the dialog pages. + p1 = .EmployeeAdd~new(sd"employee11tab.rc", IDD_EMPLOYEES_ADD) + p2 = .EmployeeEdit~new(sd"employee11tab.rc", IDD_EMPLOYEES_EDIT) + p3 = .EmployeeBrowse~new(sd"employee11tab.rc", IDD_EMPLOYEES_BROWSE) + p4 = .EmployeeList~new(sd"employee11tab.rc", IDD_EMPLOYEES_LIST) + + pages = .array~of(p1, p2, p3, p4) + dlg = .AcmeEmployeesDlg~new(pages, "NOAPPLYNOW", "Acme Software - Employee Manager Version 10.00.0") + + dlg~execute + + return 0 + +::requires "ooDialog.cls" + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + AcmeEmployeesDlg - The property sheet dialog for this application. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'AcmeEmployeesDlg' subclass PropertySheetDialog + +::constant DATABASE 'employee11tab.db' + +::attribute employees +::attribute empCount +::attribute empIndex + +::method init + expose dbChanged + + forward class (super) continue + + self~readDataBase + + dbChanged = .false + + if self~employees~items == 0 then self~startPage = 1 + else self~startPage = 4 + + do page over self~pages + page~configure(self~employees, self~empCount, self~empIndex) + end + + +::method newEmployeeNotify + expose dbChanged + use strict arg emp + + dbChanged = .true + + self~empCount += 1 + self~employees[self~empCount] = emp + self~empIndex = self~empCount + + self~notifyPages + + listPage = self~pages[4] + + -- If the user has not yet visited the List Employees page, then there is + -- no list view to update. Instead, when the user first visits that page, + -- the list view will be filled with all existing employees. + if listPage~wasActivated then listPage~newEmployeeNotify + + +::method editedEmployeeNotify + expose dbChanged + use strict arg emp + + dbChanged = .true + self~employees[self~empIndex] = emp + + listPage = self~pages[4] + if listPage~wasActivated then listPage~editedEmployeeNotify + + self~setCurSel( , 4) + + +::method selectedEmployeeNotify + use strict arg index + + self~empIndex = index + self~notifyPages + + +::method maybeDeleteEmployee + expose dbChanged + + emp = self~employees[self~empIndex] + + pronoun = 'him' + if \ emp~male then pronoun = 'her' + + title = "Acme Software - Deleting Employee:" emp~name + msg = "Deleting" emp~name "will permanently remove" pronoun "from" || .endOfLine || - + 'the database. No further pay checks can be issued to' emp~name'.' || .endOfLine~copies(2) || - + "Are you sure you want to continue this action?" + + answer = MessageDialog(msg, self~hwnd, title, 'YESNO', 'QUESTION', 'DEFBUTTON2') + if answer == self~IDYES then do + oldIndex = self~empIndex + + self~employees~delete(self~empIndex) + self~empCount -= 1 + self~empIndex = 1 + + listPage = self~pages[4] + if listPage~wasActivated then listPage~deleteEmployeeNotify(oldIndex) + + self~notifyPages + dbChanged = .true + end + +::method leaving + expose dbChanged + + if dbChanged & self~getResult == 'CLOSEDOK' then do + self~writeDataBase + end + + +::method notifyPages private + + do page over self~pages + page~empCount = self~empCount + page~empIndex = self~empIndex + end + + +::method readDataBase private + + db = self~DATABASE + + fsObj = .stream~new(db) + if fsObj~query('EXISTS') == '' then do + self~employees = .array~new(10) + self~empCount = 0 + self~empIndex = 0 + end + else do + lines = fsObj~makeArray + fsObj~close + + emps = .array~new(lines~items) + do l over lines + l = l~strip + if l~length == 0 | l~abbrev("#") | l~abbrev("/*") then iterate + + parse var l name', 'city', 'pos', 'male', 'married', 'fullTime . + + if male == 'M' then male = .true + else male = .false + + if married == 'M' then married = .true + else married = .false + + if fullTime == 'F' then fullTime = .true + else fullTime = .false + + emp = .Employee~new(name, city, pos, male, married, fullTime) + emps~append(emp) + end + + self~employees = emps + self~empCount = emps~items + self~empIndex = 1 + end + + +::method writeDataBase private + + db = self~DATABASE + + fsObj = .stream~new(db) + + fsObj~open('WRITE REPLACE') + + if fsObj~state == 'READY' then do e over self~employees + line = e~toCSV + fsObj~lineout(line) + end + else do + title = "Acme Software - Internal Error Detected" + msg = "The database could not be opened to record current changes." + j = MessageDialog(msg, 0, title, 'OK', 'ERROR') + end + + fsObj~close + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + EmployeeAdd - A dialog class for a page in the PropertySheetDialog. This page + allows the user to add employee records. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'EmployeeAdd' subclass RcPSPDialog + +::attribute employees +::attribute empCount +::attribute empIndex +::attribute empView +::attribute empInitial + +::method configure + expose isChanged + use arg employees, count, index + + self~employees = employess + self~empCount = count + self~empIndex = index + self~empInitial = .Employee~new() + + self~connectEditEvent(IDC_EDIT_NAME_A, "CHANGE", onChange) + self~connectComboBoxEvent(IDC_CB_CITY_A, "SELCHANGE", onChange) + self~connectListBoxEvent(IDC_LB_POSITION_A, "SELCHANGE", onChange) + self~connectButtonEvent(IDC_RB_MALE_A, "CLICKED", onChange) + self~connectButtonEvent(IDC_RB_FEMALE_A, "CLICKED", onChange) + self~connectButtonEvent(IDC_CHK_MARRIED_A, "CLICKED", onChange) + self~connectButtonEvent(IDC_CHK_FULLTIME_A, "CLICKED", onChange) + isChanged = .false + + self~connectButtonEvent(IDC_PB_PRINT_A, "CLICKED", onPrint) + self~connectButtonEvent(IDC_PB_ADD_A, "CLICKED", onAdd) + +::method initDialog + expose cbCity lbPosition editName + + self~setControls + self~empView~fillBoxes + + editName~connectCharEvent(onChar) + + -- If we are the start page, it means there are no employees. So we put up + -- a message box informing the user she needs to add employees through this + -- page. + if self~propSheet~startPage == 1 then do + title = "Acme Software - Employee Manager" + msg = "The Employee Database is empty." || .endOfLine~copies(2) || - + "Use the 'Add Employees' page to add employees." + + ret = MessageDialog(msg, self~hwnd, title) + end + + +::method setActive unguarded + + self~defaultForm + return 0 + +::method killActive unguarded + expose isChanged + use arg psDlg + + if isChanged then do + title = "Acme Software - Add Employee" + msg = 'The addition of the new employee is not' || .endOfLine || - + 'complete. Leaving this page will result' || .endOfLine || - + 'in all changes being lost.' || .endOfLine~copies(2) || - + 'To leave this page and abandon changes,' || .endOfLine || - + 'press Ok. To stay on the page and con-' || .endOfLine || - + 'tinue adding a new employee, press Cancel' + + ret = MessageDialog(msg, self~hwnd, title, "OKCANCEL", "WARNING", 'DEFBUTTON2') + if ret == self~IDCANCEL then return .false + end + + return .true + + +::method onPrint unguarded + + currentEmployee = self~empView~createEmployee + currentEmployee~print(self) + return 0 + + +::method onAdd unguarded + + newEmployee = self~empView~createEmployee + self~propSheet~newEmployeeNotify(newEmployee) + + self~defaultForm + return 0 + + +::method onChar unguarded + use arg char, isShift, isCtrl, isAlt, misc, editControl + + if char~d2c == ',' then do + result = ' '~c2d + reply result + + msg = 'Employee names can not contain a comma. You can not type a comma here' + title = "Unacceptable Character" + editControl~showBalloon(title, msg, "ERROR") + end + else do + return .true + end + + +::method onChange unguarded + expose isChanged pbPrint pbAdd editName + + if isChanged then do + if self~empView~sameAs(self~empInitial) then isChanged = .false + end + else do + if \ self~empView~sameAs(self~empInitial) then isChanged = .true + end + + -- The Add and Print buttons are only enabled when there is some change and + -- the employee name is not blank. The status of the buttons *could* change + -- on any change, but only *will* change under certain cicrcumstances. + -- Rather than try to track and determine those exact circumstances, we just + -- check if the buttons should be enabled or not and do that on each change. + if isChanged, editName~getText~strip \== '' then do + pbPrint~enable + pbAdd~enable + end + else do + pbPrint~disable + pbAdd~disable + end + + return 0 + + +::method setControls private + expose editName cbCity lbPosition rbMale rbFemale chkMarried chkFullTime pbPrint pbAdd + + editName = self~newEdit(IDC_EDIT_NAME_A) + cbCity = self~newComboBox(IDC_CB_CITY_A) + lbPosition = self~newListBox(IDC_LB_POSITION_A) + rbMale = self~newRadioButton(IDC_RB_MALE_A) + rbFemale = self~newRadioButton(IDC_RB_FEMALE_A) + chkMarried = self~newCheckBox(IDC_CHK_MARRIED_A) + chkFullTime = self~newCheckBox(IDC_CHK_FULLTIME_A) + + self~empView = .EmployeeView~new(editName, cbCity, lbPosition, rbMale, rbFemale, chkMarried, chkFullTime) + + pbPrint = self~newPushButton(IDC_PB_PRINT_A) + pbAdd = self~newPushButton(IDC_PB_ADD_A) + + +::method defaultForm private + expose pbPrint pbAdd + + pbPrint~disable + pbAdd~disable + + self~empView~displayEmployee(self~empInitial) + self~empView~editName~assignFocus + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + EmployeeEdit - A dialog class for a page in the PropertySheetDialog. This + page allows the user to edit an existing employee's record +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'EmployeeEdit' subclass RcPSPDialog + +::attribute employees +::attribute empCount +::attribute empIndex +::attribute empInitial +::attribute empView + +::method configure + expose isChanged + use arg employees, count, index + + self~employees = employees + self~empCount = count + self~empIndex = index + + self~empInitial = .nil + + self~connectEditEvent(IDC_EDIT_NAME_E, "CHANGE", onChange) + self~connectComboBoxEvent(IDC_CB_CITY_E, "SELCHANGE", onChange) + self~connectListBoxEvent(IDC_LB_POSITION_E, "SELCHANGE", onChange) + self~connectButtonEvent(IDC_RB_MALE_E, "CLICKED", onChange) + self~connectButtonEvent(IDC_RB_FEMALE_E, "CLICKED", onChange) + self~connectButtonEvent(IDC_CHK_MARRIED_E, "CLICKED", onChange) + self~connectButtonEvent(IDC_CHK_FULLTIME_E, "CLICKED", onChange) + isChanged = .false + + self~connectButtonEvent(IDC_PB_PRINT_E, "CLICKED", onPrint) + self~connectButtonEvent(IDC_PB_SAVE_E, "CLICKED", onSave) + self~connectButtonEvent(IDC_PB_RESET_E, "CLICKED", onReset) + + +::method initDialog + expose cbCity lbPosition + + self~setControls + self~empView~fillBoxes + + +::method setActive unguarded + + self~setEmpRecord + return 0 + + +::method onPrint unguarded + + if self~empInitial \== .nil then do + currentEmployee = self~empView~createEmployee + currentEmployee~print(self) + end + return 0 + +::method onSave unguarded + + editedEmployee = self~empView~createEmployee + self~propSheet~editedEmployeeNotify(editedEmployee) + + return 0 + + +::method onReset unguarded + self~setEmpRecord + + +::method onChange unguarded + expose isChanged pbPrint pbSave pbReset editName + + if self~empInitial == .nil then return 0 + + if isChanged then do + if self~empView~sameAs(self~empInitial) then isChanged = .false + end + else do + if \ self~empView~sameAs(self~empInitial) then isChanged = .true + end + + txt = editName~getText~strip + + if txt == '' then do + pbPrint~disable + pbSave~disable + pbReset~enable + end + else if isChanged then do + pbPrint~enable + pbSave~enable + pbReset~enable + end + else do + pbPrint~enable + pbSave~disable + pbReset~disable + end + + return 0 + + +::method setControls private + expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName pbPrint pbSave pbReset + + cbCity = self~newComboBox(IDC_CB_CITY_E) + lbPosition = self~newListBox(IDC_LB_POSITION_E) + rbMale = self~newRadioButton(IDC_RB_MALE_E) + rbFemale = self~newRadioButton(IDC_RB_FEMALE_E) + chkMarried = self~newCheckBox(IDC_CHK_MARRIED_E) + chkFullTime = self~newCheckBox(IDC_CHK_FULLTIME_E) + editName = self~newEdit(IDC_EDIT_NAME_E) + + self~empView = .EmployeeView~new(editName, cbCity, lbPosition, rbMale, rbFemale, chkMarried, chkFullTime) + + pbReset = self~newPushButton(IDC_PB_RESET_E) + pbSave = self~newPushButton(IDC_PB_SAVE_E) + pbPrint = self~newPushButton(IDC_PB_PRINT_E) + + +::method setEmpRecord + expose pbSave pbPrint pbReset isChanged + + if self~empCount < 1 then do + self~empView~disable + pbSave~disable + pbPrint~disable + pbReset~disable + return 0 + end + + isChanged = .false + pbSave~disable + pbPrint~enable + + self~empInitial = self~employees[self~empIndex] + self~empView~displayEmployee(self~empInitial) + self~empView~editName~assignFocus + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + EmployeeBrowse - A dialog class for a page in the PropertySheetDialog. This + page allows the user to scroll through employee records one + at a time. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'EmployeeBrowse' subclass RcPSPDialog + +::attribute employees +::attribute empCount +::attribute empIndex +::attribute empView + +::method configure + use arg employees, count, empIndex + + self~employees = employees + self~empCount = count + self~empIndex = empIndex + + self~connectButtonEvent(IDC_PB_PRINT_B, "CLICKED", onPrint) + self~connectUpDownEvent(IDC_UPD, "DELTAPOS", onEmpChange) + + +::method initDialog + expose upDown + + self~setControls + self~empView~fillBoxes + + +::method setActive unguarded + + self~updateUpdown + return 0 + + +::method onPrint unguarded + + if self~empCount > 0 then do + currentEmployee = self~empView~createEmployee + currentEmployee~print(self) + end + return 0 + + +::method onEmpChange unguarded + use arg curPos, increment + + self~setEmpRecord(curPos + increment) + return .UpDown~deltaPosReply + + +::method setEmpRecord private + expose upDown + use strict arg empIndex + + if empIndex < 1 then return self~noRecord('bottom') + else if empIndex > upDown~getRange~max then return self~noRecord('top') + + emp = self~employees[empIndex] + self~empView~displayEmployee(emp) + + self~propSheet~selectedEmployeeNotify(empIndex) + + +::method setControls private + expose cbCity lbPosition rbMale rbFemale chkMarried chkFullTime editName upDown pbPrint + + cbCity = self~newComboBox(IDC_CB_CITY_B) + lbPosition = self~newListBox(IDC_LB_POSITION_B) + rbMale = self~newRadioButton(IDC_RB_MALE_B) + rbFemale = self~newRadioButton(IDC_RB_FEMALE_B) + chkMarried = self~newCheckBox(IDC_CHK_MARRIED_B) + chkFullTime = self~newCheckBox(IDC_CHK_FULLTIME_B) + editName = self~newEdit(IDC_EDIT_NAME_B) + + self~empView = .EmployeeView~new(editName, cbCity, lbPosition, rbMale, rbFemale, chkMarried, chkFullTime) + + upDown = self~newUpDown(IDC_UPD) + pbPrint = self~newPushButton(IDC_PB_PRINT_B) + + +::method noRecord private + use strict arg direction + return MessageDialog('At the' direction 'of the records', self~hwnd, - + 'Employee Records') + + +::method updateUpdown private + expose pbPrint upDown + + if self~empCount < 1 then do + upDown~setRange(0, 0) + upDown~setPosition(0) + upDown~disable + pbPrint~disable + self~empView~blank + end + else do + upDown~enable + upDown~setRange(1, self~empCount) + upDown~setPosition(self~empIndex) + pbPrint~enable + self~empView~displayEmployee(self~employees[self~empIndex]) + end + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + EmployeeList - A dialog class for a page in the PropertySheetDialog. This + page allows the user to look at multiple employee records in + one view. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'EmployeeList' subclass RcPSPDialog + +::attribute employees +::attribute empCount +::attribute empIndex + +::method configure + expose contextMenu + use arg employees, count, index + + self~employees = employees + self~empCount = count + self~empIndex = index + + self~connectListViewEvent(IDC_LV_EMPLOYEES, "SELECTCHANGED", onSelectionChanged) + + mb = .ScriptMenuBar~new(.application~srcDir'employee11tab.rc', IDM_CONTEXT_MENUBAR) + contextMenu = mb~getPopup(IDM_POP_CONTEXT) + +::method newEmployeeNotify + expose lv + + emp = self~employees[self~empIndex] + self~addEmployeeRow(lv, emp) + + self~ensureSelection + + +::method editedEmployeeNotify + expose lv + + emp = self~employees[self~empIndex] + index = self~empIndex - 1 + + gender = 'Male' + if \ emp~male then gender = 'Female' + + mStatus = 'Married' + if \ emp~married then mStatus = 'Unmarried' + + eStatus = 'Full Time' + if \ emp~fullTime then eStatus = 'Part Time' + + lv~setItemText(index, 0, emp~name) + lv~setItemText(index, 1, emp~city) + lv~setItemText(index, 2, emp~position) + lv~setItemText(index, 3, gender) + lv~setItemText(index, 4, mStatus) + lv~setItemText(index, 5, eStatus) + + self~ensureSelection + + +::method initDialog + expose lv contextMenu + + lv = self~newListView(IDC_LV_EMPLOYEES) + + lv~addExtendedStyle('CHECKBOXES GRIDLINES FULLROWSELECT') + + lv~insertColumn(0, "Name", 50) + lv~insertColumn(1, "City", 40) + lv~insertColumn(2, "Position", 40) + lv~insertColumn(3, "Gender", 30) + lv~insertColumn(4, "Marital Status", 30) + lv~insertColumn(5, "Employment Classification", 40) + + do i = 1 to self~empCount + self~addEmployeeRow(lv, self~employees[i]) + end + + self~ensureSelection + + contextMenu~assignTo(self, .true) + contextMenu~connectContextMenu(onContext, lv~hwnd) + + +::method onSelectionChanged unguarded + use arg id, itemIndex, state + + if state == 'SELECTED' then do + self~propSheet~selectedEmployeeNotify(itemIndex + 1) + end + + +::method setActive unguarded + expose lv + + self~ensureSelection + return 0 + + +::method onContext + expose contextMenu lv + use arg hwnd, x, y + + if x == -1, y == -1 then do + -- The keyboard was used, not the mouse. Position the context menu + -- towards the bottom right corner of the list view. + rect = lv~windowRect + x = rect~right - .SM~cxVScroll - 15 + y = rect~bottom - 15 + + pos = .Point~new(x, y) + end + else do + pos = .Point~new(x, y) + + p = pos~copy + lv~screen2client(p) + index = lv~hitTestInfo(p) + + if index == -1 then do + contextMenu~disable(.array~of(IDM_EDIT, IDM_DELETE)) + self~ensureSelection + end + end + + ret = contextMenu~show(pos) + + return 0 + +::method browseEmployees unguarded + self~propSheet~setCurSel( , 3) + return 0 + +::method addEmployee unguarded + self~propSheet~setCurSel( , 1) + return 0 + +::method editEmployee unguarded + self~propSheet~setCurSel( , 2) + return 0 + +::method deleteEmployee unguarded + self~propSheet~maybeDeleteEmployee + return 0 + +::method deleteEmployeeNotify unguarded + expose lv + use strict arg index + + lv~delete(index - 1) + self~ensureSelection + + return 0 + +::method ensureSelection private + expose lv + + index = self~empIndex - 1 + if index < 0 then index = 0 + lv~select(index) + lv~focus(index) + + return 0 + + +::method addEmployeeRow private + use strict arg list, employee + + gender = 'Male' + if \ employee~male then gender = 'Female' + + mStatus = 'Married' + if \ employee~married then mStatus = 'Unmarried' + + eStatus = 'Full Time' + if \ employee~fullTime then eStatus = 'Part Time' + + e = employee + list~addRow( , , e~name, e~city, e~position, gender, mStatus, eStatus) + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Employee - A class that reflects a single, specific, employee. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'Employee' + +::attribute name +::attribute city +::attribute position +::attribute male +::attribute married +::attribute fullTime + +::method init + expose name city position male married fullTime + use strict arg name = "", city = "New York", position = "Software Developer", - + male = .true, married = .false, fullTime = .true + +::method isValid + expose name + return name \== '' + + +::method print + expose name city position male married fullTime + use strict arg dlg + + eol = .endOfLine + tab = '09'x + + if \ self~isValid then do + title = "Acme Software - Internal Error Detected" + msg = "Attempting to print invalid employee record." || eol~copies(2) - + "Employee record has no assigned name." + icon = 'ERROR' + end + else do + title = "Acme Software - Employee:" + + if male then msg = "Mr." name + else msg = "Ms." name + + if married then msg ||= " (married) " + + msg ||= eol + + if fullTime then status = 'Full Time Employee' + else status = 'Part Time Employee' + + msg ||= eol || "City:" || tab~copies(2) || city || eol || - + "Profession:" || tab || position || eol || - + 'Status:' || tab~copies(2) || status + + icon = 'INFORMATION' + end + + j = MessageDialog(msg, dlg~hwnd, title, , icon) + + +::method toCSV + expose name city position male married fullTime + use strict arg + + if male then mf = "M" + else mf = "F" + + if married then mu = "M" + else mu = 'U' + + if fullTime then fp = 'F' + else fp = 'P' + + txt = name', 'city', 'position', 'mf', 'mu', 'fp + + return txt + + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + EmployeeView - A class containing the dialog controls used to display an + employee in a dialog. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'EmployeeView' public + +::attribute editName +::attribute cbCity +::attribute lbPosition +::attribute rbMale +::attribute rbFemale +::attribute chkMarried +::attribute chkFullTime + +::method init + expose editName cbCity lbPosition rbMale rbFemale chkMarried chkFullTime + use strict arg editName, cbCity, lbPosition, rbMale, rbFemale, chkMarried, chkFullTime + +/** fillBoxes() + * Fills the city combo box and the position list box with the correct items. + */ +::method fillBoxes + expose cbCity lbPosition + use strict arg + + cbCity~add("Munich") + cbCity~add("New York") + cbCity~add("San Francisco") + cbCity~add("Stuttgart") + cbCity~add("San Diego") + cbCity~add("Tucson") + cbCity~add("Houston") + cbCity~add("Los Angeles") + + lbPosition~add("Business Manager") + lbPosition~add("Engineering Manager") + lbPosition~add("Software Developer") + lbPosition~add("Software QA") + lbPosition~add("Accountant") + lbPosition~add("Security") + lbPosition~add("Secretary") + lbPosition~add("Recptionist") + lbPosition~add("Lab Manager") + lbPosition~add("Lawyer") + lbPosition~add("CEO") + + +/** displayEmployee() + * Sets the state of the controls to reflect the specified employee + */ +::method displayEmployee + use strict arg emp + + self~editName~setText(emp~name) + self~cbCity~select(emp~City) + self~lbPosition~select(emp~Position) + + if emp~male then do + self~rbMale~check + self~rbFemale~uncheck + end + else do + self~rbFemale~check + self~rbMale~uncheck + end + + if emp~married then self~chkMarried~check + else self~chkMarried~uncheck + + if emp~fullTime then self~chkFullTime~check + else self~chkFullTime~uncheck + + +/** disable() + * Disables all the controls and sets the edit control text to the empty string. + */ +::method disable + use strict arg + + self~editName~setText("") + + self~editName~disable + self~cbCity~disable + self~lbPosition~disable + + self~rbMale~disable + self~rbFemale~disable + self~chkMarried~disable + self~chkFullTime~disable + + +/** blank() + * Sets all the controls to a 'blank' state. + */ +::method blank + use strict arg + + self~editName~setText("") + --self~cbCity~ + self~lbPosition~deselectIndex + + self~rbMale~uncheck + self~rbFemale~uncheck + self~chkMarried~uncheck + self~chkFullTime~uncheck + + +/** match() + * Tests if the state of the controls match the specified employee. + */ +::method sameAs + use strict arg emp + + if self~editName~getText \== emp~name then return .false + if self~cbCity~selected \== emp~City then return .false + if self~lbPosition~selected \== emp~Position then return .false + + if self~rbMale~checked & \ emp~male then return .false + if \ self~rbMale~checked & emp~male then return .false + + if self~chkMarried~checked & \ emp~married then return .false + if \ self~chkMarried~checked & emp~married then return .false + + if self~chkFullTime~checked & \ emp~fullTime then return .false + if \ self~chkFullTime~checked & emp~fullTime then return .false + + return .true + +/** createEmployee() + * Instantiates a new Employee object using the current state of the controls, + * and returns it if it is valid. If it is not valid, returns .nil + */ +::method createEmployee + use strict arg + + name = self~editName~getText~strip + city = self~cbCity~selected + position = self~lbPosition~selected + male = self~rbMale~checked + married = self~chkMarried~checked + fullTime = self~chkFullTime~checked + + emp = .Employee~new(name, city, position, male, married, fullTime) + + if emp~isValid then return emp + else return .nil + + diff --git a/modules/windows/oodialog/tutorial/logo.bmp b/modules/windows/oodialog/tutorial/logo.bmp new file mode 100644 index 0000000..f80c306 Binary files /dev/null and b/modules/windows/oodialog/tutorial/logo.bmp differ diff --git a/modules/windows/oodialog/tutorial/textScroll.rc b/modules/windows/oodialog/tutorial/textScroll.rc new file mode 100644 index 0000000..3e12b18 --- /dev/null +++ b/modules/windows/oodialog/tutorial/textScroll.rc @@ -0,0 +1,66 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/**************************************************************************** + +textscrl.rc + +produced by VisualAge Resource Workshop + +*****************************************************************************/ + +#include + +#define DIALOG_1 1 + +100 DIALOG 6, 15, 218, 94 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "ooDialog Scrolling Text" +FONT 12, "Arial" +{ + CONTROL "Text", 12, "EDIT", ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP, 30, 9, 181, 12 + CONTROL "Fontname", 13, "EDIT", WS_BORDER | WS_TABSTOP, 45, 27, 101, 12 + CONTROL "fontsize", 14, "EDIT", WS_BORDER | WS_TABSTOP, 187, 26, 24, 12 + PUSHBUTTON "&Display", 11, 10, 77, 50, 14 + DEFPUSHBUTTON "Leave", 1, 161, 77, 50, 14 + AUTO3STATE "Button", 10, 8, 47, 204, 24, BS_OWNERDRAW | WS_CHILD | WS_VISIBLE | WS_TABSTOP + CONTROL "", -1, "static", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE, 4, 44, 211, 30 + LTEXT "Text", -1, 7, 12, 20, 7 + LTEXT "Fontname", -1, 7, 28, 34, 8 + LTEXT "Fontsize", -1, 152, 28, 30, 8 +} + diff --git a/modules/windows/oodialog/tutorial/textScroll.rex b/modules/windows/oodialog/tutorial/textScroll.rex new file mode 100755 index 0000000..3612041 --- /dev/null +++ b/modules/windows/oodialog/tutorial/textScroll.rex @@ -0,0 +1,81 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: textScroll.rex + * Type: Open Object REXX Script + * + * Description: Scrolling text example. + */ + +sd = locate() +dlg = .MyDialogClass~new(sd"textScroll.rc", 100) +if dlg~initCode <> 0 then return 99 +dlg~execute("SHOWTOP") + +return 0 + + +::requires "ooDialog.cls" + +::class 'MyDialogClass' subclass RcDialog + +::method init + + forward class (super) continue + if self~initCode <> 0 then return self~initCode + + self~data13 = "Arial" + self~text = "This is a goofy scrolling text demonstration" + self~data14 = 24 + self~connectButtonEvent(11, "CLICKED", "Display") + + return self~initCode + + +::method initDialog + + -- Set the background color of the button to the backgroud color of a button. + COLOR_BTNFACE = 15 + self~setControlSysColor(10, COLOR_BTNFACE) + + +::method display + self~getData + self~scrollInControl(10, self~text, self~data13, self~data14, "BOLD") + diff --git a/modules/windows/oodialog/userGuide/ReadMe.txt b/modules/windows/oodialog/userGuide/ReadMe.txt new file mode 100644 index 0000000..7129a19 --- /dev/null +++ b/modules/windows/oodialog/userGuide/ReadMe.txt @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Programs to Accompany the ooDialog User Guide + ------------------------------------------------------------ + + This subdirectory tree contains the example programs referred to in the + ooDialog User Guide. The programs are intended to give context to the + discussions in the User Guide, and may, or may not, be of use to ooRexx + programmers by themselves. + + The structure of the subdirectory tree and the programs themselves are + explained in the ooDialog User Guide. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise02/HelloWorld.rex b/modules/windows/oodialog/userGuide/exercises/Exercise02/HelloWorld.rex new file mode 100755 index 0000000..e0d2abe --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise02/HelloWorld.rex @@ -0,0 +1,67 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 02: Hello World v01-00 31May12 + + File Contents: class "HelloWorld" + Pre-requisites: None. + Description: The simplest possible dialog. + + Changes: + v01-00: First version. + +------------------------------------------------------------------------------*/ + +dlg = .HelloWorld~new +dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +::REQUIRES "ooDialog.cls" + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'HelloWorld' SUBCLASS UserDialog + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Hello World", "CENTER") + +/*---------------------------------------------------------------------------*/ + + + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise02/WoW.rex b/modules/windows/oodialog/userGuide/exercises/Exercise02/WoW.rex new file mode 100755 index 0000000..1e1d420 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise02/WoW.rex @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 02: Putting "controls" on the window. v01-00 31May12 + + File Contents: class "WordsOfWisdom" + Pre-requisites: None. + Description: Simple Words of Wisdom app - displays hard-coded 'words of + wisdom' in a static text control. + + Changes: + v01-00: First version. + +------------------------------------------------------------------------------*/ + +dlg = .WordsOfWisdom~new +dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +::REQUIRES "ooDialog.cls" + +/*----------------------------------------------------------------------------*/ +::CLASS 'WordsOfWisdom' SUBCLASS UserDialog + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Words of Wisdom", "CENTER") + + ::METHOD defineDialog -- Invoked automatically by ooDialog. + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "More wisdom") + self~createPushButton(IDCANCEL, 197, 99, 50, 14, ,"Cancel") + self~createStaticText(-1, 40, 40, 200, 20, , - + "Complex problems have simple solutions"||.endofline||"- which are wrong.") + +/*----------------------------------------------------------------------------*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise02/WoW2.rex b/modules/windows/oodialog/userGuide/exercises/Exercise02/WoW2.rex new file mode 100755 index 0000000..48c3533 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise02/WoW2.rex @@ -0,0 +1,94 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 02: Making the Controls Work v01-00 31May12 + + File Contents: class "WordsOfWisdom2" + Pre-requisites: None. + Description: Simple Words of Wisdom app - displays hard-coded 'words of + wisdom' in a static text control. + + Changes: + v01-00: First version. + +------------------------------------------------------------------------------*/ + +dlg = .WordsOfWisdom2~new +dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +::REQUIRES "ooDialog.cls" + +/*---------------------------------------------------------------------------*/ +::CLASS 'WordsOfWisdom2' SUBCLASS UserDialog + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Words of Wisdom 2", "CENTER") + + + ::METHOD defineDialog -- Invoked automatically by ooDialog. + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "More wisdom", OkClicked) + self~createPushButton(IDCANCEL, 197, 99, 50, 14, ,"Cancel") + self~createStaticText(101, 40, 40, 200, 40, , "Click 'More wisdom'") + + ::METHOD okClicked + arrWow = .array~new + + arrWow[1] = "Agnes Allen's Law:"||.endofline|| - + "Almost anything is easier to get into than out of." + arrWow[2] = "Airplane Law:"||.endofline||"When the plane you are on is late," - + ||.endofline||"the plane you want to transfer to is on time." + arrWow[3] = "Fourteenth Corollary of Atwood's General Law of Dynamic Negatives:" - + ||.endofline||"No books are lost by loaning"||.endofline|| - + "except those you particularly wanted to keep." + arrWow[4] = "Baker's Byroad:"||.endofline||"When you're over the hill, you pick up speed." + arrWow[5] = "First Law of Bicycling:"||.endofline|| - + "No matter which way you ride, it's uphill and against the wind." + arrWow[6] = "Brooks's Law:"||.endofline|| - + "Adding manpower to a late software project makes it later." + arrWow[7] = "Grossman's Misquote of H. L. Mencken"||.endofline|| - + "Complex problems have simple, easy-to-understand wrong answers." + + say "'More wisdom' button clicked" + + newText = self~newStatic(101) + i = random(1,7) + newText~setText(arrWow[i]) + return + +/*----------------------------------------------------------------------------*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise03/Startup.rex b/modules/windows/oodialog/userGuide/exercises/Exercise03/Startup.rex new file mode 100755 index 0000000..e2327f1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise03/Startup.rex @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide v01-00 31May12 + Exercise 03 Part 2: Startup.rex + + This file is the "application" or "root" or "starter" part + of the "Words of Wisdom" application. All other files in this exercise + contain only classes. + + Changes: + v01-00 31May12: First version. +------------------------------------------------------------------------------*/ + + +/******************************************************************************/ + +.local~my.idWowData = .WowData~new +.local~my.idWowPicker = .WowPicker~new +dlg = .WowView~new + +.local~my.idWowData~activate +.local~my.idWowPicker~activate +dlg~activate + +::REQUIRES "WowView.rex" +::REQUIRES "WowModel.rex" +::REQUIRES "WowData.rex" + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise03/Wow3.rex b/modules/windows/oodialog/userGuide/exercises/Exercise03/Wow3.rex new file mode 100755 index 0000000..2e67579 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise03/Wow3.rex @@ -0,0 +1,192 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 03a: Re-structuring the "Words of Wisdom" app. v01-00 31May12 + + Contains: Startup statements + Classes: WowView, WowModel, WowData. + + Pre-requisites: None. + + Description: A re-structuring of the "Words of Wisdom" code. + + Changes: + v01-00 31May12: First version. + + ******************************************************************************/ + +dlg = .WowView~new +dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + + +::REQUIRES "ooDialog.cls" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + UI - Class 'WowView' v01-00 31may12 + --------------------- + Defines the Words of Wisdom User Interface. + + Changes: + v01-00 31May12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS 'WowView' SUBCLASS UserDialog + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose wowPicker + forward class (super) continue + self~create(30, 30, 257, 123, "Words of Wisdom", "CENTER") + wowPicker = .WowPicker~new + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + defineDialog - defines the "Words of Wisdom" controls + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineDialog -- Invoked automatically. + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "More wisdom", OkClicked) + self~createPushButton(IDCANCEL, 197, 99, 50, 14, ,"Cancel") + self~createStaticText(101, 40, 40, 200, 40, , "Click 'More wisdom'") + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invoked automatically after the dialog has been created. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose newText + newText = self~newStatic(101) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + okClicked - Actions the "More wisdom" control + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD okClicked + expose wowPicker newText + wow = wowPicker~pickWow + newText~setText(wow) + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowPicker v01-00 31May12 + ------------- + Picks a "words of wisdom" string from a set of such "words of wisdom" + and returns it. The set is initially retrieved from the WowData class. + + Changes: + v01-00 31May12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS WowPicker + +/*---------------------------------------------------------------------------- + init - gets an initial Wow set from the WowData object. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose wowSet + dataSource = .WowData~new + wowSet = dataSource~readWowSet + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + pickWow - picks a Word of Wisdom from the current wowSet and returns it. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD pickWow + expose wowSet + i = random(1,7) + return wowSet[i] + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowData v01-00 31May12 + ------------- + Has access to WOW data, and returns a set to requester. The size of the set + can be set via configuration (but not in this version). + + Changes: + v01-00 31May12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS WowData + + /*---------------------------------------------------------------------------- + init - reads initial Wow Set from disk (but not in this version) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose arrWow + arrWow = .array~new + arrWow[1] = "Agnes Allen's Law:" - + "Almost anything is easier to get into than out of." + arrWow[2] = "Airplane Law:" - + "When the plane you are on is late," - + "the plane you want to transfer to is on time." + arrWow[3] = "Fourteenth Corollary of Atwood's General Law of Dynamic Negatives:" - + "No books are lost by loaning" - + "except those you particularly wanted to keep." + arrWow[4] = "Baker's Byroad: When you're over the hill, you pick up speed." + arrWow[5] = "First Law of Bicycling:" - + "No matter which way you ride, it's uphill and against the wind." + arrWow[6] = "Brooks's Law:" - + "Adding manpower to a late software project makes it later." + arrWow[7] = "Grossman's Misquote of H. L. Mencken:" - + "Complex problems have simple, easy-to-understand wrong answers." + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + read - Returns a wowSet + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD readWowSet + expose arrWow + return arrWow + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise03/WowData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise03/WowData.rex new file mode 100755 index 0000000..2f75505 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise03/WowData.rex @@ -0,0 +1,97 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise03 Part 2: The WowData component. v01-00 31May12 + + Contains: Classes: WowData. + + Pre-requisites: None. + + Description: The data component of the "Words of Wisdom" app. + + Changes: + v01-00 31May12: First version. + +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowData v01-00 31May12 + ------- + Has access to WOW data, and returns a set to requester. + + Potential enhancement: Define the size of a set through configuration. + + Changes: + v01-01: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS WowData PUBLIC + + /*---------------------------------------------------------------------------- + activate - reads initial Wow Set from disk (but not in this version) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate + expose arrWow + arrWow = .array~new + arrWow[1] = "Agnes Allen's Law:" - + "Almost anything is easier to get into than out of." + arrWow[2] = "Airplane Law:" - + "When the plane you are on is late," - + "the plane you want to transfer to is on time." + arrWow[3] = "Fourteenth Corollary of Atwood's General Law of Dynamic Negatives:" - + "No books are lost by loaning" - + "except those you particularly wanted to keep." + arrWow[4] = "Baker's Byroad: When you're over the hill, you pick up speed." + arrWow[5] = "First Law of Bicycling:" - + "No matter which way you ride, it's uphill and against the wind." + arrWow[6] = "Brooks's Law:" - + "Adding manpower to a late software project makes it later." + arrWow[7] = "Grossman's Misquote of H. L. Mencken:" - + "Complex problems have simple, easy-to-understand wrong answers." + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + readWowSet - returns the Wow set as an array. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD readWowSet + expose arrWow + return arrWow + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise03/WowModel.rex b/modules/windows/oodialog/userGuide/exercises/Exercise03/WowModel.rex new file mode 100755 index 0000000..9b59638 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise03/WowModel.rex @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise03 Part 2: The WowModel component. v01-00 31May12 + + Contains: Classes: WowPicker. + + Pre-requisites: + .local~my.idWowData - an object that provides an array of 'words of wisdom'. + + Description: The model component of the "Words of Wisdom" app. + + Changes: + v01-00 31May12: First version. +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowPicker v01-00 31may12 + --------- + A class that returns a Words of Wisdom string, selected randomly from a set + of such Words of Wisdom. + (Potential enhancements: Request a different set from the WowData class; + Have the size of the set configurable.) + Changes: + v01-00: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS WowPicker Public + +/*---------------------------------------------------------------------------- + activate - gets an initial Wow set from the WowData object. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate + expose arrWowSet + dataSource = .local~my.idWowData + arrWowSet = dataSource~readWowSet + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + pickWow - picks a Word of Wisdom from the current wowSet and returns it. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD pickWow + expose arrWowSet + i = random(1,7) + return arrWowSet[i] + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise03/WowView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise03/WowView.rex new file mode 100755 index 0000000..f3e760c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise03/WowView.rex @@ -0,0 +1,111 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise03 Part 2: The WowView component. v01-00 31may12 + + Contains: Classes: WowView. + + Pre-requisites: + .local~my.idWowPicker - an object that provides a 'pickWow' method. + + Description: The view component for the "Words of Wisdom" app. + + Changes: + v01-00: First version. +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowView v01-00 31May12 + ------- + A class that defines the User Interface for the Wow application. + + Changes: + v01-00: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "ooDialog.cls" + +::CLASS 'WowView' SUBCLASS UserDialog PUBLIC + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Words of Wisdom", "CENTER") + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + defineDialog - defines the "Words of Wisdom" controls + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineDialog -- Invoked automatically by ooDialog. + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "More wisdom", OkClicked) + self~createPushButton(IDCANCEL, 197, 99, 50, 14, ,"Cancel") + self~createStaticText(101, 40, 40, 200, 40, , "Click 'More wisdom'") + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invoked automatically after the dialog has been created. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose newText + newText = self~newStatic(101) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + activate - gets id for wowPicker, shows the dialog. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose wowPicker + wowPicker = .local~my.idWowPicker + self~execute("SHOWTOP", IDI_DLG_OOREXX) -- MUST be last! + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + okClicked - Actions the "More wisdom" control + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD okClicked + expose wowPicker newText + wow = wowPicker~pickWow + newText~setText(wow) + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerModelData.rex new file mode 100755 index 0000000..e254186 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerModelData.rex @@ -0,0 +1,143 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 04: The CustomerModel and CustomerData Classes v01-00 07Jun12 + + Contains: classes "CustomerModel" and "CustomerResource". + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerModel v01-00 07Jun12 + ------------ + The "model" part of the Customer component. + + Changes: + v01-00 07Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerModel PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + aCustomerModel = self~new + return aCustomerModel + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD activate PUBLIC + -- Gets its data from ProductData. + expose idCustomerData + idCustomerData = .local~my.idCustomerData + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + expose idCustomerData + say "CustomerModel-query-01." + data = idCustomerData~getData + return data +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerData v01-00 07Jun12 + ------------ + The "data" part of the Customer component. + + Changes: + v01-00 07Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerData PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + aCustomerData = self~new + return aCustomerData + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate PUBLIC + expose custData + custData = .directory~new + custData[custNo] = "AB15784" + custData[custName] = "Joe Bloggs & Co Ltd" + arrCustAddr = .array~new + arrCustAddr[1] = "28 Frith Street" + arrCustAddr[2] = "Hardington" + arrCustAddr[3] = "Blockshire" + custData[CustAddr] = arrCustAddr + custData[custZip] = "LB7 4EJ" + custData[custDiscount]= "B1" + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC + expose custData + say "CustomerData-getData-01." + return custData + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.h b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.h new file mode 100644 index 0000000..5458b27 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.h @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* Symbolic resource IDs for exercise 4a. */ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_CUST_DIALOG 102 +#define IDR_CUST_MENU 103 +#define IDC_CUST_LBL_CUSTNO 1001 +#define IDC_CUST_LBL_DISCOUNT 1002 +#define IDC_CUST_BTN_SHOWLASTORDER 1003 +#define IDM_CUST_NEW 40000 +#define IDM_CUST_UPDATE 40001 +#define IDM_CUST_PRINT 40002 +#define IDM_CUST_LAST_ORDER 40003 +#define IDC_CUST_EDT_CUSTNO 40043 +#define IDC_CUST_EDT_CUSTNAME 40044 +#define IDC_CUST_BTN_RECORDCHANGES 40069 +#define IDC_CUST_LBL_CUSTNAME 40070 +#define IDC_CUST_LBL_CUSTADDR 40071 +#define IDC_CUST_LBL_ZIP 40072 +#define IDC_CUST_LBL_LASTORDER 40073 +#define IDC_CUST_STC_LASTORDERDETAILS 40077 +#define IDC_CUST_EDT_CUSTADDR 40078 +#define IDC_CUST_EDT_DISCOUNT 40079 +#define IDC_CUST_EDT_CUSTZIP 40080 +#define IDC_CUST_STC_ERRORMSG 40081 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.rc new file mode 100644 index 0000000..e7870ef --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.rc @@ -0,0 +1,80 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "CustomerView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUST_NEW + MENUITEM "Update...", IDM_CUST_UPDATE + MENUITEM "Print...", IDM_CUST_PRINT + MENUITEM "Last Order", IDM_CUST_LAST_ORDER + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUST_DIALOG DIALOG 0, 0, 275, 239 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "*CustomerName*" +FONT 8, "Microsoft Sans Serif" +{ + LTEXT "Name:", IDC_CUST_LBL_CUSTNAME, 18, 47, 22, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNO, 85, 20, 65, 15, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Customer Number:", IDC_CUST_LBL_CUSTNO, 18, 22, 59, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNAME, 85, 45, 165, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Address:", IDC_CUST_LBL_CUSTADDR, 18, 72, 28, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTADDR, 85, 70, 167, 40, ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + LTEXT "Zip Code:", IDC_CUST_LBL_ZIP, 20, 120, 32, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTZIP, 85, 120, 65, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Last Order:", IDC_CUST_LBL_LASTORDER, 18, 177, 36, 8, SS_LEFT + LTEXT " ", IDC_CUST_STC_LASTORDERDETAILS, 88, 177, 145, 8, SS_LEFT + LTEXT "Discount Code:", IDC_CUST_LBL_DISCOUNT, 18, 149, 50, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_DISCOUNT, 85, 145, 20, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT " ", IDC_CUST_STC_ERRORMSG, 18, 215, 8, 8, SS_LEFT + DEFPUSHBUTTON "Record Changes", IDC_CUST_BTN_RECORDCHANGES, 130, 195, 58, 14, WS_DISABLED + PUSHBUTTON "Show Last Order", IDC_CUST_BTN_SHOWLASTORDER, 195, 195, 58, 14 +} + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.rex new file mode 100755 index 0000000..dcc81b5 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/CustomerView.rex @@ -0,0 +1,324 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise04: The Customer component v01-00 01Jun12 + + Contains: class "CustomerView"; routine "startCustomerView". + + Pre-requisites: CustomerView.rc, CustomerView.h, CustomerModelView.rex. + + Description: A sample Customer View component - part of the sample + Order Management application. + + Changes: + v01-00 01Jun12: First version. + +-------------------------------------------------------------------------*/ + +::requires "ooDialog.cls" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerView v01-00 01Jun12 + ------------- + The "view" (or "gui") part of the Customer component - part of the sample + Order Management application. + + Changes: + v01-00: First version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS "CustomerView" SUBCLASS RcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Dialog Creation Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Init - creates the dialog instance but does not make it visible. --*/ + ::METHOD init + expose menuBar + say "CustomerView-init-01." + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Create Menu Bar - Creates the menu bar on the dialog. --*/ + ::METHOD createMenuBar + expose menuBar + say "CustomerView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("CustomerView.rc", IDR_CUST_MENU, , , .true) + return .true + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Activate - Shows the Dialog - i.e. makes it visible to the user. --*/ + ::METHOD activate unguarded + say "CustomerView-activate-01." + self~execute("SHOWTOP") + return + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + InitDialog - Called by ooDialog -- */ + ::METHOD initDialog + expose menuBar custControls + say "CustomerView-initDialog-01." + menuBar~attachTo(self) + -- Create objects that map to the edit controls defined by the "customer.rc" + -- so they can be programmatically used elsewhere in the class: + custControls = .Directory~new + custControls[ecCustNo] = self~newEdit("IDC_CUST_EDT_CUSTNO") + custControls[ecCustName] = self~newEdit("IDC_CUST_EDT_CUSTNAME") + custControls[ecCustAddr] = self~newEdit("IDC_CUST_EDT_CUSTADDR") + custControls[ecCustZip] = self~newEdit("IDC_CUST_EDT_CUSTZIP") + custControls[ecCustDiscount] = self~newEdit("IDC_CUST_EDT_DISCOUNT") + custControls[stLastOrder] = self~newStatic("IDC_CUST_STC_LASTORDERDETAILS") + -- Create an object for the "Record Change" pushbutton in order to be able + -- to change its focus later: + custControls[btnRecordChanges] = self~newPushButton("IDC_CUST_BTN_RECORDCHANGES") + -- Define event handler methods for push-buttons: + self~connectButtonEvent("IDC_CUST_BTN_RECORDCHANGES","CLICKED",recordChanges) + self~connectButtonEvent("IDC_CUST_BTN_SHOWLASTORDER","CLICKED",showLastOrder) + -- Get app data and then show it: + self~getData + self~showData + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + MenuBar Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + New Customer... Not fully implemented - merely tells user to use the + Customer List object. --*/ + ::METHOD newCustomer unguarded + msg = "Creating a new Customer is not yet implemented." + ret = InfoDialog(msg) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Update - Sets fields to edit mode so that user can change the data. + Business Rule: Customer Number cannot be changed. --*/ + ::METHOD update unguarded + expose custControls + say "CustomerView-Update-01" + custControls[ecCustName]~setReadOnly(.false) + custControls[ecCustAddr]~setReadOnly(.false) + custControls[ecCustZip]~setReadOnly(.false) + custControls[ecCustDiscount]~setReadOnly(.false) + self~enableControl("IDC_CUST_BTN_RECORDCHANGES") + custControls[btnRecordChanges]~state = "FOCUS" -- Put focus on the button + self~focusControl("IDC_CUST_EDT_CUSTNAME") -- place cursor in the CustName edit control. + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Last Order - Displays info about the last order placed by this customer.--*/ + ::METHOD lastOrder unguarded + expose custControls + use arg button + orderDate="31/12/11"; orderNum = "ZZ999"; orderTotal = "$999.99" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Print - Not implemented yet --*/ + ::METHOD print unguarded + msg = "The 'Print...' menu item is not yet implemented." + ret = MessageDialog(msg, self~hwnd, 'Print', 'WARNING') + + + /*---------------------------------------------------------------------------- + PushButton Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Record Changes - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg and disables + the button. --*/ + ::METHOD recordChanges unguarded + expose custControls custData newCustData + say "CustomerView-recordChanges-01" + + newCustData = .directory~new + newCustData[custName] = custControls[ecCustName]~getLine(1) + newCustData[custAddr] = .array~new + do i=1 to custControls[ecCustAddr]~lines + newCustData[custAddr][i] = custControls[ecCustAddr]~getLine(i) + end + newCustData[custZip] = custControls[ecCustZip]~getLine(1) + newCustData[custDiscount] = custControls[ecCustDiscount]~getLine(1) + + -- Check if anything's changed: + result = self~checkForChanges + if result then say "CustomerView-recordChanges-01: There were changes!" + else say "CustomerView-recordChanges-02: No Changes Found" + + /* Send new data to be checked by CustomerModel (not implemented). */ + + /* Disable controls that were enabled by menu "File-Update" selection: */ + custControls[ecCustName]~setReadOnly(.true) + custControls[ecCustAddr]~setReadOnly(.true) + custControls[ecCustZip]~setReadOnly(.true) + custControls[ecCustDiscount]~setReadOnly(.true) + self~disableControl("IDC_CUST_BTN_RECORDCHANGES") + + + /*---------------------------------------------------------------------------- + Show Last Order - displays mock sales order info in the Last_Order_Details + field; info is hard-coded in this method. --*/ + ::METHOD showLastOrder unguarded + expose CustControls + -- Notionally get last order from "SalesOrder" component. + orderDate="12/2/11"; orderNum = "AB123"; orderTotal = "$524.58" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Get Data - gets data from the CustomerModel component and displays it in the + appropriate controls. --*/ + ::METHOD getData + expose custData + say "CustomerView-getData-01." + idCustomerModel = .local~my.idCustomerModel + custData = idCustomerModel~query + + /*---------------------------------------------------------------------------- + showData - displays data in the dialog's controls. */ + ::METHOD showData + expose custData custControls + say "CustomerView-showData-01." + -- Show CustNo and CustName: + custControls[ecCustNo]~setText(custData[custNo]) + custControls[ecCustName]~setText(custData[custName]) + -- Re-format Cust Address from an array into a string with line-ends + -- after each array element except the last, then show it. + arrCustAddr = custData[CustAddr] + strCustAddr = "" + do i=1 to arrCustAddr~items + if i < arrCustAddr~items then do + strCustAddr = strCustAddr||arrCustAddr[i] || .endofline + end + else do + strCustAddr = strCustAddr || arrCustAddr[i] + end + end + custControls[ecCustAddr]~setText(strCustAddr) + -- Finally, show Zip and Discount: + custControls[ecCustZip]~setText(custData[custZip]) + custControls[ecCustDiscount]~setText(custData[custDiscount]) + --custControls[stLastOrder]~setText("Press Me") + + + /*-------------------------------------------------------------------------- + checkForChanges - after "Record Changes" actioned by the user, check whether + any data has actually changed. If it has: (a) assign new data to old data; + (b) return .true. If it hasn't: return .false. + Note: cannot just compare the two directories since data format in Address + is different. --*/ + ::METHOD checkForChanges + expose custData newCustData + changed = .false + if newCustData[custName] \= custData[custName] then do + custData[custName] = newCustData[custName] + changed = .true + end + if custData[CustAddr]~items \= newCustData[CustAddr]~items then changed = .true + else + do i=1 to custData[custAddr]~items + if custData[custAddr][i] \= newCustData[custAddr][i] then do + changed = .true + leave + end + end + if newCustData[custZip] \= custData[custZip] then do + custdata[custZip] = newCustData[custZip] + changed = .true + end + if newCustData[custDiscount] \= custData[custDiscount] then do + custData[custDiscount] = newCustData[custDiscount] + changed = .true + end + -- If no changes after all, display message box: + if \changed then do + msg = "CustomerView-checkForChanges-01: Nothing was changed! Update not done." + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,"Update Customer","OK","WARNING","DEFBUTTON2 APPLMODAL") + end + else do + say "CustomerView-checkForChanges-02: changed =" changed + custData = newCustData + end + return changed + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + StartCustomerView v01-00 01Jun12 + ----------------- + A routine that creates the CustomerView dialog. + + Changes: + v01-00: First version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::ROUTINE StartCustomerView PUBLIC + say "StartCustomerView Routine-01: Start." + .Application~setDefaults("O", "CustomerView.h", .false) + dlg = .CustomerView~new("CustomerView.rc", "IDD_CUST_DIALOG") + say "StartCustomerView Routine-02: dlg~activate." + dlg~activate + say "StartCustomerView Routine-03: End." +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.h b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.h new file mode 100644 index 0000000..4306015 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDC_EDIT1 1002 +#define IDC_RADIO1 1003 +#define IDC_RADIO2 1004 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.rc b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.rc new file mode 100644 index 0000000..af5b53a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.rc @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "ASimpleDialog.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOG 0, 0, 186, 95 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "A Simple Dialog" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 130, 72, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 75, 72, 50, 14 + EDITTEXT IDC_EDIT1, 50, 16, 120, 15, ES_AUTOHSCROLL + LTEXT "Statement:", IDC_STATIC, 8, 19, 35, 8, SS_LEFT + GROUPBOX "", IDC_STATIC, 55, 38, 108, 27 + AUTORADIOBUTTON "Agree", IDC_RADIO1, 66, 48, 35, 8 + AUTORADIOBUTTON "Disagree", IDC_RADIO2, 117, 48, 44, 8 +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.rex b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.rex new file mode 100755 index 0000000..7a95004 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog.rex @@ -0,0 +1,121 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* ooDialog User Guide + Samples\DlgData + ASimpleDialog.rex v01-00 12JLY11 + + This Dialog is intended to illustrate the use of DlgData. It is a very simple + dialog that displays some text, allows the user to change the text, and also + to indicate agreement or disagreement with the text. A response is provided + in a message box. + + Associated files: ASimpleDialog.rc ASimpleDialog.h +------------------------------------------------------------------------------*/ + +-- (0) Add the symbolic IDs in ASimpleDialog.h file to GlobalConstDir: +.Application~useGlobalConstDir("O", "ASimpleDialog.h") + +-- (1) Set text in the edit control: +statement = "It's a fine day today." +dlgData.IDC_EDIT1 = statement + +-- (2a) Create the dialog defined by the .rc file: +dlg = .ASimpleDialog~new("ASimpleDialog.rc", IDD_DIALOG1, dlgData.) + +-- (2b) Display the dialog: +ret = dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +-- (3) When the dialog is closed, and if the user pressed OK, then retrieve +-- the data provided by the user: +if ret == 1 then do -- if the user pressed OK + statement2 = dlgData.1002 -- get data from the edit control + agree = dlgData.IDC_RADIO1 -- get the state of the radio buttons: + disagree = dlgData.1004 + +-- (4) Set up the appropriate message to display: + choice = .true -- Assume user selected a radio button + if \agree & \disagree then choice = .false -- If neither radio button selected. + if statement2 \= statement then - -- If data in edit control changed + newStmt = .true + else newStmt = .false + + -- Set some initial values for the message: + title = 'Response Received' + icon = 'INFORMATION' + + -- Build the appropriate response message: + msg = "Thank you for" + if newStmt then do -- New statement entered: + msg = msg "your statement," + if \choice then do + msg = msg "but you have not indicated whether or not you agree with it." + end + else do -- a choice was made + if agree then msg = msg "and for your agreement with it." + else msg = msg "even though you disagree with it." + end + end + else do -- Original stament unchanged: + if \choice then do + msg = msg "neither agreeing nor disagreeing." + end + else do + if agree then msg = msg "your agreement." + else msg = msg "your disagreement." + end + end +end +else do -- if Cancel Pressed + title = "Dialog Canceled" + icon = "ERROR" + msg = "Thank you for canceling." +end + +-- (5) Display a message to respond to the user's choices: +ret = MessageDialog(msg, 0, title, 'OK', icon, 'SETFOREGROUND') + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::CLASS ASimpleDialog SUBCLASS RcDialog + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog2.rex b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog2.rex new file mode 100755 index 0000000..60e843e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/ASimpleDialog2.rex @@ -0,0 +1,125 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* ooDialog User Guide + Samples\DlgData + ASimpleDialog2.rex v01-00 12JLY11 + + A Simple Dialog 2 - identical to ASimpleDialog.rex except that: + - this is a subclass of ResDialog + - uses .Application to specify the *.h file. + + This Dialog is intended to illustrate the use of DlgData. It is a very simple + dialog that displays some text, allows the user to change the text and to + indicate agreement or disagreement with the text. On pressing OK or Cancel, + a messagebox provides a response. + + Associated files: ASimpleDialog.dll ASimpleDialog.h +------------------------------------------------------------------------------*/ + +-- (0) Add the symbolic IDs in ASimpleDialog.h file to GlobalConstDir: +.Application~useGlobalConstDir("O", "ASimpleDialog.h") + +-- (1) Set text in the edit control: +statement = "It's a fine day today." +dlgData.IDC_EDIT1 = statement + +-- (2a) Create the dialog defined by the .rc file: +dlg = .ASimpleDialog~new("res\ASimpleDialog.dll", IDD_DIALOG1, dlgData.) + +-- (2b) Display the dialog: +ret = dlg~execute("SHOWTOP", IDI_DLG_OOREXX) + +-- (3) When the dialog is closed, and if the user pressed OK, then retrieve +-- the data provided by the user: +if ret == 1 then do -- if the user pressed OK + statement2 = dlgData.1002 -- get data from the edit control + agree = dlgData.IDC_RADIO1 -- get the state of the radio buttons: + disagree = dlgData.1004 + +-- (4) Set up the appropriate message to display: + choice = .true -- Assume user selected a radio button + if \agree & \disagree then choice = .false -- If neither radio button selected. + if statement2 \= statement then - -- If data in edit control changed + newStmt = .true + else newStmt = .false + + -- Set some initial values for the message: + title = 'Response Received' + icon = 'INFORMATION' + + -- Build the appropriate response message: + msg = "Thank you for" + if newStmt then do -- New statement entered: + msg = msg "your statement," + if \choice then do + msg = msg "but you have not indicated whether or not you agree with it." + end + else do -- a choice was made + if agree then msg = msg "and for your agreement with it." + else msg = msg "even though you disagree with it." + end + end + else do -- Original stament unchanged: + if \choice then do + msg = msg "neither agreeing nor disagreeing." + end + else do + if agree then msg = msg "your agreement." + else msg = msg "your disagreement." + end + end +end +else do -- if Cancel Pressed + title = "Dialog Canceled" + icon = "ERROR" + msg = "Thank you for canceling." +end + +-- (5) Display a message to respond to the user's choices: +ret = MessageDialog(msg, 0, title, 'OK', icon, 'SETFOREGROUND') + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Directives, Classes, or Routines. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::requires "ooDialog.cls" + +::CLASS ASimpleDialog SUBCLASS ResDialog + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/res/ASimpleDialog.dll b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/res/ASimpleDialog.dll new file mode 100644 index 0000000..571fdbd Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/res/ASimpleDialog.dll differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/res/res.mak b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/res/res.mak new file mode 100644 index 0000000..ccf023a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/DlgData/res/res.mak @@ -0,0 +1,50 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# nMake-compatible Make file for the DlgData resource-only DLL. + +all: ASimpleDialog.dll + +ASimpleDialog.dll: ASimpleDialog.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) /OUT:$(@B).dll + +# Create .res from .rc +ASimpleDialog.res: ..\ASimpleDialog.rc + rc -r -fo$(@B).res ..\$(@B).rc + +clean: + del *.res *.dll 1>nul 2>&1 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/ReadMe.txt b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/ReadMe.txt new file mode 100644 index 0000000..f95760c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Extras/ReadMe.txt @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Additional Examples to Accompany the ooDialog User Guide + ----------------------------------------------------------------------- + + This subdirectory tree contains the example programs referred to in the + appendix of the ooDialog User Guide. The programs are intended to give + context to the discussions in the User Guide, and may, or may not, be of + use to ooRexx programmers by themselves. + + The structure of the subdirectory tree and the programs themselves are + explained in the ooDialog User Guide. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise04/Startup.rex b/modules/windows/oodialog/userGuide/exercises/Exercise04/Startup.rex new file mode 100755 index 0000000..8ccbe88 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise04/Startup.rex @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise04: The Customer Component v01-00 01Jun12 + + Contains: Startup.rex + + Pre-requisites: + CustomerView.rex - the CustomerView dialog. + CustomerModelData.rex - Customer model and data components. + + Description: The startup script for the CustomerView component. + + Changes: + v01-00 01Jun12: First version. + +------------------------------------------------------------------------------*/ + +.local~my.idCustomerData = .CustomerData~new -- create Customer Data instance +.local~my.idCustomerModel = .CustomerModel~new -- create Customer Model instance +.local~my.idCustomerData~activate +.local~my.idCustomerModel~activate + +call startCustomerView -- a routine in CustomerView.rex + +say "Startup-01: Finished." + +::REQUIRES "CustomerView.rex" +::REQUIRES "CustomerModelData.rex" +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductModelData.rex new file mode 100755 index 0000000..95b4810 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductModelData.rex @@ -0,0 +1,169 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 05: The ProductModel and ProductData Components v01-00 03Jun12 + + Contains: classes "ProductModel", "ProductResource", and "ProductDT". + + Pre-requisites: None. + + Changes: + v01-00 03Jun12: First Version +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductModel v01-00 03Jun12 + ------------ + The "model" part of the Product component. + + Changes: + v01-00 03Jun12: First Version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductModel PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + aProductModel = self~new + return aProductModel + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD activate PUBLIC + -- Gets its data from ProductData. + expose data + idProductData = .local~my.idProductData + data = idProductData~getData + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + expose data + return data +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductData v01-00 03Jun12 + ------------ + The "data" part of the Product component. + + Changes: + v01-00 03Jun12: First Version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductData PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + aProductData = self~new + return aProductData + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate PUBLIC + expose data + data = .ProductDT~new + data~number = "CF300/X" + data~name = "Widget Box" + data~price = "2895" + data~uom = "6" + data~description = "A 10 litre case with flat sides capable of holding quite a lot of stuff." + data~size = "M" + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC + expose data + return data + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductDT - A business data type for Product data. v01-00 03Jun12 + + Changes: + v01-00 03Jun12: First Version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS ProductDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE number -- number Product Number + ::ATTRIBUTE name -- name Product Description + ::ATTRIBUTE price -- price Product Price (rightmost two digits are 100ths of currency unit) +--::ATTRIBUTE currency -- currency Three-letter currency code + ::ATTRIBUTE uom -- uom Product Unit of Measure + ::ATTRIBUTE description -- descrip Product Description + ::ATTRIBUTE size -- size Produce Size Category (S/M/L) + + ::METHOD list PUBLIC + expose number name price uom description size + say "---------------" + say "ProductDT-List:" + say "Number: " number "Name:" name + say "Price:" price "UOM:" uom "Size:" size + say "Description:" description + say "---------------" +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.h b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.h new file mode 100644 index 0000000..31a55a7 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.h @@ -0,0 +1,67 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODUCT_VIEW 106 +#define IDR_PRODUCT_VIEW_MENU 107 +#define IDD_PRODUCT_VIEW_ABOUT 108 +#define IDB_PROD_ICON 109 +#define IDC_PRODABT_ICON_PLACE 1000 +#define IDC_PROD_NO 1000 +#define IDC_PROD_UOM 1001 +#define IDC_PROD_STATIC2 1003 +#define IDC_PROD_STATIC3 1004 +#define IDC_PROD_STATIC1 1005 +#define IDC_PROD_STATIC4 1007 +#define IDC_PROD_STATIC5 1008 +#define IDM_PROD_UPDATE 40000 +#define IDM_PROD_REFRESH 40001 +#define IDM_PROD_CLOSE 40002 +#define IDM_PROD_PRINT 40003 +#define IDM_PROD_ABOUT 40004 +#define IDC_PROD_NAME 40010 +#define IDC_PROD_DESCRIPTION 40011 +#define IDC_PROD_LIST_PRICE 40012 +#define IDC_PROD_SIZE_GROUP 40013 +#define IDC_PROD_SAVE_CHANGES 40014 +#define IDC_PROD_RADIO_SMALL 40015 +#define IDC_PROD_RADIO_MEDIUM 40016 +#define IDC_PRODABT_STATIC1 40017 +#define IDC_PROD_RADIO_LARGE 40017 +#define IDC_PRODABT_STATIC2 40018 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.rc new file mode 100644 index 0000000..af4ef9f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.rc @@ -0,0 +1,102 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "ProductView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_PROD_ICON BITMAP ".\\res\\ProductIcon.bmp" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODUCT_VIEW_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "&Update Product", IDM_PROD_UPDATE + MENUITEM "Refresh Data", IDM_PROD_REFRESH + MENUITEM "Print...", IDM_PROD_PRINT + MENUITEM "Close", IDM_PROD_CLOSE + } + POPUP "Help" + { + MENUITEM "About...", IDM_PROD_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW DIALOG 0, 0, 248, 228 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Product Number:", IDC_PROD_STATIC1, 25, 28, 54, 8, SS_LEFT + LTEXT "Product Name:", IDC_PROD_STATIC2, 25, 53, 48, 8, SS_LEFT + LTEXT "List Price:", IDC_PROD_STATIC3, 25, 78, 32, 8, SS_LEFT + LTEXT "UOM:", IDC_PROD_STATIC5, 151, 78, 20, 8, SS_LEFT + LTEXT "Description", IDC_PROD_STATIC4, 25, 103, 36, 8, SS_LEFT + EDITTEXT IDC_PROD_NO, 95, 25, 50, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_NAME, 95, 51, 130, 13, ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_LIST_PRICE, 95, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + EDITTEXT IDC_PROD_UOM, 175, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + EDITTEXT IDC_PROD_DESCRIPTION, 95, 99, 125, 35, WS_HSCROLL | WS_SIZEBOX | ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + GROUPBOX "Size Category", IDC_PROD_SIZE_GROUP, 31, 151, 189, 30, WS_GROUP, WS_EX_CLIENTEDGE + AUTORADIOBUTTON "Small", IDC_PROD_RADIO_SMALL, 46, 165, 33, 8, WS_DISABLED + AUTORADIOBUTTON "Medium", IDC_PROD_RADIO_MEDIUM, 110, 165, 41, 8, WS_DISABLED + AUTORADIOBUTTON "Large", IDC_PROD_RADIO_LARGE, 168, 165, 34, 8, WS_DISABLED + DEFPUSHBUTTON "Save Changes", IDC_PROD_SAVE_CHANGES, 180, 195, 52, 14, WS_DISABLED +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW_ABOUT DIALOG 0, 0, 204, 109 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "About Product View" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 143, 88, 50, 14 + CONTROL "", IDC_PRODABT_ICON_PLACE, WC_STATIC, SS_BITMAP | SS_NOTIFY | 0x00000040, 16, 7, 102, 71 + LTEXT "A view of a Product component.", IDC_PRODABT_STATIC1, 15, 84, 110, 15, SS_LEFT + LTEXT "An example of an About box using .ResDialog.", IDC_PRODABT_STATIC2, 130, 9, 65, 65, SS_LEFT +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.rex new file mode 100755 index 0000000..2d7ad52 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/ProductView.rex @@ -0,0 +1,480 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 05: ProductView.rex - The ProductView component v01-00 03Jun12 + + Contains: classes "ProductView" and "AboutDialog". + + Pre-requisites: ProductView.dll, ProductView.h. + Support\NumberOnlyEditEx.cls (copied from ooDialog Samples) + + Description: A sample Product View component - part of the sample + Order Management application. + + Changes: + v01-00 03Jun12: First version. + +------------------------------------------------------------------------------*/ + +::requires "ooDialog.cls" +::requires "Support\NumberOnlyEditEx.cls" +::requires "ProductModelData.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductView v01-00 03Jun12 + ----------- + The "view" part of the Product business component. + + Changes: + v01-00 03Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductView SUBCLASS ResDialog PUBLIC + + ::ATTRIBUTE dialogState PRIVATE -- States are: 'closable' or 'inUpdate". + + /*---------------------------------------------------------------------------- + Class Methods: + --------------------------------------------------------------------------*/ + + ::METHOD newInstance CLASS PUBLIC UNGUARDED + say ".ProductView-newInstance-01: Start." + -- Enable use of symbolic IDs in menu creation, and turn off AutoDetection + -- (the third parameter: + .Application~setDefaults("O", "ProductView.h", .false) + -- Create an instance of ProductView and show it: + dlg = .ProductView~new("res\ProductView.dll", IDD_PRODUCT_VIEW) + say ".ProductView-newInstance-02: dlg~Activate." + dlg~activate + + + /*---------------------------------------------------------------------------- + Instance Methods: + --------------------------------------------------------------------------*/ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + say "ProductView-init-01." + -- called first (result of .ProductView~new) + forward class (super) continue + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + say "ProductView-activate-01." + self~dialogState = "closable" + self~execute("SHOWTOP","IDB_PROD_ICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar prodControls prodData + say "ProductView-initDialog-01" + + menuBar = .BinaryMenuBar~new(self, IDR_PRODUCT_VIEW_MENU, , self, .true) + + prodControls = .Directory~new + prodControls[ecProdNo] = self~newEdit("IDC_PROD_NO") + prodControls[ecProdName] = self~newEdit("IDC_PROD_NAME") + prodControls[ecProdPrice] = self~newEdit("IDC_PROD_LIST_PRICE") + prodControls[ecUOM] = self~newEdit("IDC_PROD_UOM") + prodControls[ecProdDescr] = self~newEdit("IDC_PROD_DESCRIPTION") + prodControls[gbSizes] = self~newEdit("IDC_PROD_SIZE_GROUP") -- Do we ever need this? + prodControls[rbSmall] = self~newRadioButton("IDC_PROD_RADIO_SMALL") + prodControls[rbMedium] = self~newRadioButton("IDC_PROD_RADIO_MEDIUM") + prodControls[rbLarge] = self~newRadioButton("IDC_PROD_RADIO_LARGE") + prodControls[pbSaveChanges] = self~newPushButton("IDC_PROD_SAVE_CHANGES") + self~connectButtonEvent("IDC_PROD_SAVE_CHANGES","CLICKED",saveChanges) + + -- Use NumberOnlyEditEx.cls to enforce numeric only entry for Price and UOM: + prodControls[ecProdPrice]~initDecimalOnly(2,.false) -- 2 decimal places, no sign. + prodControls[ecUOM]~initDecimalOnly(0,.false) -- 0 decimal places, no sign. + prodControls[ecProdPrice]~connectCharEvent(onChar) + prodControls[ecUOM]~connectCharEvent(onChar) + + prodData = self~getData -- Gets data from ProductModel into prodData + self~showData -- Show the data + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - MenuBar Events: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD updateProduct UNGUARDED + expose prodControls +say "ProductView-updateProduct-01." + -- Enable the controls to allow changes to the data: + prodControls[ecProdName]~setReadOnly(.false) + prodControls[ecProdPrice]~setReadOnly(.false) + prodControls[ecUOM]~setReadOnly(.false) + prodControls[ecProdDescr]~setReadOnly(.false) + prodControls[rbSmall]~enable + prodControls[rbMedium]~enable + prodControls[rbLarge]~enable + self~enableControl("IDC_PROD_SAVE_CHANGES") + prodControls[pbSaveChanges]~state = "FOCUS" -- Put input focus on the button + self~tabToNext() -- put text cursor on Product Description + -- (as if the user had pressed tab) + self~dialogState = "inUpdate" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD refreshData UNGUARDED + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~showData + self~dialogState = "closable" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD print UNGUARDED + say "ProductView-print-01" + ret = InfoDialog(.HRS~printMsg) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD close UNGUARDED + say "ProductView-close-01" + self~cancel + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + say "ProductView-about-01" + dlg = .AboutDialog~new("ProductView.dll", IDD_PRODUCT_VIEW_ABOUT) + dlg~execute("SHOWTOP") + + + /*---------------------------------------------------------------------------- + Event Handler Methods - PushButton Events: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "Save Changes" - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg. Disables the + button when valid changes made. */ + ::METHOD saveChanges UNGUARDED + expose prodControls prodData + + -- Transform data from view format (as in controls) to app format (a directory): + newProdData = self~xformView2App(prodControls) + + -- Check if anything's changed; if not, show msgbox and exit with controls enabled. + -- If changed, go on to validate data. + result = self~checkForChanges(newProdData) + if result = .false then do + msg = .HRS~nilSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRS~updateProd,"OK","WARNING","DEFBUTTON2 APPLMODAL") + return + end + + -- Now validate data: + result = self~validate(newProdData) -- returns a null string or error messages. + -- Better would be a set of error numbers. + -- If no problems, then show msgbox and go on to disable controls. + if result = "" then do + msg = .HRS~saved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRS~updateProd,"OK","INFORMATION","DEFBUTTON1 APPLMODAL") + end + -- If problems, then show msgbox and leave user to try again or refresh or exit. + else do + msg = result||.EndOfLine||.HRS~notSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRS~updateProd,"OK","ERROR","DEFBUTTON1 APPLMODAL") + return + end + + -- Send new data to be checked by CustomerModel object (not implemented). + + -- Disable controls that were enabled by menu "ActionsFile-->Update" selection: + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUom]~setReadOnly(.true) + if newProdData~size \= "S" then prodControls[rbSmall]~disable + if newProdData~size \= "M" then prodControls[rbMedium]~disable + if newProdData~size \= "L" then prodControls[rbLarge]~disable + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~dialogState = "closable" + + prodData = newProdData + prodData~list + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - Keyboard Events: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onChar UNGUARDED + -- called for each character entered in the price or UOM fields. + forward to (arg(6)) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + -- If in the process of updating, then ask whether any changes should be + -- thrown away and dialog closed. If yes then close by calling the superclass, + -- else nop. If not in update, then close immediately + say "ProductView-cancel-01." + if self~dialogState = "inUpdate" then do + ans = MessageDialog(.HRS~closeInUpdate, self~dlgHandle, .HRS~updateIP, "YESNO", "WARNING", "DEFBUTTON2") + if ans = .PlainBaseDialog~IDYES then return self~cancel:super + else nop + end + else return self~cancel:super + + + /*---------------------------------------------------------------------------- + Application Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData + -- Get data from the ProductModel: + --expose prodData + say "ProductView-getData-01." + idProductModel = .local~my.idProductModel + prodData = idProductModel~query -- prodData is of type ProductDT + return prodData + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showData + -- Transfrom data (where necessary) to display format, and then disable controls. + expose prodControls prodData + say "ProductView-showData-01." + -- Set data in controls: + prodControls[ecProdNo]~setText( prodData~number ) + prodControls[ecProdName]~setText( prodData~name ) + -- Price in prodData has no decimal point - 2 decimal places are implied - hence /100 for display. + prodControls[ecProdPrice]~setText(prodData~price/100 ) + prodControls[ecUOM]~settext( proddata~uom ) + prodControls[ecProdDescr]~setText(prodData~description ) + size = prodData~size + -- Disable controls + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUOM]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[rbSmall]~disable + prodControls[rbMedium]~disable + prodControls[rbLarge]~disable + -- But check correct button and enable it to highlight it to the user: + select + when size = "S" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_SMALL") + prodcontrols[rbSmall]~enable + end + when size = "M" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_MEDIUM") + prodcontrols[rbMedium]~enable + end + otherwise do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_LARGE") + prodcontrols[rbLarge]~enable + end + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD checkForChanges + -- Check whether any data has actually changed when "Save Changes" button + -- has been pressed. Return .true if data changed, else returns .false. + expose prodData + use arg newProdData + + changed = .false + select + when newProdData~name \= prodData~name then changed = .true + when newProdData~price \= prodData~price then changed = .true + when newProdData~uom \= prodData~uom then changed = .true + when newProdData~description \= prodData~description then changed = .true + when newProdData~size \= ProdData~size then changed = .true + otherwise nop + end + return changed + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD validate + -- Validation: 1. Check price/UOM not changed > 50% up or down. + -- 2. Cannot change from Large to Small without UOM increasing + -- by at least 100%; nor from Small to Large without + -- decreasing by more than 50%. + -- 3. Product Description <= 100 characters. + -- 4. Product Name <= 30 characters. + -- Returns string of messages - the null string if all OK. + expose prodData + use arg newProdData + msg = "" + + -- Check Price (catches decimal point errors also): + price = prodData~price; newPrice = newProdData~price + oldUom = prodData~uom; newUom = newProdData~uom -- 'oldUom - avoids name conflict with 'uom' in newProddata~uom. + if ((price/oldUom)*1.5 < newPrice/newUom) | (newPrice/newUom < (price/oldUom)/2) then do + msg = msg||.HRS~badRatio||" " + end + + -- Check Size vs UOM: + if prodData~size = "L" & newProdData~size = "S" - -- Large to Small + & prodData~uom/2 < newProdData~uom then do + msg = msg||.HRS~uomTooBig||" " + end + if prodData~size = "S" & newProdData~size = "L" - -- Small to Large + & prodData~uom*2 > newProdData~uom then do + msg = msg||.HRS~uomTooSmall||" " + end + + -- Check Product Description length: + if newProdData.description~length > 80 then do + msg = msg||.HRS~descrTooBig||" " + end + + -- Check Product Name length: + if newProdData~name~length > 30 then do + msg = msg||.HRS~prodNameTooBig + end + + return msg + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD xformView2App + -- Transforms Product Data from View form (in the GUI controls) to + -- App form (a directory with address as an array). + expose prodControls + prodData = .ProductDT~new + prodData~number = prodControls[ecProdNo]~gettext() + prodData~name = prodControls[ecProdName]~getText() + price = prodControls[ecProdPrice]~getText() + -- Data entered has or assumes a decimal point; but data in "application" + -- is a whole number (e.g. $42.42 is recorded in the database as "4242"). + -- So re-format data from decimal to whole number: + priceTwoDecs = price~format(,2) -- force 2 dec positions + -- Re-display price properly formatted (in case the user did not format correctly - e.g. entered "42" or "38.4"): + prodControls[ecProdPrice]~setText(priceTwoDecs) + -- Now format price to "application" format: + price = (priceTwoDecs*100)~format(,0) -- multiply by 100 and then force whole number. + prodData~price = price + prodData~uom = prodControls[ecUOM]~getText() + prodData~description = prodControls[ecProdDescr]~getText() + select + when prodControls[rbSmall]~checked then prodData~size = "S" + when prodControls[rbMedium]~checked then prodData~size = "M" + otherwise prodData~size = "L" + end + + return prodData + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + AboutDialog v01-00 03Jun12 + ------------- + The "About" class - shows a dialog box that includes a bitmap - part of the + ProductView component. + + Changes: + v01-00 03Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS AboutDialog SUBCLASS ResDialog + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method initDialog + expose font image + resImage = .ResourceImage~new(self) -- Create an instance of a resource image + image = resImage~getImage(IDB_PROD_ICON) -- Create an image from the Product bitmap + stImage = self~newStatic(IDC_PRODABT_ICON_PLACE)~setImage(image) -- Create a static text control and set the image in it + font = self~createFontEx("Ariel", 12) -- Create up a largish font with which to display text and ... + self~newStatic(IDC_PRODABT_STATIC2)~setFont(font) -- ... set the static text to use that font. + -- Provide for a double-click in Product icon: + self~connectStaticNotify("IDC_PRODABT_ICON_PLACE", "DBLCLK", showMsgBox) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method showMsgBox + say "AboutDialog-showMsgBox-01." + ans = MessageDialog(.HRS~aboutDblClick) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method leaving + expose font image + self~deleteFont(font) + image~release() + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRS) v01-00 03Jun12 + -------- + The HRS class provides constant character strings for user-visible messages. + + Changes: + v01-00 03Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRS PRIVATE -- Human-Readable Strings + ::CONSTANT aboutDblClick "You double-clicked!" + ::CONSTANT badRatio "The new price/UOM ratio cannot be changed more than 50% up or down." + ::CONSTANT closeInUpdate "Any changes made will be lost. Exit anyway?" + ::CONSTANT descrTooBig "The Product Description is too long." + ::CONSTANT nilSaved "Nothing was changed! Data not saved." + ::CONSTANT notSaved "Changes Not Saved!" + ::CONSTANT prodNameTooBig "The Product Name is too long." + ::CONSTANT saved "Changes saved." + ::CONSTANT uomTooBig "The new UOM is too large." + ::CONSTANT uomTooSmall "The new UOM is too small." + ::CONSTANT updateIP "Update in process" + ::CONSTANT updateProd "Update Product" + ::CONSTANT printMsg "The 'Print...' menu item is not yet implemented." + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/Startup.rex b/modules/windows/oodialog/userGuide/exercises/Exercise05/Startup.rex new file mode 100755 index 0000000..a5015d6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/Startup.rex @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 05: The Product component v01-00 03Jun12 + + Startup.rex - the starter" for the Product component. + + Changes: + v01-00 03Jun12: Firect version. + +------------------------------------------------------------------------------*/ + +.local~my.idProductData = .ProductData~newInstance -- create a ProductData instance +.local~my.idProductModel = .ProductModel~newInstance -- create a ProductModel instance +.local~my.idProductData~activate +.local~my.idProductModel~activate + +.ProductView~newInstance + +::requires "ProductView.rex" +::requires "ProductModelData.rex" + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/Support/NumberOnlyEditEx.cls b/modules/windows/oodialog/userGuide/exercises/Exercise05/Support/NumberOnlyEditEx.cls new file mode 100644 index 0000000..9613851 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/Support/NumberOnlyEditEx.cls @@ -0,0 +1,526 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * The NumberOnlyEditEx class extends the .Edit class to provide an edit + * control which restricts entry to decimal only, or signed decimal only, + * numbers. + * + * The NumberOnlyEditEx.cls file is meant to be included in any ooDialog + * program where this extension to the edit control is desired. The programmer + * needs to take 4 steps to gain the functionality of a signed decimal number + * only edit control: + * + * 1.) Require the NumberOnlyEditEx.cls file (this file.) + * + * ::requires 'NumberOnlyEditEx.cls' + * + * 2.) Invoke the initDecimalOnly() method on each edit control object that is + * to be a decimal number only edit control. If initDecimalOnly() is not + * invoked, the behaviour of the edit control is unchanged. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~initDecimalOnly(decimalPlaces, allowSign) + * + * arguments: + * + * decimalPlaces [optional] The number of decimal places allowed in the + * number. The default is 2. Specifying 0 + * decimal places is acceptable. + * + * allowSign [optional] If a sign character (+ or -) is allowed as the + * leading character of the number. The default + * is .false. Specify .true to allow a sign + * character. + * + * 3.) For each decimal only edit control, the character event must be + * connected to a method in the Rexx dialog object. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~connectCharEvent(onChar) + * + * 4.) In the connected character event handler, the message and its arguments + * must be forwarded on to the onChar() method of the edit control. The + * 6th argument to the event handler is the dialog control object where the + * character event occurred. That is the object the event must be forwared + * to. + * + * When the programmer connects the character event to a method named + * onChar, the event handler is simple: + * + * ::method onChar unguarded + * forward to (arg(6)) + * + * If the programmer chooses a different method name for the event handler, + * then he must be sure to forward to the onChar() method of the edit + * control: + * + * ::method myOwnMethodName unguarded + * forward message 'onChar' to (arg(6)) + * + * And of course there is no reason why the event handler can not be coded + * using the explicit arguments: + * + * ::method myOwnMethodName unguarded + * use arg char, isShift, isCtrl, isAlt, misc, control + * forward message 'onChar' to (control) + */ + + -- Extend the .Edit control by inheriting the .NumberOnlyEditEx mixin class. + + .Edit~inherit(.NumberOnlyEditEx, .EditControl) + +::requires 'ooDialog.cls' +::requires 'winsystm.cls' + +::class 'NumberOnlyEditEx' public mixinclass object + +-- Users of the signed decimal number only edit control must invoke +-- initDecimalOnly() first to assign decimal places and specify if the sign +-- character is allowed. Until this is done, there is no change to the +-- behaviour of the Edit control object. +::method initDecimalOnly + expose decimalPlaces signOk initialized clipBoard + use strict arg decimalPlaces = 2, plusMinus = .false + + if plusMinus~isA(.String), plusMinus~datatype('O') then signOk = plusMinus + else signOk = .false + + initialized = .true + clipBoard = .WindowsClipboard~new + +-- The onChar() method should be inovked at every character event. Returning +-- true allows the character, returning false disallows the character. When a +-- character is not allowed, an edit ballon is set with a message explaining to +-- the user why the character is not appearing when they type. +::method onChar unguarded + expose decimalPlaces initialized signOk + use arg char, isShift, isCtrl, isAlt, misc, control + + if \ var('initialized') then return .true + + if misc~pos("extended") <> 0, self~isExtendedKey(char) then return .true + + if char == 8 then return .true + if signOk, (char == 43 | char == 45) then return self~checkSign + if char == 46 then return self~checkDecimal + if char >= 48, char <= 57 then return self~checkDigit + + if isCtrl, \isAlt, \isShift then return self~checkControlKey(char) + + reply .false + self~charBalloon + + +/** checkDigit() + * + * Checks that the digit being typed, at the cursor position, is allowed. + */ +::method checkDigit private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if signOk, cursorPos == 1 then do + c = text~left(1) + + if c == '-' | c == '+' then do + reply .false + self~showBalloon(.MT~NUM_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + return .true + end + + if decimalPos == 0 then return .true + + if cursorPos <= decimalPos then return .true + + if text~length < (decimalPos + decimalPlaces) then return .true + + reply .false + + msg = self~decimalPlacesUsedMsg + self~showBalloon(.MT~NUM_TITLE, msg, "ERROR") + + +/** checkSign() + * + * Checks that the sign character being typed is allowed at the current cursor + * position. Note that this method is only invoked when the sign character is + * allowed. + */ +::method checkSign private unguarded + expose decimalPlaces + + text = self~getText + cursorPos = self~getCaretPos + + if cursorPos == 1 then do + if self~hasSign(text) then do + reply .false + self~showBalloon(.MT~SIGN_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + + return .true + end + + reply .false + + decimalPos = text~pos('.') + if decimalPos <> 0 | decimalPlaces == 0 then msg = .MT~ONLY_NUMBER + else msg = .MT~ONLY_DECIMAL_NUMBER + + self~showBalloon(.MT~SIGN_TITLE, msg, "ERROR") + + +/** checkDecimal() + * + * Checks that the decimal point being typed is allowed at the current cursor + * position. + */ +::method checkDecimal private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if decimalPlaces == 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if decimalPos <> 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if cursorPos == 1, signOk, self~hasSign(text) then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if text~length < cursorPos + decimalPlaces then return .true + + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + + +/** checkControlKey() + * + * Invoked for a control key combination (Ctrl-?). Anything other than Ctrl-V + * is automatically allowed. Ctrl-V is of course the paste operation. For + * Ctrl-V, we check that the result after pasting the text would be a valid + * signed decimal number, under the constraints for this object. If not, it + * is disallowed and a ballon set. + */ +::method checkControlKey private unguarded + expose clipBoard decimalPlaces + use strict arg char + + if char \== 22 then return .true -- Not Ctrl-V + + -- If there is no text data available we don't care, pasting it will not do + -- any harm. + if \ clipBoard~isDataAvailable then return .true + + pastedText = clipBoard~paste + + -- We have text to paste, need to check is the text acceptable, + -- and is it acceptable for where it will be placed. + text = self~getText + len = text~length + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + -- isValidDecimal() checks that the resulting text after inserting the pasted + -- text is valid. + if \ self~isValidDecimal(pastedText, text, cursorPos) then do + reply .false + self~pasteBalloon(pastedText, text, cursorPos) + return + end + + return .true + + +/** decimalPointBalloon() + * + * This method produces the proper balloon message text when a decimal point has + * been typed, but is not allowed at the current position. + */ +::method decimalPointBalloon private unguarded + expose decimalPlaces signOk + use strict arg decimalPos, cursorPos, text + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~DEC_TITLE, msg, "ERROR") + + +/** charBalloon() + * + * This method produces the proper balloon message when a character is typed. + */ +::method charBalloon private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + msg = .MT~ONLY_NUMBER + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if decimalPlaces == 0, \signOk then msg = .MT~ONLY_WHOLE_NUMBER + else if decimalPos == 0, signOk then msg = .MT~ONLY_SIGNED_DECIMAL_NUMBER + else if decimalPos == 0, \signOk then msg = .MT~ONLY_DECIMAL_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when decimalPos == 0 then do + msg = .MT~ONLY_DECIMAL_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~CHAR_TITLE, msg, "ERROR") + + +/** pasteBalloon() + * + * This method produces the proper balloon message when text is pasted into the + * edit control that is not allowed. + */ +::method pasteBalloon private unguarded + expose decimalPlaces signOk + use strict arg pastedText, text, cursorPos + + if signOk then do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE_SIGNED + else msg = .MT~ONLY_PASTE_A_SIGNED decimalPlaces .MT~ONLY_PASTE_B + end + else do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE + else msg = .MT~ONLY_PASTE_A decimalPlaces .MT~ONLY_PASTE_B + end + + resultText = text~substr(1, cursorPos - 1) || pastedText || text~substr(cursorPos) + + -- Balloon text has to be less than 1023 characters. If we don't exceed that + -- length, we will show the incorrect text to the user. Otherwise we just + -- show the short message. Note that new line characters can be used to + -- format the balloon text. + len = msg~length + resultText~length + .MT~PASTED_A~length + .MT~PASTED_B~length + 8 + + if len < 1023 then do + msg ||= .endOfLine~copies(2) || .MT~PASTED_A || - + .endOfLine~copies(2) || '"'resultText'"' || - + .endOfLine~copies(2) || .MT~PASTED_B + end + + self~showBalloon(.MT~PASTE_TITLE, msg, "ERROR") + + +/** decimalPlacesUsedMsg() + * + * Convenience method to return the proper message for the situation where the + * allowable number of decimal places have been filled. + */ +::method decimalPlacesUsedMsg private unguarded + expose decimalPlaces + + if decimalPlaces == 1 then return .MT~ONLY_1_DECIMAL + else return .MT~ONLY_DECIMALS_A decimalPlaces .MT~ONLY_DECIMALS_B + + +/** isValidDecimal() + * + * Checks that the resulting text after the pasted text is inserted into text at + * the current position, results in a valid number using the current + * restrictions. Decimal places and sign allowed or not. + */ +::method isValidDecimal private unguarded + expose decimalPlaces signOk + use strict arg pasteText, text, cursorPos + + resultText = text~substr(1, cursorPos - 1) || pasteText || text~substr(cursorPos) + + -- Can't have any type of space character, tab, new line, etc.. + if resultText \== resultText~space(0) then return .false + + -- Eliminate obvious problems with decimals. + countDots = resultText~countStr(".") + if countDots > 1 then return .false + if decimalPlaces == 0, countDots > 0 then return .false + + -- Eliminate any problems with the sign character. + if signOk then do + if resultText~pos('-') > 1 | resultText~pos('+') > 1 then return .false + end + else do + if resultText~pos('-') <> 0 | resultText~pos('+') <> 0 then return .false + end + + + decimalPos = resultText~pos('.') + if decimalPos > 0 then do + if resultText~length - decimalPos > decimalPlaces then return .false + + -- Remove the decimal char so we can test for all digits. + resultText = resultText~changeStr('.', '') + end + + -- Remove the sign character if it exists. + if self~hasSign(resultText) then resultText = resultText~substr(2) + + -- Exponential notation can not be allowed. + if resultText~caselessPos('E') <> 0 then return .false + + if \ resultText~datatype('W') then return .false + + return .true + + +/** isExtendedKey + * + * Convenience method to test if the character, char, is an extended key we want + * to pass on to the edit control + */ +::method isExtendedKey private + use strict arg char + + if char >= 33, char <= 40 then return .true + if char == 45 | char == 46 | char == 8 then return .true + return .false + + +/** hasSign + * + * Convenience method to test if a text string starts with a sign (+ or -) + * character. + */ +::method hasSign private + use strict arg text + + c = text~left(1) + if c == '-' | c == '+' then return .true + return .false + + +/** getCaretPos() + * + * Returns the current caret (cursor) position of this edit control. + */ +::method getCaretPos private + return self~selection~startChar + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Class: MT + + This class is used to provide constant character strings. The strings are + used for the balloon messages put up by the NumberOnlyEditEx mixin class. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'MT' private +::constant CHAR_TITLE "Unacceptable Character" +::constant DEC_TITLE "Unacceptable Decimal Point" +::constant NUM_TITLE "Unacceptable Number" +::constant SIGN_TITLE "Unacceptable Sign Character" +::constant PASTE_TITLE "Unacceptable Pasted Text" + +::constant ONLY_NUMBER "You can only type a number here." +::constant ONLY_SIGNED_NUMBER "You can only type a number or the sign here." +::constant ONLY_DECIMAL_NUMBER "You can only type a number or the decimal point here." +::constant ONLY_SIGNED_DECIMAL_NUMBER "You can only type a number, the sign, or the decimal point here." +::constant ONLY_WHOLE_NUMBER "You can only type a number here. Only whole numbers are allowed." +::constant ONLY_WHOLE_SIGNED_NUMBER "You can only type a number or the sign here. Only whole numbers are allowed." + +::constant HAS_SIGN "You can not type here. The sign character is already in place." +::constant ONLY_1_DECIMAL "You can not type here. Only 1 decimal place is allowed." +::constant ONLY_DECIMALS_A "You can not type here. Only" +::constant ONLY_DECIMALS_B "decimal places are allowed." + +::constant ONLY_PASTE_WHOLE "You can only paste text here that produces a whole number." +::constant ONLY_PASTE_WHOLE_SIGNED "You can only paste text here that produces a signed whole number." +::constant ONLY_PASTE_A_SIGNED "You can only paste text here that produces a signed decimal number with" +::constant ONLY_PASTE_A "You can only paste text here that produces a decimal number with" +::constant ONLY_PASTE_B "or less decimal places." +::constant PASTED_A "Resulting text of:" +::constant PASTED_B "is not valid." diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/res/ProductIcon.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise05/res/ProductIcon.bmp new file mode 100644 index 0000000..13ca9ac Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise05/res/ProductIcon.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/res/ProductView.dll b/modules/windows/oodialog/userGuide/exercises/Exercise05/res/ProductView.dll new file mode 100644 index 0000000..cb2b24e Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise05/res/ProductView.dll differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise05/res/res.mak b/modules/windows/oodialog/userGuide/exercises/Exercise05/res/res.mak new file mode 100644 index 0000000..7f0e390 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise05/res/res.mak @@ -0,0 +1,50 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# nMake-compatible Make file for the ProductView resource-only DLL. + +all: ProductView.dll + +ProductView.dll: ProductView.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) /OUT:$(@B).dll + +# Create .res from .rc +ProductView.res: ..\ProductView.rc + rc -r -fo$(@B).res ..\$(@B).rc + +clean: + del *.res *.dll 1>nul 2>&1 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.h new file mode 100644 index 0000000..62b5eb4 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDI_CUSTLIST_DLGICON 103 +#define IDD_CUSTLIST_DIALOG 104 +#define IDR_CUSTLIST_MENU 105 +#define IDC_CUSTLIST_LIST 1001 +#define IDM_CUSTLIST_NEWCUST 40000 +#define IDC_CUSTLIST_SHOWCUST 40001 +#define IDM_CUSTLIST_ABOUT 40002 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.rc new file mode 100644 index 0000000..073d8f2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "CustomerListView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUSTLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUSTLIST_NEWCUST + } + POPUP "Help" + { + MENUITEM "About...", IDM_CUSTLIST_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUSTLIST_DIALOG DIALOG 0, 0, 225, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Customer List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_CUSTLIST_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING | LVS_NOSORTHEADER , 15, 10, 190, 215 + DEFPUSHBUTTON "Show Customer", IDC_CUSTLIST_SHOWCUST, 89, 235, 54, 14, WS_DISABLED +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_CUSTLIST_DLGICON ICON ".\\customer\\bmp\\CustList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.rex new file mode 100755 index 0000000..a776f31 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerListView.rex @@ -0,0 +1,250 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The Customer ListView v01-00 06Jun12 + + Contains: classes "CustomerListView" and "HRSclv". + + Pre-requisite: CustomerListView.rc, CustomerListView.h, CustList.ico + + Description: Provides a list of Customers and supports viewing any given + Customer via a double-click on that Customer's item in the list. + This is an "Intermediate" component - it is invoked by OrderMgmt, + and invokes CustomerView. + + v01-00 06Jun12: First Version. + + Outstanding Problems: None reported. +*******************************************************************************/ + + +.Application~addToConstDir("Customer\CustomerListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "customer\customerview.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerListView v01-04 19Feb12 + ---------------- + The view of a list of Customers. + Changes: + v01-01: First version + v01-02: Corrected for standalone invocation. + v01-03 28Jan12: Changed name of HRS class to HRSplv. + v01-04 11Feb12: moved .application~setDefaults() to app startup file. + changed to .application~addToConstDir() here. + v01-05 19Feb12: Moved .Application~addToConstDir statement from newInstance + method to top of file - just before ::requires statement(s). + v01-06 29Mar12: Very minor mods - all just minor clean-ups. All comments removed + + + [interface (idl format)] <> + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerListView SUBCLASS RcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg rootDlg + dlg = self~new("Customer\CustomerListView.rc", "IDD_CUSTLIST_DIALOG") + dlg~activate(rootDlg) -- Must be the last statement. + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + menuBar = .ScriptMenuBar~new("Customer\CustomerListView.rc", "IDR_CUSTLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg + use arg rootDlg + if rootDlg = "SA" then do -- If standalone operation required + rootDlg = self -- To pass on to children + self~execute("SHOWTOP","IDI_CUSTLIST_DLGICON") + end + else self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_CUSTLIST_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvCustomers btnShowCustomer + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + lvCustomers = self~newListView("IDC_CUSTLIST_LIST"); + lvCustomers~addExtendedStyle("GRIDLINES FULLROWSELECT") + lvCustomers~insertColumnPX(0,"Number",60,"LEFT") + lvCustomers~insertColumnPX(1,"Name",220,"LEFT") + lvCustomers~insertColumnPX(2,"Zip",80,"LEFT") + self~connectListViewEvent("IDC_CUSTLIST_LIST","CLICK",itemSelected) -- Single click + self~connectButtonEvent("IDC_CUSTLIST_SHOWCUST","CLICKED",showCustomer) + self~connectListViewEvent("IDC_CUSTLIST_LIST","ACTIVATE",openItem) -- Double-click + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newCustomer UNGUARDED + self~noMenuFunction(.HRSclv~newCust) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSclv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSclv~noMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected UNGUARDED + use arg id, itemIndex, columnIndex, keyState + /* This method is fired when the user clicks on a row in the ListView. + If the user clicks on an empty row, then itemIndex is set to -1, else + the itemIndex is set to the 0-based row number. + If the user double-clicks on a row, this method is fired in response + to the first click but not to the second. If the row is empty, the second + click of the double-click is ignored, else the double-click method is + fired. + */ + if itemIndex > -1 then self~enableControl("IDC_CUSTLIST_SHOWCUST") + else self~disableControl("IDC_CUSTLIST_SHOWCUST") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + -- User double-clicked on an item in the ListView. + -- Note: does not get fired if double-click was on an empty row. + self~showCustomer + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showCustomer UNGUARDED + expose lvCustomers rootDlg + item = lvCustomers~selected + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSclv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvCustomers~getItemInfo(item, info) then do + say "CustomerListView-showCustomer-02: info~text =" info~text + .local~my.idCustomerData = .CustomerData~new -- create Customer Data instance + .local~my.idCustomerModel = .CustomerModel~new -- create Customer Model instance + .local~my.idCustomerData~activate + .local~my.idCustomerModel~activate + .CustomerView~newInstance(rootDlg,"CU003") + self~disableControl("IDC_CUSTLIST_SHOWCUST") + end + else do + say "CustomerListView-showCustomer-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvCustomers + lvCustomers~addRow( , ,"CU001", "ABC Inc.", "TX 20152") + lvCustomers~addRow( , ,"CU002", "Frith Inc.", "CA 30543") + lvCustomers~addRow( , ,"CU003", "LMN & Co", "NY 47290-1201") + lvCustomers~addRow( , ,"CU005", "EJ Smith", "NJ 12345") + lvCustomers~addRow( , ,"CU010", "Red-On Inc.","AZ 12345") + lvCustomers~addRow( , ,"AB15784", "Joe Bloggs & Co Ltd","LB7 4EJ") + /*do i = 1 to 50 + lvCustomers~addRow(i, , "Line" i, i) + end*/ + lvCustomers~setColumnWidth(1) -- set width of 2nd column to longest text entry. + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSclv (Human-Readable Strings for CustomerListView) v01-00 06Jun12 + --- + The HRSclv class provides constant character strings for user-visible messages + issued by the CustomerListView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSclv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newCust "New Customer" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerModelData.rex new file mode 100755 index 0000000..c4a3fd3 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerModelData.rex @@ -0,0 +1,142 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 04&06: The CustomerModel and CustomerData Classes v01-00 07Jun12 + + Contains: classes "CustomerModel" and "CustomerResource". + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerModel v01-00 07Jun12 + ------------ + The "model" part of the Customer component. + + Changes: + v01-00 07Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerModel PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + aCustomerModel = self~new + return aCustomerModel + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD activate PUBLIC + -- Gets its data from ProductData. + expose idCustomerData + idCustomerData = .local~my.idCustomerData + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + expose idCustomerData + say "CustomerModel-query-01." + data = idCustomerData~getData + return data +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerData v01-00 07Jun12 + ------------ + The "data" part of the Customer component. + Changes: + v01-00 07Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerData PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + aCustomerData = self~new + return aCustomerData + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate PUBLIC + expose custData + custData = .directory~new + custData[custNo] = "AB15784" + custData[custName] = "Joe Bloggs & Co Ltd" + arrCustAddr = .array~new + arrCustAddr[1] = "28 Frith Street" + arrCustAddr[2] = "Hardington" + arrCustAddr[3] = "Blockshire" + custData[CustAddr] = arrCustAddr + custData[custZip] = "LB7 4EJ" + custData[custDiscount]= "B1" + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC + expose custData + say "CustomerData-getData-01." + return custData + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.h new file mode 100644 index 0000000..26d87d2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.h @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_CUST_DIALOG 102 +#define IDR_CUST_MENU 103 +#define IDI_CUST_DLGICON 105 +#define IDC_CUST_LBL_CUSTNO 1001 +#define IDC_CUST_LBL_DISCOUNT 1002 +#define IDC_CUST_BTN_SHOWLASTORDER 1003 +#define IDM_CUST_NEW 40000 +#define IDM_CUST_UPDATE 40001 +#define IDM_CUST_PRINT 40002 +#define IDM_CUST_LAST_ORDER 40003 +#define IDC_CUST_EDT_CUSTNO 40043 +#define IDC_CUST_EDT_CUSTNAME 40044 +#define IDC_CUST_BTN_RECORDCHANGES 40069 +#define IDC_CUST_LBL_CUSTNAME 40070 +#define IDC_CUST_LBL_CUSTADDR 40071 +#define IDC_CUST_LBL_ZIP 40072 +#define IDC_CUST_LBL_LASTORDER 40073 +#define IDC_CUST_STC_LASTORDERDETAILS 40077 +#define IDC_CUST_EDT_CUSTADDR 40078 +#define IDC_CUST_EDT_DISCOUNT 40079 +#define IDC_CUST_EDT_CUSTZIP 40080 +#define IDC_CUST_STC_ERRORMSG 40081 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.rc new file mode 100644 index 0000000..cab2d63 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.rc @@ -0,0 +1,85 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "customerview.h" + + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUST_NEW + MENUITEM "&Update...", IDM_CUST_UPDATE + MENUITEM "Print...", IDM_CUST_PRINT + MENUITEM "Last Order", IDM_CUST_LAST_ORDER + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUST_DIALOG DIALOG 0, 0, 275, 239 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "*CustomerName*" +FONT 8, "Microsoft Sans Serif" +{ + LTEXT "Name:", IDC_CUST_LBL_CUSTNAME, 18, 47, 22, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNO, 85, 20, 65, 15, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Customer Number:", IDC_CUST_LBL_CUSTNO, 18, 22, 59, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNAME, 85, 45, 165, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Address:", IDC_CUST_LBL_CUSTADDR, 18, 72, 28, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTADDR, 85, 70, 167, 40, ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + LTEXT "Zip Code:", IDC_CUST_LBL_ZIP, 20, 120, 32, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTZIP, 85, 120, 65, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Last Order:", IDC_CUST_LBL_LASTORDER, 18, 177, 36, 8, SS_LEFT + LTEXT " ", IDC_CUST_STC_LASTORDERDETAILS, 88, 177, 145, 8, SS_LEFT + LTEXT "Discount Code:", IDC_CUST_LBL_DISCOUNT, 18, 149, 50, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_DISCOUNT, 85, 145, 20, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT " ", IDC_CUST_STC_ERRORMSG, 18, 215, 8, 8, SS_LEFT + DEFPUSHBUTTON "Record Changes", IDC_CUST_BTN_RECORDCHANGES, 130, 195, 58, 14, WS_DISABLED + PUSHBUTTON "Show Last Order", IDC_CUST_BTN_SHOWLASTORDER, 195, 195, 58, 14 +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_CUST_DLGICON ICON ".\\customer\\bmp\\Customer.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.rex new file mode 100755 index 0000000..b6fc6f5 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/CustomerView.rex @@ -0,0 +1,366 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The CustomerView component v01-01 07Jun12 + + Contains: class "CustomerView"; routine "startCustomerView". + Pre-requisites: CustomerView.rc, CustomerView.h. + + Description: A sample Customer View component - part of the sample + Order Management application. This is a "leaf" component - + it does not invoke other components. + + Changes: + v01-00 01Jun12: First version (Exercise04). + v01-01 07Jun12: Minor changes for Exercise06. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Customer\CustomerView.h") + + +::requires "ooDialog.cls" +::requires "CustomerModelData.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerView v02-05 19Feb12 + ------------- + The "view" (or "gui") part of the Customer component - part of the sample + Order Management application. + Changes: + v00-02: Prevented close on enter key by providing no-op "ok" method. + Changed tab order on window by changing sequence of controls in .rc file + v00-03: Changed symbolic IDs to conform with naming convention + Added initAutoDetection method because deleted dlgData. from + dlg~new statement in starter.rex. + v00-04: Took out the OK method - include that in Exercise05. + v00-05: Modified to use CustomerData and CustomerModel classes. + Mods after Exercise04: + v02-00: Added "newInstance" class method - removed routine "StartCustomerView". + v02-01 19Sep11: Corrected for stand-alone invocation. + v02-02 04Oct11: Added msgbox for unimplemented menu item. + v02-03 28Jan12: Changed class name HRS to HRSclv to allow for multiple + HRS classes in same file at some future time. + v02-04 11Feb12: moved .application~setDefaults() to app startup file. + changed to .application~addToConstDir() here. + v02-05 19Feb12: Moved .Application~addToConstDir statement from newInstance + method to top of file - just before ::requires statement(s). + + + [interface (idl format)] + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerView SUBCLASS RcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC UNGUARDED + expose hasParent + -- ADDED FOR EXERCISE06. Statements in the old "StartCustomerView" Routine + -- have been moved here. The ~activate statement has also changed. + use arg rootDlg, customerNo + --say ".CustomerView-newInstance-01: Start." + -- Create an instance of CustomerView and show it: + dlg = .CustomerView~new("Customer\CustomerView.rc", "IDD_CUST_DIALOG") + --say ".CustomerView-newInstance-02: root =" rootDlg + dlg~activate(rootDlg, customerNo) + + + /*---------------------------------------------------------------------------- + Dialog Creation Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Init - creates the dialog instance but does not make it visible. --*/ + ::METHOD init + expose menuBar + --say "CustomerView-init-01." + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Create Menu Bar - Creates the menu bar on the dialog. --*/ + ::METHOD createMenuBar + expose menuBar + --say "CustomerView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Customer\CustomerView.rc", "IDR_CUST_MENU", , , .true) + return .true + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Activate - Shows the Dialog - i.e. makes it visible to the user. --*/ + ::METHOD activate unguarded + use arg rootDlg, customerNo -- ADDED FOR EXERCISE06. + --say "CustomerView-activate-01." + if rootDlg = "SA" then self~execute("SHOWTOP","IDI_CUST_DLGICON") --ADDED FOR EXERCISE06. + else self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_CUST_DLGICON") --ADDED FOR EXERCISE06. + return + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + InitDialog - Called by ooDialog -- */ + ::METHOD initDialog + expose menuBar custControls + --say "CustomerView-initDialog-01." + menuBar~attachTo(self) + -- Create objects that map to the edit controls defined by the "customer.rc" + -- so they can be programmatically used elsewhere in the class: + custControls = .Directory~new + custControls[ecCustNo] = self~newEdit("IDC_CUST_EDT_CUSTNO") + custControls[ecCustName] = self~newEdit("IDC_CUST_EDT_CUSTNAME") + custControls[ecCustAddr] = self~newEdit("IDC_CUST_EDT_CUSTADDR") + custControls[ecCustZip] = self~newEdit("IDC_CUST_EDT_CUSTZIP") + custControls[ecCustDiscount] = self~newEdit("IDC_CUST_EDT_DISCOUNT") + custControls[stLastOrder] = self~newStatic("IDC_CUST_STC_LASTORDERDETAILS") + -- Create an object for the "Record Change" pushbutton in order to be able + -- to change its focus later: + custControls[btnRecordChanges] = self~newPushButton("IDC_CUST_BTN_RECORDCHANGES") + -- Define event handler methods for push-buttons: + self~connectButtonEvent("IDC_CUST_BTN_RECORDCHANGES","CLICKED",recordChanges) + self~connectButtonEvent("IDC_CUST_BTN_SHOWLASTORDER","CLICKED",showLastOrder) + + self~setTitle(.HRScv~dlgTitle) -- set dialog title. + + -- Get app data and then show it: + self~getData + self~showData + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + MenuBar Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + New Customer... Not fully implemented - merely tells user to use the + Customer List object. --*/ + ::METHOD newCustomer unguarded + answer = MessageDialog(.HRScv~useList, self~hwnd,.HRScv~useListCap,"INFORMATION") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Update - Sets fields to edit mode so that user can change the data. + Business Rule: Customer Number cannot be changed. --*/ + ::METHOD update unguarded + expose custControls + say "CustomerView-Update-01" + custControls[ecCustName]~setReadOnly(.false) + custControls[ecCustAddr]~setReadOnly(.false) + custControls[ecCustZip]~setReadOnly(.false) + custControls[ecCustDiscount]~setReadOnly(.false) + self~enableControl("IDC_CUST_BTN_RECORDCHANGES") + custControls[btnRecordChanges]~state = "FOCUS" -- Put focus on the button + self~focusControl("IDC_CUST_EDT_CUSTNAME") -- place cursor in the CustName edit control. + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Last Order - Displays info about the last order placed by this customer.--*/ + ::METHOD lastOrder unguarded + expose custControls + use arg button + orderDate="31/12/11"; orderNum = "ZZ999"; orderTotal = "$999.99" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Print - Not implemented yet --*/ + ::METHOD print unguarded + msg = "The 'Print...' menu item is not yet implemented." + ret = MessageDialog(.HRScv~noPrint, self~hwnd, .HRScv~noPrintCap, 'WARNING') + + + /*---------------------------------------------------------------------------- + PushButton Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Record Changes - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg and disables + the button. --*/ + ::METHOD recordChanges unguarded + expose custControls custData newCustData + --say "CustomerView-recordChanges-01" + + newCustData = .directory~new + newCustData[custName] = custControls[ecCustName]~getLine(1) + newCustData[custAddr] = .array~new + do i=1 to custControls[ecCustAddr]~lines + newCustData[custAddr][i] = custControls[ecCustAddr]~getLine(i) + end + newCustData[custZip] = custControls[ecCustZip]~getLine(1) + newCustData[custDiscount] = custControls[ecCustDiscount]~getLine(1) + + -- Check if anything's changed: + result = self~checkForChanges + if result then say "CustomerView-recordChanges-01: There were changes!" + else say "CustomerView-recordChanges-02: No Changes Found" + + /* Send new data to be checked by CustomerModel (not implemented). */ + + /* Disable controls that were enabled by menu "File-Update" selection: */ + custControls[ecCustName]~setReadOnly(.true) + custControls[ecCustAddr]~setReadOnly(.true) + custControls[ecCustZip]~setReadOnly(.true) + custControls[ecCustDiscount]~setReadOnly(.true) + self~disableControl("IDC_CUST_BTN_RECORDCHANGES") + + + /*---------------------------------------------------------------------------- + Show Last Order - displays mock sales order info in the Last_Order_Details + field; info is hard-coded in this method. --*/ + ::METHOD showLastOrder unguarded + expose CustControls + -- Notionally get last order from "SalesOrder" component. + orderDate="12/2/11"; orderNum = "AB123"; orderTotal = "$524.58" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Get Data - gets data from the CustomerModel component and displays it in the + appropriate controls. --*/ + ::METHOD getData + expose custData + --say "CustomerView-getData-01." + idCustomerModel = .local~my.idCustomerModel + custData = idCustomerModel~query + + /*---------------------------------------------------------------------------- + showData - displays data in the dialog's controls. */ + ::METHOD showData + expose custData custControls + --say "CustomerView-showData-01." + -- Show CustNo and CustName: + custControls[ecCustNo]~setText(custData[custNo]) + custControls[ecCustName]~setText(custData[custName]) + -- Re-format Cust Address from an array into a string with line-ends + -- after each array element except the last, then show it. + arrCustAddr = custData[CustAddr] + strCustAddr = "" + do i=1 to arrCustAddr~items + if i < arrCustAddr~items then do + strCustAddr = strCustAddr||arrCustAddr[i] || .endofline + end + else do + strCustAddr = strCustAddr || arrCustAddr[i] + end + end + custControls[ecCustAddr]~setText(strCustAddr) + -- Finally, show Zip and Discount: + custControls[ecCustZip]~setText(custData[custZip]) + custControls[ecCustDiscount]~setText(custData[custDiscount]) + --custControls[stLastOrder]~setText("Press Me") + + + /*-------------------------------------------------------------------------- + checkForChanges - after "Record Changes" actioned by the user, check whether + any data has actually changed. If it has: (a) assign new data to old data; + (b) return .true. If it hasn't: return .false. + Note: cannot just compare the two directories since data format in Address + is different. --*/ + ::METHOD checkForChanges + expose custData newCustData + changed = .false + if newCustData[custName] \= custData[custName] then do + custData[custName] = newCustData[custName] + changed = .true + end + if custData[CustAddr]~items \= newCustData[CustAddr]~items then changed = .true + else + do i=1 to custData[custAddr]~items + if custData[custAddr][i] \= newCustData[custAddr][i] then do + changed = .true + leave + end + end + if newCustData[custZip] \= custData[custZip] then do + custdata[custZip] = newCustData[custZip] + changed = .true + end + if newCustData[custDiscount] \= custData[custDiscount] then do + custData[custDiscount] = newCustData[custDiscount] + changed = .true + end + -- If no changes after all, display message box: + if \changed then do + msg = .HRScv~nilChanged + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRScv~nilChangedCap,"OK","WARNING","DEFBUTTON2 APPLMODAL") + end + else do + say "CustomerView-checkForChanges-02: changed =" changed + custData = newCustData + end + return changed + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRScv) v02-03 28Jan12 + -------- + This class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRScv PRIVATE -- Human-Readable Strings + ::CONSTANT nilChanged "Nothing was changed! Update not done." + ::CONSTANT nilChangedCap "Update Customer" + ::CONSTANT noPrint "The 'Print...' menu item is not yet implemented." + ::CONSTANT noPrintCap "*Customer Name*" + ::CONSTANT dlgTitle "*Customer*" + ::CONSTANT useList "You must use the Customer List to create a new Customer." + ::CONSTANT useListCap "Create New Customer" +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/StartupCustomer.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/StartupCustomer.rex new file mode 100755 index 0000000..7048805 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/StartupCustomer.rex @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for CustomerView + startupCustomer.rex v01-00 07Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Customer folder. + + Changes: + v01-00 07Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.local~my.idCustomerData = .CustomerData~new -- create Customer Data instance +.local~my.idCustomerModel = .CustomerModel~new -- create Customer Model instance +.local~my.idCustomerData~activate +.local~my.idCustomerModel~activate + +.CustomerView~newInstance("SA") + +::REQUIRES "Customer\CustomerView.rex" +::REQUIRES "Customer\CustomerModelData.rex" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/StartupCustomerList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/StartupCustomerList.rex new file mode 100755 index 0000000..cbfdbd1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/StartupCustomerList.rex @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for CustomerList + startupCustomerList.rex v01-00 07Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Customer folder. + + Changes: + v01-00 107Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.CustomerListView~newInstance("SA") + +::requires "Customer\CustomerListView.rex" + + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/CustList.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/CustList.bmp new file mode 100644 index 0000000..962bee3 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/CustList.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/CustList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/CustList.ico new file mode 100644 index 0000000..c9d2566 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/CustList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/Customer.ico b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/Customer.ico new file mode 100644 index 0000000..e6bc7cc Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Customer/bmp/Customer.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/Popups/OffsetPopups.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/Popups/OffsetPopups.rex new file mode 100755 index 0000000..c5ce015 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/Popups/OffsetPopups.rex @@ -0,0 +1,286 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* ooDialog User Guide + Samples\Popups + OffsetPopups.rex v01-00 07Jun12 + + The four dialogs in this file illustrate how popups can be tested in + stand-alone mode with a single code base. If a given popup pops up another + dialog, then this is treated as part of the "stand-alone" operation of the + first dialog. + + Associated files: None. + + Invocation: OffsetPopups [runType] [offset] + + "runType" controls which dialog to surface in "standalone" mode as follows: + "p" for parent, "c" for child, or "g" for grandchild, "gg" for + greatgrandchild. Parent is the default (and of course "standalone mode" has + no meaning for the parent dialog, as when run it's always the root dialog. + "offset" is a number that governs the extent to which a descendant dialog + is visually offset from the ancestor that surfaced it. + The default is runtype = Parent and offset = 0. + + Changes: + v01-00 07Jun12: First Version + +------------------------------------------------------------------------------*/ + +parse upper arg runtype offset +progName = "OffsetPopups" +if runtype = "?" then do + say + say "+-----------------------------------------------------------------------+" + say "| Demonstration of Popups, four generations, where any generation |" + say "| can be run 'standalone' - that is, as the 'parent' of other 'younger' |" + say "| dialogs. |" + say "| |" + say "| Syntax: 'OffsetPopups [runType] [offset]' |" + say "| |" + say "| - runType: Defines the 'root' dialog as follows: |" + say "| 'p/P' or null for Parent, 'c/C' for Child, |" + say "| 'g/G' for GrandChild, 'gg/GG' for GreatGrandChild. |" + say "| Default is 'P'. |" + say "| |" + say "| - offset: a number (e.g. 100). If present, visibly offsets |" + say "| a descendant dialog from its immediate ancestor. |" + say "| Default is 0 - that is, no offset. |" + say "+-----------------------------------------------------------------------+" + exit +end + +-- Work out which of the four possible formats of parameters applies: +if runtype = "" & offset = "" then case = 1 +if runtype~datatype = "NUM" & offset = "" then case = 2 +if ("PCG"~caselessPos(runtype) >0 | runtype = "GG") & offset = "" then case = 3 +if ("PCG"~caselessPos(runtype) >0 | runtype = "GG") & offset~datatype = "NUM" then case = 4 + +-- Set up parameter values: +select + when case = 1 then do + runtype = "P"; offset = 0 + end + when case = 2 then do + offset = runtype; runtype = "P"; + end + when case = 3 then do + offset = 0 + end + when case = 4 then nop + otherwise do + say "Parameter Error. Run '"||progName||" ?' for parameter values." + exit + end +end + +-- Set up offset amount in View class attribute: +.View~offsetAmount = offset + +-- Launch First Dialog: +select + when runtype = "P" then .ParentDialog~newInstance() + when runtype = "C" then .ChildDialog~newInstance("SA") + when runtype = "G" then .GrandChildDialog~newInstance("SA") + when runtype = "GG" then .GreatGrandChildDialog~newInstance("SA") + otherwise nop +end + +::REQUIRES "ooDialog.cls" + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'ParentDialog' SUBCLASS View -- modified for offset + + ::METHOD newInstance CLASS + dlg = self~new + dlg~activate + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Parent Dialog for Popups", "CENTER") + + + ::METHOD defineDialog + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "Pop Up Child", popup) + + + ::METHOD activate UNGUARDED + self~execute("SHOWTOP") + + + ::METHOD popup UNGUARDED + popupPos = self~getPopupPos() -- added for offset + .ChildDialog~newInstance(self, popupPos) + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'ChildDialog' SUBCLASS View -- modified for offset + + ::METHOD newInstance CLASS + use arg rootDlg, dlgPos -- modified for offset + dlg = self~new + dlg~activate(rootDlg, dlgPos) -- modified for offset + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Child Dialog", "CENTER") + + + ::METHOD defineDialog + self~createPushButton(901, 142, 99, 100, 14, "DEFAULT", "Pop Up Grandchild", popup) + + + ::METHOD activate UNGUARDED + expose rootDlg dlgPos standalone -- modified for offset + use arg rootDlg, dlgPos -- modified for offset + if rootDlg = "SA" then do + rootDlg = self + standAlone = .true -- added for offset + self~execute("SHOWTOP") + end + else self~popupAsChild(rootDlg, "SHOWTOP") + + + ::METHOD initDialog -- added for offset + expose rootDlg dlgPos standalone + if standalone \= .true then self~offset(dlgPos) + + + ::METHOD popup UNGUARDED + expose rootDlg -- modified for offset + popupPos = self~getPopupPos() + .GrandChildDialog~newInstance(rootDlg, popupPos) -- modified for offset +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'GrandChildDialog' SUBCLASS View -- modified for offset + + ::METHOD newInstance CLASS + use arg rootDlg, dlgPos -- modified for offset + dlg = self~new + dlg~activate(rootDlg, dlgPos) -- modified for offset + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Grandchild", "CENTER") + + + ::METHOD defineDialog + self~createPushButton(901, 142, 99, 100, 14, "DEFAULT", "Pop Up GreatGrandchild", popup) + + + ::METHOD activate UNGUARDED + expose rootDlg dlgPos standalone -- modified for offset + use arg rootDlg, dlgPos -- modified for offset + if rootDlg = "SA" then do + rootDlg = self + standAlone = .true -- added for offset + self~execute("SHOWTOP") + end + else self~popupAsChild(rootDlg, "SHOWTOP") + + + ::METHOD initDialog -- added for offset + expose rootDlg dlgPos standalone + if standalone \= .true then self~offset(dlgPos) + + + ::METHOD popup UNGUARDED + expose rootDlg + popupPos = self~getPopupPos(offset) + .GreatGrandChildDialog~newInstance(rootDlg, popupPos) -- modified for offset + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'GreatGrandChildDialog' SUBCLASS View -- modified for offset + + ::METHOD newInstance CLASS + use arg rootDlg, dlgPos -- modified for offset + dlg = self~new + dlg~activate(rootDlg, dlgPos) -- modified for offset + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "GreatGrandchild", "CENTER") + + + ::METHOD activate + expose rootDlg dlgPos -- added for offset + use arg rootDlg, dlgPos -- modified for offset + if rootDlg = "SA" then self~execute("SHOWTOP") + else self~popupAsChild(rootDlg, "SHOWTOP") + + + ::METHOD initDialog -- added for offset + expose rootdlg dlgPos + if rootDlg \= "SA" then self~offset(dlgPos) + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS View SUBCLASS UserDialog -- added for offset + + ::ATTRIBUTE offsetAmount CLASS PUBLIC + + ::METHOD getPopupPos + popupPos = self~getRealpos + offset = .View~offsetAmount + popupPos~incr(offset,offset) + return popupPos + + ::METHOD offset + use arg dlgPos + self~moveTo(dlgPos, 'SHOWWINDOW') + self~ensureVisible() + +/*---------------------------------------------------------------------------*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/Popups/Popups.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/Popups/Popups.rex new file mode 100755 index 0000000..2fdb292 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/Popups/Popups.rex @@ -0,0 +1,221 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* ooDialog User Guide + Samples\Popups + Popups.rex v01-00 07Jun12 + + The four dialogs in this file illustrate how popups can be tested in + stand-alone mode with a single code base. If a given dialog pops up another + dialog, then this is part of the "stand-alone" operation of the + first dialog. + + Associated files: None. + + Invocation: popups [runType] + + "runType" controls which dialog to surface in "standalone" mode as follows: + "p" for parent, "c" for child, or "g" for grandchild, "gg" for + greatgrandchild. Of course "standalone mode" has no meaning for the + parent dialog, as when run it's always the root. + + The default is runtype = Parent. + + Changes: + v01-00 07Jun12: First Version + +------------------------------------------------------------------------------*/ + +parse upper arg runtype +progName = "Popups" +if runtype = "?" then do + say + say "+-----------------------------------------------------------------------+" + say "| Demonstration of Popups, four generations, where any generation |" + say "| can be run 'standalone' - that is, as the 'parent' of other 'younger' |" + say "| dialogs. |" + say "| |" + say "| Syntax: 'Popups [runType]' |" + say "| |" + say "| - runType: Defines the 'root' dialog as follows: |" + say "| 'p/P' or null for Parent, 'c/C' for Child, |" + say "| 'g/G' for GrandChild, 'gg/GG' for GreatGrandChild. |" + say "| Default is 'P'. |" + say "+-----------------------------------------------------------------------+" + exit +end + +-- Work out which of the four possible formats of parameters applies: +if runtype = "" then runtype = "P" + +-- Launch First Dialog: +select + when runtype = "P" then .ParentDialog~newInstance(offset) + when runtype = "C" then .ChildDialog~newInstance("SA",offset) + when runtype = "G" then .GrandChildDialog~newInstance("SA",offset) + when runtype = "GG" then .GreatGrandChildDialog~newInstance("SA",offset) + otherwise do + say "Parameter Error. Run '"||progName||" ?' for parameter values." + exit + end +end + +::REQUIRES "ooDialog.cls" + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'ParentDialog' SUBCLASS UserDialog + + ::METHOD newInstance CLASS + dlg = self~new + dlg~activate() + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Parent Dialog for Popups", "CENTER") + + + ::METHOD defineDialog + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "Pop Up Child", popup) + + + ::METHOD activate UNGUARDED + self~execute("SHOWTOP") + + + ::METHOD popup UNGUARDED + .ChildDialog~newInstance(self) + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'ChildDialog' SUBCLASS UserDialog + + ::METHOD newInstance CLASS + use arg rootDlg + dlg = self~new + dlg~activate(rootDlg) + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Child Dialog", "CENTER") + + + ::METHOD defineDialog + self~createPushButton(901, 142, 99, 100, 14, "DEFAULT", "Pop Up Grandchild", popup) + + + ::METHOD activate UNGUARDED + expose rootDlg + use arg rootDlg + if rootDlg = "SA" then do + rootDlg = self + self~execute("SHOWTOP") + end + else self~popupAsChild(rootDlg, "SHOWTOP") + + + ::METHOD popup UNGUARDED + expose rootDlg + .GrandChildDialog~newInstance(rootDlg) + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'GrandChildDialog' SUBCLASS UserDialog + + ::METHOD newInstance CLASS + use arg rootDlg + dlg = self~new + dlg~activate(rootDlg) + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Grandchild", "CENTER") + + + ::METHOD defineDialog + self~createPushButton(901, 142, 99, 100, 14, "DEFAULT", "Pop Up GreatGrandchild", popup) + + + ::METHOD activate + expose rootDlg + use arg rootDlg + if rootDlg = "SA" then do + rootDlg = self + self~execute("SHOWTOP") + end + else self~popupAsChild(rootDlg, "SHOWTOP") + + + ::METHOD popup UNGUARDED + expose rootDlg + .GreatGrandChildDialog~newInstance(rootDlg) + +/*---------------------------------------------------------------------------*/ + + +/*---------------------------------------------------------------------------*/ + +::CLASS 'GreatGrandChildDialog' SUBCLASS UserDialog + + ::METHOD newInstance CLASS + use arg rootDlg + dlg = self~new + dlg~activate(rootDlg) + + + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "GreatGrandchild", "CENTER") + + + ::METHOD activate + use arg rootDlg + if rootDlg = "SA" then self~execute("SHOWTOP") + else self~popupAsChild(rootDlg, "SHOWTOP") + +/*---------------------------------------------------------------------------*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/ReadMe.txt b/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/ReadMe.txt new file mode 100644 index 0000000..f95760c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Extras/ReadMe.txt @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Additional Examples to Accompany the ooDialog User Guide + ----------------------------------------------------------------------- + + This subdirectory tree contains the example programs referred to in the + appendix of the ooDialog User Guide. The programs are intended to give + context to the discussions in the User Guide, and may, or may not, be of + use to ooRexx programmers by themselves. + + The structure of the subdirectory tree and the programs themselves are + explained in the ooDialog User Guide. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.h new file mode 100644 index 0000000..99b425d --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.h @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDR_ORDFORM_MENU 102 +#define IDD_ORDFORM_DIALOG 105 +#define IDI_ORDFORM_DLGICON 107 +#define IDC_CANCEL 1001 +#define IDM_ORDFORM_PLACE 40000 +#define IDM_ORDFORM_ABOUT 40001 +#define IDC_ORDFORM_DATE 40002 +#define IDM_ORDFORM_SAVE 40003 +#define IDM_ORDFORM_CANCEL 40004 +#define IDC_ORDFORM_ORDNO 40005 +#define IDC_ORDFORM_TABS 40009 +#define IDC_ORDFORM_PLACEORDER 40010 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.rc new file mode 100644 index 0000000..a0d72fc --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.rc @@ -0,0 +1,98 @@ +//*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "OrderFormView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDFORM_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "Place Order...", IDM_ORDFORM_PLACE + MENUITEM "Save Order...", IDM_ORDFORM_SAVE + MENUITEM "Cancel Order", IDM_ORDFORM_CANCEL + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDFORM_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_DIALOG DIALOG 0, 0, 272, 278 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Order Form" +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_ORDFORM_DATE, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_RIGHTALIGN, 185, 9, 70, 15 + EDITTEXT IDC_ORDFORM_ORDNO, 50, 9, 40, 14, ES_AUTOHSCROLL + LTEXT "Order No.", IDC_STATIC, 10, 14, 32, 8, SS_LEFT + LTEXT "Date", IDC_STATIC, 158, 12, 16, 8, SS_LEFT + LTEXT "Total Cost:", IDC_STATIC, 116, 194, 35, 8, SS_LEFT + LTEXT "Discount", IDC_STATIC, 116, 208, 29, 8, SS_LEFT + PUSHBUTTON "Place Order", IDC_ORDFORM_PLACEORDER, 200, 244, 50, 14 + LTEXT "Tax", IDC_STATIC, 116, 222, 13, 8, SS_LEFT + RTEXT "0.00", IDC_STATIC, 164, 208, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 164, 222, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 222, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 194, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 208, 40, 8, SS_RIGHT + CONTROL "", IDC_ORDFORM_TABS, WC_TABCONTROL, 0, 15, 44, 245, 135 + PUSHBUTTON "Cancel Order", IDC_CANCEL, 132, 244, 46, 14 +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDFORM_DLGICON ICON ".\\Order\\bmp\\OrderForm.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.rex new file mode 100755 index 0000000..aed5e8f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderFormView.rex @@ -0,0 +1,188 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The OrderFormView class v01-00 07Jun12 + OrderFormView.rex + + Contains: class "OrderFormView", class "HRSofv". + Pre-requisite files: OrderFormView.rc, OrderFormView.h. + + Changes: + v01-00 07Jun12: First version. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Order\OrderFormView.h") + + +::requires "ooDialog.cls" + + +/*============================================================================== + OrderFormView v01-00 07Jun12 + ------------- + The "view" (or "gui") Data Entry part of the Sales Order component. + + Changes: + v01-00 07Jun12: First Version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderFormView SUBCLASS RcDialog PUBLIC + + ::METHOD newInstance CLASS PUBLIC + use arg rootDlg, orderNo + dlg = self~new("Order\OrderFormView.rc", "IDD_ORDFORM_DIALOG") + --say ".OrderFormView-newInstance: rootDlg =" rootDlg + dlg~activate(rootDlg, orderNo) + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- creates the dialog instance but does not make it visible. + expose menuBar + say "OrderFormView-init-01" + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + say "OrderFormView-createMenuBar-01" + menuBar = .ScriptMenuBar~new("Order\OrderFormView.rc", IDR_ORDFORM_MENU, , , .true) + + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + use arg rootDlg + -- Shows the Dialog - i.e. makes it visible to the user. + say "OrderFormView-activate-01" + if rootDlg = "SA" then self~execute("SHOWTOP","IDI_ORDFORM_DLGICON") + else self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_ORDFORM_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- Called by ooDialog after SHOWTOP. + expose menuBar custControls + say "OrderFormView-initDialog-01" + + menuBar~attachTo(self) + + btnCancelOrder = self~newPushButton("IDC_CANCEL") + btnPlaceOrder = self~newPushButton("IDC_ORDFORM_PLACEORDER") + self~connectButtonEvent("IDC_CANCEL","CLICKED",cancel) + self~connectButtonEvent("IDC_ORDFORM_PLACEORDER","CLICKED",placeOrderBtn) + + return + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD placeOrder UNGUARDED + self~noMenuFunction(.HRSofv~PlaceOrder) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD saveOrder UNGUARDED + self~noMenuFunction(.HRSofv~SaveOrder) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD CancelOrder UNGUARDED + self~cancel + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSofv~HelpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSofv~NoMenu, self~hwnd, title, 'WARNING') + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + -- "Cancel" - This method over-rides the default Windows action of + -- 'cancel window' for an Escape key. + ::METHOD cancel + response = askDialog(.HRSofv~QExit, "N") + if response = 1 then forward class (super) + return + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Button Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD placeOrderBtn UNGUARDED + ret = MessageDialog(.HRSofv~NoBtn, self~hwnd, "Place Order Button", 'WARNING') + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSofv) v01-00 07Jun12 + -------- + The HRSofv class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSofv PRIVATE -- Human-Readable Strings + ::CONSTANT QExit "Are you sure you want to cancel this Order and throw away all changes?" + ::CONSTANT NoMenu "This menu item is not yet implemented." + ::CONSTANT NoBtn "This button is not yet implemented." + ::CONSTANT PlaceOrder "Place Order" + ::CONSTANT SaveOrder "Save Order" + ::CONSTANT CancelOrder "Cancel Order" + ::CONSTANT HelpAbout "Help - About" + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.h new file mode 100644 index 0000000..bc886a6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDLIST_LISTVIEW 106 +#define IDI_ORDLIST_DLGICON 107 +#define IDR_ORDLIST_MENU 108 +#define IDC_ORDLIST_LIST 1000 +#define IDC_ORDLIST_SHOWORDER 1001 +#define IDM_ORDLIST_NEWORDER 40000 +#define IDM_ORDLIST_ABOUT 40001 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.rc new file mode 100644 index 0000000..317a390 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderListView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Order...", IDM_ORDLIST_NEWORDER + } + POPUP "Help" + { + MENUITEM "About...", IDM_ORDLIST_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDLIST_LISTVIEW DIALOG 0, 0, 255, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Order List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_ORDLIST_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING, 15, 10, 225, 215 + DEFPUSHBUTTON "Show Order", IDC_ORDLIST_SHOWORDER, 89, 235, 42, 14, WS_DISABLED +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDLIST_DLGICON ICON ".\\order\\bmp\\OrderList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.rex new file mode 100755 index 0000000..8716ba1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderListView.rex @@ -0,0 +1,250 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The Order ListView v01-00 07Jun12 + + Contains: class "OrderListView", "HRSolv" + + Pre-requisite files: OrderListView.rc, OrderListView.h. + + Description: Provides a list of Orders and supports viewing any given + Order via a double-click on that Order's item in the list. + This is an "Intermediate" component - it is invoked by OrderMgmt, + and invokes OrderView. + + Changes: + v01-00 07Jun12: First Version + + Outstanding Problems: None reported. + +*******************************************************************************/ + + +.Application~addToConstDir("Order\OrderListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Order\OrderView.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderListView v01-00 07Jun12 + ------------- + The view of a list of products. + Changes: + v01-00 07Jun12: First version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderListView SUBCLASS RcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg rootDlg + say ".OrderListView-newInstance-01: root =" "'"||rootDlg||"'" + dlg = self~new("Order\OrderListView.rc", "IDD_ORDLIST_LISTVIEW") + say ".OrderListView-newInstance-02." + dlg~activate(rootDlg) -- Must be the last statement. + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + forward class (super) continue + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + say "OrderListView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Order\OrderListView.rc", "IDR_ORDLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg + use arg rootDlg + say "OrderListView-activate-01: root =" rootDlg + --trace i + if rootDlg = "SA" then do -- If standalone operation required + rootDlg = self -- To pass on to children + self~execute("SHOWTOP","IDI_ORDLIST_DLGICON") + end + else self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_ORDLIST_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvOrders btnShowOrder + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + say "OrderListView-initDialog-01"; say + lvOrders = self~newListView("IDC_ORDLIST_LIST"); + lvOrders~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvOrders~insertColumnPX(0,"OrderNo",60,"LEFT") + lvOrders~insertColumnPX(1,"CustNo",80,"LEFT") + lvOrders~insertColumnPX(2,"CustName",130,"LEFT") + lvOrders~insertColumnPX(3,"Date",80,"LEFT") + self~connectListViewEvent("IDC_ORDLIST_LIST","CLICK",itemSelected) + self~connectListViewEvent("IDC_ORDLIST_LIST","ACTIVATE",openItem) + self~connectButtonEvent("IDC_ORDLIST_SHOWORDER","CLICKED",showOrder) + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newOrder UNGUARDED + self~noMenuFunction(.HRSolv~newOrder) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSolv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSolv~noMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected unguarded + expose lvOrders --btnShowOrder + use arg id, itemIndex, columnIndex, keyState + if itemIndex > -1 then self~enableControl("IDC_ORDLIST_SHOWORDER") + else self~disableControl("IDC_ORDLIST_SHOWORDER") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + say "OrderListView-openItem-01: item selected =" item + self~showOrder + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showOrder unguarded + expose lvOrders rootDlg + item = lvOrders~selected + say "OrderListView-showOrder-01: item selected =" item + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSolv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvOrders~getItemInfo(item, info) then do + say "OrderListView-showOrder-02: info~text =" info~text + .local~my.idOrderData = .OrderData~new -- create Order Data instance + .local~my.idOrderModel = .OrderModel~new -- create Order Model instance + .local~my.idOrderData~activate + .local~my.idOrderModel~activate + .OrderView~newInstance(rootDlg,"DM00263") + --say "OrderListView-showOrder-03: after startOrderView" + self~disableControl("IDC_ORDLIST_SHOWORDER") + end + else do + say "OrderListView-showOrder-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvOrders + + lvOrders~addRow( 1, ,"DM00263", "CU003", "ABC Inc.", "21Nov12") + lvOrders~addRow( 2, ,"DM10473", "AB15784", "Frith Inc.", "12Oct12") + lvOrders~addRow( 3, ,"DM13003", "CU001", "LMN & Co", "07Jun12") + lvOrders~addRow( 4, ,"AS49005", "CU003", "EJ Smith", "30Aug12") + lvOrders~addRow( 5, ,"AM72010", "CU005", "Red-On Inc.","17Jan13") + lvOrders~addRow( 6, ,"OZ15784", "CU003", "Joe Bloggs & Co Ltd","28Feb13") + /*do i = 1 to 50 + lvOrders~addRow(i, , "Line" i, i) + end*/ + lvOrders~setColumnWidth(1) -- set width of 2nd column to longest text entry. + + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSolv (Human-Readable Strings for OrderListView) v01-00 07Jun12 + --- + The HRSolv class provides constant character strings for user-visible messages + issued by the OrderListView class. + + Changes: + v01-00 07Jun12: First Version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSolv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newOrder "New Order" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderModelData.rex new file mode 100755 index 0000000..df26493 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderModelData.rex @@ -0,0 +1,139 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The OrderModel and OrderData Classes v01-00 07Jun12 + + Contains: classes "OrderModel" and "OrderResource". + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderModel v01-00 07Jun12 + ------------ + The "model" part of the Order component. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderModel PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + aOrderModel = self~new + return aOrderModel + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD activate PUBLIC + -- Gets its data from ProductData. + expose idOrderData + idOrderData = .local~my.idOrderData + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + expose idOrderData + say "OrderModel-query-01." + data = idOrderData~getData + return data +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderData v01-00 07Jun12 + ------------ + The "data" part of the Order component. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderData PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + aOrderData = self~new + return aOrderData + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate PUBLIC + expose custData + custData = .directory~new + custData[custNo] = "AB15784" + custData[custName] = "Joe Bloggs & Co Ltd" + arrCustAddr = .array~new + arrCustAddr[1] = "28 Frith Street" + arrCustAddr[2] = "Hardington" + arrCustAddr[3] = "Blockshire" + custData[CustAddr] = arrCustAddr + custData[custZip] = "LB7 4EJ" + custData[custDiscount]= "B1" + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC + expose custData + say "OrderData-getData-01." + return custData + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.h new file mode 100644 index 0000000..969b70a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.h @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDER_DIALOG 108 +#define IDI_ORDER_DLGICON 109 +#define IDR_ORDER_MENU 110 +#define IDC_ORDER_NAMEADDR 1000 +#define IDC_ORDER_DATE 1001 +#define IDM_ORDER_DOTHIS 40000 +#define IDM_ORDER_ABOUT 40001 +#define IDC_ORDER_ORDNO 40007 +#define IDC_ORDER_CUSTNO 40008 +#define IDC_ORDER_ITEMS 40009 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.rc new file mode 100644 index 0000000..a8f21c7 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.rc @@ -0,0 +1,87 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDER_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "An Action", IDM_ORDER_DOTHIS + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDER_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDER_DIALOG DIALOG 0, 0, 272, 271 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Sales Order" +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_ORDER_DATE, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_RIGHTALIGN, 185, 15, 70, 15 + EDITTEXT IDC_ORDER_ORDNO, 215, 35, 40, 14, ES_AUTOHSCROLL + EDITTEXT IDC_ORDER_CUSTNO, 215, 55, 40, 14, ES_AUTOHSCROLL + LTEXT "Order No.", IDC_STATIC, 174, 38, 32, 8, SS_LEFT + LTEXT "Customer No.", IDC_STATIC, 170, 58, 44, 8, SS_LEFT + CONTROL "", IDC_ORDER_ITEMS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_ICON, 20, 75, 240, 115 + LTEXT "Date", IDC_STATIC, 158, 18, 16, 8, SS_LEFT + LTEXT "Total Cost:", IDC_STATIC, 116, 200, 35, 8, SS_LEFT + LTEXT "Discount", IDC_STATIC, 116, 214, 29, 8, SS_LEFT + DEFPUSHBUTTON "Cancel", IDCANCEL, 190, 245, 37, 14 + LTEXT "Tax", IDC_STATIC, 116, 228, 13, 8, SS_LEFT + RTEXT "0.00", IDC_STATIC, 164, 214, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 164, 228, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 228, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 200, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 214, 40, 8, SS_RIGHT + EDITTEXT IDC_ORDER_NAMEADDR, 20, 30, 103, 39, ES_AUTOHSCROLL + LTEXT "Customer:", IDC_STATIC, 28, 16, 32, 8, SS_LEFT +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDER_DLGICON ICON ".\\Order\\bmp\\OrderForm.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.rex new file mode 100755 index 0000000..b44f5d6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/OrderView.rex @@ -0,0 +1,174 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The OrderView class v01-00 07Jun12 + + OrderFormView.rex + + Contains: class "OrderView". + Pre-requisite files: OrderView.rc, OrderView.h. + + Description: A sample Order View component - part of the sample + Order Management application. + This is a "leaf" component - invoked by OrderListView. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Order\OrderView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Order\OrderModelData.rex" + + +/*============================================================================== + OrderView v01-00 07Jun12 + ------------- + The "view" (or "gui") part of the Order component - part of the sample + Order Management application. + + Changes: + v01-00 07Jun12: First Version. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderView SUBCLASS RcDialog PUBLIC + + ::METHOD newInstance CLASS PUBLIC + expose rootDlg + use arg rootDlg, orderNo + say ".OrderView-newInstance: rootDlg =" rootDlg + dlg = self~new("Order\OrderView.rc", "IDD_ORDER_DIALOG") + dlg~activate(rootDlg, orderNo) + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- creates the dialog instance but does not make it visible. + expose menuBar + say "OrderView-init-01" + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + say "OrderView-createMenuBar-01" + menuBar = .ScriptMenuBar~new("Order\OrderView.rc", IDR_ORDER_MENU, , , .true) + + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + use arg rootDlg + -- Shows the Dialog - i.e. makes it visible to the user. + say "OrderView-activate-01" + if rootDlg = "SA" then self~execute("SHOWTOP","IDI_ORDER_DLGICON") + else self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_ORDER_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- Called by ooDialog after SHOWTOP. + expose menuBar custControls + say "OrderView-initDialog-01" + + menuBar~attachTo(self) + + return + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD anAction UNGUARDED + self~noMenuFunction(.HRSov~anAction) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSov~HelpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSov~NoMenu, self~hwnd, title, 'WARNING') + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + -- "Cancel" - This method over-rides the default Windows action of + -- 'cancel window' for an Escape key. + ::METHOD cancel + response = askDialog(.HRSov~QExit, "N") + if response = 1 then forward class (super) + return + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSov) v01-00 07Jun12 + -------- + The HRSofv class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSov PRIVATE -- Human-Readable Strings + ::CONSTANT anAction "An Action" + ::CONSTANT NoMenu "This menu item is not implemented." + ::CONSTANT QExit "Are you sure you want to cancel this Order View?" + ::CONSTANT HelpAbout "About Sales Order" + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrder.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrder.rex new file mode 100755 index 0000000..bb77162 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrder.rex @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for OrderForm + startupOrder.rex v01-00 07Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Order folder. + + Changes: + v01-00 07Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.OrderView~newInstance("SA") + +::REQUIRES "Order\OrderView.rex" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrderForm.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrderForm.rex new file mode 100755 index 0000000..3884c32 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrderForm.rex @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for OrderForm + startupOrderForm.rex v01-00 07Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Order folder. + + Changes: + v01-00 07Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.OrderFormView~newInstance("SA") + +::REQUIRES "Order\OrderFormView.rex" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrderList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrderList.rex new file mode 100755 index 0000000..6d3c89b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/StartupOrderList.rex @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for OrderForm + startupOrderForm.rex v01-00 07Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Order folder. + + Changes: + v01-00 07Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.OrderListView~newInstance("SA") + +::REQUIRES "Order\OrderListView.rex" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderForm.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderForm.bmp new file mode 100644 index 0000000..2c2ca38 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderForm.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderForm.ico b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderForm.ico new file mode 100644 index 0000000..7b5e883 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderForm.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderList.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderList.bmp new file mode 100644 index 0000000..4cc094e Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderList.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderList.ico new file mode 100644 index 0000000..1c5b303 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Order/bmp/OrderList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.h new file mode 100644 index 0000000..b86c0b1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.h @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDMGR 100 +#define IDR_ORDMGR_MENU 102 +#define IDC_ORDMGR_RESET 1000 +#define IDC_ORDMGR_EXIT 1001 +#define IDC_ORDMGR_ICONS 1002 +#define IDM_ORDMGR_NEWORDER 40000 +#define IDM_ORDMGR_ORDERLIST 40001 +#define IDM_ORDMGR_CUSTLIST 40002 +#define IDM_ORDMGR_CUSTSEARCH 40003 +#define IDM_ORDMGR_PRODLIST 40004 +#define IDM_ORDMGR_PRODSEARCH 40005 +#define IDM_ORDMGR_ORDERSEARCH 40006 +#define IDM_ORDMGR_PRODNEW 40007 +#define IDM_ORDMGR_CUSTNEW 40008 +#define IDM_ORDMGR_ORDERNEW 40009 +#define IDM_ORDMGR_ABOUT 40010 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.rc new file mode 100644 index 0000000..b53ec13 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.rc @@ -0,0 +1,96 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderMgrView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDMGR_MENU MENU +{ + POPUP "Orders" + { + MENUITEM "New Order...", IDM_ORDMGR_NEWORDER + MENUITEM "Order List...", IDM_ORDMGR_ORDERLIST + MENUITEM "Order Search...", IDM_ORDMGR_ORDERSEARCH + } + POPUP "Customers" + { + MENUITEM "Customer List...", IDM_ORDMGR_CUSTLIST + MENUITEM "Customer Search...", IDM_ORDMGR_CUSTSEARCH + } + POPUP "Products" + { + MENUITEM "Product List...", IDM_ORDMGR_PRODLIST + MENUITEM SEPARATOR + MENUITEM "Product Search...", IDM_ORDMGR_PRODSEARCH + } + POPUP "New" + { + MENUITEM "Product...", IDM_ORDMGR_PRODNEW + MENUITEM "Customer...", IDM_ORDMGR_CUSTNEW + MENUITEM "Order...", IDM_ORDMGR_ORDERNEW + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDMGR_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDMGR DIALOG 0, 0, 310, 209 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Exit Application", IDC_ORDMGR_EXIT, 245, 186, 60, 15 + PUSHBUTTON "Reset Icons", IDC_ORDMGR_RESET, 5, 186, 50, 15 + CONTROL "", IDC_ORDMGR_ICONS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_ICON, 5, 5, 300, 175 +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.rex new file mode 100755 index 0000000..ce5ea8a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/OrderMgrView.rex @@ -0,0 +1,333 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: OrderMgrView.rex v01-00 30Jly13 + + Contains: class: "OrderMgrView", "HRSomv" + + Description: A sample Order Manager View class - part of the sample + Order Manager component. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version (ooDialog 4.2.1) - used dlgArea for re-sizing. + 18Jan13: Second Version (ooDialog 4.2.2) - uses ResizingAdmin for + re-sizing. + 30Jly14: Corrected .ImageList~create(...) statement in + createIconList method. +------------------------------------------------------------------------------*/ + +-- Use the global .constDir for symbolic IDs - load them from OrderMgrView.h +.Application~addToConstDir("OrderMgr\OrderMgrView.h") + +call "OrderMgr\RequiresList.rex" + +::REQUIRES "ooDialog.cls" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderMgrView v01-00 18Jan13 + -------------------- + To the user, this class is the Order Management Application. It provides + access to the various functions required for managing Sales orders. + In this Exercise, however, only very basic application function is provided. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderMgrView SUBCLASS RcDialog PUBLIC INHERIT ResizingAdmin + + ::ATTRIBUTE lv PRIVATE -- The ListView that contains the icons. + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + say ".OrderMgrView-newInstance-01." + dlg = .OrderMgrView~new("OrderMgr\OrderMgrView.rc", IDD_ORDMGR) + dlg~activate + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + expose menuBar records + forward class (super) continue + say "OrderMgrView-init-01." + menuBar = .ScriptMenuBar~new("OrderMgr\OrderMgrView.rc", IDR_ORDMGR_MENU, , , .true) + self~createIconList + records = self~initRecords + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineDialog + say "OrderMgrView-defineDialog-01." + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + say "OrderMgrView-activate-01." + self~execute("SHOWTOP", IDI_DLG_OOREXX) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar records iconList + say "OrderMgrView-initDialog-01." + menuBar~attachTo(self) + + -- Create a proxy for the List View and store in instance variable 'lv'. + self~lv = self~newListView(IDC_ORDMGR_ICONS) + + -- Add the Image List to the ListView: + self~lv~setImageList(iconList, NORMAL) + -- Add icons (i.e. records) to the ListView: + do i=1 to records~items + self~lv~addRow(, i-1, records[i]~name) + end + + self~connectListViewEvent(IDC_ORDMGR_ICONS, "ACTIVATE", "onDoubleClick") + -- Following line required to allow icons to be dragged around the listview. + self~connectListViewEvent(IDC_ORDMGR_ICONS, "BEGINDRAG", "DefListDragHandler") + self~connectButtonEvent("IDC_ORDMGR_EXIT", "CLICKED",exitApp) + self~connectButtonEvent("IDC_ORDMGR_RESET","CLICKED",resetIcons) + self~setTitle(.HRSomv~WindowTitle) -- set dialog title. + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createIconList PRIVATE + -- This method simulates getting the icon "data" for the OrderMgr view. + -- The icon data is loaded into 'iconList' which is an 'ImageList' as + -- required by the ListView control. + expose iconList + --say "OrderMgrView-createIconList." + imgCustList = .Image~getImage("customer\bmp\CustList.bmp") + imgProdList = .Image~getImage("product\res\ProdList.bmp") + imgOrderList = .Image~getImage("order\bmp\OrderList.bmp") + imgOrderForm = .Image~getImage("order\bmp\OrderForm.bmp") + iconList = .ImageList~create(.Size~new(64, 64), .Image~toId(ILC_COLOR4), 4, 0) + -- Boldly assume no errors in creating the Image List or in the ~getImage statements. + iconList~add(imgCustList) -- item 0 in iconList (item 1 in records) + iconList~add(imgProdList) -- item 1 in iconList (item 2 in records) + iconList~add(imgOrderList) -- item 2 in iconList (item 3 in records) + iconList~add(imgOrderForm) -- item 3 in iconList (item 4 in records) + imgCustList~release + imgProdList~release + imgOrderList~release + imgOrderForm~release + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initRecords PRIVATE + -- This method simulates getting the "data" for the OrderMgr view. + expose records + records = .array~new() + + rec = .directory~new + rec~ID = "CustomerList" + rec~name = "Customer List" + records[1] = rec + + rec = .directory~new + rec~ID = "ProductList" + rec~name = "Product List" + records[2] = rec + + rec = .directory~new + rec~ID = "OrderList" + rec~name = "Sales Orders" + records[3] = rec + + rec = .directory~new + rec~ID = "OrderForm" + rec~name = "New Order" + records[4] = rec + + return records + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - Orders - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newOrder UNGUARDED + expose records + self~showModel(records[4]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD orderList UNGUARDED + expose records + self~showModel(records[3]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD orderSearch UNGUARDED + self~noMenuFunction(.HRSomv~OrdSrch) + + /*- - Customers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customerList UNGUARDED + expose records + self~showModel(records[1]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customerSearch UNGUARDED + self~noMenuFunction(.HRSomv~CustSrch) + + /*- - Products - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD productList + expose records + self~showModel(records[2]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD productSearch UNGUARDED + self~noMenuFunction(.HRSomv~ProdSrch) + + /*- - New - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD product UNGUARDED + self~noMenuFunction(.HRSomv~NewProd) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customer UNGUARDED + self~noMenuFunction(.HRSomv~NewCust) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD order UNGUARDED + self~newOrder + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSomv~HelpAbout) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSomv~NoMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Icon Double-Click + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onDoubleClick UNGUARDED + expose records + --use arg id + --say "OrderMgrView-onDoubleClick-01." + -- Get the index of the item with the focus, use the index to retrieve + -- the item's record: + index = self~lv~focused -- lv is an attribute of the superclass. + record = records[index+1] + --say "OrderMgrView-onDoubleClick-02: Record ID =" record~ID + self~showModel(record) + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - PushButton Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD resetIcons + r = self~lv~arrange + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD exitApp UNGUARDED + --say "OrderMgrView-exitApp-01." + self~cancel + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + --say "OrderMgrView-cancel-01." + response = askDialog(.HRSomv~QExit, "N") + if response = 1 then forward class (super) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD ok + -- Invoked when enter key pressed - if passed to superclass, cancels dialog. + return -- do not close dialog - appears as a no-op to the user. + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel UNGUARDED + /* Surface the view of an icon (i.e. view of the model represented by the icon). + Ideally, if already instantiated, surface it, else makeInstance. + In this version, get as many as you like - but all have the same data!.*/ + use arg record -- record is a directory object. + className = record~ID + --say "OrderMgrView-showModel-01: className =" className + viewClassName = className||"View" + interpret "."||viewClassName||"~newInstance(self)" + --say "OrderMgrView-showModel-02:" + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSomv (Human-Readable Strings for OrderMgrView) v01-00 07Jun12 + --- + The HRSomv class provides constant character strings for user-visible messages + issued by the OrderMgrBaseView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSomv PRIVATE -- Human-Readable Strings + ::CONSTANT QExit "Are you sure you want to close all windows and exit the application?" + ::CONSTANT NoMenu "This menu item is not yet implemented." + ::CONSTANT OM "Order Manager" + ::CONSTANT OrdSrch "Order Search" + ::CONSTANT CustSrch "Customer Search" + ::CONSTANT ProdSrch "Product Search" + ::CONSTANT NewCust "New Customer" + ::CONSTANT NewProd "New Product" + ::CONSTANT HelpAbout "Help - About" + ::CONSTANT WindowTitle "Sales Order Management" -- Dialog Caption + ::CONSTANT Reset "Reset Icons" -- PushButton + ::CONSTANT ExitApp "Exit Application" -- PushButton +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/RequiresList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/RequiresList.rex new file mode 100755 index 0000000..4b4a3de --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/OrderMgr/RequiresList.rex @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: RequiresList.rex v01-00 07Jun12 + + Contains: The list of View components that OrderMgrView requires. + + Pre-requisites: Class "OrderMgrView + + Description: This script is called by OrderMgrView. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version +------------------------------------------------------------------------------*/ + +--say "RequiresList." + +::REQUIRES "Customer\CustomerListView.rex" +::REQUIRES "Product\ProductListView.rex" +::REQUIRES "Order\OrderListView.rex" +::REQUIRES "Order\OrderFormView.rex" + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.h new file mode 100644 index 0000000..67f5489 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODLIST_DIALOG 102 +#define IDR_PRODLIST_MENU 104 +#define IDI_PRODLIST_DLGICON 105 +#define IDC_PRODLIST_SHOWPRODUCT 1000 +#define IDC_PRODLIST_LISTVIEW 1001 +#define IDM_PRODLIST_NEWPROD 40000 +#define IDM_PRODLIST_ABOUT 40001 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.rc new file mode 100644 index 0000000..539fa1e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.rc @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "ProductListView.h" + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Product...", IDM_PRODLIST_NEWPROD + } + POPUP "Help" + { + MENUITEM "About...", IDM_PRODLIST_ABOUT + } +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODLIST_DIALOG DIALOG 0, 0, 225, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_PRODLIST_LISTVIEW, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING, 15, 10, 190, 215 + DEFPUSHBUTTON "Show Product", IDC_PRODLIST_SHOWPRODUCT, 90, 235, 50, 14, WS_DISABLED +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_PRODLIST_DLGICON ICON ".\\product\\res\\ProdList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.rex new file mode 100755 index 0000000..5148d8d --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductListView.rex @@ -0,0 +1,237 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: The Product List View v01-00 06Jun12 + + Contains: classes "ProductListView, HRSplv (for human-readable strings) + + Pre-requisites: ProductListView.rc, ProductListView.h, ProdList.ico + + Description: An "intermediate" component - called by OrderMgr, + invokes "ProductView". + + Changes: + v01-00 06Jun12: First version. + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~addToConstDir("Product\ProductListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Product\ProductView.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductListView v01-00 06Jun12 + ------------- + The view of a list of products. + Changes: + v01-00: First version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductListView SUBCLASS RcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg rootDlg + --say ".ProductListView-newInstance-01: rootDlg =" rootDlg + dlg = self~new("Product\ProductListView.rc", "IDD_PRODLIST_DIALOG") + --say ".ProductListView-newInstance-02." + dlg~activate(rootDlg) + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + forward class (super) continue + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "ProductListView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Product\ProductListView.rc", "IDR_PRODLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg + use arg rootDlg + --say "ProductListView-activate-01: root =" root + + if rootDlg = "SA" then do -- If standalone operation required + rootDlg = self -- To pass on to children + self~execute("SHOWTOP","IDI_PRODLIST_DLGICON") + end + else self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_PRODLIST_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvProducts btnShowProduct + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + --say "ProductListView-initDialog-01"; say + lvProducts = self~newListView("IDC_PRODLIST_LISTVIEW"); + lvProducts~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvProducts~insertColumnPX(0,"Number",60,"LEFT") + lvProducts~insertColumnPX(1,"Name",150,"LEFT") + lvProducts~insertColumnPX(2,"Zip",50,"LEFT") + self~connectListViewEvent("IDC_PRODLIST_LISTVIEW","CLICK",itemSelected) + self~connectListViewEvent("IDC_PRODLIST_LISTVIEW","ACTIVATE",openItem) + self~connectButtonEvent("IDC_PRODLIST_SHOWPRODUCT","CLICKED",showProduct) + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newProduct UNGUARDED + self~noMenuFunction(.HRSplv~newProd) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSplv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg caption + ret = MessageDialog(.HRSplv~noMenu, self~hwnd, caption, 'WARNING') + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected unguarded + expose lvProducts + use arg id, itemIndex, columnIndex, keyState + --say "ProductListView-itemSelected: itemIndex, columnIndex, keyState:" itemIndex columnIndex keyState + --say "ProductListView-itemSelected: item selected is:"lvProducts~selected + if itemIndex > -1 then self~enableControl("IDC_PRODLIST_SHOWPRODUCT") + else self~disableControl("IDC_PRODLIST_SHOWPRODUCT") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + --say "ProductListView-openItem-01: item selected =" item + self~showProduct + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD showProduct UNGUARDED + expose lvProducts rootDlg + item = lvProducts~selected + say "ProductListView-showProduct-01: item selected =" item + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSplv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvProducts~getItemInfo(item, info) then do + --say "ProductListView-showProduct-02: info~text =" info~text + --say "ProductListView-showProduct-03; root =" root + .local~my.idProductData = .ProductData~newInstance -- create a ProductData instance + .local~my.idProductModel = .ProductModel~newInstance -- create a ProductModel instance + .local~my.idProductData~activate + .local~my.idProductModel~activate + .ProductView~newInstance(rootDlg,"CU003") + --say "ProductListView-showProduct-04: after startProductView" + self~disableControl("IDC_PRODLIST_SHOWPRODUCT") + end + else do + say "ProductListView-showProduct-05: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvProducts + lvProducts~addRow(2, ,"CU003","Widget, 5in") + lvProducts~addRow(4, ,"CU025","Slodget, case of 24", "RG7 3UP") + lvProducts~addRow(3, ,"DX210","Driblet, 5in, 10-pack, no delivery.", "021956") + do i = 1 to 50 + lvProducts~addRow(i, , "Line" i, i) + end + lvProducts~setColumnWidth(1) -- set width of 2nd column to longest text entry. + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSplv (Human-Readable Strings for ProductListView) v01-00 06Jun12 + ------ + The HRS class provides constant character strings for user-visible messages + issued by the ProductListView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSplv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newProd "New Product" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductModelData.rex new file mode 100755 index 0000000..b88897c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductModelData.rex @@ -0,0 +1,171 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 04b: The ProductModel and ProductData Classes v00-03 08Aug11 + + Contains: classes "ProductModel", "ProductResource", and "ProductDT". + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v00-02: 21Jly11 + v00-03: Correct "return" statement not in right place (typo in code!!) + Renamed the ProductDT attributes (initial "prod" deemed extraneous) + - 26Aug11: added some comments - no change to function. +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductModel v00-02 12Jly11 + ------------ + The "model" part of the Product component. + + interface productModel{ + aProductModel newInstance() -- Class method. + null activate() + aProductDT query() + }; + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductModel PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + aProductModel = self~new + return aProductModel + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD activate PUBLIC + -- Gets its data from ProductData. + expose data + idProductData = .local~my.idProductData + data = idProductData~getData + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + expose data + say "ProductModel-query." + return data +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductData v01-00 20Jly11 + ------------ + The "data" part of the Product component. + [interface (idl format)] + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductData PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + aProductData = self~new + return aProductData + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate PUBLIC + expose data + data = .ProductDT~new + data~number = "CF300/X" + data~name = "Widget Box" + data~price = "2895" + data~uom = "6" + data~description = "A 10 litre case with flat sides capable of holding quite a lot of stuff." + data~size = "M" + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC + expose data + say "ProductData-getData." + return data + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductDT - A business data type for Product data. v00-02 07Aug11 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS ProductDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE number -- number Product Number + ::ATTRIBUTE name -- name Product Description + ::ATTRIBUTE price -- price Product Price (rightmost two digits are 100ths of currency unit) +--::ATTRIBUTE currency -- currency Three-letter currency code + ::ATTRIBUTE uom -- uom Product Unit of Measure + ::ATTRIBUTE description -- descrip Product Description + ::ATTRIBUTE size -- size Produce Size Category (S/M/L) + + ::METHOD list PUBLIC + expose number name price uom description size + say "---------------" + say "ProductDT-List:" + say "Number: " number "Name:" name + say "Price:" price "UOM:" uom "Size:" size + say "Description:" description + say "---------------" +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.h b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.h new file mode 100644 index 0000000..b22805a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.h @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODUCT_VIEW 106 +#define IDR_PRODUCT_VIEW_MENU 107 +#define IDD_PRODUCT_VIEW_ABOUT 108 +#define IDB_PROD_ICON 112 +#define IDI_PROD_DLGICON 113 +#define IDC_PRODABT_ICON_PLACE 1000 +#define IDC_PROD_NO 1000 +#define IDC_PROD_UOM 1001 +#define IDC_PROD_DESCRIPTION 1002 +#define IDC_PROD_STATIC2 1003 +#define IDC_PROD_STATIC3 1004 +#define IDC_PROD_STATIC1 1005 +#define IDC_PROD_STATIC4 1007 +#define IDC_PROD_STATIC5 1008 +#define IDM_PROD_UPDATE 40000 +#define IDM_PROD_REFRESH 40001 +#define IDM_PROD_CLOSE 40002 +#define IDM_PROD_PRINT 40003 +#define IDM_PROD_ABOUT 40004 +#define IDC_PROD_NAME 40010 +#define IDC_PROD_LIST_PRICE 40012 +#define IDC_PROD_SIZE_GROUP 40013 +#define IDC_PROD_SAVE_CHANGES 40014 +#define IDC_PROD_RADIO_SMALL 40015 +#define IDC_PROD_RADIO_MEDIUM 40016 +#define IDC_PRODABT_STATIC1 40017 +#define IDC_PROD_RADIO_LARGE 40017 +#define IDC_PRODABT_STATIC2 40018 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.rc new file mode 100644 index 0000000..742651b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.rc @@ -0,0 +1,124 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + + +#include +#include +#include +#include "ProductView.h" + + + + +// +// Bitmap resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_PROD_ICON BITMAP ".\\res\\producticon.bmp" + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODUCT_VIEW_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "&Update Product", IDM_PROD_UPDATE + MENUITEM "Refresh Data", IDM_PROD_REFRESH + MENUITEM "Print...", IDM_PROD_PRINT + MENUITEM "Close", IDM_PROD_CLOSE + } + POPUP "Help" + { + MENUITEM "About...", IDM_PROD_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW DIALOG 0, 0, 248, 228 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Product Number:", IDC_PROD_STATIC1, 25, 28, 54, 8, SS_LEFT + LTEXT "Product Name:", IDC_PROD_STATIC2, 25, 53, 48, 8, SS_LEFT + LTEXT "List Price:", IDC_PROD_STATIC3, 25, 78, 32, 8, SS_LEFT + LTEXT "UOM:", IDC_PROD_STATIC5, 151, 78, 20, 8, SS_LEFT + LTEXT "Description", IDC_PROD_STATIC4, 25, 103, 36, 8, SS_LEFT + EDITTEXT IDC_PROD_NO, 95, 25, 50, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_NAME, 95, 51, 130, 13, ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_LIST_PRICE, 95, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + EDITTEXT IDC_PROD_UOM, 175, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + GROUPBOX "Size Category", IDC_PROD_SIZE_GROUP, 31, 151, 189, 30, WS_GROUP, WS_EX_CLIENTEDGE + AUTORADIOBUTTON "Small", IDC_PROD_RADIO_SMALL, 46, 165, 33, 8, WS_DISABLED + AUTORADIOBUTTON "Medium", IDC_PROD_RADIO_MEDIUM, 110, 165, 41, 8, WS_DISABLED + AUTORADIOBUTTON "Large", IDC_PROD_RADIO_LARGE, 168, 165, 34, 8, WS_DISABLED + DEFPUSHBUTTON "Save Changes", IDC_PROD_SAVE_CHANGES, 180, 195, 52, 14, WS_DISABLED + EDITTEXT IDC_PROD_DESCRIPTION, 95, 100, 125, 30, ES_MULTILINE +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW_ABOUT DIALOG 0, 0, 204, 109 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "About Product View" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 143, 88, 50, 14 + CONTROL "", IDC_PRODABT_ICON_PLACE, WC_STATIC, SS_BITMAP | SS_NOTIFY | SS_REALSIZECONTROL, 16, 7, 102, 71 + LTEXT "A view of a Product component.", IDC_PRODABT_STATIC1, 15, 84, 110, 15, SS_LEFT + LTEXT "An example of an About box using .ResDialog.", IDC_PRODABT_STATIC2, 130, 9, 65, 65, SS_LEFT +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_PROD_DLGICON ICON ".\\res\\Product.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.rex new file mode 100755 index 0000000..b684411 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/ProductView.rex @@ -0,0 +1,499 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: ProductView.rex - The ProductView component v01-01 01Apr13 + + Contains: classes "ProductView", "AboutDialog", and "HRSpv". + + Pre-requisites: ProductView.dll, ProductView.h, Pproduct.ico, ProductIcon.bmp, + Support\NumberOnlyEditEx.cls (copied from ooDialog Samples + into the folder Exercise06\Support) + + Description: A sample Product View component - part of the sample + Order Management application. + + Outstanding Problems: None reported. + + Changes: + v01-00 03Jun12: First version for Exercise05. + v01-01 06Jun12: Minor changes for Exercise06. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + +.Application~addToConstDir("Product\ProductView.h") + + +::requires "ooDialog.cls" +::requires "Support\NumberOnlyEditEx.cls" +::requires "Product\ProductModelData.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductView v01-01 06Jun12 + ----------- + The "view" part of the Product component. Now designed to operate from its own + folder. Should be invoked from immediately outside the Product folder. + [interface (idl format)] + + Changes: + v01-00 03Jun12: First version. + v01-01 06Jun12: Minor changes for Exercise06. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductView SUBCLASS ResDialog PUBLIC + + ::ATTRIBUTE dialogState PRIVATE -- States are: 'closable' or 'inUpdate". + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC UNGUARDED + use arg rootDlg, productNo --ADDED FOR EXERCISE06. + if parent = "SA" then hasParent = .false; else hasParent = .true + --say ".ProductView-newInstance-01: rootDlg =" rootDlg + .Application~addToConstDir("Product\ProductView.h") + -- Create an instance of ProductView and show it: + dlg = .ProductView~new("Product\res\ProductView.dll", IDD_PRODUCT_VIEW) + dlg~activate(rootDlg, productNo) -- CHANGED FOR EXERCISE06. + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + --say "ProductView-init-01." + -- called first (result of .ProductView~new) + forward class (super) continue + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + use arg rootDlg, productNo --ADDED FOR EXERCISE06. + --say "ProductView-activate-01: rootDlg =" rootDlg + self~dialogState = "closable" + if rootDlg = "SA" then self~execute("SHOWTOP","IDI_PROD_DLGICON") --ADDED FOR EXERCISE06. + else self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_PROD_DLGICON") --ADDED FOR EXERCISE06. + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar prodControls prodData + --say "ProductView-initDialog-01" + + menuBar = .BinaryMenuBar~new(self, IDR_PRODUCT_VIEW_MENU, , self, .true) + + prodControls = .Directory~new + prodControls[ecProdNo] = self~newEdit("IDC_PROD_NO") + prodControls[ecProdName] = self~newEdit("IDC_PROD_NAME") + prodControls[ecProdPrice] = self~newEdit("IDC_PROD_LIST_PRICE") + prodControls[ecUOM] = self~newEdit("IDC_PROD_UOM") + prodControls[ecProdDescr] = self~newEdit("IDC_PROD_DESCRIPTION") + prodControls[gbSizes] = self~newEdit("IDC_PROD_SIZE_GROUP") + prodControls[rbSmall] = self~newRadioButton("IDC_PROD_RADIO_SMALL") + prodControls[rbMedium] = self~newRadioButton("IDC_PROD_RADIO_MEDIUM") + prodControls[rbLarge] = self~newRadioButton("IDC_PROD_RADIO_LARGE") + prodControls[pbSaveChanges] = self~newPushButton("IDC_PROD_SAVE_CHANGES") + self~connectButtonEvent("IDC_PROD_SAVE_CHANGES","CLICKED",saveChanges) + + -- Use NumberOnlyEditEx.cls to enforce numeric only entry for Price and UOM: + prodControls[ecProdPrice]~initDecimalOnly(2,.false) -- 2 decimal places, no sign. + prodControls[ecUOM]~initDecimalOnly(0,.false) -- 0 decimal places, no sign. + prodControls[ecProdPrice]~connectCharEvent(onChar) + prodControls[ecUOM]~connectCharEvent(onChar) + + prodData = self~getData -- Gets data from ProductModel into prodData + self~showData -- Show the data + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - MenuBar Events: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD updateProduct UNGUARDED + expose prodControls + + -- Enable the controls to allow changes to the data: + prodControls[ecProdName]~setReadOnly(.false) + prodControls[ecProdPrice]~setReadOnly(.false) + prodControls[ecUOM]~setReadOnly(.false) + prodControls[ecProdDescr]~setReadOnly(.false) + prodControls[rbSmall]~enable + prodControls[rbMedium]~enable + prodControls[rbLarge]~enable + self~enableControl("IDC_PROD_SAVE_CHANGES") + prodControls[pbSaveChanges]~state = "FOCUS" -- Put input focus on the button + self~tabToNext() -- put text cursor on Product Description + -- (as if the user had pressed tab) + self~dialogState = "inUpdate" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD refreshData UNGUARDED + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~showData + self~dialogState = "closable" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD print UNGUARDED + -- say "ProductView-print-01" + ans = MessageDialog(.HRSpv~printMsg) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD close UNGUARDED + --say "ProductView-close-01" + return self~cancel:super + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + --say "ProductView-about-01" + dlg = .AboutDialog~new("ProductView.dll", IDD_PRODUCT_VIEW_ABOUT) + dlg~execute("SHOWTOP") + + + /*---------------------------------------------------------------------------- + Event Handler Methods - PushButton Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "Save Changes" - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg. Disables the + button when valid changes made. */ + ::METHOD saveChanges UNGUARDED + expose prodControls prodData + + -- Transform data from view format (as in controls) to app format (a directory): + newProdData = self~xformView2App(prodControls) + + -- Check if anything's changed; if not, show msgbox and exit with controls enabled. + -- If changed, go on to validate data. + result = self~checkForChanges(newProdData) + if result = .false then do + msg = .HRSpv~nilSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","WARNING","DEFBUTTON2 APPLMODAL") + return + end + + -- Now validate data: + result = self~validate(newProdData) -- returns a null string or error messages. + -- Better would be a set of error numbers. + -- If no problems, then show msgbox and go on to disable controls. + if result = "" then do + msg = .HRSpv~saved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","INFORMATION","DEFBUTTON1 APPLMODAL") + end + -- If problems, then show msgbox and leave user to try again or refresh or exit. + else do + msg = result||.EndOfLine||.HRSpv~notSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","ERROR","DEFBUTTON1 APPLMODAL") + return + end + + -- Send new data to be checked by CustomerModel object (not implemented). + + -- Disable controls that were enabled by menu "ActionsFile-->Update" selection: + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUom]~setReadOnly(.true) + if newProdData~size \= "S" then prodControls[rbSmall]~disable + if newProdData~size \= "M" then prodControls[rbMedium]~disable + if newProdData~size \= "L" then prodControls[rbLarge]~disable + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~dialogState = "closable" + + prodData = newProdData + prodData~list + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - Keyboard Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onChar UNGUARDED + -- called for each character entered in the price or UOM fields. + forward to (arg(6)) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "OK" - This is a no-op method that over-rides the default Windows action + of 'close window' for an Enter key --*/ + ::METHOD ok unguarded + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + -- If in the process of updating, then ask whether any changes should be + -- thrown away and dialog closed. If yes then close by calling the superclass, + -- else nop. If not in update, then close immediately + if self~dialogState = "inUpdate" then do + ans = MessageDialog(.HRSpv~closeInUpdate, self~dlgHandle, .HRSpv~updateIP, "YESNO", "WARNING", "DEFBUTTON2") + if ans = .PlainBaseDialog~IDYES then return self~cancel:super + else nop + end + else return self~cancel:super + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData + -- Get data from the ProductModel: + --expose prodData + --say "ProductView-getData-01." + idProductModel = .local~my.idProductModel + prodData = idProductModel~query -- prodData is of type ProductDT + return prodData + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showData + -- Transfrom data (where necessary) to display format, and then disable controls. + expose prodControls prodData + --say "ProductView-showData-01." + -- Set data in controls: + prodControls[ecProdNo]~setText( prodData~number ) + prodControls[ecProdName]~setText( prodData~name ) + -- Price in prodData has no decimal point - 2 decimal places are implied - hence /100 for display. + prodControls[ecProdPrice]~setText(prodData~price/100 ) + prodControls[ecUOM]~settext( proddata~uom ) + prodControls[ecProdDescr]~setText(prodData~description ) + size = prodData~size + -- Disable controls + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUOM]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[rbSmall]~disable + prodControls[rbMedium]~disable + prodControls[rbLarge]~disable + -- But check correct button and enable it to highlight it to the user: + select + when size = "S" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_SMALL") + prodcontrols[rbSmall]~enable + end + when size = "M" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_MEDIUM") + prodcontrols[rbMedium]~enable + end + otherwise do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_LARGE") + prodcontrols[rbLarge]~enable + end + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD checkForChanges + -- Check whether any data has actually changed when "Save Changes" button + -- has been pressed. Return .true if data changed, else returns .false. + expose prodData + use arg newProdData + + changed = .false + select + when newProdData~name \= prodData~name then changed = .true + when newProdData~price \= prodData~price then changed = .true + when newProdData~uom \= prodData~uom then changed = .true + when newProdData~description \= prodData~description then changed = .true + when newProdData~size \= ProdData~size then changed = .true + otherwise nop + end + return changed + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD validate + -- Validation: 1. Check price/UOM not changed > 50% up or down. + -- 2. Cannot change from Large to Small without UOM increasing + -- by at least 100%; nor from Small to Large without + -- decreasing by more than 50%. + -- 3. Product Description <= 100 characters. + -- 4. Product Name <= 30 characters. + -- Returns string of messages - the null string if all OK. + expose prodData + use arg newProdData + msg = "" + + -- Check Price (catches decimal point errors also): + price = prodData~price; newPrice = newProdData~price + oldUom = prodData~uom; newUom = newProdData~uom -- 'oldUom - avoids name conflict with 'uom' in newProddata~uom. + if ((price/oldUom)*1.5 < newPrice/newUom) | (newPrice/newUom < (price/oldUom)/2) then do + msg = msg||.HRSpv~badRatio||" " + end + + -- Check Size vs UOM: + if prodData~size = "L" & newProdData~size = "S" - -- Large to Small + & prodData~uom/2 < newProdData~uom then do + msg = msg||.HRSpv~uomTooBig||" " + end + if prodData~size = "S" & newProdData~size = "L" - -- Small to Large + & prodData~uom*2 > newProdData~uom then do + msg = msg||.HRSpv~uomTooSmall||" " + end + + -- Check Product Description length: + if newProdData.description~length > 80 then do + msg = msg||.HRSpv~descrTooBig||" " + end + + -- Check Product Name length: + if newProdData~name~length > 30 then do + msg = msg||.HRSpv~prodNameTooBig + end + + return msg + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD xformView2App + -- Transforms Product Data from View form (in the GUI controls) to + -- App form (a directory with address as an array). + expose prodControls + prodData = .ProductDT~new + prodData~number = prodControls[ecProdNo]~gettext() + prodData~name = prodControls[ecProdName]~getText() + price = prodControls[ecProdPrice]~getText() + -- Data entered has or assumes a decimal point; but data in "application" + -- is a whole number (e.g. $42.42 is recorded in the database as "4242"). + -- So re-format data from decimal to whole number: + priceTwoDecs = price~format(,2) -- force 2 dec positions + -- Re-display price properly formatted (in case the user did not format correctly - e.g. entered "42" or "38.4"): + prodControls[ecProdPrice]~setText(priceTwoDecs) + -- Now format price to "application" format: + price = (priceTwoDecs*100)~format(,0) -- multiply by 100 and then force whole number. + prodData~price = price + prodData~uom = prodControls[ecUOM]~getText() + prodData~description = prodControls[ecProdDescr]~getText() + select + when prodControls[rbSmall]~checked then prodData~size = "S" + when prodControls[rbMedium]~checked then prodData~size = "M" + otherwise prodData~size = "L" + end + + return prodData + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + AboutDialog v01-00 03Jun12 + ------------- + The "About" class - shows a dialog box that includes a bitmap - part of the + ProductView component. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS AboutDialog SUBCLASS ResDialog + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method initDialog + expose font image + resImage = .ResourceImage~new(self) -- Create an instance of a resource image + image = resImage~getImage(IDB_PROD_ICON) -- Create an image from the Product bitmap + stImage = self~newStatic(IDC_PRODABT_ICON_PLACE)~setImage(image) -- Create a static text control and set the image in it + font = self~createFontEx("Ariel", 12) -- Create up a largish font with which to display text and ... + self~newStatic(IDC_PRODABT_STATIC2)~setFont(font) -- ... set the static text to use that font. + -- Provide for a double-click in Product icon: + self~connectStaticNotify("IDC_PRODABT_ICON_PLACE", "DBLCLK", showMsgBox) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method showMsgBox + --say "AboutDialog-showMsgBox-01." + ans = MessageDialog(.HRSpv~AboutDblClick) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method leaving + expose font image + self~deleteFont(font) + image~release() + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSpv) v01-00 03Jun12 + ------------------------------ + The HRSpv class provides constant character strings for user-visible messages. + + Changes: + v00-03 11Feb12: Changed class name NRS to HRSpv + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSpv PRIVATE -- Human-Readable Strings + ::CONSTANT AboutDblClick "You double-clicked!" + ::CONSTANT badRatio "The new price/UOM ratio cannot be changed more than 50% up or down." + ::CONSTANT closeInUpdate "Any changes made will be lost. Exit anyway?" + ::CONSTANT descrTooBig "The Product Description is too long." + ::CONSTANT nilSaved "Nothing was changed! Data not saved." + ::CONSTANT notSaved "Changes Not Saved!" + ::CONSTANT prodNameTooBig "The Product Name is too long." + ::CONSTANT saved "Changes saved." + ::CONSTANT uomTooBig "The new UOM is too large." + ::CONSTANT uomTooSmall "The new UOM is too small." + ::CONSTANT updateIP "Update in process" + ::CONSTANT updateProd "Update Product" + ::CONSTANT printMsg "The 'Print...' menu item is not yet implemented." + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/StartupProduct.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/StartupProduct.rex new file mode 100755 index 0000000..78a0069 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/StartupProduct.rex @@ -0,0 +1,62 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for Product + startupProduct.rex v01-00 06Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Product folder. + + Changes: + v01-00 06Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.local~my.idProductData = .ProductData~newInstance -- create a ProductData instance +.local~my.idProductModel = .ProductModel~newInstance -- create a ProductModel instance +.local~my.idProductData~activate +.local~my.idProductModel~activate + +.ProductView~newInstance("SA") + +::requires "Product\ProductView.rex" +::requires "Product\ProductModelData.rex" + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/StartupProductList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/StartupProductList.rex new file mode 100755 index 0000000..c0e1e48 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/StartupProductList.rex @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise06: Stand-alone startup for ProductList + startupProductList.rex v01-00 06Jun12 + + Contains: Startup code. + Pre-requisites: Must be run from the parent folder of the Product folder. + + Changes: + v01-00 06Jun12: First Version + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~setDefaults("O", , .false) + +.ProductListView~newInstance("SA") + +::requires "Product\ProductListView.rex" + + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProdList.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProdList.bmp new file mode 100644 index 0000000..6e4e8c1 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProdList.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProdList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProdList.ico new file mode 100644 index 0000000..51333f8 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProdList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/Product.ico b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/Product.ico new file mode 100644 index 0000000..64a7c78 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/Product.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProductIcon.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProductIcon.bmp new file mode 100644 index 0000000..13ca9ac Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProductIcon.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProductView.dll b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProductView.dll new file mode 100644 index 0000000..e7e1e64 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/ProductView.dll differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/res.mak b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/res.mak new file mode 100644 index 0000000..d54d43d --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Product/res/res.mak @@ -0,0 +1,50 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# nMake-compatible Make file for the ProductView resource-only DLL. + +all: ProductView.dll + +ProductView.dll: ProductView.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) /OUT:$(@B).dll + +# Create .res from .rc +ProductView.res: ..\ProductView.rc + rc -r -fo$(@B).res ..\$(@B).rc + +clean: + del *.res *.dll 1>nul 2>&1 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Startup.rex b/modules/windows/oodialog/userGuide/exercises/Exercise06/Startup.rex new file mode 100755 index 0000000..b2988c0 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Startup.rex @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 06: The Order Management Application + Startup.rex v01-00 06Jun12 + + Description: This file is the "application" or "root" or "starter" part + of the sample Order Management application. + + Changes: + v00-01 06Jun12: First version. + +------------------------------------------------------------------------------*/ + +parse arg pwOption +if pwOption = "enterPW" then do + pwd = PasswordBox("Please enter your password","Sign In") + if pwd \= "Password" then exit +end + +-- Set application defaults: +.Application~setDefaults("O", , .false) + +-- Start OrderMgrView: +.OrderMgrView~newInstance + +::REQUIRES "OrderMgr\OrderMgrView.rex" + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise06/Support/NumberOnlyEditEx.cls b/modules/windows/oodialog/userGuide/exercises/Exercise06/Support/NumberOnlyEditEx.cls new file mode 100644 index 0000000..9613851 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise06/Support/NumberOnlyEditEx.cls @@ -0,0 +1,526 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * The NumberOnlyEditEx class extends the .Edit class to provide an edit + * control which restricts entry to decimal only, or signed decimal only, + * numbers. + * + * The NumberOnlyEditEx.cls file is meant to be included in any ooDialog + * program where this extension to the edit control is desired. The programmer + * needs to take 4 steps to gain the functionality of a signed decimal number + * only edit control: + * + * 1.) Require the NumberOnlyEditEx.cls file (this file.) + * + * ::requires 'NumberOnlyEditEx.cls' + * + * 2.) Invoke the initDecimalOnly() method on each edit control object that is + * to be a decimal number only edit control. If initDecimalOnly() is not + * invoked, the behaviour of the edit control is unchanged. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~initDecimalOnly(decimalPlaces, allowSign) + * + * arguments: + * + * decimalPlaces [optional] The number of decimal places allowed in the + * number. The default is 2. Specifying 0 + * decimal places is acceptable. + * + * allowSign [optional] If a sign character (+ or -) is allowed as the + * leading character of the number. The default + * is .false. Specify .true to allow a sign + * character. + * + * 3.) For each decimal only edit control, the character event must be + * connected to a method in the Rexx dialog object. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~connectCharEvent(onChar) + * + * 4.) In the connected character event handler, the message and its arguments + * must be forwarded on to the onChar() method of the edit control. The + * 6th argument to the event handler is the dialog control object where the + * character event occurred. That is the object the event must be forwared + * to. + * + * When the programmer connects the character event to a method named + * onChar, the event handler is simple: + * + * ::method onChar unguarded + * forward to (arg(6)) + * + * If the programmer chooses a different method name for the event handler, + * then he must be sure to forward to the onChar() method of the edit + * control: + * + * ::method myOwnMethodName unguarded + * forward message 'onChar' to (arg(6)) + * + * And of course there is no reason why the event handler can not be coded + * using the explicit arguments: + * + * ::method myOwnMethodName unguarded + * use arg char, isShift, isCtrl, isAlt, misc, control + * forward message 'onChar' to (control) + */ + + -- Extend the .Edit control by inheriting the .NumberOnlyEditEx mixin class. + + .Edit~inherit(.NumberOnlyEditEx, .EditControl) + +::requires 'ooDialog.cls' +::requires 'winsystm.cls' + +::class 'NumberOnlyEditEx' public mixinclass object + +-- Users of the signed decimal number only edit control must invoke +-- initDecimalOnly() first to assign decimal places and specify if the sign +-- character is allowed. Until this is done, there is no change to the +-- behaviour of the Edit control object. +::method initDecimalOnly + expose decimalPlaces signOk initialized clipBoard + use strict arg decimalPlaces = 2, plusMinus = .false + + if plusMinus~isA(.String), plusMinus~datatype('O') then signOk = plusMinus + else signOk = .false + + initialized = .true + clipBoard = .WindowsClipboard~new + +-- The onChar() method should be inovked at every character event. Returning +-- true allows the character, returning false disallows the character. When a +-- character is not allowed, an edit ballon is set with a message explaining to +-- the user why the character is not appearing when they type. +::method onChar unguarded + expose decimalPlaces initialized signOk + use arg char, isShift, isCtrl, isAlt, misc, control + + if \ var('initialized') then return .true + + if misc~pos("extended") <> 0, self~isExtendedKey(char) then return .true + + if char == 8 then return .true + if signOk, (char == 43 | char == 45) then return self~checkSign + if char == 46 then return self~checkDecimal + if char >= 48, char <= 57 then return self~checkDigit + + if isCtrl, \isAlt, \isShift then return self~checkControlKey(char) + + reply .false + self~charBalloon + + +/** checkDigit() + * + * Checks that the digit being typed, at the cursor position, is allowed. + */ +::method checkDigit private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if signOk, cursorPos == 1 then do + c = text~left(1) + + if c == '-' | c == '+' then do + reply .false + self~showBalloon(.MT~NUM_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + return .true + end + + if decimalPos == 0 then return .true + + if cursorPos <= decimalPos then return .true + + if text~length < (decimalPos + decimalPlaces) then return .true + + reply .false + + msg = self~decimalPlacesUsedMsg + self~showBalloon(.MT~NUM_TITLE, msg, "ERROR") + + +/** checkSign() + * + * Checks that the sign character being typed is allowed at the current cursor + * position. Note that this method is only invoked when the sign character is + * allowed. + */ +::method checkSign private unguarded + expose decimalPlaces + + text = self~getText + cursorPos = self~getCaretPos + + if cursorPos == 1 then do + if self~hasSign(text) then do + reply .false + self~showBalloon(.MT~SIGN_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + + return .true + end + + reply .false + + decimalPos = text~pos('.') + if decimalPos <> 0 | decimalPlaces == 0 then msg = .MT~ONLY_NUMBER + else msg = .MT~ONLY_DECIMAL_NUMBER + + self~showBalloon(.MT~SIGN_TITLE, msg, "ERROR") + + +/** checkDecimal() + * + * Checks that the decimal point being typed is allowed at the current cursor + * position. + */ +::method checkDecimal private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if decimalPlaces == 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if decimalPos <> 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if cursorPos == 1, signOk, self~hasSign(text) then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if text~length < cursorPos + decimalPlaces then return .true + + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + + +/** checkControlKey() + * + * Invoked for a control key combination (Ctrl-?). Anything other than Ctrl-V + * is automatically allowed. Ctrl-V is of course the paste operation. For + * Ctrl-V, we check that the result after pasting the text would be a valid + * signed decimal number, under the constraints for this object. If not, it + * is disallowed and a ballon set. + */ +::method checkControlKey private unguarded + expose clipBoard decimalPlaces + use strict arg char + + if char \== 22 then return .true -- Not Ctrl-V + + -- If there is no text data available we don't care, pasting it will not do + -- any harm. + if \ clipBoard~isDataAvailable then return .true + + pastedText = clipBoard~paste + + -- We have text to paste, need to check is the text acceptable, + -- and is it acceptable for where it will be placed. + text = self~getText + len = text~length + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + -- isValidDecimal() checks that the resulting text after inserting the pasted + -- text is valid. + if \ self~isValidDecimal(pastedText, text, cursorPos) then do + reply .false + self~pasteBalloon(pastedText, text, cursorPos) + return + end + + return .true + + +/** decimalPointBalloon() + * + * This method produces the proper balloon message text when a decimal point has + * been typed, but is not allowed at the current position. + */ +::method decimalPointBalloon private unguarded + expose decimalPlaces signOk + use strict arg decimalPos, cursorPos, text + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~DEC_TITLE, msg, "ERROR") + + +/** charBalloon() + * + * This method produces the proper balloon message when a character is typed. + */ +::method charBalloon private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + msg = .MT~ONLY_NUMBER + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if decimalPlaces == 0, \signOk then msg = .MT~ONLY_WHOLE_NUMBER + else if decimalPos == 0, signOk then msg = .MT~ONLY_SIGNED_DECIMAL_NUMBER + else if decimalPos == 0, \signOk then msg = .MT~ONLY_DECIMAL_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when decimalPos == 0 then do + msg = .MT~ONLY_DECIMAL_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~CHAR_TITLE, msg, "ERROR") + + +/** pasteBalloon() + * + * This method produces the proper balloon message when text is pasted into the + * edit control that is not allowed. + */ +::method pasteBalloon private unguarded + expose decimalPlaces signOk + use strict arg pastedText, text, cursorPos + + if signOk then do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE_SIGNED + else msg = .MT~ONLY_PASTE_A_SIGNED decimalPlaces .MT~ONLY_PASTE_B + end + else do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE + else msg = .MT~ONLY_PASTE_A decimalPlaces .MT~ONLY_PASTE_B + end + + resultText = text~substr(1, cursorPos - 1) || pastedText || text~substr(cursorPos) + + -- Balloon text has to be less than 1023 characters. If we don't exceed that + -- length, we will show the incorrect text to the user. Otherwise we just + -- show the short message. Note that new line characters can be used to + -- format the balloon text. + len = msg~length + resultText~length + .MT~PASTED_A~length + .MT~PASTED_B~length + 8 + + if len < 1023 then do + msg ||= .endOfLine~copies(2) || .MT~PASTED_A || - + .endOfLine~copies(2) || '"'resultText'"' || - + .endOfLine~copies(2) || .MT~PASTED_B + end + + self~showBalloon(.MT~PASTE_TITLE, msg, "ERROR") + + +/** decimalPlacesUsedMsg() + * + * Convenience method to return the proper message for the situation where the + * allowable number of decimal places have been filled. + */ +::method decimalPlacesUsedMsg private unguarded + expose decimalPlaces + + if decimalPlaces == 1 then return .MT~ONLY_1_DECIMAL + else return .MT~ONLY_DECIMALS_A decimalPlaces .MT~ONLY_DECIMALS_B + + +/** isValidDecimal() + * + * Checks that the resulting text after the pasted text is inserted into text at + * the current position, results in a valid number using the current + * restrictions. Decimal places and sign allowed or not. + */ +::method isValidDecimal private unguarded + expose decimalPlaces signOk + use strict arg pasteText, text, cursorPos + + resultText = text~substr(1, cursorPos - 1) || pasteText || text~substr(cursorPos) + + -- Can't have any type of space character, tab, new line, etc.. + if resultText \== resultText~space(0) then return .false + + -- Eliminate obvious problems with decimals. + countDots = resultText~countStr(".") + if countDots > 1 then return .false + if decimalPlaces == 0, countDots > 0 then return .false + + -- Eliminate any problems with the sign character. + if signOk then do + if resultText~pos('-') > 1 | resultText~pos('+') > 1 then return .false + end + else do + if resultText~pos('-') <> 0 | resultText~pos('+') <> 0 then return .false + end + + + decimalPos = resultText~pos('.') + if decimalPos > 0 then do + if resultText~length - decimalPos > decimalPlaces then return .false + + -- Remove the decimal char so we can test for all digits. + resultText = resultText~changeStr('.', '') + end + + -- Remove the sign character if it exists. + if self~hasSign(resultText) then resultText = resultText~substr(2) + + -- Exponential notation can not be allowed. + if resultText~caselessPos('E') <> 0 then return .false + + if \ resultText~datatype('W') then return .false + + return .true + + +/** isExtendedKey + * + * Convenience method to test if the character, char, is an extended key we want + * to pass on to the edit control + */ +::method isExtendedKey private + use strict arg char + + if char >= 33, char <= 40 then return .true + if char == 45 | char == 46 | char == 8 then return .true + return .false + + +/** hasSign + * + * Convenience method to test if a text string starts with a sign (+ or -) + * character. + */ +::method hasSign private + use strict arg text + + c = text~left(1) + if c == '-' | c == '+' then return .true + return .false + + +/** getCaretPos() + * + * Returns the current caret (cursor) position of this edit control. + */ +::method getCaretPos private + return self~selection~startChar + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Class: MT + + This class is used to provide constant character strings. The strings are + used for the balloon messages put up by the NumberOnlyEditEx mixin class. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'MT' private +::constant CHAR_TITLE "Unacceptable Character" +::constant DEC_TITLE "Unacceptable Decimal Point" +::constant NUM_TITLE "Unacceptable Number" +::constant SIGN_TITLE "Unacceptable Sign Character" +::constant PASTE_TITLE "Unacceptable Pasted Text" + +::constant ONLY_NUMBER "You can only type a number here." +::constant ONLY_SIGNED_NUMBER "You can only type a number or the sign here." +::constant ONLY_DECIMAL_NUMBER "You can only type a number or the decimal point here." +::constant ONLY_SIGNED_DECIMAL_NUMBER "You can only type a number, the sign, or the decimal point here." +::constant ONLY_WHOLE_NUMBER "You can only type a number here. Only whole numbers are allowed." +::constant ONLY_WHOLE_SIGNED_NUMBER "You can only type a number or the sign here. Only whole numbers are allowed." + +::constant HAS_SIGN "You can not type here. The sign character is already in place." +::constant ONLY_1_DECIMAL "You can not type here. Only 1 decimal place is allowed." +::constant ONLY_DECIMALS_A "You can not type here. Only" +::constant ONLY_DECIMALS_B "decimal places are allowed." + +::constant ONLY_PASTE_WHOLE "You can only paste text here that produces a whole number." +::constant ONLY_PASTE_WHOLE_SIGNED "You can only paste text here that produces a signed whole number." +::constant ONLY_PASTE_A_SIGNED "You can only paste text here that produces a signed decimal number with" +::constant ONLY_PASTE_A "You can only paste text here that produces a decimal number with" +::constant ONLY_PASTE_B "or less decimal places." +::constant PASTED_A "Resulting text of:" +::constant PASTED_B "is not valid." diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerFile.txt new file mode 100644 index 0000000..651d7bc --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerFile.txt @@ -0,0 +1,6 @@ +CustNo | CustName | CustDisc | CustAddr | Zip +AB0784 | ABC Enterprises Inc. | B1 | 2145 Engle Blvd,Hardtown,FL | 37043 +AC0027 | Frith Motors Inc. | B1 | 124 Freeview St.,Mackfield,TX | 78254 +BA0314 | LMN & Partners | C2 | 116 High St.,Ensleigh,NV | 84394 +BA0526 | EJ Smith United Inc. | C1 | 3 Ventry Rd,Ventry,MS | 38216 +CU0003 | Red-On & Locus Inc. | A1 | 43 Main St,Plingford,AR | 48231 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.h new file mode 100644 index 0000000..62b5eb4 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDI_CUSTLIST_DLGICON 103 +#define IDD_CUSTLIST_DIALOG 104 +#define IDR_CUSTLIST_MENU 105 +#define IDC_CUSTLIST_LIST 1001 +#define IDM_CUSTLIST_NEWCUST 40000 +#define IDC_CUSTLIST_SHOWCUST 40001 +#define IDM_CUSTLIST_ABOUT 40002 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.rc new file mode 100644 index 0000000..073d8f2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "CustomerListView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUSTLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUSTLIST_NEWCUST + } + POPUP "Help" + { + MENUITEM "About...", IDM_CUSTLIST_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUSTLIST_DIALOG DIALOG 0, 0, 225, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Customer List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_CUSTLIST_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING | LVS_NOSORTHEADER , 15, 10, 190, 215 + DEFPUSHBUTTON "Show Customer", IDC_CUSTLIST_SHOWCUST, 89, 235, 54, 14, WS_DISABLED +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_CUSTLIST_DLGICON ICON ".\\customer\\bmp\\CustList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.rex new file mode 100755 index 0000000..0c3614f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerListView.rex @@ -0,0 +1,254 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The Customer ListView v02-00 08Jan13 + + Contains: classes "CustomerListView" and "HRSclv". + + Pre-requisite: CustomerListView.rc, CustomerListView.h, CustList.ico + + Description: Provides a list of Customers and supports viewing any given + Customer via a double-click on that Customer's item in the list. + This is an "Intermediate" component - it is invoked by OrderMgmt, + and invokes CustomerView. + + v01-00 06Jun12: First Version. + v02-00 08Jan13: Removed stand-alone startup code (not needed after Ex06) + Commented out say's. + + Outstanding Problems: None reported. +*******************************************************************************/ + + +.Application~addToConstDir("Customer\CustomerListView.h") + +::REQUIRES "ooDialog.cls" +::REQUIRES "customer\customerview.rex" + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerListView v02-00 08Jan13 + ---------------- + The view of a list of Customers. + Changes: + v01-01: First version + v01-02: Corrected for standalone invocation. + v01-03 28Jan12: Changed name of HRS class to HRSplv. + v01-04 11Feb12: moved .application~setDefaults() to app startup file. + changed to .application~addToConstDir() here. + v01-05 19Feb12: Moved .Application~addToConstDir statement from newInstance + method to top of file - just before ::requires statement(s). + v01-06 29Mar12: Very minor mods - all just minor clean-ups. All comments removed + v02-00 17Aug12: Exercise07 - modified to use the MVF. + 08Jan13: Removed stand-alone startup (not now needed). + + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerListView SUBCLASS RcView PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg idCustomerListModel, rootDlg + --say "CustomerListView-newInstance-01: instName, rootDlg =" idCustomerListModel rootDlg + dlg = self~new("Customer\CustomerListView.rc", "IDD_CUSTLIST_DIALOG") + --say "CustomerListView-newInstance-02: dlg =" dlg + dlg~activate(idCustomerListModel, rootDlg) -- Must be the last statement. + return dlg + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + menuBar = .ScriptMenuBar~new("Customer\CustomerListView.rc", "IDR_CUSTLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg modelData + use arg idCustomerListModel, rootDlg + --say "CustomerListView-activate-01." + forward class (super) continue -- required for MVF + modelData = RESULT -- super gets my data! + --say "CustomerListView-activate-02: rootDlg =" rootDlg + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_CUSTLIST_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvCustomers btnShowCustomer modelData + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + lvCustomers = self~newListView("IDC_CUSTLIST_LIST"); + lvCustomers~addExtendedStyle("GRIDLINES FULLROWSELECT") + lvCustomers~insertColumnPX(0,"Number",60,"LEFT") + lvCustomers~insertColumnPX(1,"Name",220,"LEFT") + lvCustomers~insertColumnPX(2,"Zip",80,"LEFT") + self~connectListViewEvent("IDC_CUSTLIST_LIST","CLICK",itemSelected) -- Single click + self~connectButtonEvent("IDC_CUSTLIST_SHOWCUST","CLICKED",showCustomer) + self~connectListViewEvent("IDC_CUSTLIST_LIST","ACTIVATE",openItem) -- Double-click + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newCustomer UNGUARDED + self~noMenuFunction(.HRSclv~newCust) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSclv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSclv~noMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected UNGUARDED + use arg id, itemIndex, columnIndex, keyState + /* This method is fired when the user clicks on a row in the ListView. + If the user clicks on an empty row, then itemIndex is set to -1, else + the itemIndex is set to the 0-based row number. + If the user double-clicks on a row, this method is fired in response + to the first click but not to the second. If the row is empty, the second + click of the double-click is ignored, else the double-click method is + fired. + */ + if itemIndex > -1 then self~enableControl("IDC_CUSTLIST_SHOWCUST") + else self~disableControl("IDC_CUSTLIST_SHOWCUST") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + -- User double-clicked on an item in the ListView. + -- Note: does not get fired if double-click was on an empty row. + self~showCustomer + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showCustomer UNGUARDED + expose lvCustomers rootDlg + item = lvCustomers~selected + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSclv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvCustomers~getItemInfo(item, info) then do + --say "CustomerListView-showCustomer-02: info~text =" info~text + objectMgr = .local~my.ObjectMgr -- Ex07 + objectMgr~showModel("CustomerModel", info~text, rootDlg) -- Ex07 + self~disableControl("IDC_CUSTLIST_SHOWCUST") -- Ex07 + end + else do + say "CustomerListView-showCustomer-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvCustomers modelData -- Ex07 + --say "CustomerListView-LoadList-00: modelData =" modelData + -- modelData is a directory. + --say "CustomerListView-loadList-01: No Records =" modelData[count] + rows = modelData[count] -- Ex07 - number of rows + arrData = modelData[records] + --say "CustomerListView-loadList-02:Dims =" arrData~dimension(1) arrData~dimension(2) + do i = 1 to rows -- Ex07 - omit the header line. + --say "CustomerListView-loadList-02: arr[i,1 =" arrData[i,1] + lvCustomers~addRow( , ,arrData[i,1],arrData[i,2],arrData[i,5]) + end + lvCustomers~setColumnWidth(1) -- set width of 2nd column to longest text entry. + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSclv (Human-Readable Strings for CustomerListView) v01-00 06Jun12 + --- + The HRSclv class provides constant character strings for user-visible messages + issued by the CustomerListView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSclv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newCust "New Customer" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerModelsData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerModelsData.rex new file mode 100755 index 0000000..d311931 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerModelsData.rex @@ -0,0 +1,241 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: Customer Models and Data Classes v02-00 01Apr13 + + Contains: classes "CustomerModel" "CustomerListModel" and "CustomerData". + + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. + v02-00 11Jan13: Modified to use the Model-View Framework with data read from + file using the GenericFile class. CustomerListModel added. + Commented out 'say' instructions. + 31Jan13: Removed 'query' method (it's in the superclass) from both + Customer and CustomerList - also removed code storing data + in self~myData. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + +::REQUIRES "Support\GenericFile.rex" +::REQUIRES "Support\Model.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerModel v01-01 09Aug12 + ------------ + The "model" part of the Customer component. + + Changes: + v01-00 07Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE myData + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + expose noDataError + use strict arg instanceName + --say ".CustomerModel-newInstance-01; class name =" self~objectName + -- Get my data via my superclass: + forward class (super) continue + customerId = RESULT + return customerId + + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + use strict arg dirData + return self + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerListModel v02-00 13Jan08 + ---------------- + The model for a list of Customers. + Changes: + v00-01 15Aug12: First version + v02-00 13Jan08: Runs under MVF (Ex07). Commented out 'say's. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerListModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE myData + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg instanceName + self~wantList = .true -- set super's attribute + forward class (super) continue + return RESULT + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + use arg dirData + --self~myData = arrdata + --say "CustomerListModel-init-01: myData =" self~myData + return self + +-- ::METHOD query PUBLIC + /*---------------------------------------------------------------------------- + query - returns an array of all Customer data. + In MVF this method is invoked by the RcView (or ResView) superclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --say "CustomerListModel-query-01." +-- return self~myData + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerData v01-01 09Aug12 + ------------ + The "data" part of the Customer component. + Changes: + v01-00 07Jun12: First version. + v02-00 09Aug12: Second version - subclasses GenericFile to read data from + a disk file. + 08Jan13: Commented out some 'say' instructions. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerData SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC -- Invoked by ObjectMgr + --use strict arg instanceName + if self~created = "CREATED" then do -- If this is first time + --say ".CustomerData-newInstance-01." + customerDataId = self~new() + self~created = .true + return customerDataId + end + else do + say ".CustomerData-newInstance-02 - Error - Singleton component, so can't have more than one instance." + return .false + end + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init PUBLIC + expose fileName numRecords + fileName = "Customer\CustomerFile.txt" + columns = 5 -- colums in the Customer "table" + numRecords = self~init:super(fileName, columns) + --say "CustomerData-init-01: numRecords:" numRecords + /* + if numRecords > 0 then do + say "CustomerData-init-02: Array is:" + say self~fileArray~tostring + end + */ + return self + + +/*============================================================================*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerDT - A business data type for Customer data. v00-01 05May12 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS CustomerDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE custNo -- custNo Customer Number + ::ATTRIBUTE custName -- custName Customer Name + ::ATTRIBUTE discount -- discount Discount code + ::ATTRIBUTE address -- address Customer's address + ::ATTRIBUTE zipCode -- zip ZipCode + + ::METHOD makeDir + dir = .Directory~new + dir["custNo"] = self~custNo + dir["custName"] = self~custName + dir["discount"] = self~discount + dir["address"] = self~address + dir["zipCode"] = self~zipCode + return dir + + ::METHOD list PUBLIC + expose custNo custName discount address zipCode + say "---------------" + say "CustomerDT-List:" + say "CustNo: " custNo " CustName:" custName + say "Address: " address + say "Zip: " zipCode " Discount:" discount + say "---------------" + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.h new file mode 100644 index 0000000..26d87d2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.h @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_CUST_DIALOG 102 +#define IDR_CUST_MENU 103 +#define IDI_CUST_DLGICON 105 +#define IDC_CUST_LBL_CUSTNO 1001 +#define IDC_CUST_LBL_DISCOUNT 1002 +#define IDC_CUST_BTN_SHOWLASTORDER 1003 +#define IDM_CUST_NEW 40000 +#define IDM_CUST_UPDATE 40001 +#define IDM_CUST_PRINT 40002 +#define IDM_CUST_LAST_ORDER 40003 +#define IDC_CUST_EDT_CUSTNO 40043 +#define IDC_CUST_EDT_CUSTNAME 40044 +#define IDC_CUST_BTN_RECORDCHANGES 40069 +#define IDC_CUST_LBL_CUSTNAME 40070 +#define IDC_CUST_LBL_CUSTADDR 40071 +#define IDC_CUST_LBL_ZIP 40072 +#define IDC_CUST_LBL_LASTORDER 40073 +#define IDC_CUST_STC_LASTORDERDETAILS 40077 +#define IDC_CUST_EDT_CUSTADDR 40078 +#define IDC_CUST_EDT_DISCOUNT 40079 +#define IDC_CUST_EDT_CUSTZIP 40080 +#define IDC_CUST_STC_ERRORMSG 40081 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.rc new file mode 100644 index 0000000..cab2d63 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.rc @@ -0,0 +1,85 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "customerview.h" + + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUST_NEW + MENUITEM "&Update...", IDM_CUST_UPDATE + MENUITEM "Print...", IDM_CUST_PRINT + MENUITEM "Last Order", IDM_CUST_LAST_ORDER + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUST_DIALOG DIALOG 0, 0, 275, 239 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "*CustomerName*" +FONT 8, "Microsoft Sans Serif" +{ + LTEXT "Name:", IDC_CUST_LBL_CUSTNAME, 18, 47, 22, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNO, 85, 20, 65, 15, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Customer Number:", IDC_CUST_LBL_CUSTNO, 18, 22, 59, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNAME, 85, 45, 165, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Address:", IDC_CUST_LBL_CUSTADDR, 18, 72, 28, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTADDR, 85, 70, 167, 40, ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + LTEXT "Zip Code:", IDC_CUST_LBL_ZIP, 20, 120, 32, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTZIP, 85, 120, 65, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Last Order:", IDC_CUST_LBL_LASTORDER, 18, 177, 36, 8, SS_LEFT + LTEXT " ", IDC_CUST_STC_LASTORDERDETAILS, 88, 177, 145, 8, SS_LEFT + LTEXT "Discount Code:", IDC_CUST_LBL_DISCOUNT, 18, 149, 50, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_DISCOUNT, 85, 145, 20, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT " ", IDC_CUST_STC_ERRORMSG, 18, 215, 8, 8, SS_LEFT + DEFPUSHBUTTON "Record Changes", IDC_CUST_BTN_RECORDCHANGES, 130, 195, 58, 14, WS_DISABLED + PUSHBUTTON "Show Last Order", IDC_CUST_BTN_SHOWLASTORDER, 195, 195, 58, 14 +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_CUST_DLGICON ICON ".\\customer\\bmp\\Customer.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.rex new file mode 100755 index 0000000..0b5c586 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/CustomerView.rex @@ -0,0 +1,339 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The CustomerView component v02-00 01Apr13 + + Contains: class "CustomerView"; routine "startCustomerView". + Pre-requisites: RcView.rex, CustomerView.rc, CustomerView.h. + + Description: A sample Customer View component - part of the sample + Order Management application. This is a "leaf" component - + it does not invoke other components. + + Changes: + v01-00 01Jun12: First version (Exercise04). + v01-01 07Jun12: Minor changes for Exercise06. + .... + v02-00 09Aug12: Changed to use MVF. + 09Jan13: Removed stand-alone startup (not now needed). + Changes to CustomerView (not at v03-00). + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Customer\CustomerView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "support\RcView.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerView v03-00 01Apr13 + ------------- + The "view" (or "gui") part of the Customer component - part of the sample + Order Management application. + Changes: + v00-02: Prevented close on enter key by providing no-op "ok" method. + Changed tab order on window by changing sequence of controls in .rc file + v00-03: Changed symbolic IDs to conform with naming convention + Added initAutoDetection method because deleted dlgData. from + dlg~new statement in starter.rex. + v00-04: Took out the OK method - include that in Exercise05. + v00-05: Modified to use CustomerData and CustomerModel classes. + Mods after Exercise04: + v02-00: Added "newInstance" class method - removed routine "StartCustomerView". + v02-01 19Sep11: Corrected for stand-alone invocation. + v02-02 04Oct11: Added msgbox for unimplemented menu item. + v02-03 28Jan12: Changed class name HRS to HRSclv to allow for multiple + HRS classes in same file at some future time. + v02-04 11Feb12: moved .application~setDefaults() to app startup file. + changed to .application~addToConstDir() here. + v02-05 19Feb12: Moved .Application~addToConstDir statement from newInstance + method to top of file - just before ::requires statement(s). + v03-00 09Aug12: Changed to use MVF. Stand-alone startup removed. + 09Jan13: Removed stand-alone startup (not now needed). + Commented out most 'say' instructions. + Removed 'getData' method - redundant with MVF. + Modified handling of Cust Address due to change in data + format of Cust Address (now provided as string via MVF + from Customer File). + Deleted a number of "say" instructions. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + ::CLASS CustomerView SUBCLASS RcView PUBLIC -- v03-00 + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC UNGUARDED + use arg idCustomerModel, rootDlg -- Ex07 + -- Create an instance of CustomerView and show it: + dlg = .CustomerView~new("Customer\CustomerView.rc", "IDD_CUST_DIALOG") + dlg~activate(idCustomerModel, rootDlg) -- Ex07 + return dlg -- Ex07 + + + /*---------------------------------------------------------------------------- + Dialog Creation Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Init - creates the dialog instance but does not make it visible. --*/ + ::METHOD init + expose menuBar + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Create Menu Bar - Creates the menu bar on the dialog. --*/ + ::METHOD createMenuBar + expose menuBar + menuBar = .ScriptMenuBar~new("Customer\CustomerView.rc", "IDR_CUST_MENU", , , .true) + return .true + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Activate - Shows the Dialog - i.e. makes it visible to the user. --*/ + ::METHOD activate unguarded + expose custData + use arg idCustomerModel, rootDlg -- ADDED FOR EXERCISE06. Params reversed for Ex07. + forward class (super) continue -- Ex07: Required for MV framework. + custData = RESULT -- Ex07: instance data returned by super + -- Ex07: ('forward' returns any result via 'RESULT'.) + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_CUST_DLGICON") -- Ex07: deleted "standalone" startup. + return + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + InitDialog - Called by ooDialog -- */ + ::METHOD initDialog + expose menuBar custControls + menuBar~attachTo(self) + -- Create objects that map to the edit controls defined by the "customer.rc" + -- so they can be programmatically used elsewhere in the class: + custControls = .Directory~new + custControls[ecCustNo] = self~newEdit("IDC_CUST_EDT_CUSTNO") + custControls[ecCustName] = self~newEdit("IDC_CUST_EDT_CUSTNAME") + custControls[ecCustAddr] = self~newEdit("IDC_CUST_EDT_CUSTADDR") + custControls[ecCustZip] = self~newEdit("IDC_CUST_EDT_CUSTZIP") + custControls[ecCustDiscount] = self~newEdit("IDC_CUST_EDT_DISCOUNT") + custControls[stLastOrder] = self~newStatic("IDC_CUST_STC_LASTORDERDETAILS") + -- Create an object for the "Record Change" pushbutton in order to be able + -- to change its focus later: + custControls[btnRecordChanges] = self~newPushButton("IDC_CUST_BTN_RECORDCHANGES") + -- Define event handler methods for push-buttons: + self~connectButtonEvent("IDC_CUST_BTN_RECORDCHANGES","CLICKED",recordChanges) + self~connectButtonEvent("IDC_CUST_BTN_SHOWLASTORDER","CLICKED",showLastOrder) + + self~setTitle(.HRScv~dlgTitle) -- set dialog title. + + -- Show app data: + self~showData + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + MenuBar Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + New Customer... Not fully implemented - merely tells user to use the + Customer List object. --*/ + ::METHOD newCustomer unguarded + answer = MessageDialog(.HRScv~useList, self~hwnd,.HRScv~useListCap,"INFORMATION") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Update - Sets fields to edit mode so that user can change the data. + Business Rule: Customer Number cannot be changed. --*/ + ::METHOD update unguarded + expose custControls + custControls[ecCustName]~setReadOnly(.false) + custControls[ecCustAddr]~setReadOnly(.false) + custControls[ecCustZip]~setReadOnly(.false) + custControls[ecCustDiscount]~setReadOnly(.false) + self~enableControl("IDC_CUST_BTN_RECORDCHANGES") + custControls[btnRecordChanges]~state = "FOCUS" -- Put focus on the button + self~focusControl("IDC_CUST_EDT_CUSTNAME") -- place cursor in the CustName edit control. + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Last Order - Displays info about the last order placed by this customer.--*/ + ::METHOD lastOrder unguarded + expose custControls + use arg button + orderDate="31/12/11"; orderNum = "ZZ999"; orderTotal = "$999.99" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Print - Not implemented yet --*/ + ::METHOD print unguarded + msg = "The 'Print...' menu item is not yet implemented." + ret = MessageDialog(.HRScv~noPrint, self~hwnd, .HRScv~noPrintCap, 'WARNING') + + + /*---------------------------------------------------------------------------- + PushButton Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Record Changes - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg and disables + the button. --*/ + ::METHOD recordChanges unguarded + expose custControls custData newCustData + + newCustData = .directory~new + newCustData[custName] = custControls[ecCustName]~getLine(1) + newCustData[custAddr] = .array~new + do i=1 to custControls[ecCustAddr]~lines + newCustData[custAddr][i] = custControls[ecCustAddr]~getLine(i) + end + newCustData[custZip] = custControls[ecCustZip]~getLine(1) + newCustData[custDiscount] = custControls[ecCustDiscount]~getLine(1) + + -- Check if anything's changed: + result = self~checkForChanges + --if result then say "CustomerView-recordChanges-01: There were changes!" + --else say "CustomerView-recordChanges-02: No Changes Found" + + /* Send new data to be checked by CustomerModel (not implemented). */ + + /* Disable controls that were enabled by menu "File-Update" selection: */ + custControls[ecCustName]~setReadOnly(.true) + custControls[ecCustAddr]~setReadOnly(.true) + custControls[ecCustZip]~setReadOnly(.true) + custControls[ecCustDiscount]~setReadOnly(.true) + self~disableControl("IDC_CUST_BTN_RECORDCHANGES") + + + /*---------------------------------------------------------------------------- + Show Last Order - displays mock sales order info in the Last_Order_Details + field; info is hard-coded in this method. --*/ + ::METHOD showLastOrder unguarded + expose CustControls + -- Notionally get last order from "SalesOrder" component. + orderDate="12/2/11"; orderNum = "AB123"; orderTotal = "$524.58" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + showData - displays data in the dialog's controls. */ + ::METHOD showData + expose custData custControls + -- Show CustNo and CustName: + custControls[ecCustNo]~setText(custData["CustNo"]) + custControls[ecCustName]~setText(custData["CustName"]) + -- Re-format Cust Address from a comma-separated string into a -- Ex07 + -- line-end-separated string. + strCustAddr = custData["CustAddr"]~changeStr(",",.endOfLine) + custControls[ecCustAddr]~setText(strCustAddr) + -- Finally, show Zip and Discount: + custControls[ecCustZip]~setText(custData["Zip"]) + custControls[ecCustDiscount]~setText(custData["CustDisc"]) + + + /*-------------------------------------------------------------------------- + checkForChanges - after "Record Changes" actioned by the user, check whether + any data has actually changed. If it has: (a) assign new data to old data; + (b) return .true. If it hasn't: return .false. + Note: cannot just compare the two directories since data format in Address + is different. --*/ + ::METHOD checkForChanges + expose custData newCustData + changed = .false + if newCustData[custName] \= custData[custName] then do + custData[custName] = newCustData[custName] + changed = .true + end + if custData[custAddr] \= newCustData[custAddr] then changed = .true + if newCustData[custZip] \= custData[custZip] then do + custdata[custZip] = newCustData[custZip] + changed = .true + end + if newCustData[custDiscount] \= custData[custDiscount] then do + custData[custDiscount] = newCustData[custDiscount] + changed = .true + end + -- If no changes after all, display message box: + if \changed then do + msg = .HRScv~nilChanged + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRScv~nilChangedCap,"OK","WARNING","DEFBUTTON2 APPLMODAL") + end + else do + custData = newCustData + end + return changed + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRScv) v02-04 13Jan12 + -------- + This class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRScv PRIVATE -- Human-Readable Strings + ::CONSTANT nilChanged "Nothing was changed! Update not done." + ::CONSTANT nilChangedCap "Update Customer" + ::CONSTANT noPrint "The 'Print...' menu item is not yet implemented." + ::CONSTANT noPrintCap "*Customer Name*" + ::CONSTANT dlgTitle "*Customer*" + ::CONSTANT useList "Please use the Customer List to create a new Customer (not yet implemented)." + ::CONSTANT useListCap "Create New Customer" +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/CustList.BMP b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/CustList.BMP new file mode 100644 index 0000000..962bee3 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/CustList.BMP differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/CustList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/CustList.ico new file mode 100644 index 0000000..c9d2566 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/CustList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/Customer.ico b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/Customer.ico new file mode 100644 index 0000000..e6bc7cc Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Customer/bmp/Customer.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonFile.txt new file mode 100644 index 0000000..ca0078f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonFile.txt @@ -0,0 +1,6 @@ +number | familyName | firstName | dob | jobDescr | baseSalary +PA100 | Bloggs | Joseph | 721224 | Director | 250400 +PA150 | James | Alfred | 751513 | Packer | 38000 +PB100 | Smithson | John | 951704 | Programmer | 40170 +PB104 | Patterson | Patricia | 790331 | Office Manager | 76430 +PC200 | Cardaj | Jacob | 740615 | Plant Manager | 148250 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonModelData.rex new file mode 100755 index 0000000..910bad7 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonModelData.rex @@ -0,0 +1,195 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + + Samples: Person Model and Data Classes v01-00 26May13 + + Contains: classes "PersonModel" and "PersonData". + + Pre-requisites: Model-View Framework. + + Outstanding Problems: + None. + + Changes: + v01-00 01Oct12: First version. + 09Jan13: Removed or commented-out 'say' instructions. + 05Feb13: Removed 'query' method since it's available in the superclass. + 14Feb13: Removed (commented-out) 'return self' from the init method. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. Also, 'Samples' folder + changed name to 'Extras'. + 26May13: Corrected file path after re-factoring Extras folder. + + +------------------------------------------------------------------------------*/ + + +::REQUIRES "..\Exercise07\Support\GenericFile.rex" +::REQUIRES "..\Exercise07\Support\Model.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonModel v01-00 09Jan13 + ------------ + + The "model" part of the Person component - a simple "Model" class that + illustrates use of the Model-View framework. + See comments that include the string 'MFV'. + + Changes: + v01-00 01Oct12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS 'PersonModel' SUBCLASS Model PUBLIC + + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName -- Instance name of required instance is + -- provided by MVF as result of sending + -- a 'showModel' message to the Object Manager. + forward class (super) continue -- As part of MVF, super does the ~new + -- and provide's the model's instance + -- data as a param on the init. + modelId = RESULT -- MVF requires the model instance + return modelId -- ('modelId') to be returned. + + + + /*---------------------------------------------------------------------------- + init + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose dirPerson + use strict arg dirPerson -- Super gets data from PersonData and passes + -- that data when it creates this instance with + -- '~new'. + -- The data is in a directory: + + self~myData = dirPerson -- Store the data in my superclass. + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + test - a method to demonstrate Message Sender method store. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD test + return 25 + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonData- The data resource for Persons. v01-00 23Sep12 + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS 'PersonData' SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + + ::METHOD newInstance CLASS PUBLIC -- Invoked by ObjectMgr + --use strict arg instanceName + if self~created = "CREATED" then do -- If this is first time + --say ".PersonData-newInstance-01." + personDataId = self~new() -- the object id of the PersonData component. + self~created = .true + return personDataId + end + else do + say ".PersonData-newInstance-02 - Error - Singleton component, so can't have more than one instance." + return .false + end + + + ::METHOD init PRIVATE + fileName = "Extras\Person\PersonFile.txt" + columns = 6 -- colums in the Persons "table" + records = self~init:super(fileName, columns) + --say "PersonData-init-01: records:" records + + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonDT - A business data type for Person data. v00-01 05May12 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS PersonDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE number -- number Person Number + ::ATTRIBUTE familyName -- familyName Person Family Name + ::ATTRIBUTE firstName -- firstName Person First Name + ::ATTRIBUTE dob -- dob Date of Birth (format: yymmdd) + ::ATTRIBUTE jobDescr -- jobDescrip Job Description + ::ATTRIBUTE baseSalary -- baseSalary Basic Salary + + ::METHOD makeDir + dir = .Directory~new + dir["number"] = self~number + dir["familyName"] = self~familyName + dir["firstName"] = self~firstName + dir["dob"] = self~dob + dir["jobDescr"] = self~jobDescr + dir["baseSalary"] = self~baseSalary + + return dir + + ::METHOD list PUBLIC + expose number name price uom description size + say "---------------" + say "PersonDT-List:" + say "Number: " number " Family Name:" familyName + say "DOB:" dob " First Name:" firstName + say "Base Salary:" baseSalary + say "Job:" jobDescr + say "---------------" + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.h new file mode 100644 index 0000000..bd1631f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDC_PERS_NO 1000 +#define IDC_PERS_DOB 1001 +#define IDC_PERS_FIRSTNAME 1009 +#define IDC_PERS_FAMILYNAME 1010 +#define IDC_PERS_POSITION 1013 +#define IDC_PERS_SALARY 1014 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.rc new file mode 100644 index 0000000..d2d5e4b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +// Generated by ResEdit 1.5.11 +// Copyright (C) 2006-2012 +// http://www.resedit.net + +#include +#include +#include +#include "PersonView.h" + + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOG 0, 0, 179, 166 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | WS_VISIBLE | DS_SHELLFONT | WS_CAPTION | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Person Record" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 66, 142, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 121, 142, 50, 14 + LTEXT "Personnel No:", IDC_STATIC, 75, 19, 46, 8, SS_LEFT + EDITTEXT IDC_PERS_NO, 125, 15, 40, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Family Name:", IDC_STATIC, 11, 36, 43, 8, SS_LEFT + EDITTEXT IDC_PERS_FAMILYNAME, 10, 45, 85, 14, ES_AUTOHSCROLL + EDITTEXT IDC_PERS_FIRSTNAME, 106, 45, 60, 14, ES_AUTOHSCROLL + LTEXT "First Name:", IDC_STATIC, 107, 37, 36, 8, SS_LEFT + LTEXT "DOB:", IDC_STATIC, 12, 71, 18, 8, SS_LEFT + EDITTEXT IDC_PERS_DOB, 45, 70, 50, 15, ES_AUTOHSCROLL + LTEXT "Position:", IDC_STATIC, 12, 95, 28, 8, SS_LEFT + LTEXT "Salary:", IDC_STATIC, 12, 119, 22, 8, SS_LEFT + EDITTEXT IDC_PERS_POSITION, 45, 93, 120, 14, ES_AUTOHSCROLL + EDITTEXT IDC_PERS_SALARY, 45, 117, 40, 14, ES_AUTOHSCROLL +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.rex new file mode 100755 index 0000000..178523d --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Person/PersonView.rex @@ -0,0 +1,143 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Samples: Person View Class v01-00 26May13 + + Contains: classes "PersonView". + + Pre-requisites: Model-View Framework. + + Outstanding Problems: + None. + + Changes: + v01-00 01Oct12: First version. + 01Apr13: After ooDialog 4.2.2, Samples folder renamed to 'Extras' + and Support moved to within execise foldes. + so changes to ::Requires and ~addToConstDir needed. + 26May13: Corrected h path after re-factoring Extras folder. + + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Extras\Person\PersonView.h") + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonView v01-00 01Oct12 + ---------- + A simple class that shows how to exploit the Model-View framework. + See comments that include the string 'MFV'. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Support\RcView.rex" + +::CLASS 'PersonView' SUBCLASS 'RcView' PUBLIC + + /*---------------------------------------------------------------------------- + newInstance - creates an instance of the View: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS + use strict arg modelId, rootDlg -- MVF provides id of this view's Model; + -- not used in this sample. + dlg = .PersonView~new("Extras\Person\PersonView.rc", "IDD_DIALOG1") + dlg~activate(modelId, rootDlg) + return dlg -- required by MVF. + + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + activate - Model's data is provided by the superclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose personData + use strict arg modelId, rootDlg + forward class (super) continue -- Required by MVF to get this View's + -- data from its Model component. + personData = RESULT -- personData returned by superclass + self~popupAsChild(rootDlg, "SHOWTOP") + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + initDialog - invoked automatically after the dialog has been created. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose personData ecPersNo ecPersFamilyName ecPersFirstName ecPersDOB ecPersPosition ecPersSalary + --say "PersonView-initDialog-01." + ecPersNo = self~newEdit("IDC_PERS_NO") + ecPersFamilyName = self~NewEdit("IDC_PERS_FAMILYNAME") + ecPersFirstName = self~newEdit("IDC_PERS_FIRSTNAME") + ecPersDob = self~newEdit("IDC_PERS_DOB") + ecPersPosition = self~newEdit("IDC_PERS_POSITION") + ecPersSalary = self~newEdit("IDC_PERS_SALARY") + self~setMyData(personData) -- Note: cannor use 'setData' as this + -- would conflict with ooDialog's + -- setData method. + --self~offset:super -- offsetting logic is in the superclass. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + setData - sets (or "populates") controls with data provided in the + method's argument. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setMyData + expose ecPersNo ecPersFamilyName ecPersFirstName ecPersDOB ecPersPosition ecPersSalary + use arg personData + ecPersNo~setText( personData["number"]) + ecPersFamilyName~setText(personData["familyName"]) + ecPersFirstName~setText( personData["firstName"]) + ecPersDOB~setText( personData["dob"]) + ecPersPosition~setText( personData["jobDescr"]) + ecPersSalary~setText( personData["baseSalary"]) + return + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/ReadMe.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/ReadMe.txt new file mode 100644 index 0000000..f95760c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/ReadMe.txt @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Additional Examples to Accompany the ooDialog User Guide + ----------------------------------------------------------------------- + + This subdirectory tree contains the example programs referred to in the + appendix of the ooDialog User Guide. The programs are intended to give + context to the discussions in the User Guide, and may, or may not, be of + use to ooRexx programmers by themselves. + + The structure of the subdirectory tree and the programs themselves are + explained in the ooDialog User Guide. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowData.rex new file mode 100755 index 0000000..e99f1b1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowData.rex @@ -0,0 +1,151 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise07 The WowData component. v02-00 01Apr13 + + Contains: Classes: WowData. + + Pre-requisites: None. + + Description: The data component of the "Words of Wisdom" app. + + Changes: + v01-00 31May12: First version. + v02-00 06Sep12: Second version - modified to use the Model-View Framework (MVF) + 21Jan13: Updated comments. No change in funtion. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowData v02-00 13Feb13 + ------- + Has access to WOW data, and returns a set to requester. + + Potential enhancement: Define the size of a set through configuration. + + Changes: + v01-01 31May12: First version. + v02-00 06Sep12: Second version - modified to use the Model-View Framework (MVF) + 13Feb13: Changes to comments only. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "..\Exercise07\Support\GenericFile.rex" -- MVF + +--::CLASS WowData PUBLIC + ::CLASS WowData SUBCLASS GenericFile PUBLIC -- v01-00-->MVF + + ::ATTRIBUTE created CLASS -- MVF + + /*---------------------------------------------------------------------------- + newInstance - creates an instance of WowData. Since all data + components are singletons, MVF applies the instance + name "The". + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC -- MVF + use strict arg instanceName -- the instanceName is "The". + if self~created = "CREATED" then do -- if not yet created + WowDataId = self~new() + return WowDataId + end + else do -- if already created, then error. + say ".WowData-newInstance-01 - Error: singleton component, so can't have more than one instance." + return .false + end + + /*---------------------------------------------------------------------------- + init - asks super to read the file from disk. + Returns the number of records (exclusing the colums headers line) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init -- MVF + expose filename records + filename = "Extras\Wow4\WowFile.txt"; columns = 1 + records = self~init:super(fileName, columns) + return self + + + /*---------------------------------------------------------------------------- + getRecord - asks super to read the file from disk. + Normally for a 'named' component, MVF invokes 'getRecord' + to ask the Data component for a single record (handled by the + 'GenericFile' superclass). For a ListModel, MVF invokes 'getFile' + to get the whole file to display in a list. + Here, although WowModel is a Model, not a ListModel, we want the + whole file. And GenericFile holds the file in its 'fileAsDirectory' + attribute. So we intercept the 'getRecord' message, and return + the file. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC -- MVF + return self~fileAsDirectory + + + /*---------------------------------------------------------------------------- + activate - Not used for a Data component in MVF v01-00 + reads initial Wow Set from disk (but not in this version) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ::METHOD activate + expose arrWow + arrWow = .array~new + arrWow[1] = "Agnes Allen's Law:" - + "Almost anything is easier to get into than out of." + arrWow[2] = "Airplane Law:" - + "When the plane you are on is late," - + "the plane you want to transfer to is on time." + arrWow[3] = "Fourteenth Corollary of Atwood's General Law of Dynamic Negatives:" - + "No books are lost by loaning" - + "except those you particularly wanted to keep." + arrWow[4] = "Baker's Byroad: When you're over the hill, you pick up speed." + arrWow[5] = "First Law of Bicycling:" - + "No matter which way you ride, it's uphill and against the wind." + arrWow[6] = "Brooks's Law:" - + "Adding manpower to a late software project makes it later." + arrWow[7] = "Grossman's Misquote of H. L. Mencken:" - + "Complex problems have simple, easy-to-understand wrong answers." + return */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + readWowSet - returns the Wow set as an array. v01-00 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD readWowSet + --expose arrWow + --return arrWow + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowFile.txt new file mode 100644 index 0000000..f9699a8 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowFile.txt @@ -0,0 +1,27 @@ +Words of Wisdom +Agnes Allen's Law: Almost anything is easier to get into than out of. +Airplane Law: When the plane you are on is late, the plane you want to transfer to is on time. +Fourteenth Corollary of Atwood's General Law of Dynamic Negatives: No books are lost by loaning except those you particularly wanted to keep. +Baker's Byroad: When you're over the hill, you pick up speed. +First Law of Bicycling: No matter which way you ride, it's uphill and against the wind. +Brooks's Law: Adding manpower to a late software project makes it later. +Grossman's Misquote of H. L. Mencken: Complex problems have simple, easy-to-understand wrong answers. +Rule of Accuracy: When working toward the solution of a problem, it always helps if you know the answer. Corollary: Provided, of course, that you know there is a problem. +Acheson's Rule of the Bureaucracy: A memorandum is written not to inform the reader but to protect the writer. +Ade's Law: Anybody can win -- unless there happens to be a second entry. +Bradley's Bromide: If computers get too powerful, we can organize them into a committee - that will do them in. +Civilization: Civilization advances by extending the number of important operations which we can do without thinking of them. +Fred Allen's Law: I'd rather have a free bottle in front of me than a prefrontal lobotomy. +Beardsley's Warning to Lawyers: Beware of and eschew pompous prolixity. +Boling's Postulate: If you're feeling good, don't worry. You'll get over it. +Laws of Programming: Definition: A working program is one that has only unobserved bugs. +Rules of Pratt: #1 If a severe problem manifests itself, no solution is acceptable unless it is involved, expensive, and time consuming. +Computers vs People: One good reason why computers can do more work than people is that they never have to stop and answer the phone. +First law of programming: Problems that go away by themselves come back by themselves. +It is useless for the sheep to pass resolutions in favor of vegetarianism while the wolf remains of a different opinion. +Many are called, Few are chosen. Even fewer get to do the choosing. +Tell them 30 billion stars and they believe you. Say "Wet paint" and they check for themselves. +Entropy isn't what it used to be. (Al Vesper.) +Never try to teach a pig to whistle. It wastes your time, and annoys the pig. +No one can attain perfection but, if you chase perfection, you can catch excellence! (Vince Lombardi) +Murphy's 11th Law: It is impossible to make anything foolproof because fools are very ingenious. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowModel.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowModel.rex new file mode 100755 index 0000000..23826d2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowModel.rex @@ -0,0 +1,128 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise07 Part 2: The WowModel component. v02-00 20Jly13 + + Contains: Classes: WowModel. + + Pre-requisites: The Model-View Framework (MVF) + + Description: The model component of the "Words of Wisdom" app. + + Changes: + v01-00 31May12: First version. + v02-00 06Sep12: Second version - uses the MVF. Class name changed from + WowPicker to WowModel. + 09Jan13: Comment-out 'say's. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + 20Jly13: Added another "wise saying" to the data file so had to add + 1 to upped bound for random selection in 'pickWow' method. + +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowModel v01-00 13Feb13 + --------- + A class that returns a Words of Wisdom string, selected randomly from a set + of such Words of Wisdom. + (Potential enhancements: Request a different set from the WowData class; + Have the size of the set configurable.) + Changes: + v01-00 31may12: First version. + v02-00 06Sep12: Second version - uses the MVF. + 13Feb13: Mods to comments only. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "..\Exercise07\Support\Model.rex" -- MVF + +::CLASS WowModel SUBCLASS Model PUBLIC --v01-00-->MVF + + /*---------------------------------------------------------------------------- + newInstance - class method required for MVF. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC --MVF + use strict arg instanceName + forward class (super) continue -- Super does the ~new, gets the data + -- and passes it as a param on the init. + modelId = RESULT -- MVF (or just 'return RESULT') + return modelId + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init - Since there's not no divided setup as in Views, + 'activate' is same as 'init' so with MVF we just use 'init'. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init -- MVF + expose arrWowSet + use strict arg dirWowSet -- MVF: data for model provided by super + arrWowSet = dirWowSet[Records] -- MVF: pre-defines format of data. + return self -- MVF. + + + /*---------------------------------------------------------------------------- + activate - Not used by Model components when using MVF. --v01-00 + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + /*::METHOD activate + expose arrWowSet + dataSource = .local~my.idWowData + arrWowSet = dataSource~readWowSet + return */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + pickWow - picks a Word of Wisdom from the current wowSet and returns it. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD pickWow -- v01-00 & MVF + expose arrWowSet + i = random(1,26) + return arrWowSet[i,1] + + /*---------------------------------------------------------------------------- + query - MVF sends 'query' when the View is created. However, this function + is not used by WowView since it does not display data when the + dialog is opened for first time. Thus, since the superclass's + method is not required either, this method merely returns a string. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD query PUBLIC -- MVF + return "WowModel-query: this method not supported." + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowView.rex new file mode 100755 index 0000000..303052c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Extras/Wow4/WowView.rex @@ -0,0 +1,139 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise03 Part 2: The WowView component. v02-00 01Apr13 + + Contains: Classes: WowView. + + Pre-requisites: + .local~my.idWowPicker - an object that provides a 'pickWow' method. + + Description: The view component for the "Words of Wisdom" app. + + Changes: + v01-00 31May12: First version. + v02-00 06Sep12: Changed to use MVF. + 09Jan13: 'say's commented out. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + WowView v02-00 06Sep12 + ------- + A class that defines the User Interface for the Wow application. + + Changes: + v01-00 31May12: First version. + v02-00 06Sep12: Second version - uses the Model-View Framework. + 09Jan13: 'say's commented-out. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "ooDialog.cls" +::REQUIRES "..\Exercise07\Support\UdView.rex" + +::CLASS 'WowView' SUBCLASS UdView PUBLIC -- MVF + + /*---------------------------------------------------------------------------- + newInstance - invoked to create the View instance -- MVF + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS + use strict arg idModel, rootDlg -- MVF: idModel is the object ref of the Model instance. + dlg = self~new() + dlg~activate(idModel,rootDlg) -- MVF: idModel required by MVF + return dlg -- MVF: must return view id. + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + self~create(30, 30, 257, 123, "Words of Wisdom", "CENTER") + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + defineDialog - defines the "Words of Wisdom" controls + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineDialog -- Invoked automatically by ooDialog. + self~createPushButton(901, 142, 99, 50, 14, "DEFAULT", "More wisdom", OkClicked) + self~createPushButton(IDCANCEL, 197, 99, 50, 14, ,"Cancel") + self~createStaticText(101, 40, 40, 200, 40, , "Click 'More wisdom'") + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invoked automatically after the dialog has been created. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- expose newText -- v01-00 + expose modelData newText -- MVF + newText = self~newStatic(101) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + activate - gets id for wowPicker, shows the dialog. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + --expose wowPicker -- v01-00 + expose rootDlg modelData idModel -- MVF + --wowPicker = .local~my.idWowPicker -- v01-00 + use strict arg idModel, rootDlg -- MVF + say "WowView-activate-01: idModel, rootDlg" idModel||"," rootDlg + forward class (super) continue -- MVF: gets Model's data + modelData = RESULT -- MVF: Model's data returned by super + --self~execute("SHOWTOP", IDI_DLG_OOREXX) + self~popupAsChild(rootDlg,"SHOWTOP", IDI_DLG_OOREXX) + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + okClicked - Actions the "More wisdom" control + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD okClicked + -- expose wowPicker newText -- v01-00 + expose idModel newText -- MVF + --wow = wowPicker~pickWow -- v01-00 + wow = idModel~pickWow + --newText~setText(wow) -- v01-00 + --say "WowView-okClicked-01: newText, modelData =" newText wow + newText~setText(wow) -- MVF + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.h new file mode 100644 index 0000000..07943a1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.h @@ -0,0 +1,65 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDR_ORDFORM_MENU 102 +#define IDI_ORDFORM_DLGICON 107 +#define IDD_ORDFORM_DIALOG 113 +#define IDD_ORDFORM_CUST_DIALOG 114 +#define IDD_ORDFORM_ORDLINES_DIALOG 115 +#define IDC_CUSTDTLS_NUM 1000 +#define IDC_CANCEL 1001 +#define IDC_CUSTDTLS_DISC 1001 +#define IDM_ORDFORM_PLACE 40000 +#define IDM_ORDFORM_ABOUT 40001 +#define IDC_ORDFORM_DATE 40002 +#define IDM_ORDFORM_SAVE 40003 +#define IDM_ORDFORM_CANCEL 40004 +#define IDC_ORDFORM_ORDNO 40005 +#define IDC_ORDFORM_TABS 40009 +#define IDC_ORDFORM_PLACEORDER 40010 +#define IDC_ORDLINES_LIST 40026 +#define IDC_ORDLINES_PRODNO 40027 +#define IDC_ORDLINES_QTY 40028 +#define IDC_ORDLINES_ADD 40029 +#define IDC_ORDLINES_DELETE 40030 +#define IDC_CUSTDTLS_FIND 40031 +#define IDC_CUSTDTLS_ADDR 40037 +#define IDC_CUSTDTLS_NAME 40038 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.rc new file mode 100644 index 0000000..b0cc704 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.rc @@ -0,0 +1,99 @@ +// Generated by ResEdit 1.5.11 +// Copyright (C) 2006-2012 +// http://www.resedit.net + +#include +#include +#include +#include "OrderFormView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDFORM_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "Place Order...", IDM_ORDFORM_PLACE + MENUITEM "Save Order...", IDM_ORDFORM_SAVE + MENUITEM "Cancel Order", IDM_ORDFORM_CANCEL + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDFORM_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_CUST_DIALOG DIALOG 6, 15, 206, 127 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Customer Name:", IDC_STATIC, 16, 37, 53, 8, SS_LEFT + EDITTEXT IDC_CUSTDTLS_NAME, 79, 32, 100, 14, WS_DISABLED | ES_AUTOHSCROLL + EDITTEXT IDC_CUSTDTLS_NUM, 79, 11, 50, 14, ES_AUTOHSCROLL + LTEXT "Customer Number:", IDC_STATIC, 16, 16, 59, 8, SS_LEFT + PUSHBUTTON "Find Customer", IDC_CUSTDTLS_FIND, 145, 11, 50, 14 + EDITTEXT IDC_CUSTDTLS_ADDR, 80, 55, 100, 35, WS_DISABLED | ES_AUTOHSCROLL + LTEXT "Customer Address:", IDC_STATIC, 16, 57, 60, 8, SS_LEFT + LTEXT "Customer Discount:", IDC_STATIC, 16, 99, 62, 8, SS_LEFT + EDITTEXT IDC_CUSTDTLS_DISC, 80, 96, 40, 14, WS_DISABLED | ES_AUTOHSCROLL +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_DIALOG DIALOG 0, 0, 272, 278 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Order Form" +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_ORDFORM_DATE, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_APPCANPARSE | DTS_RIGHTALIGN, 185, 9, 70, 15 + EDITTEXT IDC_ORDFORM_ORDNO, 50, 9, 40, 14, ES_AUTOHSCROLL + LTEXT "Order No.", IDC_STATIC, 10, 12, 32, 8, SS_LEFT + LTEXT "Date", IDC_STATIC, 158, 12, 16, 8, SS_LEFT + LTEXT "Total Cost:", IDC_STATIC, 116, 194, 35, 8, SS_LEFT + LTEXT "Discount", IDC_STATIC, 116, 208, 29, 8, SS_LEFT + PUSHBUTTON "Place Order", IDC_ORDFORM_PLACEORDER, 200, 244, 50, 14 + LTEXT "Tax", IDC_STATIC, 116, 222, 13, 8, SS_LEFT + RTEXT "0.00", IDC_STATIC, 164, 208, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 164, 222, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 222, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 194, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_STATIC, 215, 208, 40, 8, SS_RIGHT + CONTROL "", IDC_ORDFORM_TABS, WC_TABCONTROL, 0, 15, 35, 245, 150 + PUSHBUTTON "Cancel Order", IDC_CANCEL, 132, 244, 46, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_ORDLINES_DIALOG DIALOG 6, 15, 240, 132 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_POPUP | WS_SYSMENU +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_ORDLINES_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT, 5, 5, 230, 90 + EDITTEXT IDC_ORDLINES_PRODNO, 7, 103, 40, 14, ES_AUTOHSCROLL + LTEXT "Product No.", IDC_STATIC, 9, 119, 39, 8, SS_LEFT + EDITTEXT IDC_ORDLINES_QTY, 62, 103, 38, 14, ES_AUTOHSCROLL + LTEXT "Quantity", IDC_STATIC, 65, 119, 27, 8, SS_LEFT + PUSHBUTTON "Add OrderLine", IDC_ORDLINES_ADD, 122, 105, 50, 14 + PUSHBUTTON "Delete OrderLine", IDC_ORDLINES_DELETE, 177, 105, 58, 14 +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDFORM_DLGICON ICON ".\\Order\\bmp\\OrderForm.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.rex new file mode 100755 index 0000000..cd2de6d --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderFormView.rex @@ -0,0 +1,421 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The OrderFormView class v02-00 01Apr13 + OrderFormView.rex + + Contains: class "OrderFormView", class "HRSofv". + Pre-requisite files: OrderFormView.rc, OrderFormView.h. + + Changes: + v01-00 07Jun12: First version. + v02-00 08Jan13: OrderFormView Modified to use the Model-View Framework (MVF). + Removed stand-alone startup (not now needed). + 25Feb13: Added control dialogs in tab sheet. + 27Feb13: Made Order Date functional. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Order\OrderFormView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "support\RcView.rex" + +/*============================================================================== + OrderFormView v02-00 27Feb13 + ------------- + The "view" (or "gui") Data Entry part of the Sales Order component. + + Changes: + v01-00 07Jun12: First Version + v02-00 05Oct12: Modified to use the Model-View Framework (MVF) including + removal of stand-alone startup. + 27Feb13: Changed to show tabs (control dialogs). + Corrected the Order Date control and limited order date to + one year ahead. + Commented-out say's. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderFormView SUBCLASS RcView PUBLIC + + ::ATTRIBUTE tabContent + + ::METHOD newInstance CLASS PUBLIC + use strict arg idModel, rootDlg + --say; say ".OrderFormView-newInstance: rootDlg =" rootDlg + dlg = self~new("Order\OrderFormView.rc", "IDD_ORDFORM_DIALOG") + dlg~activate(idModel, rootDlg) + return dlg + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- creates the dialog instance but does not make it visible. + expose menuBar + --say "OrderFormView-init-01" + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "OrderFormView-createMenuBar-01" + menuBar = .ScriptMenuBar~new("Order\OrderFormView.rc", IDR_ORDFORM_MENU, , , .true) + + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg idModelInstance orderData cd1 cd2 + use strict arg idModelInstance, rootDlg + forward class (super) continue + orderData = RESULT + + -- set up tabs for Customer Details and Order Lines: + cd1 = .CustDetailsDlg~new("Order\OrderFormView.rc", IDD_ORDFORM_CUST_DIALOG) + cd2 = .OrderLinesDlg~new("Order\OrderFormView.rc", IDD_ORDFORM_ORDLINES_DIALOG) + tabContent = .array~of(cd1, cd2) + --say "OrderFormView-activate-01: tabContent =" tabContent[1]||"," tabContent[2] + cd1~ownerDialog = self + self~prep(tabContent) + + --say "OrderFormView-activate-02: modelData, orderNum =" orderData||"," orderData[formNumber] + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_ORDFORM_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD prep + expose tabContent lastSelected havePositioned + use strict arg tabContent + --say "OrderFormView-prep-01." + -- The havePositioned array is used to determine if the page dialogs have been + -- positioned or not. Mark all 5 dialogs as not having been positioned yet. + havePositioned = .array~of(.false, .false) + -- No tab has been selected yet + lastSelected = 0 + + -- Connect the event handling methods to the events we are interested in. + --self~connectButtonEvent(IDC_PB_PREVIOUS, CLICKED, onPrevious) + --self~connectButtonEvent(IDC_PB_NEXT, CLICKED, onNext) + self~connectTabEvent(IDC_ORDFORM_TABS, SELCHANGE, onNewTab) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- Called by ooDialog after SHOWTOP. + expose menuBar ecOrderNo orderData tabContent tabControl orderDate + --say "OrderFormView-initDialog-01" + + menuBar~attachTo(self) + + -- Tab stuff starts: + cd1 = tabContent[1] + cd1~execute + + -- Add the tabs to the tab control. + tabControl = self~newTab(IDC_ORDFORM_TABS) + tabControl~addSequence("Customer Details", "Order Lines") + -- tab stuff ends + + ecOrderNo = self~newEdit("IDC_ORDFORM_ORDNO") + --say "OrderFormView-initDialog-02: ecOrderNo =" ecOrderNo + btnCancelOrder = self~newPushButton("IDC_CANCEL") + btnPlaceOrder = self~newPushButton("IDC_ORDFORM_PLACEORDER") + self~connectButtonEvent("IDC_CANCEL","CLICKED",cancel) + self~connectButtonEvent("IDC_ORDFORM_PLACEORDER","CLICKED",placeOrderBtn) + + -- Get proxy for Order date and set its format. By default, it shows today. + --Also, set allowable date range selected to between today and 1 year's time. + orderDate = self~newDateTimePicker(IDC_ORDFORM_DATE); + orderDate~setFormat("MMM dd',' yyyy") + today = .DateTime~today + maxOrderDate = today~addYears(1) + orderDate~setRange(.array~of(today,maxOrderDate)) + + -- Tab stuff starts: + -- Determine the position and size of the display area of the tab control. + self~calculateDisplayArea + -- Position and show the control dialog used for the first page of the tab. + self~positionAndShow(1) + -- tab stuff ends + + self~setMyData(orderData) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD calculateDisplayArea PRIVATE + expose tabControl displayRect + + -- Given a rectangle describing the tab control's size and position, the tab + -- control itself will calculate the display area's size and position. + r = tabControl~windowRect + tabControl~calcDisplayRect(r) + + -- Save the size of the display area, we need it later. + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Now we need to map the display area's position on the screen, to the client + -- co-ordinates of the main dialog. The control dialog(s) are children windows + -- of the main dialog, which is why we need to use the client-area of the + -- dialog, not the client area of the tab control. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Create our display rectangle. This is used in setWindowPosition(), which + -- takes a point / size rectangle. ooDialog defines a point / size rectangle + -- as using the left and top attributes for the position of the upper left + -- corner of a rectangle, using the right attribute for the width of the + -- rectangle, and using the bottom attribute for the height of the rectangle. + displayRect = .Rect~new(p~x, p~y, s~width, s~height) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + positionAndShow() + Used to resize and reposition one of the control dialogs so it occupies + the display area of the tab control. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD positionAndShow private + expose tabControl tabContent displayRect lastSelected havePositioned + use strict arg index + --say "OrderFormView-positionAndShow-01; index =" index + -- We can not position the control dialog until the underlying Windows dialog + -- is created. If the system is heavily loaded for some reason, this may not + -- have happened yet. We need to wait for it. + dlg = tabContent[index] + do i = 1 to 10 + if dlg~hwnd <> 0 then leave + z = SysSleep(.01) + end + --say "OrderFormView-positionAndShow-02." + if dlg~hwnd == 0 then do + say "Error creating dialog for the tab with index:" index", aborting" + return self~cancel + end + + if lastSelected <> 0 then tabContent[lastSelected]~hide + + -- Now resize and reposition the control dialog to the tab control's display + -- area. We need to position the control dialog *above* the tab control in + -- the Z-order so that it shows. + dlg~setWindowPos(tabControl~hwnd, displayRect, "SHOWWINDOW NOOWNERZORDER") + --say "OrderFormView-positionAndShow-03."; say + + lastSelected = index + havePositioned[index] = .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + onNewTab - Invoked when user selects another tab. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onNewTab + expose tabControl tabContent havePositioned lastSelected + --say "OrderFormView-onNewTab-01." + index = tabControl~selectedIndex + 1 + --say "OrderFormView-onNewTab-02: index =" index + dlg = tabContent[index] + --say "OrderFormView-onNewTab-03: dlg, havePositioned[index] =" dlg havePositioned[index] + + if havePositioned[index] then do + last = tabContent[lastSelected] + last~hide + dlg~show + lastSelected = index + end + else do + dlg~ownerDialog = self + dlg~execute + self~positionAndShow(index) + end + + + /*---------------------------------------------------------------------------- + setData - sets (or "populates") controls with data provided in the + method's argument. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setMyData + expose ecOrderNo + use strict arg orderData + ecOrderNo~setText( orderData[formNumber]) + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD placeOrder UNGUARDED + self~noMenuFunction(.HRSofv~PlaceOrder) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD saveOrder UNGUARDED + self~noMenuFunction(.HRSofv~SaveOrder) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD CancelOrder UNGUARDED + self~cancel + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSofv~HelpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSofv~NoMenu, self~hwnd, title, 'WARNING') + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + -- "Cancel" - This method over-rides the default Windows action of + -- 'cancel window' for an Escape key. + -- cancel - 'endExecution' required else dialog hangs when user tried to close. + ::METHOD cancel + expose tabContent + say "OrderFormView-cancel-01." + + response = askDialog(.HRSofv~QExit, "N") + if response = 1 then do /*forward class (super) */ -- '1' means the 'Yes' button pressed + do dlg over tabContent + dlg~endExecution(.false) + end + return self~cancel:super + end + + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Button Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD placeOrderBtn UNGUARDED + ret = MessageDialog(.HRSofv~NoBtn, self~hwnd, "Place Order Button", 'WARNING') + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + *** Find out if it's a bug in RcControlDialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + expose cd1 cd2 + say "OrderFormView-leaving-01." + forward class (super) continue + +/*============================================================================*/ + + + +/*============================================================================== + CustDetailsDlg - a Page in the OrderFormView + ------------- + + The "view" (or "gui") Customer Ordering part of the OrderFormView component. + ----------------------------------------------------------------------------*/ +::class CustDetailsDlg subclass RcControlDialog + + ::method initDialog + expose tabControl + --say "CustDetailsDlg-initDialog-01." + + +/*============================================================================== + OrderLinesDlg - a Page in the OrderFormView + ---------------- + + The "view" (or "gui") Products Ordering part of the OrderFormView. + ----------------------------------------------------------------------------*/ +::class OrderLinesDlg subclass RcControlDialog + + ::method initDialog + expose tabControl + lvOrderItems = self~newListView("IDC_ORDLINES_LIST") + lvOrderItems~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvOrderItems~insertColumnPX(0,"ProdNo", 60,"LEFT") + lvOrderItems~insertColumnPX(1,"Product Name", 180,"LEFT") + lvOrderItems~insertColumnPX(2,"Qty", 40,"LEFT") + lvOrderItems~insertColumnPX(3,"Amount", 60,"LEFT") + --say "OrderLinesDlg-initDialog-01." + + -- Test an edit field: + ecProdno = self~newEdit("IDC_ORDLINES_PRODNO") + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD leaving UNGUARDED + --expose objectMgr viewClass viewInstance + --objectMgr~removeView(viewClass, viewInstance) + --say "OrderFormView=OrderLinesDlg-leaving-01." + -- Note - we do not remove the Model. Should we? If so, not from here! + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSofv) v01-00 07Jun12 + -------- + The HRSofv class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSofv PRIVATE -- Human-Readable Strings + ::CONSTANT QExit "Are you sure you want to cancel this Order and throw away all changes?" + ::CONSTANT NoMenu "This menu item is not yet implemented." + ::CONSTANT NoBtn "This button is not yet implemented." + ::CONSTANT PlaceOrder "Place Order" + ::CONSTANT SaveOrder "Save Order" + ::CONSTANT CancelOrder "Cancel Order" + ::CONSTANT HelpAbout "Help - About" + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderHeadersFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderHeadersFile.txt new file mode 100644 index 0000000..7f4bfeb --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderHeadersFile.txt @@ -0,0 +1,6 @@ +OrderNo | CustNo | Date | Disc | Cmtd +SO-1234 | AB0784 | 120821 | 2 | N +SO-2345 | BA0314 | 110815 | 1.5 | Y +SO-3456 | BA0314 | 120527 | 0 | Y +SO-4567 | CU0003 | 120630 | 0 | Y +SO-4569 | AC0027 | 120824 | 5 | N diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderLinesFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderLinesFile.txt new file mode 100644 index 0000000..38c61df --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderLinesFile.txt @@ -0,0 +1,13 @@ +OrderNo | ProdNo | Qty +SO-1234 | AB100/W | 5 +SO-1234 | CF300/X | 6 +SO-1234 | EF500/W | 15 +SO-2345 | AB100/W | 5 +SO-3456 | XY200 | 7 +SO-3456 | LM400 | 4 +SO-4567 | XY200 | 12 +SO-4567 | CU003 | 1 +SO-4569 | AB100/W | 10 +SO-4569 | LM400 | 8 +SO-4569 | CU003 | 5 +SO-4569 | XY200 | 12 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.h new file mode 100644 index 0000000..bc886a6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDLIST_LISTVIEW 106 +#define IDI_ORDLIST_DLGICON 107 +#define IDR_ORDLIST_MENU 108 +#define IDC_ORDLIST_LIST 1000 +#define IDC_ORDLIST_SHOWORDER 1001 +#define IDM_ORDLIST_NEWORDER 40000 +#define IDM_ORDLIST_ABOUT 40001 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.rc new file mode 100644 index 0000000..317a390 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderListView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Order...", IDM_ORDLIST_NEWORDER + } + POPUP "Help" + { + MENUITEM "About...", IDM_ORDLIST_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDLIST_LISTVIEW DIALOG 0, 0, 255, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Order List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_ORDLIST_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING, 15, 10, 225, 215 + DEFPUSHBUTTON "Show Order", IDC_ORDLIST_SHOWORDER, 89, 235, 42, 14, WS_DISABLED +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDLIST_DLGICON ICON ".\\order\\bmp\\OrderList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.rex new file mode 100755 index 0000000..3d5fe77 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderListView.rex @@ -0,0 +1,251 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The Order ListView v02-00 01Apr13 + + Contains: class "OrderListView", "HRSolv" + + Pre-requisite files: OrderListView.rc, OrderListView.h. + + Description: Provides a list of Orders and supports viewing any given + Order via a double-click on that Order's item in the list. + This is an "Intermediate" component - it is invoked by OrderMgmt, + and invokes OrderView. + + Changes: + v01-00 07Jun12: First Version (Ex06). + v02-00 25Aug12: Updated for Ex07 using the MVF. + 08Jan13: Removed stand-alone startup (not now needed). + 11Jan13: Commented-out 'say' instructions. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + + Outstanding Problems: None reported. + +*******************************************************************************/ + + +.Application~addToConstDir("Order\OrderListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Order\OrderView.rex" +::REQUIRES "Support\RcView.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderListView v01-01 25Aug12 + ------------- + The view of a list of products. + Changes: + v01-00 07Jun12: First version + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderListView SUBCLASS RcView PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use strict arg idModel, rootDlg --Ex07 + --say ".OrderListView-newInstance-01: root, idModel =" rootDlg idModel + dlg = self~new("Order\OrderListView.rc", "IDD_ORDLIST_LISTVIEW") + --say ".OrderListView-newInstance-02." + dlg~activate(idModel, rootDlg) --Ex07 + return dlg --Ex07 + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + forward class (super) continue + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "OrderListView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Order\OrderListView.rc", "IDR_ORDLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg modelData --Ex07 + use strict arg idModel, rootDlg --Ex07 + --say "OrderListView-activate-01: idModel, root =" idModel rootDlg + forward class (super) continue --Ex07 + modelData = RESULT --Ex07 + --say "OrderListView-activate-02: modelData =" modelData + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_ORDLIST_DLGICON") + --return self --Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvOrders btnShowOrder modelData --Ex07 + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + --say "OrderListView-initDialog-01"; say + lvOrders = self~newListView("IDC_ORDLIST_LIST"); + lvOrders~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvOrders~insertColumnPX(0,"OrderNo",60,"LEFT") + lvOrders~insertColumnPX(1,"CustNo",80,"LEFT") + lvOrders~insertColumnPX(2,"CustName",130,"LEFT") + lvOrders~insertColumnPX(3,"Date",80,"LEFT") + self~connectListViewEvent("IDC_ORDLIST_LIST","CLICK",itemSelected) + self~connectListViewEvent("IDC_ORDLIST_LIST","ACTIVATE",openItem) -- double-click + self~connectButtonEvent("IDC_ORDLIST_SHOWORDER","CLICKED",showOrder) + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newOrder UNGUARDED + self~noMenuFunction(.HRSolv~newOrder) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSolv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSolv~noMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected unguarded + expose lvOrders --btnShowOrder + use arg id, itemIndex, columnIndex, keyState + if itemIndex > -1 then self~enableControl("IDC_ORDLIST_SHOWORDER") + else self~disableControl("IDC_ORDLIST_SHOWORDER") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + --say "OrderListView-openItem-01: item selected =" item + self~showOrder + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showOrder unguarded + expose lvOrders rootDlg + item = lvOrders~selected + --say "OrderListView-showOrder-01: item selected =" item + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSolv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvOrders~getItemInfo(item, info) then do + --say "OrderListView-showOrder-02: info~text =" info~text + objectMgr = .local~my.ObjectMgr + objectMgr~showModel("OrderModel", info~text, rootDlg) --Ex07 + self~disableControl("IDC_ORDLIST_SHOWORDER") + end + else do + say "OrderListView-showOrder-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvOrders modelData -- Ex07 + --say "OrderListView-loadList-01: dataArray =" modelData -- Ex07 + rows = modelData[count] -- Ex07 - number of rows + arrData = modelData[records] + --say "OrderListView-loadList-02:Dims =" modelData~dimension(1) modelData~dimension(2) + do i = 1 to rows + --say "OrderListView-loadList-04a: modelData[i,2] =" modelData[i,2] + -- Change date to display format - i.e. yymmdd to (US format!) mm-dd-yy): + date = arrData[i,3] + displayDate = date~substr(3,2)||"/"||date~substr(5)||"/"||date~substr(1,2) + lvOrders~addRow( , ,arrData[i,1], arrData[i,2], arrData[i,6], displayDate) + end + lvOrders~setColumnWidth(2) -- set width of 3rd column to longest text entry. + + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSolv (Human-Readable Strings for OrderListView) v01-00 07Jun12 + --- + The HRSolv class provides constant character strings for user-visible messages + issued by the OrderListView class. + + Changes: + v01-00 07Jun12: First Version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSolv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newOrder "New Order" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderModelsData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderModelsData.rex new file mode 100755 index 0000000..d075fed --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderModelsData.rex @@ -0,0 +1,501 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The OrderModel and OrderData Classes v02-00 01Apr13 + + Contains: classes "OrderModel", OrderListModel, and "OrderData". --Ex07 + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. + v02-00 08Jan13: Modified to use the MVF. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + + +::REQUIRES "Support\Model.rex" +::REQUIRES "Support\GenericFile.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderModel v01-00 08Feb13 + ------------ + The "model" part of the Order component. + + Changes: + v01-00 07Jun12: First version. + 24Aug12: Modified to use the MVF. + 11Jan13: Commented-out 'say' instructions. + 08Feb13: Minor changes to comments only. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderModel SUBCLASS Model PUBLIC --Ex07 + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName --Ex07 + forward class (super) continue --Ex07 + modelId = RESULT --Ex07 + return modelId --Ex07 + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init - Superclass 'Model', in its newInstance method, queries the Data + component for this instance's data, then does the self~new(myData) + which invokes this 'init' method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose orderData + use strict arg orderData -- Ex07: data provided by Superclass. + self~myData = orderData -- Ex07: store in superclass's attribute. + --say "OrderModel-init-01: orderData =" orderData + --say "OrderModel-init-02: self~myData =" self~myData + + -- MVF gives gets the Order's Header data for the OrderModel, and OrderDetails for + -- the OrderListModel. Here we've got the Order Headers; now we need to ask + -- the OrderData component for the Order Details for this Order only: + --objMgr = .local.my~ObjectMgr + --idOrderData = objMgr~getComponentId("ProductData", "The") + --headerData = idOrderData~getHeaders( = + + return self -- Ex07 + + +-- ::METHOD query PUBLIC +-- use arg orderNo +-- if orderNo = "ORDERNO" then -- param not supplied +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderFormModel v01-00 04Oct12 + -------------- + The model component for the OrderForm business component. + + Changes: + v01-00 04Oct12. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderFormModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE nextOrderNumber CLASS + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + newInstance - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName -- invoked by ObjectMgr + --say ".OrderFormModel-newInstanceName-01." + forward class (super) continue --Ex07 + modelId = RESULT --Ex07 + return modelId --Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getInstanceName - over-rides super's method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD getInstanceName CLASS PUBLIC + --say ".OrderFormModel-getInstanceName-01." + if self~nextOrderNumber = "NEXTORDERNUMBER" then do -- No instance name set + self~nextOrderNumber = "SO-4999" + end + number = self~nextOrderNumber~right(4) + number += 1 + self~nextOrderNumber = "SO-"||number + --say ".OrderFormModel-getInstanceName-02: instanceName =" self~nextOrderNumber + return self~nextOrderNumber + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD init + expose orderData + use strict arg orderData -- Ex07: data provided by Superclass. + self~myData = orderData -- Ex07: store in superclass's attribute. + --say "OrderModel-init-01: orderData =" orderData + return self + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderListModel v01-00 24Aug12 + -------------- + The "ListModel" for the SalesOrder business component. + + Changes: + v01-00 24Aug12. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderListModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE myData +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName + self~wantList = .true -- MVF - for List models only. + forward class (super) continue -- MVF: super does the ~new and + -- passes data as a param on the init. + modelId = RESULT -- MVF + --say ".OrderListModel-newInstance-01: id =" modelId + return modelId -- MVF - could just say 'return modelId'. + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init - stores received data in attribute 'arrData' and returns self. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose arrData + use strict arg arrData + self~myData = arrData + --say "OrderListModel-init-01: data = " self~myData + --say "OrderListModel-init-02: type and dimensions:" self~myData self~myData~dimension + return self + + + /*---------------------------------------------------------------------------- + query - returns an array of all OrderHeader data. + In MVF this method is invoked by the RcView (or ResView) superclass. + But the list also needs the name of the Customer. So this model + also gets the Customer Name from the appropriate Customer Model. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD query PUBLIC + --say "OrderListModel-query-01: self~myData =" self~myData + -- myData is an array of records. Now get Customer + return self~myData + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderData v01-00 07Jun12 + ------------ + The "data" part of the Order component. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderData SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + ::ATTRIBUTE dirOrderHeaders PUBLIC -- a directory containing all records in + -- the SalesOrderHeaders.txt file joined + -- with Customer Name and Address from + -- the Customer file. + ::ATTRIBUTE dirOrderLines PUBLIC -- a directory containing all records in + -- the SalesOrderLines.txt file joined + -- with product Description from the + -- Product File. +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName + if self~created = "CREATED" then do + orderDataId = self~new() + return orderDataId + end + else do + say "... singleton component, so can't have more than one instance." + return .false + end + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - Invoked super to read the OrderHeader file, which is stored by super + in super's 'fileAsDirectory' attribute - and also the 'raw' form of + the file is stored in super's 'fileArray' attribute. + The OrderDetail file is read separately by invoking super's 'readFile' + method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD init --Ex07 + expose filename numRecords + -- Read the OrderHeaders file: + filename = "Order\OrderHeadersFile.txt"; columns = 5 + -- invoke super to read the OrderHeaders file (read into super's + -- fileAsDirectory attribute): + numRecords = self~init:super(fileName, columns) + self~dirOrderHeaders = self~fileAsDirectory + -- List the OrderHeaders + /*say "OrderData-init-01: numRecords:" numRecords + if numRecords > 0 then do + say "OrderData-init-02: Array is:" + say self~fileArray~tostring -- fileArray is super's attribute. + end */ + -- Read the OrderLines file: + self~dirOrderLines = self~readFile:super("Order\OrderLinesFile.txt", 3) + + -- At this point, the OrderHeader file is the dirOrderHeadersattribute, + -- and the OrderLines file is in self~dirOrderLines. + -- Now, for the OrderHeaders, do a 'join' with Customer to add the + -- customer's name and address to the order headers in self~dirOrderHeaders: + self~addCustomerInfo + -- And now add Product info to the order lines in self~dirOrderLines: + self~addProductInfo + --self~listOrders + return self -- MVF + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + addCustomerInfo - Called by init - adds customer info from the CustomerData + component to each of the OrderHeader lines. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD addCustomerInfo PRIVATE + -- (1) Add column headers (field names) from Customer to OrderHeaders: + columnHeaders = self~dirOrderHeaders[headers] + columnHeaders[6] = "CustName"; columnHeaders[7] = "CustDisc" + columnHeaders[8] = "CustAddr"; columnHeaders[9] = "Zip" + self~dirOrderHeaders[headers] = columnHeaders + + -- (2) Add values for custName, Discount, CustAddress and Zip for each order header line: + arrData = self~dirOrderHeaders[records] + --say "OrderData-getFile-02 arrData, dims =" arrData arrData~dimension + -- (2a) First get id for CustomerData: + objMgr = .local~my.ObjectMgr + idCustData = objMgr~getComponentId("CustomerData", "The") + if idCustData = .false then return .false + -- (2b) For each order header, get the cust name & addr from CustomerData + -- and add it to the OrderHeader in-memory file: + do i=1 to self~dirOrderHeaders[count] -- loop over the Order Headers records: + -- get Customer record from CustomerData: + --say "OrderData-getFile-04: arrOrderHeaders[i,2] =" arrOrderHeaders[i,2] + orderCustNo = arrData[i,2] + custDir = idCustdata~getRecord(orderCustNo) + -- add customer's Name and Address to the end of the record: + arrData[i,6] = custDir["CustName"] + arrData[i,7] = custDir["CustDisc"] + arrData[i,8] = custDir["CustAddr"] + arrData[i,9] = custDir["Zip"] + end + self~dirOrderHeaders[records] = arrData + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + addProductInfo - Called by init - adds product name from the ProductData + component to each of the OrderLine records + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD addProductInfo PRIVATE -- Invoked by init. + -- (1) Add column header from Product to the headers (field labels) array: + columnHeaders = self~dirOrderLines[headers] + columnHeaders[4] = "ProdName" + self~dirOrderLines[headers] = columnHeaders + + -- (2) Add values for ProdName to each order header line: + arrData = self~dirOrderLines[records] + -- (2a) First get id for ProductData: + objMgr = .local~my.ObjectMgr + idProductData = objMgr~getComponentId("ProductData", "The") + if idProductData = .false then return .false + -- (2b) For each order line, get the product name from ProductData + -- and add it to the OrderLines in-memory file: + do i=1 to self~dirOrderLines[count] -- loop over the Order Lines records: + -- get Product record from ProductData: + orderProductNo = arrData[i,2] + prodDir = idProductData~getRecord(orderProductNo) + orderProductName = prodDir["ProdName"] + -- add product's Name to the end of the record: + arrData[i,4] = orderProductName + end + self~dirOrderLines[records] = arrData + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + dirData = .Directory~new + do j=1 to columns + header = self~FileHeaders[j] + dirData[header] = self~fileRecords[recordNo,j] + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getRecord - returns a directory 'dirOrderRecord' containing all the data for + a given Order, including both Order Headers and Order Lines. + The format of the directory is: + Index Item + ------- ------- + OrderNo the order number (from dirOrderHeaders} + CustNo customer number (from dirOrderHeaders} + Date order date (from dirOrderHeaders} + Disc discount (from dirOrderHeaders} + Cmtd committed? (from dirOrderHeaders} + CustDisc customer discount (from dirOrderHeaders) + OrderLineHdrs (from dirOrderLines) + OrderLines (from dirOrderLines) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC + use strict arg orderNo + if orderNo = "" then return .false + + -- (1) Get the data from the two directories that contain data from the two + -- files. Call these the "src" (source) variables: + arrSrcOrderHeaderLabels = self~dirOrderHeaders[headers] -- note naming clash but never mind... + arrSrcOrderHeaders = self~dirOrderHeaders[records] + numSrcOrderHeaders = self~dirOrderHeaders[count] + arrSrcOrderLineLabels = self~dirOrderLines[headers] + arrSrcOrderLines = self~dirOrderLines[records] + numSrcOrderLines = self~dirOrderLines[count] + + -- (2) Find the Order Header record: + found = .false + do recordNo = 1 to numSrcOrderHeaders + if arrSrcOrderHeaders[recordNo,1] = orderNo then do + found = .true; leave + end + end + if \found then return .false + + -- (3) Now build the dirOrderRecord + -- (3a) Put the Order headers(i,e, the field labels) into dirOrderRecord: + dirOrderRecord = .Directory~new + -- Put the OrderHeader info into dirOrderRecord: + columns = arrSrcOrderHeaderLabels~items + do j=1 to columns + itemName = arrSrcOrderHeaderLabels[j] + dirOrderRecord[itemName] = arrSrcOrderHeaders[recordNo,j] + end + -- (3b) Put the Headers (Field Labels) for the order lines into the record: + arrOLH = .Array~new + arrOLH = arrSrcOrderLineLabels + dirOrderRecord[OrderLineHdrs] = arrOLH + -- (3c) Now Put OrderLines for this order into dirOrderRecord's array + arrOrderLines = .Array~new + rows = arrSrcOrderLines~dimension(1) -- number of lines or rows + j = 1 + do i =1 to rows -- iterate over all rows in arrSrcOrderLines + --say "Orderdata-getRecord-02:" orderNo arrSrcOrderLines[i,1] + if arrSrcOrderLines[i,1] = orderNo then do + --say "OrderData-getRecord-02a: j arrSrcOrderLines[i,1] orderNo:" j arrSrcOrderLines[i,1] orderNo + arrOrderLines[j,1] = arrSrcOrderLines[i,1] + arrOrderLines[j,2] = arrSrcOrderLines[i,2] + arrOrderLines[j,3] = arrSrcOrderLines[i,3] + arrOrderLines[j,4] = arrSrcOrderLines[i,4] + j = j+1 + end + end + --say "OrderData-getRecord-03: arrOrderLines dimensions =" arrOrderLines~dimension(1) arrOrderLines~dimension(2) + dirOrderRecord[OrderLines] = arrOrderLines + + return dirOrderRecord + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getFile - Invoked by Model for an xxxListModel component; + returns all OrderHeaders including customer info. */ + ::METHOD getFile PUBLIC + return self~dirOrderHeaders + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + listOrders - lists the file. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD listOrders PUBLIC + say; say "----List-Orders--------------------------------" + say "Number of Orders:" self~dirOrderHeaders[Count] + arrOHH = self~dirOrderHeaders[Headers] + say "Order Headers: Headers or Field Names ("||arrOHH~items "columns):" + do i=1 to 9 + say "Order Headers FieldNames:" arrOHH[i] + end + say " " arrOHH[1] arrOHH[2] arrOHH[3] arrOHH[4] arrOHH[5] arrOHH[6] arrOHH[7] arrOHH[8] arrOHH[9] + say "Order Headers - Records" + arrOHR = self~dirOrderHeaders[Records] + do i = 1 to arrOHR~dimension(1) + say i||". " arrOHR[i,1] arrOHR[i,2] arrOHR[i,3] arrOHR[i,4] + say " " arrOHR[i,5] arrOHR[i,6] arrOHR[i,7] + say " " arrOHR[i,8] arrOHR[i,9] + end + say + say "Number of Order Lines:" self~dirOrderLines[Count] + arrOLH = self~dirOrderLines[Headers] + say "Order Lines: Headers or FieldNames ("||arrOLH~items "columns):" + say arrOLH[1] arrOLH[2] arrOLH[3] arrOLH[4] + say "Order Lines - Records" + arrOLR = self~dirOrderLines[Records] + do i = 1 to arrOLR~dimension(1) + say i||". " arrOLR[i,1] arrOLR[i,2] arrOLR[i,3] arrOLR[i,4] + end + say "-----------------------------------------------" + say + return .true + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.h new file mode 100644 index 0000000..9b72260 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.h @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDER_DIALOG 108 +#define IDI_ORDER_DLGICON 109 +#define IDR_ORDER_MENU 110 +#define IDC_ORDER_NAMEADDR 1000 +#define IDC_ST_DISCOUNT_PC 1005 +#define IDM_ORDER_DOTHIS 40000 +#define IDM_ORDER_ABOUT 40001 +#define IDC_ORDER_ORDNO 40007 +#define IDC_ORDER_CUSTNO 40008 +#define IDC_ORDER_ITEMS 40009 +#define IDC_ST_TAX_PC 40010 +#define IDC_ST_DISCOUNT 40011 +#define IDC_ST_TAX 40012 +#define IDC_ST_NET 40013 +#define IDC_ST_TOTAL 40014 +#define IDC_ORDER_DATE 40017 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.rc new file mode 100644 index 0000000..3c77c08 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.rc @@ -0,0 +1,101 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "OrderView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDER_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "An Action", IDM_ORDER_DOTHIS + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDER_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDER_DIALOG DIALOG 0, 0, 272, 270 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Sales Order" +FONT 8, "Ms Shell Dlg" +{ + EDITTEXT IDC_ORDER_ORDNO, 217, 30, 40, 14, ES_CENTER | ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_ORDER_CUSTNO, 217, 50, 40, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Order No.", IDC_STATIC, 169, 33, 32, 8, SS_LEFT + LTEXT "Customer No.", IDC_STATIC, 169, 53, 44, 8, SS_LEFT + CONTROL "", IDC_ORDER_ITEMS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT, 17, 70, 240, 115 + LTEXT "Date", IDC_STATIC, 169, 13, 16, 8, SS_LEFT + LTEXT "Net Cost:", IDC_STATIC, 113, 195, 30, 8, SS_LEFT + LTEXT "Discount:", IDC_STATIC, 113, 209, 31, 8, SS_LEFT + DEFPUSHBUTTON "Close", IDCANCEL, 17, 234, 35, 14 + LTEXT "Tax:", IDC_STATIC, 113, 223, 15, 8, SS_LEFT + RTEXT "0.00", IDC_ST_DISCOUNT_PC, 161, 209, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ST_TAX_PC, 161, 223, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ST_TAX, 212, 223, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ST_NET, 212, 195, 40, 8, SS_RIGHT, WS_EX_RIGHT + RTEXT "0.00", IDC_ST_DISCOUNT, 212, 209, 40, 8, SS_RIGHT + EDITTEXT IDC_ORDER_NAMEADDR, 17, 23, 103, 39, ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + LTEXT "Customer:", IDC_STATIC, 19, 9, 32, 8, SS_LEFT + LTEXT "Total Cost:", IDC_STATIC, 113, 237, 35, 8, SS_LEFT + RTEXT "0.00", IDC_ST_TOTAL, 212, 237, 40, 11, WS_BORDER | SS_RIGHT + EDITTEXT IDC_ORDER_DATE, 217, 10, 40, 14, ES_CENTER | ES_AUTOHSCROLL | ES_READONLY +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDER_DLGICON ICON ".\\Order\\bmp\\OrderForm.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.rex new file mode 100755 index 0000000..1a70ac7 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/OrderView.rex @@ -0,0 +1,296 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The OrderView class v02-00 01Apr13 + + OrderFormView.rex + + Contains: class "OrderView". + Pre-requisite files: OrderView.rc, OrderView.h. + + Description: A sample Order View component - part of the sample + Order Management application. + This is a "leaf" component - invoked by OrderListView. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version (Exercise06) + v02-00 08Jan13: Ex07 - changed to use the MVF. + 11Jan13: Removed stand-alone operation. + Commented-out 'say' instructions. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Order\OrderView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Order\OrderModelsData.rex" +::REQUIRES "Support\RcView.rex" + + +/*============================================================================== + OrderView v01-01 25Aug12 + ------------- + The "view" (or "gui") part of the Order component - part of the sample + Order Management application. + + Changes: + v01-00 07Jun12: First Version. + v02-00 25Aug12: Ex07 - changed to use the MVF. + 08Jan13: Extraneous comments removed; some 'say' stmts commented out. + 11Jan13: Commented-out 'say' instructions. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderView SUBCLASS RcView PUBLIC -- Ex07 + + ::METHOD newInstance CLASS PUBLIC + use strict arg idModel, rootDlg -- Ex07 + --say ".OrderView-newInstance: rootDlg =" rootDlg + dlg = self~new("Order\OrderView.rc", "IDD_ORDER_DIALOG") + dlg~activate(idModel, rootDlg) -- Ex07 + return dlg -- Ex07 + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- creates the dialog instance but does not make it visible. + expose menuBar + --say "OrderView-init-01" + + forward class (super) continue + + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "OrderView-createMenuBar-01" + menuBar = .ScriptMenuBar~new("Order\OrderView.rc", IDR_ORDER_MENU, , , .true) + + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg orderData + use strict arg idModelInstance, rootDlg -- Ex07 + forward class (super) continue -- Ex07 - MVF: required to get Model's data + orderData = RESULT -- Ex07 - MVF: model's data returned by super + --say "OrderView-activate-00: orderData = " orderData + + -- Shows the Dialog - i.e. makes it visible to the user. + --say "OrderView-activate-01: OrderNumber = " orderData["OrderNo"] orderData~orderNo + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_ORDER_DLGICON") + return self -- Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- Called by ooDialog after SHOWTOP. + expose menuBar orderControls orderData -- Ex07 + --say "OrderView-initDialog-01" + + menuBar~attachTo(self) + + orderControls = .Directory~new + orderControls[ecOrderNameAddr] = self~newEdit( "IDC_ORDER_NAMEADDR") + orderControls[ecOrderDate] = self~newEdit( "IDC_ORDER_DATE" ) + orderControls[ecOrderNo] = self~newEdit( "IDC_ORDER_ORDNO" ) + orderControls[ecCustNo] = self~newEdit( "IDC_ORDER_CUSTNO" ) + orderControls[lvOrderItems] = self~newListView("IDC_ORDER_ITEMS" ) + orderControls[stNetCost] = self~newStatic( "IDC_ST_NET" ) + orderControls[stDiscountPC] = self~newStatic( "IDC_ST_DISCOUNT_PC") + orderControls[stDiscount] = self~newStatic( "IDC_ST_DISCOUNT" ) + orderControls[stTaxPC] = self~newStatic( "IDC_ST_TAX_PC" ) + orderControls[stTax] = self~newStatic( "IDC_ST_TAX" ) + orderControls[stTotal] = self~newStatic( "IDC_ST_TOTAL" ) + + -- Each Order Item consists of ProdNo, ProdName, Qty: + orderItems = orderControls[lvOrderItems] + orderItems~addExtendedStyle(GRIDLINES FULLROWSELECT) + orderItems~insertColumnPX(0,"Product No.",110,"LEFT") + orderItems~insertColumnPX(1,"Product Name",160,"LEFT") + orderItems~insertColumnPX(2,"Quantity",85,"LEFT") + self~connectListViewEvent("IDC_ORDER_ITEMS","ACTIVATE",showProduct) -- double-click + + --font = self~createFontEx("Ariel", 10) + font = self~createFontEx("Courier", 8) + orderControls[lvOrderItems]~setFont(font) + self~showData + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showProduct + expose orderControls rootDlg + --say "OrderView-showProduct-01: Show Product requested." + productItem = orderControls[lvOrderItems]~selected + --say "OrderView-showProduct-01: item selected =" productItem + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSolv~nilSelected, self~hwnd, title, 'WARNING') + return + end + + info=.Directory~new + if orderControls[lvOrderItems]~getItemInfo(productItem, info) then do + --say "OrderView-showOrder-02: info~text =" info~text + objectMgr = .local~my.ObjectMgr + objectMgr~showModel("ProductModel", info~text, self) --Ex07 + self~disableControl("IDC_ORDLIST_SHOWORDER") + end + else do + say "OrderListView-showOrder-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD anAction UNGUARDED + self~noMenuFunction(.HRSov~anAction) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSov~HelpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSov~NoMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showData + expose orderControls orderData +/* say "--------------------" + say "OrderView-showData-00: contents of orderData:" + do i over orderData + say i orderData[i] + end + say; say "Order Lines:" + xorderLines = orderData[OrderLines] + do i over xorderLines + say i + end + say; say "Order Line Headers:" + xorderLines = orderData[OrderLineHdrs] + do i over xorderLines + say i + end + say "End of Contents of orderData." + say "---------------------"; say +*/ + --say "orderData['CustNo']:" orderData['CustNo'] -- orderData~CustNo, orderData~'CustNo' - neither work. + --say "--------------------" + -- Format & show the address: + custAddr = orderData["CustAddr"] + parse var custAddr street "," city "," state + --say "OrderView-showData-01: address =" street city state orderData["Zip"] + eol = .endOfLine + custNameAddr = orderData["CustName"]||eol||street||eol||city||eol||state orderData["Zip"] + orderControls[ecOrderNameAddr]~setText(custNameAddr) + -- Format & show the order date: + orderDate = orderData["Date"] + yy = orderDate~left(2); dd = orderDate~right(2); mm = orderDate~substr(3,2) + orderDate = mm||"/"||dd||"/"||yy + orderControls[ecOrderDate]~setText(orderDate) + -- Show the Order NUmber: + orderControls[ecOrderNo]~setText(orderData["OrderNo"]) + -- Show the Customer NUmber: + orderControls[ecCustNo]~setText(orderData["CustNo"]) + + -- Show the Order Items (aka Order Lines): + lvOrderLines = orderControls[lvOrderItems] + arr = orderData[OrderLines] + --say "OrderView-showData-02: order lines array dims =" arr~dimension + --do i = 1 to arr~dimension(1) + --say arr[i,1] "-" arr[i,2] arr[i,3] arr[i,4] + --end + do i=1 to arr~dimension(1) + qty = arr[i,3]~right(8," ") + lvOrderLines~addRow( , , arr[i,2], arr[i,4], qty ) + end + --lvOrderLines~setColumnWidth(0) -- set width of 2nd column to longest text entry. + --lvOrderLines~setColumnWidth(1) + --lvOrderLines~setColumnWidth(3) + --say "OrderView-showData-02: arrOrderLines =" arrOrderLines + --orderControls[lvOrderItems] + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + -- "Cancel" - This method over-rides the default Windows action of + -- 'cancel window' for an Escape key. + ::METHOD cancel + response = askDialog(.HRSov~QExit, "N") + if response = 1 then forward class (super) + return + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSov) v01-00 07Jun12 + -------- + The HRSofv class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSov PRIVATE -- Human-Readable Strings + ::CONSTANT anAction "An Action" + ::CONSTANT NoMenu "This menu item is not implemented." + ::CONSTANT QExit "Are you sure you want to cancel this Order View?" + ::CONSTANT HelpAbout "About Sales Order" + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderForm.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderForm.bmp new file mode 100644 index 0000000..2c2ca38 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderForm.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderForm.ico b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderForm.ico new file mode 100644 index 0000000..7b5e883 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderForm.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderList.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderList.bmp new file mode 100644 index 0000000..4cc094e Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderList.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderList.ico new file mode 100644 index 0000000..1c5b303 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Order/bmp/OrderList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.h new file mode 100644 index 0000000..1511da6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.h @@ -0,0 +1,59 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDMGR 100 +#define IDR_ORDMGR_MENU 102 +#define IDC_ORDMGR_RESET 1000 +#define IDC_ORDMGR_EXIT 1001 +#define IDC_ORDMGR_ICONS 1002 +#define IDM_ORDMGR_NEWORDER 40000 +#define IDM_ORDMGR_ORDERLIST 40001 +#define IDM_ORDMGR_CUSTLIST 40002 +#define IDM_ORDMGR_CUSTSEARCH 40003 +#define IDM_ORDMGR_PRODLIST 40004 +#define IDM_ORDMGR_PRODSEARCH 40005 +#define IDM_ORDMGR_ORDERSEARCH 40006 +#define IDM_ORDMGR_PRODNEW 40007 +#define IDM_ORDMGR_CUSTNEW 40008 +#define IDM_ORDMGR_ORDERNEW 40009 +#define IDM_ORDMGR_ABOUT 40010 +#define IDM_MESSAGE_SENDER1 40011 +#define IDM_PERSON1 40012 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.rc new file mode 100644 index 0000000..abc4f0b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.rc @@ -0,0 +1,98 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderMgrView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDMGR_MENU MENU +{ + POPUP "Orders" + { + MENUITEM "New Order...", IDM_ORDMGR_NEWORDER + MENUITEM "Order List...", IDM_ORDMGR_ORDERLIST + MENUITEM "Order Search...", IDM_ORDMGR_ORDERSEARCH + } + POPUP "Customers" + { + MENUITEM "Customer List...", IDM_ORDMGR_CUSTLIST + MENUITEM "Customer Search...", IDM_ORDMGR_CUSTSEARCH + } + POPUP "Products" + { + MENUITEM "Product List...", IDM_ORDMGR_PRODLIST + MENUITEM SEPARATOR + MENUITEM "Product Search...", IDM_ORDMGR_PRODSEARCH + } + POPUP "New" + { + MENUITEM "Product...", IDM_ORDMGR_PRODNEW + MENUITEM "Customer...", IDM_ORDMGR_CUSTNEW + MENUITEM "Order...", IDM_ORDMGR_ORDERNEW + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDMGR_ABOUT + MENUITEM "Message Sender", IDM_MESSAGE_SENDER1 + MENUITEM "Person", IDM_PERSON1 + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDMGR DIALOG 0, 0, 310, 209 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX +CAPTION "Dialog" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Exit Application", IDC_ORDMGR_EXIT, 245, 186, 60, 15 + PUSHBUTTON "Reset Icons", IDC_ORDMGR_RESET, 5, 186, 50, 15 + CONTROL "", IDC_ORDMGR_ICONS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_ICON, 5, 5, 300, 175 +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.rex new file mode 100755 index 0000000..e29b23f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/OrderMgrView.rex @@ -0,0 +1,399 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: OrderMgrView.rex v02-00 27Feb13 + + Contains: class: "OrderMgrView", "HRSomv" + + Description: The Order Manager View class - the container for of the + Order Management application. + + Pre-requisites: MVF. + + Description: A sample Order Manager View class - part of the sample + Order Manager component. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + v01-01 18Jan13: Version 1.1 - dialog sizing now uses resizingAdmin. + v02-00 20Feb13: + 1. Added get id of ObjectMgr in init method. + 2. Added menu item "Help - Person" to surface a Person Model in order to + illustrate MVF using Person class early in Chapter 7. + 3. Added menu item "Help - Message Sender" to surface the Message Sender. + 4. Updated 'showModel' method to use the MVF (via ObjectMgr) to surface + List Views that are populated with data read from disk (instead of data + hard-coded in the ListView) also give listview the instance name of "a" + to indicate an anonymous component to ObjectMgr. + 5. Added methods "person" and "messageSender" which launch a PersonModel + and a Message Sender respectively. + 27Feb13: Commented-out several 'say's. + 30Jly14: Corrected .ImageList~create(...) statement in createIconList + method. + +------------------------------------------------------------------------------*/ + +-- Use the global .constDir for symbolic IDs - load them from OrderMgrView.h +.Application~addToConstDir("OrderMgr\OrderMgrView.h") + +call "OrderMgr\RequiresList.rex" + +::REQUIRES "ooDialog.cls" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderMgrView v02-00 20Feb13 + -------------------- + To the user, this class is the Order Management Application. It provides + access to the various functions required for managing Sales orders. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderMgrView SUBCLASS RcDialog PUBLIC INHERIT ResizingAdmin + + ::ATTRIBUTE lv PRIVATE -- The ListView that contains the icons. + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + --say ".OrderMgrView-newInstance-01." + dlg = .OrderMgrView~new("OrderMgr\OrderMgrView.rc", IDD_ORDMGR) + dlg~activate + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + expose menuBar records idObjectMgr + --say "OrderMgrView-init-01; next stmt is 'forward class (super) continue'." + forward class (super) continue + --say "OrderMgrView-init-02." + menuBar = .ScriptMenuBar~new("OrderMgr\OrderMgrView.rc", IDR_ORDMGR_MENU, , , .true) + self~createIconList + records = self~initRecords + idObjectMgr = .local~my.ObjectMgr + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineDialog + --say "OrderMgrView-defineDialog-01." + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + --say "OrderMgrView-activate-01." + self~execute("SHOWTOP", IDI_DLG_OOREXX) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar records iconList + --say "OrderMgrView-initDialog-01." + menuBar~attachTo(self) + + -- Create a proxy for the List View and store in instance variable 'lv'. + self~lv = self~newListView(IDC_ORDMGR_ICONS) + + -- Add the Image List to the ListView: + self~lv~setImageList(iconList, NORMAL) + -- Add icons (i.e. records) to the ListView: + do i=1 to records~items + self~lv~addRow(, i-1, records[i]~name) + end + + self~connectListViewEvent(IDC_ORDMGR_ICONS, "ACTIVATE", "onDoubleClick") + -- Following line required to allow icons to be dragged around the listview. + self~connectListViewEvent(IDC_ORDMGR_ICONS, "BEGINDRAG", "DefListDragHandler") + self~connectButtonEvent("IDC_ORDMGR_EXIT", "CLICKED",exitApp) + self~connectButtonEvent("IDC_ORDMGR_RESET","CLICKED",resetIcons) + self~setTitle(.HRSomv~WindowTitle) -- set dialog title. + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineSizing + --say "OrderMgrView-defineSizing-01." + -- Called automatically by ooDialog. + -- Order of arrays: left, top, right, bottom. + -- Order of array items: pinType, edge-of-other-window, id of other window + self~controlSizing(IDC_ORDMGR_RESET, - + .array~of('STATIONARY', 'LEFT' ), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'BOTTOM' ), - + .array~of('MYTOP', 'TOP' ) - + ) + self~controlSizing(IDC_ORDMGR_EXIT, - + .array~of('STATIONARY', 'RIGHT' ), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'RIGHT' ), - + .array~of('MYTOP', 'TOP' ) - + ) + self~controlSizing(IDC_ORDMGR_ICONS, - + .array~of('STATIONARY', 'LEFT' ), - + .array~of('STATIONARY', 'TOP' ), - + .array~of('STATIONARY', 'RIGHT' ), - + .array~of('STATIONARY', 'BOTTOM') - + ) + return .false + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createIconList PRIVATE + -- This method simulates getting the icon "data" for the OrderMgr view. + -- The icon data is loaded into 'iconList' which is an 'ImageList' as + -- required by the ListView control. + expose iconList + --say "OrderMgrView-createIconList." + imgCustList = .Image~getImage("customer\bmp\CustList.bmp") + imgProdList = .Image~getImage("product\res\ProdList.bmp") + imgOrderList = .Image~getImage("order\bmp\OrderList.bmp") + imgOrderForm = .Image~getImage("order\bmp\OrderForm.bmp") + iconList = .ImageList~create(.Size~new(64, 64), .Image~toId(ILC_COLOR4), 4, 0) + + -- Boldly assume no errors in creating the Image List or in the ~getImage statements. + iconList~add(imgCustList) -- item 0 in iconList (item 1 in records) + iconList~add(imgProdList) -- item 1 in iconList (item 2 in records) + iconList~add(imgOrderList) -- item 2 in iconList (item 3 in records) + iconList~add(imgOrderForm) -- item 3 in iconList (item 4 in records) + imgCustList~release + imgProdList~release + imgOrderList~release + imgOrderForm~release + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initRecords PRIVATE + -- This method simulates getting the "data" for the OrderMgr view. + expose records + records = .array~new() + + rec = .directory~new + rec~ID = "CustomerListModel" -- class name + rec~name = "Customer List" + records[1] = rec + + rec = .directory~new + rec~ID = "ProductListModel" + rec~name = "Product List" + records[2] = rec + + rec = .directory~new + rec~ID = "OrderListModel" + rec~name = "Sales Orders" + records[3] = rec + + rec = .directory~new + rec~ID = "OrderFormModel" + rec~name = "New Order" + records[4] = rec + + return records + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ::METHOD initDialog + expose records iconList + --say "OrderMgrView-initDialog." + self~initDialog:super + -- Add the Image List to the ListView: + self~lv~setImageList(iconList, NORMAL) + -- Add icons (i.e. records) to the ListView: + do i=1 to records~items + self~lv~addRow(, i-1, records[i]~name) + end +*/ + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - Orders - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newOrder UNGUARDED + expose records + self~showModel(records[4]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD orderList UNGUARDED + expose records + self~showModel(records[3]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD orderSearch UNGUARDED + self~noMenuFunction(.HRSomv~OrdSrch) + + /*- - Customers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customerList UNGUARDED + expose records + self~showModel(records[1]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customerSearch UNGUARDED + self~noMenuFunction(.HRSomv~CustSrch) + + /*- - Products - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD productList + expose records + self~showModel(records[2]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD productSearch UNGUARDED + self~noMenuFunction(.HRSomv~ProdSrch) + + /*- - New - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD product UNGUARDED + self~noMenuFunction(.HRSomv~NewProd) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customer UNGUARDED + self~noMenuFunction(.HRSomv~NewCust) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD order UNGUARDED + self~newOrder + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSomv~HelpAbout) + + /*- - Message Sender- - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD messageSender UNGUARDED + --say "OrderMgrView-messageSender." + .MessageSender~newInstance(self) + --self~noMenuFunction(.HRSomv~HelpAbout) + + /*- - Message Sender- - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD person UNGUARDED + expose idObjectMgr + --say "OrderMgrView-Person." + objectMgr = .local.my.ObjectMgr + idObjectMgr~showModel("PersonModel","PA150", self) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSomv~NoMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Icon Double-Click + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onDoubleClick UNGUARDED + expose records + --use arg id + --say "OrderMgrView-onDoubleClick-01." + -- Get the index of the item with the focus, use the index to retrieve + -- the item's record: + index = self~lv~focused -- lv is an attribute of the superclass. + record = records[index+1] + --say "OrderMgrView-onDoubleClick-02: Record ID =" record~ID + self~showModel(record) + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - PushButton Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD resetIcons + r = self~lv~arrange + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD exitApp UNGUARDED + --say "OrderMgrView-exitApp-01." + self~cancel + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + --say "OrderMgrView-cancel-01." + response = askDialog(.HRSomv~QExit, "N") + if response = 1 then forward class (super) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD ok + -- Invoked when enter key pressed - if passed to superclass, cancels dialog. + return -- do not close dialog - appears as a no-op to the user. + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel UNGUARDED + /* Surface the view of an icon (i.e. view of the model represented by the icon). + Ideally, if already instantiated, surface it, else makeInstance. + In this version, get as many as you like - but all have the same data!.*/ + expose idObjectMgr + use arg record -- record is a directory object. + className = record~ID + --say "OrderMgrView-showModel-01: className =" className -- Ex07 + r = idObjectMgr~showModel(classname, "a", self) -- Ex07 + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSomv (Human-Readable Strings for OrderMgrView) v01-00 07Jun12 + --- + The HRSomv class provides constant character strings for user-visible messages + issued by the OrderMgrBaseView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSomv PRIVATE -- Human-Readable Strings + ::CONSTANT QExit "Are you sure you want to close all windows and exit the application?" + ::CONSTANT NoMenu "This menu item is not yet implemented." + ::CONSTANT OM "Order Manager" + ::CONSTANT OrdSrch "Order Search" + ::CONSTANT CustSrch "Customer Search" + ::CONSTANT ProdSrch "Product Search" + ::CONSTANT NewCust "New Customer" + ::CONSTANT NewProd "New Product" + ::CONSTANT HelpAbout "Help - About" + ::CONSTANT WindowTitle "Sales Order Management" -- Dialog Caption + ::CONSTANT Reset "Reset Icons" -- PushButton + ::CONSTANT ExitApp "Exit Application" -- PushButton + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/RequiresList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/RequiresList.rex new file mode 100755 index 0000000..28f70b3 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/OrderMgr/RequiresList.rex @@ -0,0 +1,62 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: RequiresList.rex v01-00 01Apr13 + + Contains: The list of View components that OrderMgrView requires. + + Pre-requisites: Class "OrderMgrView + + Description: This script is called by OrderMgrView. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + +--say "RequiresList." + +::REQUIRES "Customer\CustomerListView.rex" +::REQUIRES "Product\ProductListView.rex" +::REQUIRES "Order\OrderListView.rex" +::REQUIRES "Order\OrderFormView.rex" +::REQUIRES "Support\MessageSender.rex" + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductFile.txt new file mode 100644 index 0000000..a475007 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductFile.txt @@ -0,0 +1,7 @@ +ProdNo | ProdName | ListPrice | UOM | Size | Description +AB100/W | Baffle | 995 | 20 | S | 3" aluminium baffles - suitable for all bonderers. +CF300/X | Widget Box | 2895 | 6 | M | A 10 litre case with flat sides capable of holding quite a lot of stuff. +CU003 | Widget, 5in | 12499 | 100 | M | Meets all possible Widget needs, except those not possible. +EF500/W | Slodget | 1730 | 10 | S | 5" slodget for use with 3" baffles. +LM400 | Driblet, 10 guage | 34000 | 25 | L | 2' driblet guaranteed to dribletize most clambers. +XY200 | Blad Anchor | 3845 | 1 | M | Fixes all small or medium blads. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.h new file mode 100644 index 0000000..67f5489 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODLIST_DIALOG 102 +#define IDR_PRODLIST_MENU 104 +#define IDI_PRODLIST_DLGICON 105 +#define IDC_PRODLIST_SHOWPRODUCT 1000 +#define IDC_PRODLIST_LISTVIEW 1001 +#define IDM_PRODLIST_NEWPROD 40000 +#define IDM_PRODLIST_ABOUT 40001 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.rc new file mode 100644 index 0000000..539fa1e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.rc @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "ProductListView.h" + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Product...", IDM_PRODLIST_NEWPROD + } + POPUP "Help" + { + MENUITEM "About...", IDM_PRODLIST_ABOUT + } +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODLIST_DIALOG DIALOG 0, 0, 225, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_PRODLIST_LISTVIEW, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING, 15, 10, 190, 215 + DEFPUSHBUTTON "Show Product", IDC_PRODLIST_SHOWPRODUCT, 90, 235, 50, 14, WS_DISABLED +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_PRODLIST_DLGICON ICON ".\\product\\res\\ProdList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.rex new file mode 100755 index 0000000..3c446e7 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductListView.rex @@ -0,0 +1,249 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Exercise07 + + ProductListView v02-00 01Apr13 + ------------- + The view of a list of products. + + Changes: + v01-00 06Jun12: First version + v02-00 21Aug12: Modified for Exercise07 to use the Model-View Framework. + 11Jan13: Commented-out 'say' instructions. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + + Contains: classes "ProductListView, HRSplv (for human-readable strings) + + Pre-requisites: ProductListView.rc, ProductListView.h, ProdList.ico + + Description: An "intermediate" component - called by OrderMgr, + invokes "ProductView". + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~addToConstDir("Product\ProductListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Product\ProductView.rex" +::REQUIRES "Support\RcView.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductListView v02-00 21Aug12 + ------------- + The view of a list of products. + Changes: + v01-00 06Jun12: First version + v02-00 21Aug12: Modified to use the Model-View Framework. + Comment "Ex07" shows where changes from Ex06 have been made. + 09Jan13: 'Say' instructions commented out or removed. + Standalone operation removed (not now needed). + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductListView SUBCLASS RcView PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg idModel, rootDlg -- Ex07 + --say ".ProductListView-newInstance-01: rootDlg =" rootDlg + dlg = self~new("Product\ProductListView.rc", "IDD_PRODLIST_DIALOG") + --say ".ProductListView-newInstance-02." + dlg~activate(idModel,rootDlg) -- Ex07 + return dlg -- Ex07 + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + forward class (super) continue + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "ProductListView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Product\ProductListView.rc", "IDR_PRODLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg modelData idModel -- Ex07 + use arg idModelInstance, rootDlg -- Ex07 + forward class (super) continue -- Ex07: required to get Model's data + modelData = RESULT -- Ex07: model's data returned by super + --say "ProductListView-activate-01: root =" root + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_PRODLIST_DLGICON") + return self -- Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvProducts btnShowProduct modelData idModel -- Ex07 + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + --say "ProductListView-initDialog-01"; say + lvProducts = self~newListView("IDC_PRODLIST_LISTVIEW"); + lvProducts~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvProducts~insertColumnPX(0,"Number", 60,"LEFT") + lvProducts~insertColumnPX(1,"Name", 160,"LEFT") + lvProducts~insertColumnPX(2,"Price", 50,"RIGHT") -- Ex07 (Right-adjust) + lvProducts~insertColumnPX(3,"UOM", 40,"RIGHT") -- Ex07 (added) + self~connectListViewEvent("IDC_PRODLIST_LISTVIEW","CLICK",itemSelected) + self~connectListViewEvent("IDC_PRODLIST_LISTVIEW","ACTIVATE",openItem) + self~connectButtonEvent("IDC_PRODLIST_SHOWPRODUCT","CLICKED",showProduct) + + -- Set model instance name into the Titlebar: + --parse var self~objectName + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newProduct UNGUARDED + self~noMenuFunction(.HRSplv~newProd) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSplv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg caption + ret = MessageDialog(.HRSplv~noMenu, self~hwnd, caption, 'WARNING') + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected unguarded + expose lvProducts + use arg id, itemIndex, columnIndex, keyState + --say "ProductListView-itemSelected: itemIndex, columnIndex, keyState:" itemIndex columnIndex keyState + --say "ProductListView-itemSelected: item selected is:"lvProducts~selected + if itemIndex > -1 then self~enableControl("IDC_PRODLIST_SHOWPRODUCT") + else self~disableControl("IDC_PRODLIST_SHOWPRODUCT") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + --say "ProductListView-openItem-01: item selected =" item + self~showProduct + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD showProduct UNGUARDED + expose lvProducts rootDlg + item = lvProducts~selected + --say "ProductListView-showProduct-01: item selected =" item + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSplv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvProducts~getItemInfo(item, info) then do + --say "ProductListView-showProduct-02: info~text =" info~text + --say "ProductListView-showProduct-03; root =" root + objectMgr = .local~my.ObjectMgr + objectMgr~showModel("ProductModel", info~text, rootDlg) --Ex07 + --say "ProductListView-showProduct-04: after startProductView" + self~disableControl("IDC_PRODLIST_SHOWPRODUCT") + end + else do + say "ProductListView-showProduct-05: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvProducts modelData -- Ex07 + --say "ProductListView-loadList-01: dataArray =" modelData -- Ex07 + rows = modelData[count] -- Ex07 - number of rows + arrData = modelData[records] + --say "ProductListView-loadList-02:Dims =" arrData~dimension(1) arrData~dimension(2) + do i = 1 to rows + -- Change file price to display format (i.e. cents to dollars.cents): + displayPrice = (arrData[i,3]/100)~format(,2) + lvProducts~addRow( , ,arrData[i,1], arrData[i,2], displayPrice, arrData[i,4]) + end + lvProducts~setColumnWidth(1) -- set width of 2nd column to longest text entry. + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSplv (Human-Readable Strings for ProductListView) v01-00 06Jun12 + ------ + The HRS class provides constant character strings for user-visible messages + issued by the ProductListView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSplv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newProd "New Product" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductModelsData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductModelsData.rex new file mode 100755 index 0000000..d5d33b5 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductModelsData.rex @@ -0,0 +1,265 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: v02-00 01Apr13 + + The ProductModel, ProductListModel, and ProductData Classes + + Contains: classes "ProductModel", "ProductListModel, "ProductData", + and "ProductDT". + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v00-02: 21Jly11 + v00-03: Correct "return" statement not in right place (typo in code!!) + Renamed the ProductDT attributes (initial "prod" deemed extraneous) + - 26Aug11: added some comments - no change to function. + v00-04 21Aug12: ProducListModel added. Modified to fit the MV Framework. + v02-00 13Jan12: Ex07: Some 'say' instructions removed or commented out. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductModel v00-02 12Jly11 + ------------ + The "model" part of the Product component. + + interface productModel{ + aProductModel newInstance() -- Class method. + null activate() + aProductDT query() + }; + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "Support\GenericFile.rex" +::REQUIRES "Support\Model.rex" + +::CLASS ProductModel SUBCLASS Model PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + use strict arg instanceName --Ex07 + forward class (super) continue --Ex07 + modelId = RESULT --Ex07 + return modelId --Ex07 + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + -- Gets its data from ProductData. + expose prodData + use strict arg prodData --Ex07 + return self --Ex07 + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + -- self~myData (super's attribute) is a DT. So ask the data component for its + -- directory version of the data (an attribute of ProductData). + expose prodData + --say "ProductModel-query-01: prodData =" prodData + dir = .directory~new + return prodData +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductListModel v00-01 20Aug12 + ---------------- + The model for a list of Products. + Changes: + v00-01 20Aug12: First version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductListModel SUBCLASS Model PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg instanceName + --self~myInstanceName = instanceName + self~wantList = .true -- set super's attribute + forward class (super) continue + id = RESULT + --say "ProductListModel-newInstance-01: id =" id + return id + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + expose arrData + use strict arg data + --self~myData = data + --say "ProductListModel-init-01: myData =" self~myData + return self + +-- ::METHOD query PUBLIC + /*---------------------------------------------------------------------------- + query - returns an array of all Product data. + In MVF this method is invoked by the RcView (or ResView) superclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --say "ProductListModel-query-01." +-- return self~myData + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductData v01-00 20Jly11 + ------------ + The "data" part of the Product component. + [interface (idl format)] + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductData SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + ::ATTRIBUTE dirData + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName + if self~created = "CREATED" then do + self~created = .true + productDataId = self~new() + --if r = .true then self~created = .true + return productDataId + end + else do + say "... singleton component, so can't have more than one instance." + return .false + end + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init PUBLIC + expose filename numRecords + filename = "Product\ProductFile.txt"; columns = 6 + numRecords = self~init:super(filename, columns) + --say "ProductData-init-01: numRecords:" numRecords + return self + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC -- ???? Use the DT??? + expose data + --say "ProductData-getData-01." + return data + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Find - forward to super, then pack data into a ProductDT. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC + use strict arg dataKey + --say "ProductData-getRecord-00: dataKey = <"||dataKey||">" + forward class (super) continue + dirData = RESULT -- Generic File returns a directory. + --say "ProductData-getRecord-01: dirData =" dirData + self~dirData = dirData + if dirData = .false then return .false + -- Now convert dirData to a DT, pack it into dirData then return dirData: + dt = .ProductDT~new + dt~number = dirData["ProdNo"] + dt~name = dirData["ProdName"] + dt~price = dirData["ListPrice"] + dt~uom = dirData["UOM"] + dt~description = dirData["Description"] + dt~size = dirData["Size"] + dirData["DT"] = dt + return dirData + + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductDT - A business data type for Product data. v00-02 07Aug11 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS ProductDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE number -- number Product Number + ::ATTRIBUTE name -- name Product Description + ::ATTRIBUTE price -- price Product Price (rightmost two digits are 100ths of currency unit) +--::ATTRIBUTE currency -- currency Three-letter currency code + ::ATTRIBUTE uom -- uom Product Unit of Measure + ::ATTRIBUTE description -- descrip Product Description + ::ATTRIBUTE size -- size Produce Size Category (S/M/L) + + ::METHOD list PUBLIC + expose number name price uom description size + say "---------------" + say "ProductDT-List:" + say "Number: " number "Name:" name + say "Price:" price "UOM:" uom "Size:" size + say "Description:" description + say "---------------" +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.h new file mode 100644 index 0000000..b22805a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.h @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODUCT_VIEW 106 +#define IDR_PRODUCT_VIEW_MENU 107 +#define IDD_PRODUCT_VIEW_ABOUT 108 +#define IDB_PROD_ICON 112 +#define IDI_PROD_DLGICON 113 +#define IDC_PRODABT_ICON_PLACE 1000 +#define IDC_PROD_NO 1000 +#define IDC_PROD_UOM 1001 +#define IDC_PROD_DESCRIPTION 1002 +#define IDC_PROD_STATIC2 1003 +#define IDC_PROD_STATIC3 1004 +#define IDC_PROD_STATIC1 1005 +#define IDC_PROD_STATIC4 1007 +#define IDC_PROD_STATIC5 1008 +#define IDM_PROD_UPDATE 40000 +#define IDM_PROD_REFRESH 40001 +#define IDM_PROD_CLOSE 40002 +#define IDM_PROD_PRINT 40003 +#define IDM_PROD_ABOUT 40004 +#define IDC_PROD_NAME 40010 +#define IDC_PROD_LIST_PRICE 40012 +#define IDC_PROD_SIZE_GROUP 40013 +#define IDC_PROD_SAVE_CHANGES 40014 +#define IDC_PROD_RADIO_SMALL 40015 +#define IDC_PROD_RADIO_MEDIUM 40016 +#define IDC_PRODABT_STATIC1 40017 +#define IDC_PROD_RADIO_LARGE 40017 +#define IDC_PRODABT_STATIC2 40018 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.rc new file mode 100644 index 0000000..742651b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.rc @@ -0,0 +1,124 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + + +#include +#include +#include +#include "ProductView.h" + + + + +// +// Bitmap resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_PROD_ICON BITMAP ".\\res\\producticon.bmp" + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODUCT_VIEW_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "&Update Product", IDM_PROD_UPDATE + MENUITEM "Refresh Data", IDM_PROD_REFRESH + MENUITEM "Print...", IDM_PROD_PRINT + MENUITEM "Close", IDM_PROD_CLOSE + } + POPUP "Help" + { + MENUITEM "About...", IDM_PROD_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW DIALOG 0, 0, 248, 228 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Product Number:", IDC_PROD_STATIC1, 25, 28, 54, 8, SS_LEFT + LTEXT "Product Name:", IDC_PROD_STATIC2, 25, 53, 48, 8, SS_LEFT + LTEXT "List Price:", IDC_PROD_STATIC3, 25, 78, 32, 8, SS_LEFT + LTEXT "UOM:", IDC_PROD_STATIC5, 151, 78, 20, 8, SS_LEFT + LTEXT "Description", IDC_PROD_STATIC4, 25, 103, 36, 8, SS_LEFT + EDITTEXT IDC_PROD_NO, 95, 25, 50, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_NAME, 95, 51, 130, 13, ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_LIST_PRICE, 95, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + EDITTEXT IDC_PROD_UOM, 175, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + GROUPBOX "Size Category", IDC_PROD_SIZE_GROUP, 31, 151, 189, 30, WS_GROUP, WS_EX_CLIENTEDGE + AUTORADIOBUTTON "Small", IDC_PROD_RADIO_SMALL, 46, 165, 33, 8, WS_DISABLED + AUTORADIOBUTTON "Medium", IDC_PROD_RADIO_MEDIUM, 110, 165, 41, 8, WS_DISABLED + AUTORADIOBUTTON "Large", IDC_PROD_RADIO_LARGE, 168, 165, 34, 8, WS_DISABLED + DEFPUSHBUTTON "Save Changes", IDC_PROD_SAVE_CHANGES, 180, 195, 52, 14, WS_DISABLED + EDITTEXT IDC_PROD_DESCRIPTION, 95, 100, 125, 30, ES_MULTILINE +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW_ABOUT DIALOG 0, 0, 204, 109 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "About Product View" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 143, 88, 50, 14 + CONTROL "", IDC_PRODABT_ICON_PLACE, WC_STATIC, SS_BITMAP | SS_NOTIFY | SS_REALSIZECONTROL, 16, 7, 102, 71 + LTEXT "A view of a Product component.", IDC_PRODABT_STATIC1, 15, 84, 110, 15, SS_LEFT + LTEXT "An example of an About box using .ResDialog.", IDC_PRODABT_STATIC2, 130, 9, 65, 65, SS_LEFT +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_PROD_DLGICON ICON ".\\res\\Product.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.rex new file mode 100755 index 0000000..72f09c3 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/ProductView.rex @@ -0,0 +1,492 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: ProductView.rex - The ProductView component v02-00 01Apr13 + + Contains: classes "ProductView", "AboutDialog", and "HRSpv". + + Pre-requisites: ProductView.dll, ProductView.h, Pproduct.ico, ProductIcon.bmp, + Support\NumberOnlyEditEx.cls (copied from ooDialog Samples + into the folder Exercise06\Support) + + Description: A sample Product View component - part of the sample + Order Management application. + + Outstanding Problems: None reported. + + Changes: + v01-00 03Jun12: First version for Exercise05. + v01-01 06Jun12: Minor changes for Exercise06. + v02-00 11Jan12: Removed stand-alone operation, plus some comments. + Method 'getData' removed (now redundant). + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. +------------------------------------------------------------------------------*/ + +.Application~addToConstDir("Product\ProductView.h") + + +::requires "ooDialog.cls" +::requires "Support\NumberOnlyEditEx.cls" +::requires "Product\ProductModelsData.rex" +::REQUIRES "support\ResView.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductView v02-00 09Jan13 + ----------- + The "view" part of the Product component. Now designed to operate from its own + folder. Should be invoked from immediately outside the Product folder. + [interface (idl format)] + + Changes: + v01-00 03Jun12: First version. + v01-01 06Jun12: Minor changes for Exercise06. + v02-00 09Jan13: Removed stand-alone startup (not now needed), plus some + comments. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductView SUBCLASS ResView PUBLIC + + ::ATTRIBUTE dialogState PRIVATE -- States are: 'closable' or 'inUpdate". + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC UNGUARDED + use arg idModel, rootDlg --Ex07 + --say ".ProductView-newInstance-01: model, rootDlg =" idModel rootDlg + .Application~addToConstDir("Product\ProductView.h") + -- Create an instance of ProductView and show it: + dlg = self~new("Product\res\ProductView.dll", IDD_PRODUCT_VIEW) + dlg~activate(idModel, rootDlg) --Ex07 + return dlg --Ex07 + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose prodData + use arg idModel, rootDlg, prodData --Ex07- note: prodData is a ProductDT. + forward class (super) continue -- MVF: required to get Model's data + dirdata = RESULT -- MVF: model's data returned by super + prodData = dirData[DT] -- dirData is a directory - 'DT' + -- for 'DataType' is in the directory. + self~dialogState = "closable" + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_PROD_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar prodControls prodData --Ex07 + --say "ProductView-initDialog-01" + + menuBar = .BinaryMenuBar~new(self, IDR_PRODUCT_VIEW_MENU, , self, .true) + + prodControls = .Directory~new + prodControls[ecProdNo] = self~newEdit("IDC_PROD_NO") + prodControls[ecProdName] = self~newEdit("IDC_PROD_NAME") + prodControls[ecProdPrice] = self~newEdit("IDC_PROD_LIST_PRICE") + prodControls[ecUOM] = self~newEdit("IDC_PROD_UOM") + prodControls[ecProdDescr] = self~newEdit("IDC_PROD_DESCRIPTION") + prodControls[gbSizes] = self~newEdit("IDC_PROD_SIZE_GROUP") + prodControls[rbSmall] = self~newRadioButton("IDC_PROD_RADIO_SMALL") + prodControls[rbMedium] = self~newRadioButton("IDC_PROD_RADIO_MEDIUM") + prodControls[rbLarge] = self~newRadioButton("IDC_PROD_RADIO_LARGE") + prodControls[pbSaveChanges] = self~newPushButton("IDC_PROD_SAVE_CHANGES") + self~connectButtonEvent("IDC_PROD_SAVE_CHANGES","CLICKED",saveChanges) + + -- Use NumberOnlyEditEx.cls to enforce numeric only entry for Price and UOM: + prodControls[ecProdPrice]~initDecimalOnly(2,.false) -- 2 decimal places, no sign. + prodControls[ecUOM]~initDecimalOnly(0,.false) -- 0 decimal places, no sign. + prodControls[ecProdPrice]~connectCharEvent(onChar) + prodControls[ecUOM]~connectCharEvent(onChar) + + self~showData -- Show the data + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - MenuBar Events: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD updateProduct UNGUARDED + expose prodControls + + -- Enable the controls to allow changes to the data: + prodControls[ecProdName]~setReadOnly(.false) + prodControls[ecProdPrice]~setReadOnly(.false) + prodControls[ecUOM]~setReadOnly(.false) + prodControls[ecProdDescr]~setReadOnly(.false) + prodControls[rbSmall]~enable + prodControls[rbMedium]~enable + prodControls[rbLarge]~enable + self~enableControl("IDC_PROD_SAVE_CHANGES") + prodControls[pbSaveChanges]~state = "FOCUS" -- Put input focus on the button + self~tabToNext() -- put text cursor on Product Description + -- (as if the user had pressed tab) + self~dialogState = "inUpdate" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD refreshData UNGUARDED + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~showData + self~dialogState = "closable" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD print UNGUARDED + ans = MessageDialog(.HRSpv~printMsg) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD close UNGUARDED + return self~cancel:super + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + dlg = .AboutDialog~new("ProductView.dll", IDD_PRODUCT_VIEW_ABOUT) + dlg~execute("SHOWTOP") + + + /*---------------------------------------------------------------------------- + Event Handler Methods - PushButton Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "Save Changes" - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg. Disables the + button when valid changes made. */ + ::METHOD saveChanges UNGUARDED + expose prodControls prodData + + -- Transform data from view format (as in controls) to app format (a directory): + newProdData = self~xformView2App(prodControls) + + -- Check if anything's changed; if not, show msgbox and exit with controls enabled. + -- If changed, go on to validate data. + result = self~checkForChanges(newProdData) + if result = .false then do + msg = .HRSpv~nilSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","WARNING","DEFBUTTON2 APPLMODAL") + return + end + + -- Now validate data: + result = self~validate(newProdData) -- returns a null string or error messages. + -- Better would be a set of error numbers. + -- If no problems, then show msgbox and go on to disable controls. + if result = "" then do + msg = .HRSpv~saved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","INFORMATION","DEFBUTTON1 APPLMODAL") + end + -- If problems, then show msgbox and leave user to try again or refresh or exit. + else do + msg = result||.EndOfLine||.HRSpv~notSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","ERROR","DEFBUTTON1 APPLMODAL") + return + end + + -- Send new data to be checked by CustomerModel object (not implemented). + + -- Disable controls that were enabled by menu "ActionsFile-->Update" selection: + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUom]~setReadOnly(.true) + if newProdData~size \= "S" then prodControls[rbSmall]~disable + if newProdData~size \= "M" then prodControls[rbMedium]~disable + if newProdData~size \= "L" then prodControls[rbLarge]~disable + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~dialogState = "closable" + + prodData = newProdData + say "ProductView-saveChanges: new values are:" + prodData~list + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - Keyboard Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onChar UNGUARDED + -- called for each character entered in the price or UOM fields. + forward to (arg(6)) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "OK" - This is a no-op method that over-rides the default Windows action + of 'close window' for an Enter key --*/ + ::METHOD ok unguarded + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + -- If in the process of updating, then ask whether any changes should be + -- thrown away and dialog closed. If yes then close by calling the superclass, + -- else nop. If not in update, then close immediately + if self~dialogState = "inUpdate" then do + ans = MessageDialog(.HRSpv~closeInUpdate, self~dlgHandle, .HRSpv~updateIP, "YESNO", "WARNING", "DEFBUTTON2") + if ans = .PlainBaseDialog~IDYES then return self~cancel:super + else nop + end + else return self~cancel:super + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showData + -- Transfrom data (where necessary) to display format, and then disable controls. + expose prodControls prodData + -- Set data in controls: + prodControls[ecProdNo]~setText( prodData~number ) + prodControls[ecProdName]~setText( prodData~name ) + -- Price in prodData has no decimal point - 2 decimal places are implied - hence /100 for display. + -- Pad with zeros if necessary. + displayPrice = (prodData~price/100)~format(,2) -- corrected in Ex07 + prodControls[ecProdPrice]~setText(displayPrice) + prodControls[ecUOM]~settext( proddata~uom ) + prodControls[ecProdDescr]~setText(prodData~description ) + size = prodData~size + -- Disable controls + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUOM]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[rbSmall]~disable + prodControls[rbMedium]~disable + prodControls[rbLarge]~disable + -- But check correct button and enable it to highlight it to the user: + select + when size = "S" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_SMALL") + prodcontrols[rbSmall]~enable + end + when size = "M" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_MEDIUM") + prodcontrols[rbMedium]~enable + end + otherwise do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_LARGE") + prodcontrols[rbLarge]~enable + end + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD checkForChanges + -- Check whether any data has actually changed when "Save Changes" button + -- has been pressed. Return .true if data changed, else returns .false. + expose prodData + use arg newProdData + + changed = .false + select + when newProdData~name \= prodData~name then changed = .true + when newProdData~price \= prodData~price then changed = .true + when newProdData~uom \= prodData~uom then changed = .true + when newProdData~description \= prodData~description then changed = .true + when newProdData~size \= ProdData~size then changed = .true + otherwise nop + end + return changed + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD validate + -- Validation: 1. Check price/UOM not changed > 50% up or down. + -- 2. Cannot change from Large to Small without UOM increasing + -- by at least 100%; nor from Small to Large without + -- decreasing by more than 50%. + -- 3. Product Description <= 100 characters. + -- 4. Product Name <= 30 characters. + -- Returns string of messages - the null string if all OK. + expose prodData + use arg newProdData + msg = "" + + -- Check Price (catches decimal point errors also): + price = prodData~price; newPrice = newProdData~price + oldUom = prodData~uom; newUom = newProdData~uom -- 'oldUom - avoids name conflict with 'uom' in newProddata~uom. + if ((price/oldUom)*1.5 < newPrice/newUom) | (newPrice/newUom < (price/oldUom)/2) then do + msg = msg||.HRSpv~badRatio||" " + end + + -- Check Size vs UOM: + if prodData~size = "L" & newProdData~size = "S" - -- Large to Small + & prodData~uom/2 < newProdData~uom then do + msg = msg||.HRSpv~uomTooBig||" " + end + if prodData~size = "S" & newProdData~size = "L" - -- Small to Large + & prodData~uom*2 > newProdData~uom then do + msg = msg||.HRSpv~uomTooSmall||" " + end + + -- Check Product Description length: + if newProdData.description~length > 80 then do + msg = msg||.HRSpv~descrTooBig||" " + end + + -- Check Product Name length: + if newProdData~name~length > 30 then do + msg = msg||.HRSpv~prodNameTooBig + end + + return msg + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD xformView2App + -- Transforms Product Data from View form (in the GUI controls) to + -- App form (a directory with address as an array). + expose prodControls + prodData = .ProductDT~new + prodData~number = prodControls[ecProdNo]~gettext() + prodData~name = prodControls[ecProdName]~getText() + price = prodControls[ecProdPrice]~getText() + -- Data entered has or assumes a decimal point; but data in "application" + -- is a whole number (e.g. $42.42 is recorded in the database as "4242"). + -- So re-format data from decimal to whole number: + priceTwoDecs = price~format(,2) -- force 2 dec positions + -- Re-display price properly formatted (in case the user did not format correctly - e.g. entered "42" or "38.4"): + prodControls[ecProdPrice]~setText(priceTwoDecs) + -- Now format price to "application" format: + price = (priceTwoDecs*100)~format(,0) -- multiply by 100 and then force whole number. + prodData~price = price + prodData~uom = prodControls[ecUOM]~getText() + prodData~description = prodControls[ecProdDescr]~getText() + select + when prodControls[rbSmall]~checked then prodData~size = "S" + when prodControls[rbMedium]~checked then prodData~size = "M" + otherwise prodData~size = "L" + end + + return prodData + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + AboutDialog v01-00 03Jun12 + ------------- + The "About" class - shows a dialog box that includes a bitmap - part of the + ProductView component. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS AboutDialog SUBCLASS ResDialog + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method initDialog + expose font image + resImage = .ResourceImage~new(self) -- Create an instance of a resource image + image = resImage~getImage(IDB_PROD_ICON) -- Create an image from the Product bitmap + stImage = self~newStatic(IDC_PRODABT_ICON_PLACE)~setImage(image) -- Create a static text control and set the image in it + font = self~createFontEx("Ariel", 12) -- Create up a largish font with which to display text and ... + self~newStatic(IDC_PRODABT_STATIC2)~setFont(font) -- ... set the static text to use that font. + -- Provide for a double-click in Product icon: + self~connectStaticNotify("IDC_PRODABT_ICON_PLACE", "DBLCLK", showMsgBox) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method showMsgBox + --say "AboutDialog-showMsgBox-01." + ans = MessageDialog(.HRSpv~AboutDblClick) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method leaving + expose font image + self~deleteFont(font) + image~release() + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSpv) v01-00 03Jun12 + ------------------------------ + The HRSpv class provides constant character strings for user-visible messages. + + Changes: + v00-03 11Feb12: Changed class name NRS to HRSpv + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSpv PRIVATE -- Human-Readable Strings + ::CONSTANT AboutDblClick "You double-clicked!" + ::CONSTANT badRatio "The new price/UOM ratio cannot be changed more than 50% up or down." + ::CONSTANT closeInUpdate "Any changes made will be lost. Exit anyway?" + ::CONSTANT descrTooBig "The Product Description is too long." + ::CONSTANT nilSaved "Nothing was changed! Data not saved." + ::CONSTANT notSaved "Changes Not Saved!" + ::CONSTANT prodNameTooBig "The Product Name is too long." + ::CONSTANT saved "Changes saved." + ::CONSTANT uomTooBig "The new UOM is too large." + ::CONSTANT uomTooSmall "The new UOM is too small." + ::CONSTANT updateIP "Update in process" + ::CONSTANT updateProd "Update Product" + ::CONSTANT printMsg "The 'Print...' menu item is not yet implemented." + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProdList.BMP b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProdList.BMP new file mode 100644 index 0000000..6e4e8c1 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProdList.BMP differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProdList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProdList.ico new file mode 100644 index 0000000..51333f8 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProdList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/Product.ico b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/Product.ico new file mode 100644 index 0000000..64a7c78 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/Product.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProductIcon.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProductIcon.bmp new file mode 100644 index 0000000..13ca9ac Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProductIcon.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProductView.dll b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProductView.dll new file mode 100644 index 0000000..ce89cc2 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/ProductView.dll differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/res.mak b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/res.mak new file mode 100644 index 0000000..42aefbc --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Product/res/res.mak @@ -0,0 +1,50 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# nMake-compatible Make file for the ProductView resource-only DLL. + +all: ProductView.dll + +ProductView.dll: ProductView.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) /OUT:$(@B).dll + +# Create .res from .rc +ProductView.res: ..\ProductView.rc + rc -r -fo$(@B).res ..\$(@B).rc + +clean: + del *.res *.dll 1>nul 2>&1 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/RequiresList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/RequiresList.rex new file mode 100755 index 0000000..6b6ff8c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/RequiresList.rex @@ -0,0 +1,84 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The Order Management Application + Startup.rex v01-02 01Apr13 + + Description: This file is the "application" or "root" or "starter" part + of the sample Order Management application. + + Changes: + v01-00 06Jun12: First version. + v01-01 07Aug12: Support for ObjectMgr and ViewMgr added. MessageSender is + optional. + 11Jan13: Deleted Commented-out startup of MessageSender. + 21Mar13: Added Copyright notice. + v01-02 01Apr13: After ooDialog 4.2.2, "Samples" folder changed name to + "Extras", so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + RequiresList v01-00 16Sep12 + ---- + The list of files containing classes invoked by the ObjectMgr + + Changes: + v01-00 16Sep12: First version. + 11Jan13: Commented-out 'say' instruction. + 26May13: Corrected paths for ::REQUIRES afrer re-factoring. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ +--say "RequiresList-01." +::REQUIRES "Customer\CustomerView.rex" +::REQUIRES "Customer\CustomerModelsData.rex" +::REQUIRES "Customer\CustomerListView.rex" +::REQUIRES "Product\ProductModelsData.rex" +::REQUIRES "Product\ProductListView.rex" +::REQUIRES "Order\OrderFormView.rex" +::REQUIRES "Order\OrderListView.rex" +::REQUIRES "Order\OrderModelsData.rex" +::REQUIRES "Order\OrderView.rex" +::REQUIRES "Extras\Wow4\WowView.rex" +::REQUIRES "Extras\Wow4\WowModel.rex" +::REQUIRES "Extras\Wow4\WowData.rex" +::REQUIRES "Extras\Person\PersonView.rex" +::REQUIRES "Extras\Person\PersonModelData.rex" +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Startup.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Startup.rex new file mode 100755 index 0000000..1738c01 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Startup.rex @@ -0,0 +1,74 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: The Order Management Application + Startup.rex v01-02 01Apr13 + + Description: This file is the "application" or "root" or "starter" part + of the sample Order Management application. + + Changes: + v01-00 06Jun12: First version. + v01-01 07Aug12: Support for ObjectMgr and ViewMgr added. MessageSender is + optional. + 11Jan13: Deleted Commented-out startup of MessageSender. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + +------------------------------------------------------------------------------*/ + +parse arg pwOption +if pwOption = "enterPW" then do + pwd = PasswordBox("Please enter your password","Sign In") + if pwd \= "Password" then exit +end + +-- Set application defaults: +.Application~setDefaults("O", , .false) + +-- Create Object Manager and View Manager: +om = .ObjectMgr~new +vm = .ViewMgr~new + +-- Start OrderMgrView: +.OrderMgrView~newInstance + +::REQUIRES "OrderMgr\OrderMgrView.rex" +::REQUIRES "Support\ObjectMgr.rex" +::REQUIRES "Support\ViewMgr.rex" +::REQUIRES "Support\MessageSender.rex" +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/GenericFile.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/GenericFile.rex new file mode 100755 index 0000000..20d9619 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/GenericFile.rex @@ -0,0 +1,271 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise07: GenericFile v01-00 11Jan13 + + Contains: class "GenericFile". + + Pre-requisites: None. + + Desription: A component that opens and reads a text file that has a specific + format. + Outstanding problems: None reported. + + Changes: + v01-00 + 21Jly12: First version. + 25Aug12: Moved file open from init method to a separate method. + 16Dec12: Trivial correction of a couple of comments. + 11Jan13: Commented-out 'say' instructions. + + Constraints: Format of each record must be: + recordId | field2 | field3 | .... | fieldn + Note that the RecordId or Key must be in the first column. + } +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + GenericFile v01-01 24Aug12 + ----------- + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS GenericFile PUBLIC + + ::ATTRIBUTE fileHeaders GET PUBLIC -- a 1D array of column labels/headers + ::ATTRIBUTE fileHeaders SET PRIVATE + ::ATTRIBUTE fileRecords GET PUBLIC -- a 2D array of records + ::ATTRIBUTE fileRecords SET PRIVATE + ::ATTRIBUTE fileArray GET PUBLIC -- a 1D array of raw data from the file. + ::ATTRIBUTE fileArray SET PRIVATE + ::ATTRIBUTE fileAsDirectory GET PUBLIC -- a directory containing: + -- * headers: a 1D array + -- * records: a 2D array + -- * count: the number of records + ::ATTRIBUTE fileAsDirectory SET PRIVATE + + /*---------------------------------------------------------------------------- + Class Methods - none. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - Given a filename and the number of columns in the file, loads the + fileinto attribute 'fileArray', a 1-dimensional array where each item + is a single "raw" file line or record. + Returns the number of records in the file (or, if unsuccesful at reading + the file, returns 0 (.false) if file doesn't exist, or -1 if no records + in the file. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init PUBLIC + expose columns recordCount fileArray filename + use arg filename, columns + dirFile = self~readFile(fileName, columns) + if dirFile = .false | dirFile = -1 then return .false + self~fileAsDirectory = dirFile -- store whole file in the attribute + self~fileHeaders = dirFile[headers] -- store fileHeaders in the attribute + self~fileRecords = dirFile[records] -- store fileRecords in the attribute + recordCount = dirFile[count] -- store no. records in the attribute + return recordCount + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + readFile - Given a filename and the number of columns, reads a file and + returns it in "fileAsDirectory" format. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD readFile PRIVATE + expose recordCount + use strict arg fileName, columns + recordCount = 0 + --say "GenericFile-readFile-01: fileName =" fileName "columns =" columns + file = .stream~new(filename) + --say "GenericFile-readFile-02: file~query(exists):" file~query("exists") + if file~query("exists") = "" then do + say "GenericFile-readFile-03: file" filename " does not exist." + return .false + end + recordCount = file~lines + if recordCount < 2 then do + recordCount = 0 + return -1 -- Problem - no records, only headers - or nothing!. + end + recordCount = recordCount - 1 -- Exclude columns headers line from the count. + arrRawfile = file~makearray -- read file into an array; each line is an array item + file~close + --say "GenericFile-readFile-04:" filearray~string + self~fileArray = arrRawFile -- (deprecated) store "raw" file array in attribute + + -- Now turn the raw file data into a directory: + -- (1) get a 1D array of column headers or "field labels": + fileHeaders = arrRawFile[1] + arrFileHeaders = self~parseLine(fileHeaders, columns) + self~fileHeaders = arrFileHeaders + -- (2) get a 2D array of field values from data records: + arrFileRecords = .Array~new + do i=1 to recordCount -- get a 2D array of file records + arrRecord = self~parseLine(arrRawFile[i+1], columns) + do j = 1 to columns + arrFileRecords[i,j] = arrRecord[j] + end + end + self~fileRecords = arrFileRecords + -- (3) Build a directory containing headers, records, and lines (or record count). + dirFile = .directory~new + dirFile[headers] = arrFileHeaders + dirFile[count] = recordCount + dirFile[records] = arrFileRecords + return dirFile -- Returns a directory containing the file and file info. + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + parseLine - parse text from file line and place into an array. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD parseLine PRIVATE -- returns a 1D array of fields + use strict arg line, columns + arr = .Array~new + do i=1 to columns + parse var line field "|" line + field = field~strip + arr[i] = field + end + return arr + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + list - Lists a file in raw form on the console. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD list PUBLIC + expose recordCount filename + if recordCount = 0 then do + return .false + end + say; say "GenericFile-list: records in File '"||filename||"'" + say self~fileHeaders + do i=1 to recordCount + say self~fileRecords[i] + end + return .true + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getRecord - Given a "key", returns a directory containing the record data + associated with that key. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC + -- Returns a directory containing the data for the record with the requested + -- key (dataKey). + expose recordCount columns + use strict arg dataKey + if dataKey = "" then return .false + --say "GenericFile-getRecord-01: dataKey=" dataKey + if recordCount = 0 then do + --say "GenericFile-getRecord: recordCount is zero - no records!" + return .false -- File empty or does not exist + end + + found = .false + do recordNo = 1 to recordCount + --say "GenericFile-getRecord-02: self~fileRecords dims:" self~fileRecords~dimension + recordId = self~fileRecords[recordNo,1] + --say "GenericFile-getRecord-03: recordId, dataKey = <"||recordId||">" "<"||dataKey||">" + if recordId = dataKey then do + found = .true; leave; + end + end + if \found then return .false -- Records exist, but specified record not found. + + dirData = .Directory~new + do j=1 to columns + header = self~FileHeaders[j] + dirData[header] = self~fileRecords[recordNo,j] + end + -- say "GenericFile-getRecord-04: Results:" + -- do i over dirData + -- say "'"||i||"' = '"||dirData[i]||"'" + -- end + --say "GenericFile-getRecord-05: record =" + return dirData + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getFile - returns file as a directory, with indices 'headers', 'records', 'count'. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getFile PUBLIC + --say "GenericFile-getFile-01: self~fileAsDirectory =" self~fileAsDirectory + --do i over self~fileAsDirectory + --say "GenericFile-getFile-02 index & type =" i i~objectName + --end + --arrData = self~fileAsDirectory[records] + --say "GenericFile-getFile-03 - arrData =" arrData + --say "GenericFile-getFile-04 - arrData[1,1] =" arrData[1,1] + return self~fileAsDirectory + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + ::METHOD update -- INCOMPLETE!!! + -- Given a record as a Directory, replaces the existing record with the + -- new data and writes the whole file to disk. + -- Returns .false (a) if a record with the provided key does not exist, or + -- (b) if values for all fields are not provided. + + expose recordCount columns fileArray fileName + use arg recordKey, dirRecord -- record key + new record + + -- Find the record: + do i=2 to recordCount + record = fileArray[i] + parse var record recordId . -- assume recordId is first column + if recordId = recordKey then do + found = .true; leave; + end + end + if \found then return .false -- Records exist, but specified record not found. + + -- found record is i'th. Now replace that array item with the new data: + currentRecord = fileArray[i] +---- This method is only opartially completed. !!!!!!!!!!!! + newrecord = "" + do j=1 to columns + --fileArray[i]field = + end + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.h b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.h new file mode 100644 index 0000000..8f5c4b5 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.h @@ -0,0 +1,14 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define DLG_MESSAGESENDER 103 +#define IDC_MS_ERRORMSG 1000 +#define IDC_MS_CLEAR 1002 +#define IDC_MS_DATA 1010 +#define IDC_MS_REPLY 1011 +#define IDC_MS_SEND 1012 +#define IDC_MS_COMPONENT 1015 +#define IDC_MS_METHOD 1016 +#define IDC_MS_STORETARGET 1018 +#define IDC_MS_STOREMETHOD 1020 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.rc b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.rc new file mode 100644 index 0000000..8b3ad36 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.rc @@ -0,0 +1,35 @@ +// Generated by ResEdit 1.5.11 +// Copyright (C) 2006-2012 +// http://www.resedit.net + +#include +#include +#include +#include "MessageSender.h" + + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +DLG_MESSAGESENDER DIALOG 0, 0, 262, 156 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Message Sender" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Target:", IDC_STATIC, 8, 17, 24, 8, SS_LEFT + LTEXT "Method:", IDC_STATIC, 8, 38, 27, 8, SS_LEFT + LTEXT "Data:", IDC_STATIC, 9, 60, 18, 8, SS_LEFT + EDITTEXT IDC_MS_DATA, 40, 55, 210, 35, WS_VSCROLL | ES_MULTILINE + LTEXT "Reply:", IDC_STATIC, 10, 101, 21, 8, SS_LEFT + EDITTEXT IDC_MS_REPLY, 40, 101, 210, 35, WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE + DEFPUSHBUTTON "Send", IDC_MS_SEND, 211, 15, 40, 14 + PUSHBUTTON "Clear", IDC_MS_CLEAR, 211, 35, 40, 14, WS_DISABLED + LTEXT "", IDC_MS_ERRORMSG, 13, 142, 225, 10, SS_LEFT + COMBOBOX IDC_MS_COMPONENT, 40, 15, 125, 15, WS_TABSTOP | CBS_DROPDOWN | CBS_HASSTRINGS | CBS_SORT + COMBOBOX IDC_MS_METHOD, 40, 35, 115, 30, WS_TABSTOP | CBS_DROPDOWN | CBS_HASSTRINGS | CBS_SORT + AUTOCHECKBOX "Store", IDC_MS_STORETARGET, 172, 17, 33, 8 + AUTOCHECKBOX "Store", IDC_MS_STOREMETHOD, 163, 36, 33, 9 +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.rex new file mode 100755 index 0000000..a767fc0 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/MessageSender.rex @@ -0,0 +1,559 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 07: MessageSender.rex v01-00 14Feb13 + + Contains: classes: "MessageSender", "HRSms" + + Message Sender is a test/debug/utility support class that enables a user to + send a message to a component and see what's returned. + + Pre-requisites: the Object Manager (objectMgr.rex). In addition, Message + Sender should be launched from some other dialog, since it + uses popupAsChild. + + Description: A sample Message Sender utility for sending messages to + components. Note that the messages that can be sent are probably + limited, since a full test has not been done. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + 07Aug12: Changed self~execute() to popupAsChild. Launched via a menu + item in the Order Management dialog (OrderMgr.rex) + 14Jan13: Commented-out use of ViewMgr (ViewMgr function incomplete) + 05Feb13: Changed edit controls to comboboxes for Target and Method. + Provided for user add of methods and target components + (not saved over a dialog close). + 11Feb13: No change to function - minor tidy-up of a few comments. + 14Feb13: Correct text in the Help dialog. + + Description: + Target: className instanceName + Method: a single method name + Data: Either strings separated by "|" (will be sent as an array), or: + [name]value [name] value ... (will be sent as a directory), or: + space-separated strings (each is interpreted as a separate + attribute, so a parameter such as 'aaa bbb' cannot be sent + at least not in this version). + +------------------------------------------------------------------------------*/ + +.Application~addToConstDir("..\Exercise07\Support\MessageSender.h") + +::REQUIRES "ooDialog.cls" + + +::CLASS 'MessageSender' SUBCLASS rcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + newInstance - class method to create a msg sender. */ + + ::METHOD newInstance CLASS PUBLIC + use arg rootDlg + --say ".MessageSender-newInstance." + dlg = .MessageSender~new("..\Exercise07\Support\MessageSender.rc", "DLG_MESSAGESENDER") --,,"MessageSender.h") + dlg~activate(rootDlg) + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectMgr + --say "MessageSender-init-01." + forward class (super) continue + .local~my.MsgSender = self + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Activate - Shows the Dialog - i.e. makes it visible to the user. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg + use arg rootDlg + --say "MessageSender-activate-01." + self~popupAsChild(rootDlg, "SHOWTOP") --, ,"IDI_CUSTLIST_DLGICON") + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - initialises the MessageSender + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose cbTarget cbMethod ecData ecReply btnSend btnClear stErrorMsg objectMgr - + chkStoreTarget chkStoreMethod arrTargets arrMethods + --say "MessageSender-initDialog-01." + cbTarget = self~newComboBox("IDC_MS_COMPONENT") + cbMethod = self~newComboBox("IDC_MS_METHOD") + ecData = self~newEdit("IDC_MS_DATA") + ecReply = self~newEdit("IDC_MS_REPLY") + stErrorMsg = self~newStatic("IDC_MS_ERRORMSG") + btnSend = self~newPushButton("IDC_MS_SEND") + btnClear = self~newPushButton("IDC_MS_CLEAR") + chkStoreTarget = self~newCheckBox("IDC_MS_STORETARGET") + chkStoreMethod = self~newCheckBox("IDC_MS_STOREMETHOD") + self~connectButtonEvent("IDC_MS_SEND","CLICKED",sendMessage) + self~connectButtonEvent("IDC_MS_CLEAR","CLICKED",clearEntries) + self~connectHelp(onHelp) + + errorFont = self~createFontEx("Arial Italic") + stErrorMsg~setFont(errorFont) + stErrorMsg~settext(.HRSms~helpMsg) + + -- Get id of ObjectMgr: + objectMgr = .local~my.objectMgr + --say "MessageSender-initDialog-02 - objectMgr =" objectMgr + if objectMgr = .nil then do -- Check if ObjectMgr is present - .nil if not. + stErrorMsg~setText(.HRSms~prefix1||.HRSms~noObjectMgr) + btnSend~disable() + end + + arrTargets = .array~of("ObjectMgr The","PersonModel PA150") + arrMethods = .array~of("showModel","query","list") + do i over arrTargets + cbTarget~add(i) + end + do i over arrMethods + cbMethod~add(i) + end + + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Event Handler Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + sendMessage - Sends a message to the specified component. + Returns .false if error found. + Note 1: the return from the target object must be either a bool + or a directory. (Later versions may add array and string). + Note 2: The "parseData" method displays any error messages + resulting from errors in the data provided by the user. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD sendMessage + expose objectMgr ecReply stErrorMsg btnClear chkStoreTarget chkStoreMethod - + cbTarget cbMethod arrTargets arrMethods + --say; say "---------------------------------------------------------" + --say "MessageSender-sendMessage-01." + ecReply~setText("") -- Clear any reply data from previous requests. + --error = .false -- if true, indicates error in data provided. + message = self~parseData -- data is a directory, array, string; .false if error. + + if message = .false then do -- if errors found in the data. + --say "MessageSender-sendMessage-02: message =" message + btnClear~enable() -- allow user to clear entries. + chkStoreTarget~uncheck; chkStoreMethod~uncheck + return .false + end + if message = "special" then do -- message to ObjectMgr has been dealt with. + btnClear~enable + chkStoreTarget~uncheck; chkStoreMethod~uncheck + return .true + end + + -- Get the component ID (object ref) from the Object Manager: + componentRef = objectMgr~getComponentId(message["class"], message["instance"]) + if componentRef = .false then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + ecReply~setText(.HRSms~rc||" "||componentRef) + stErrorMsg~setText(.HRSms~prefix1||" "||.HRSms~noObject) + btnClear~enable + return .false + end + + -- Send the Message and Display the response: + --say "MessageSender-sendMessage-03: message[data] =" message["data"] + response = sendMsg(componentRef, message["method"],message["data"]) + select + when response = "SendMsg - Syntax Error" then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + stErrorMsg~setText(.HRSms~noResponse) + btnClear~enable + return + end + when response = "SendMsg - No Method" then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + stErrorMsg~setText(.HRSms~noTgtMethod) + btnClear~enable + return + end + when response = .false then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + ecReply~setText(.HRSms~rc||" "||response) + return + end + + when response~isa(.String) then do + ecReply~setText(response) + end + when response~isa(.Directory) then do + replyText = "" + do i over response + replyText = replyText||i||":" response[i]||"; " + end + ecReply~setText(replyText) + end + otherwise do + ecReply~setText(.HRSms~noDir1 response .HRSms~noDir2) + end + end + btnClear~enable + -- say "MessageSender-sendMessage-04: response =" response + + -- Message sent successfully - so now action the checkboxes: + self~storeEntry(cbTarget, chkStoreTarget) + self~storeEntry(cbMethod, chkStoreMethod) + + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + storeEntry - Store a new item in either Target or Method comboboxes if a + checkbox has been checked. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD storeEntry PRIVATE + use strict arg comboBox, checkBox + --say "MessageSender-storeEntry-01." + if checkBox~getCheckState = "CHECKED" then do + newItem = comboBox~getEditControl()~getLine(1) + ix = comboBox~find(newitem) -- case-insensitive find + if ix = 0 then do -- if item not found, then add it. + comboBox~add(newItem) + end + checkBox~uncheck() + end + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + clearEntries - Clear user entries and error messages. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD clearEntries + expose cbTarget cbMethod ecData ecReply stErrorMsg btnClear + cbTarget~setText("") + cbMethod~setText("") + ecData~setText("") + ecReply~setText("") + stErrorMsg~setText("") + btnClear~disable + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + onHelp - Display help. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onHelp + cr = .endOfLine + msg = .HRSms~help2||cr||.HRSms~help3||cr - + ||.HRSms~help4||cr||.HRSms~help5||cr - + ||.HRSms~help6||cr||.HRSms~help7||cr - + ||.HRSms~help8 + title = .HRSms~help1 + buttons = "OK" + --ans = MessageDialog(msg, 0, title, "OK", "INFORMATION") + ans = MessageDialog(msg, self~dlgHandle, title, "OK", "INFORMATION") + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + parseData - Check the message info provided by the user. + + Required data formats are: + Target component: "class instance". Allowed are: multiple spaces between + "class" and "instance"; leading spaces before "class". (Later version may + provide for class messages). + Method: a method name - a single string, e.d. "doThat". Any leading or + trailing spaces are removed. + Message Parameters: A string, and array, or a directory, as follows: + String, e.g.: "AB123, Joe Bloggs Inc., 124.50" The first non-white-space + character must not be "[" or "|", as these characters are used to decide + whether the data format is string, array or directory. + Array, e.g.: "| AB123 | Joe Bloggs Inc. | 124.50 " + The separator between elements is "|". Leading and trailingspaces are + removed from each array item. Thus the result of the above example would + be: "AB123|Joe Bloggs Inc.|124.50". + Directory, e.g.: "[CustNo] AB123 [Name] Joe Bloggs Inc. [Debt] 124.50". + The indices are in square brackets. Leading and trailing spaces of both + indices and items are removed. + Returns: + If no errors found, this method returns the message data in the directory + "message". This has four indexes: "class", "instance", "method", "data". + If format errors are found, a message is displayed, and .false is returned. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD parseData + expose cbTarget cbMethod ecData stErrorMsg objectMgr rootDlg + stErrorMsg~setText("") -- remove any previous error message. + --say; say "MessageSender-parseData-01." + message = .Directory~new + + -- get target component name: + --target = cbTarget~getText(1) + target = cbTarget~getEditControl()~getLine(1) + --say "MessageSender-parseData-02 target =" target + parse var target class instance + targetError = .false + if class = "" | instance = "" then targetError = .true + else do + message["class"] = class~strip; + message["instance"] = instance~strip + end + + -- get Method/Message Name: + targetMethodError = .false + targetMethod = cbMethod~getEditControl()~getLine(1) + --say "MessageSender-parseData-03 targetMethod =" targetMethod + if targetMethod~words \= 1 then targetMethodError = .true + else message["method"] = targetMethod~strip + + -- Special Treatments: + if message["class"] = "ObjectMgr" & message["instance"] = "The" then do + -- Only List and ShowModel allowed (at present). + --say "MessageSender-parseData-04: msg to ObjectMgr." + method = message["method"] + method = method~upper + select + when method = "LIST" then do + objectMgr~list + return "special" + end + when method = "SHOWMODEL" then do -- assume data is a string + modelName = ecData~getLine(1) + parse var modelName modelClass " " modelInstance + modelClass = modelClass~strip; modelInstance = modelInstance~strip + --say "MessageSender-parseData-05: ViewMgr~parentOffsetDialog = self." + -- Setup self as "Parent" dialog for offsetting the view to be shown + --(do it here because other components may have done it previously): + .local~my.ViewMgr~parentOffsetDlg = self + -- Now show the model: + --say "MessageSender-parseData-06: objectMgr~showModel." + r = objectMgr~showModel(modelClass, modelInstance, rootDlg) + --say "MessageSender-parseData-07: return =" r + return "special" + end + otherwise do + --say "MessageSender-parseData-08:" method "is invalid." + targetMethodError = .true + --return .false + end + end + end +-- Following Code does not work - left here in case needed in any following exercises. +/* else do + --say "MessageSender-parseData-01d." + if message["class"] = "ViewMgr" & message["instance"] = "The" then do + method = message["method"] + method = method~upper + if method = "SHOWMODEL" then do + modelName = ecData~getLine(1) + parse var modelName modelClass " " modelInstance + modelClass = modelClass~strip; modelInstance = modelInstance~strip + .local~my.ViewMgr~parentOffsetDlg = self + -- Now show the model: + r = .local~my.ViewMgr~showModel(modelClass, modelInstance, rootDlg) + --say "MessageSender-parseData-01e: return =" r + return "special" + end + end + end +*/ + + -- Normal treatments: + + -- get Message Data, and put in an array, directory or string: + -- Note: ecData~lines returns 1 if control is empty(!). + msgData = "" + do i=1 to ecData~lines() + msgData = msgData||ecData~getLine(i) + --say "MessageSender-parseData-02: Data = '"||msgData||"'" + end + -- Everything now in a single text string. So now check the data type: + --say "chars = '"||msgData||"'" + msgData = strip(msgData) -- remove leading & trailing blanks. + if left(msgData,1) = "" then msgDataType = .false -- i.e. no data + else if left(msgData,1) = "[" then msgDataType = "dir" + else if left(msgData,1) = "|" then msgDataType = "arr" + else msgDataType = "str" + --say "msgDataType =" msgDataType; + + formatError = .false + Select + when msgDataType = .false then msgData = "" + + when msgDataType = "dir" then do + dirMsgData = .Directory~new + separators = msgData~countStr("["); closers = msgData~countStr("]") + if separators \= closers then formatError = .true + if \formatError then do + do i = 1 to separators + parse var msgData "[" index "]" msgData + parse var msgData item "[" + dirMsgData[index] = item~strip + end + message["data"] = dirMsgData + end + end + + when msgDataType = "arr" then do + arrMsgData = .Array~new + separators = msgData~countStr("|") + --say "No. Separators =" separators + msgData = msgData~substr(2) -- strip leading "|" + do i=1 to separators + parse var msgData item "|" msgData + item = item~strip + arrMsgData[i] = item + --say "item =" "'"||item||"'" + end + message["data"] = arrMsgData + end + + otherwise do -- msgDataType = "str" + message["data"] = msgData + end + end -- Select + + -- Check for errors: + errors = 0 + if targetError then errors += 1; if targetMethodError then errors += 1 + if formatError then errors += 1 + if errors = 1 then errortext = .HRSms~prefix1 + if errors > 1 then errortext = .HRSms~prefix2 + if errors > 0 then do + if targetError then errorText = errorText||.HRSms~badTarget + if targetMethodError then errorText = errorText||" "||.HRSms~badMethod + if formatError then errorText = errorText||" "||.HRSms~badData + stErrorMsg~setText(errorText) + return .false + end + + return message + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getObjectRef + expose objectMgr + use arg target + parse var target class "-" instance + ref = objectMgr~getComponentRef(class, instance) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + sendMsg - a 'Send Message' Routine. v00-01 08May12 + -------- + This routine sends the message to the specified component instance. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::ROUTINE sendMsg + use arg targetObject, targetMethod, data + --say "MessageSender-sendMsg-01: targetObject targetMethod data =" targetObject targetMethod data + SIGNAL ON SYNTAX NAME catchIt1 + SIGNAL ON NOMETHOD NAME catchIt2 + msg = .Message~new(targetObject, targetMethod, i, data) + response = msg~send + --say "MessageSender-sendMsg-02: response =" response + return response + catchIt1: say "MessageSender-sendMsg-03: CatchIt1 - Syntax." + SIGNAL OFF SYNTAX + return "SendMsg - Syntax Error" + catchIt2: say "MessageSender-sendMsg-04: CatchIt2 - NoMethod." + SIGNAL OFF NOMETHOD + return "SendMsg - No Method" +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSms) v01-00 05May12 + -------- + This class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSms PRIVATE + ::CONSTANT prefix1 "*** Error: " + ::CONSTANT prefix2 "*** Errors: " + ::CONSTANT badTarget "Invalid class or Instance name." + ::CONSTANT badMethod "Invalid method." + ::CONSTANT badData "Invalid data format." + ::CONSTANT noObject "Target component not found." + ::CONSTANT noTgtMethod "No such method in target component." + ::CONSTANT noResponse "Note: No response received from target object." + ::CONSTANT rc "Return Code:" + ::CONSTANT noObjectMgr "The Object Manager was not found. Cannot work without it." + ::CONSTANT noDir1 "Reply is a" + ::CONSTANT noDir2 "- cannot display with this version." + ::CONSTANT help1 "Formats for data parameters:" + ::CONSTANT help2 "Target: Class Instance - e.g. 'CustomerModel CU0003'" + ::CONSTANT help3 "Method: method name - e.g. 'query'" + ::CONSTANT help4 "Data: Formats for message data are:" + ::CONSTANT help5 " Directory: '[aaa] [bbb] [c cc]'" + ::CONSTANT help6 " Array: '|aaa|bbb|c cc'" + ::CONSTANT help7 " String: 'aaa bbb'" + ::CONSTANT help8 "Note: a 'saved' target or method is not saved over a close." + ::CONSTANT helpMsg "Press F1 for help on allowable data formats." +/*============================================================================*/ + + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/Model.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/Model.rex new file mode 100755 index 0000000..65653f3 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/Model.rex @@ -0,0 +1,186 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + + Support - Model v01-00 27Feb13 + ---------------- + A superclass for the Model-View framework. + + v01-00 09Aug12: First version. + 11Jan13: Commented-out "say"s. + 31Jan13: Store model's data in 'myData'. + 27Feb13: Commented-out some "say" instructions. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::REQUIRES "ooDialog.cls" +--::REQUIRES "ObjectMgr.rex" + +/*============================================================================*/ + +::CLASS 'Model' PUBLIC + + ::ATTRIBUTE wantList CLASS PUBLIC -- for List subclasses + ::ATTRIBUTE myData + + /*---------------------------------------------------------------------------- + newInstance - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + expose noDataError -- .true if data not found. + use strict arg instanceName + --say ".Model-newInstance-01: instanceName =" instanceName + -- Check that the model's Data object is up and running. If not, then return .false: + if noDataError = .true then return .false + -- Now get the name of the Data component (FredModel or FredListModel --> FredData): + -- Get my root name (i.e. the root name of the subclass): + className = self~objectName -- objectName for a class Foo is "The Foo class" + className = className~upper() -- When class name is in quotes, then it's mixed case. + -- Upper here to make everthing upper case for parse var. + -- Handling Forms: + -- If this is a "Form" then there's no data to get (the user will provide + -- the data). So just create the Form Model (e.g. Order Form) and return. + -- Assume that the instance name is the Form Number (e.g. for an OrderForm, + -- the Form Number will be the new Order Number). + p = className~pos("FORM") + if p > 0 then do -- if this is a "Form" component. + instData = .Directory~new + instData[formNumber] = instanceName + formObject = self~new(instData) + formObject~myData = instData -- store instance data for subclasses to access. + --say ".Model-newInstance-011: formObj, instanceName =" formObject||"," instanceName + return formObject + end + -- End of Handling Forms. + + -- If there's "LIST" in the name, then set "get all" for the file access + -- (as opposed to the default of "get 1 record") + getAllRecords = .false + p = className~pos("LIST") + if p > 0 then getAllRecords = .true + -- if there's a "LIST" in the name, strip it out 'cos an xListModel gets data from xData + parse var className . root1 "MODEL" . + parse var root1 root "LIST" + dataClassName = root||"Data" + --say ".Model-newInstance-02, dataClassName =" dataClassName + -- Get the id of Data component: + objMgr = .local~my.ObjectMgr + --say ".Model-newInstance-03: objMgr =" objMgr + myDataId = objMgr~getComponentId(dataClassName, "The") + if myDataId = .false then do -- if instantiation failed + say ".Model-newInstance-04: getting ID of Data Class failed." + noDataError = .true + return .false + end + -- Got my data id, now get data for this model instance. + -- But distinguish between Entity Models and List Models - the former needs + -- a single record, the latter a group of records. + -- say ".Model-newInstance-05a: getAllRecords =" getAllRecords + if getAllRecords then instData = myDataId~getFile() -- returns a 2D array + else instData = myDataId~getRecord(instanceName) -- a directory + -- say ".Model-newInstance-05b: array dimensions: =" instData~dimension + if instData = .false then return .false -- if ID (key) not found + -- All is well, then make new instance: + --say ".Model-newInstance-06: instData =" instData + id = self~new(instData) + id~myData = instData + --say ".Model-newInstance-07: instData =" id + return id + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + getInstanceName - For an "anonymous" instance only (e.g. CustomerList) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getInstanceName CLASS PUBLIC + expose anonInstanceName + if anonInstanceName = "ANONINSTANCENAME" then anonInstanceName = 1 + else anonInstanceName = anonInstanceName + 1 + return anonInstanceName + + + /*---------------------------------------------------------------------------- + query - returns a Model's data. + Standard protocol: + Accept a .nil, directory, array, or string of names (case-sensitive). + if .nil then return all fields; else return values for the names in + the directory, array, or string. String is assumed to be data + names separated by one or more spaces. + All returns are a Directory containing names and values. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD query PUBLIC + use arg dataNames + --say "Model-query-01: dataNames:" dataNames + dirReturn = .Directory~new + select + when dataNames = .nil | dataNames = "" then return self~myData + + when dataNames = "DATANAMES" then return self~myData + + -- Caller is requesting specific data items: + when dataNames~isa(.Directory) then do + --say "Model-query-02; dataNames =" dataNames + do i over dataNames + dirReturn[i] = self~myData[i] + end + end + + when dataNames~isa(.Array) then do + do i over dataNames + dirReturn[i] = self~myData[i] + end + end + + when dataNames~isa(.String) then do + dataNames = dataNames~strip + n = dataNames~countStr(" ")+1 + do i = 1 to n + parse var dataNames name " " dataNames + if name = " " then iterate -- ignore extraneous leading spaces. + dirReturn[name] = self~myData[name] + end + end + + otherwise return .false + end + + return dirReturn + +/*============================================================================*/ + + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/NumberOnlyEditEx.cls b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/NumberOnlyEditEx.cls new file mode 100644 index 0000000..9613851 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/NumberOnlyEditEx.cls @@ -0,0 +1,526 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * The NumberOnlyEditEx class extends the .Edit class to provide an edit + * control which restricts entry to decimal only, or signed decimal only, + * numbers. + * + * The NumberOnlyEditEx.cls file is meant to be included in any ooDialog + * program where this extension to the edit control is desired. The programmer + * needs to take 4 steps to gain the functionality of a signed decimal number + * only edit control: + * + * 1.) Require the NumberOnlyEditEx.cls file (this file.) + * + * ::requires 'NumberOnlyEditEx.cls' + * + * 2.) Invoke the initDecimalOnly() method on each edit control object that is + * to be a decimal number only edit control. If initDecimalOnly() is not + * invoked, the behaviour of the edit control is unchanged. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~initDecimalOnly(decimalPlaces, allowSign) + * + * arguments: + * + * decimalPlaces [optional] The number of decimal places allowed in the + * number. The default is 2. Specifying 0 + * decimal places is acceptable. + * + * allowSign [optional] If a sign character (+ or -) is allowed as the + * leading character of the number. The default + * is .false. Specify .true to allow a sign + * character. + * + * 3.) For each decimal only edit control, the character event must be + * connected to a method in the Rexx dialog object. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~connectCharEvent(onChar) + * + * 4.) In the connected character event handler, the message and its arguments + * must be forwarded on to the onChar() method of the edit control. The + * 6th argument to the event handler is the dialog control object where the + * character event occurred. That is the object the event must be forwared + * to. + * + * When the programmer connects the character event to a method named + * onChar, the event handler is simple: + * + * ::method onChar unguarded + * forward to (arg(6)) + * + * If the programmer chooses a different method name for the event handler, + * then he must be sure to forward to the onChar() method of the edit + * control: + * + * ::method myOwnMethodName unguarded + * forward message 'onChar' to (arg(6)) + * + * And of course there is no reason why the event handler can not be coded + * using the explicit arguments: + * + * ::method myOwnMethodName unguarded + * use arg char, isShift, isCtrl, isAlt, misc, control + * forward message 'onChar' to (control) + */ + + -- Extend the .Edit control by inheriting the .NumberOnlyEditEx mixin class. + + .Edit~inherit(.NumberOnlyEditEx, .EditControl) + +::requires 'ooDialog.cls' +::requires 'winsystm.cls' + +::class 'NumberOnlyEditEx' public mixinclass object + +-- Users of the signed decimal number only edit control must invoke +-- initDecimalOnly() first to assign decimal places and specify if the sign +-- character is allowed. Until this is done, there is no change to the +-- behaviour of the Edit control object. +::method initDecimalOnly + expose decimalPlaces signOk initialized clipBoard + use strict arg decimalPlaces = 2, plusMinus = .false + + if plusMinus~isA(.String), plusMinus~datatype('O') then signOk = plusMinus + else signOk = .false + + initialized = .true + clipBoard = .WindowsClipboard~new + +-- The onChar() method should be inovked at every character event. Returning +-- true allows the character, returning false disallows the character. When a +-- character is not allowed, an edit ballon is set with a message explaining to +-- the user why the character is not appearing when they type. +::method onChar unguarded + expose decimalPlaces initialized signOk + use arg char, isShift, isCtrl, isAlt, misc, control + + if \ var('initialized') then return .true + + if misc~pos("extended") <> 0, self~isExtendedKey(char) then return .true + + if char == 8 then return .true + if signOk, (char == 43 | char == 45) then return self~checkSign + if char == 46 then return self~checkDecimal + if char >= 48, char <= 57 then return self~checkDigit + + if isCtrl, \isAlt, \isShift then return self~checkControlKey(char) + + reply .false + self~charBalloon + + +/** checkDigit() + * + * Checks that the digit being typed, at the cursor position, is allowed. + */ +::method checkDigit private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if signOk, cursorPos == 1 then do + c = text~left(1) + + if c == '-' | c == '+' then do + reply .false + self~showBalloon(.MT~NUM_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + return .true + end + + if decimalPos == 0 then return .true + + if cursorPos <= decimalPos then return .true + + if text~length < (decimalPos + decimalPlaces) then return .true + + reply .false + + msg = self~decimalPlacesUsedMsg + self~showBalloon(.MT~NUM_TITLE, msg, "ERROR") + + +/** checkSign() + * + * Checks that the sign character being typed is allowed at the current cursor + * position. Note that this method is only invoked when the sign character is + * allowed. + */ +::method checkSign private unguarded + expose decimalPlaces + + text = self~getText + cursorPos = self~getCaretPos + + if cursorPos == 1 then do + if self~hasSign(text) then do + reply .false + self~showBalloon(.MT~SIGN_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + + return .true + end + + reply .false + + decimalPos = text~pos('.') + if decimalPos <> 0 | decimalPlaces == 0 then msg = .MT~ONLY_NUMBER + else msg = .MT~ONLY_DECIMAL_NUMBER + + self~showBalloon(.MT~SIGN_TITLE, msg, "ERROR") + + +/** checkDecimal() + * + * Checks that the decimal point being typed is allowed at the current cursor + * position. + */ +::method checkDecimal private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if decimalPlaces == 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if decimalPos <> 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if cursorPos == 1, signOk, self~hasSign(text) then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if text~length < cursorPos + decimalPlaces then return .true + + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + + +/** checkControlKey() + * + * Invoked for a control key combination (Ctrl-?). Anything other than Ctrl-V + * is automatically allowed. Ctrl-V is of course the paste operation. For + * Ctrl-V, we check that the result after pasting the text would be a valid + * signed decimal number, under the constraints for this object. If not, it + * is disallowed and a ballon set. + */ +::method checkControlKey private unguarded + expose clipBoard decimalPlaces + use strict arg char + + if char \== 22 then return .true -- Not Ctrl-V + + -- If there is no text data available we don't care, pasting it will not do + -- any harm. + if \ clipBoard~isDataAvailable then return .true + + pastedText = clipBoard~paste + + -- We have text to paste, need to check is the text acceptable, + -- and is it acceptable for where it will be placed. + text = self~getText + len = text~length + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + -- isValidDecimal() checks that the resulting text after inserting the pasted + -- text is valid. + if \ self~isValidDecimal(pastedText, text, cursorPos) then do + reply .false + self~pasteBalloon(pastedText, text, cursorPos) + return + end + + return .true + + +/** decimalPointBalloon() + * + * This method produces the proper balloon message text when a decimal point has + * been typed, but is not allowed at the current position. + */ +::method decimalPointBalloon private unguarded + expose decimalPlaces signOk + use strict arg decimalPos, cursorPos, text + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~DEC_TITLE, msg, "ERROR") + + +/** charBalloon() + * + * This method produces the proper balloon message when a character is typed. + */ +::method charBalloon private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + msg = .MT~ONLY_NUMBER + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if decimalPlaces == 0, \signOk then msg = .MT~ONLY_WHOLE_NUMBER + else if decimalPos == 0, signOk then msg = .MT~ONLY_SIGNED_DECIMAL_NUMBER + else if decimalPos == 0, \signOk then msg = .MT~ONLY_DECIMAL_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when decimalPos == 0 then do + msg = .MT~ONLY_DECIMAL_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~CHAR_TITLE, msg, "ERROR") + + +/** pasteBalloon() + * + * This method produces the proper balloon message when text is pasted into the + * edit control that is not allowed. + */ +::method pasteBalloon private unguarded + expose decimalPlaces signOk + use strict arg pastedText, text, cursorPos + + if signOk then do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE_SIGNED + else msg = .MT~ONLY_PASTE_A_SIGNED decimalPlaces .MT~ONLY_PASTE_B + end + else do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE + else msg = .MT~ONLY_PASTE_A decimalPlaces .MT~ONLY_PASTE_B + end + + resultText = text~substr(1, cursorPos - 1) || pastedText || text~substr(cursorPos) + + -- Balloon text has to be less than 1023 characters. If we don't exceed that + -- length, we will show the incorrect text to the user. Otherwise we just + -- show the short message. Note that new line characters can be used to + -- format the balloon text. + len = msg~length + resultText~length + .MT~PASTED_A~length + .MT~PASTED_B~length + 8 + + if len < 1023 then do + msg ||= .endOfLine~copies(2) || .MT~PASTED_A || - + .endOfLine~copies(2) || '"'resultText'"' || - + .endOfLine~copies(2) || .MT~PASTED_B + end + + self~showBalloon(.MT~PASTE_TITLE, msg, "ERROR") + + +/** decimalPlacesUsedMsg() + * + * Convenience method to return the proper message for the situation where the + * allowable number of decimal places have been filled. + */ +::method decimalPlacesUsedMsg private unguarded + expose decimalPlaces + + if decimalPlaces == 1 then return .MT~ONLY_1_DECIMAL + else return .MT~ONLY_DECIMALS_A decimalPlaces .MT~ONLY_DECIMALS_B + + +/** isValidDecimal() + * + * Checks that the resulting text after the pasted text is inserted into text at + * the current position, results in a valid number using the current + * restrictions. Decimal places and sign allowed or not. + */ +::method isValidDecimal private unguarded + expose decimalPlaces signOk + use strict arg pasteText, text, cursorPos + + resultText = text~substr(1, cursorPos - 1) || pasteText || text~substr(cursorPos) + + -- Can't have any type of space character, tab, new line, etc.. + if resultText \== resultText~space(0) then return .false + + -- Eliminate obvious problems with decimals. + countDots = resultText~countStr(".") + if countDots > 1 then return .false + if decimalPlaces == 0, countDots > 0 then return .false + + -- Eliminate any problems with the sign character. + if signOk then do + if resultText~pos('-') > 1 | resultText~pos('+') > 1 then return .false + end + else do + if resultText~pos('-') <> 0 | resultText~pos('+') <> 0 then return .false + end + + + decimalPos = resultText~pos('.') + if decimalPos > 0 then do + if resultText~length - decimalPos > decimalPlaces then return .false + + -- Remove the decimal char so we can test for all digits. + resultText = resultText~changeStr('.', '') + end + + -- Remove the sign character if it exists. + if self~hasSign(resultText) then resultText = resultText~substr(2) + + -- Exponential notation can not be allowed. + if resultText~caselessPos('E') <> 0 then return .false + + if \ resultText~datatype('W') then return .false + + return .true + + +/** isExtendedKey + * + * Convenience method to test if the character, char, is an extended key we want + * to pass on to the edit control + */ +::method isExtendedKey private + use strict arg char + + if char >= 33, char <= 40 then return .true + if char == 45 | char == 46 | char == 8 then return .true + return .false + + +/** hasSign + * + * Convenience method to test if a text string starts with a sign (+ or -) + * character. + */ +::method hasSign private + use strict arg text + + c = text~left(1) + if c == '-' | c == '+' then return .true + return .false + + +/** getCaretPos() + * + * Returns the current caret (cursor) position of this edit control. + */ +::method getCaretPos private + return self~selection~startChar + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Class: MT + + This class is used to provide constant character strings. The strings are + used for the balloon messages put up by the NumberOnlyEditEx mixin class. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'MT' private +::constant CHAR_TITLE "Unacceptable Character" +::constant DEC_TITLE "Unacceptable Decimal Point" +::constant NUM_TITLE "Unacceptable Number" +::constant SIGN_TITLE "Unacceptable Sign Character" +::constant PASTE_TITLE "Unacceptable Pasted Text" + +::constant ONLY_NUMBER "You can only type a number here." +::constant ONLY_SIGNED_NUMBER "You can only type a number or the sign here." +::constant ONLY_DECIMAL_NUMBER "You can only type a number or the decimal point here." +::constant ONLY_SIGNED_DECIMAL_NUMBER "You can only type a number, the sign, or the decimal point here." +::constant ONLY_WHOLE_NUMBER "You can only type a number here. Only whole numbers are allowed." +::constant ONLY_WHOLE_SIGNED_NUMBER "You can only type a number or the sign here. Only whole numbers are allowed." + +::constant HAS_SIGN "You can not type here. The sign character is already in place." +::constant ONLY_1_DECIMAL "You can not type here. Only 1 decimal place is allowed." +::constant ONLY_DECIMALS_A "You can not type here. Only" +::constant ONLY_DECIMALS_B "decimal places are allowed." + +::constant ONLY_PASTE_WHOLE "You can only paste text here that produces a whole number." +::constant ONLY_PASTE_WHOLE_SIGNED "You can only paste text here that produces a signed whole number." +::constant ONLY_PASTE_A_SIGNED "You can only paste text here that produces a signed decimal number with" +::constant ONLY_PASTE_A "You can only paste text here that produces a decimal number with" +::constant ONLY_PASTE_B "or less decimal places." +::constant PASTED_A "Resulting text of:" +::constant PASTED_B "is not valid." diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ObjectMgr.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ObjectMgr.rex new file mode 100755 index 0000000..91a3910 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ObjectMgr.rex @@ -0,0 +1,302 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + + Support - ObjectMgr v01-00 21Jan13 + ------------------- + A singleton component that manages model objects. + + Should ensure that only one instance is created. This version doesn't. + + Provides an object reference given a class and an instance name. Stores these + in an "object bag", which is a table of classes, where each table item is a + table of instance names, the item being the object reference. + + Interface ObjectMgr { + bool init + cmptId getComponentId( in string className, in string instanceName ) + bool addCmptRef( in string className, in string instanceName, in objref cmptRef ) + void list( ) + bool showModel( in string modelClass, in string modelInstance ) + } + + Changes: + v01-00 23Apr12: First version. + 11Jan13: Commented-out 'say' instructions. + 21Jan13: Make 'addView' private and 'removeView' explicitly public. + Minor typos in comments corrected. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +call "RequiresList.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================*/ +::CLASS 'ObjectMgr' PUBLIC + + ::ATTRIBUTE objectBag PRIVATE-- a bag of objects - i.e. instances of Distributed + -- Components or DCs. + + /*---------------------------------------------------------------------------- + init - initialises the ObjectManager + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectBag viewBag + --say "ObjectMgr-init. Classes:" .CustomerModel .CustomerData .CustomerView + .local~my.ObjectMgr = self + objectBag = .directory~new -- holds "class-inst" "id-ViewName" + viewBag = .directory~new -- holds view class and latest view instance. + return .true + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + getComponentId - Returns a Component Id if it's in the ObjectBag, + else calls doNewInstance to get id, else returns .false. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getComponentId PUBLIC + expose objectBag + use strict arg className, instanceName + className = className~upper; instanceName = instanceName~upper + --say "ObjectMgr-getComponentId-00: className =" className "instanceName =" instanceName + ObjectName = className||"-"||instanceName + if objectBag~hasIndex(objectName) then do -- if class-instance already registered: + --say "ObjectMgr-getComponentId-01: Class Found:" objectName + arr = objectBag[objectName] -- Get info array for this class-instance. + componentId = arr[1] + return componentId -- return component id + end + -- If we've got to here, then there's no id stored. So go get one: + componentId = self~doNewInstance(className,instanceName) + --say "ObjectMgr-getComponentId-03: componentId =" componentId + if componentId = .false then return .false -- Bad object name + self~addComponentId(className,instanceName,componentId) + return componentId + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + /*---------------------------------------------------------------------------- + doNewInstance - Instantiates the requested object and returns the object id + (aka component id). If class not found, or class returns + .false to ~newInstance, then returns .false. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD doNewInstance PRIVATE + use strict arg className, instanceName + SIGNAL ON NOMETHOD NAME catchIt + interpret "componentId = ."||className||"~newInstance("||"'"||instanceName||"'"||")" + --say "ObjectMgr-doNewInstance-01: componentId =" componentId + -- add to object bag: + return componentId + catchIt: + say "ObjectMgr-doNewInstance-02: component" className instanceName "not found." + return .false + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + /*---------------------------------------------------------------------------- + addComponentId - Adds an Instance of a Class to the Object Bag. + If instance already exists, return .false + Format of ObjectBag (note - directory indices are case-sensitive, i.e. + if entry is created with index "AbC" then 'say dir["ABC")' may return nil. + + +---------------------------------+ + | Index | Item (an Array) | + +---------------------------------+ + | | | View | + | Class-Inst | objId | Class-Inst | + |---------------------------------| + | PersM-AB12 | x'12' | PersV-1 | + |- - - - - - |- - - -|- - - - - - | + | PersM-CD34 | x'5A' | .nil | + |- - - - - - |- - - -|- - - - - - | + | PersV-1 | x'7B' | .nil | + |- - - - - - |- - - -|- - - - - - | + | | | | + +---------------------------------+ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method addComponentId PRIVATE + expose objectBag + use strict arg className, instanceName, componentId + --say "ObjectMgr-addComponentId-01:" classname instancename componentId + objectName = className||"-"||instanceName + arr = .Array~new + arr[1] = componentId + arr[2] = .nil -- Space for a View Name ('class-inst') + objectBag[objectName] = arr + --self~list + return + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + /*---------------------------------------------------------------------------- + showModel - Shows a view of a model. Lacking a config file that links + model class to one or more View classes, we heroically assume + that all models are called "xxxModel" and its View is called + xxxView. Assume only one View per Model. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel PUBLIC + expose objectBag + use arg modelClass, modelInstance, parentDlg + --say "ObjectMgr-showModel-01a - modelNames:" modelClass modelInstance + --say "ObjectMgr-showModel-01b - parentDlg: " parentDlg + --say "ObjectMgr-showModel-02 - modelClass: '"||modelClass||"'; modelInstance: '"||modelInstance||"'" + -- If this is an "anonymous" component (instance name "A"|"a"), ask its + -- class object for an instance name: + if modelInstance = "A" | modelInstance = "a" then do + anonModelClass = "."||modelClass + interpret "modelInstance = "||anonModelClass||"~getInstanceName" + --say "ObjectMgr-showModel-02 - modelInstance: " modelInstance + end + modelId = self~getComponentId(modelClass, modelInstance) + --say "ObjectMgr-showModel-03 - modelId:" modelId + if modelId = .false then do + say "ObjectMgr-showModel-03b: Model" modelClass modelInstance "could not be found." + return .false + end + + -- Check if View exists - if so, surface it: + modelName = modelClass||"-"||modelInstance + modelName = modelName~upper + arr = objectBag[modelName] + viewName = arr[2] + --say "ObjectMgr-showModel-03c: ViewName =" viewName + if viewName \= .nil then do -- if view exists + arr = objectBag[viewName] + viewId = arr[1] + viewId~show("SHOWTOP") -- if minimized, doesn't work. + viewId~show("NORMAL") -- if hidden, doesn't work + return .true + end + + -- View does not exist - so construct the view name and send the class a + -- newInstance(modelId, parentDlg). + parse var modelClass root "Model" + viewClass = root||"View" + viewClassId = "."||viewClass + --say "ObjectMgr-showModel-04: viewClassId =" viewClassId + interpret "targetObject =" viewClassId + --say "ObjectMgr-showModel-05: parentDlg =" parentDlg + msg = .Message~new(targetObject, "newInstance", "I", modelId, parentDlg) + --say "ObjectMgr-showModel-06: Class is:" .CustomerView .ObjectMgr + viewId = msg~send + --say "ObjectMgr-showModel-07 - viewId:" viewId + + self~addView(modelClass, modelInstance, viewClass, viewId) + --self~addView(modelClass, modelInstance, "CustomerView", viewId) + return .true + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + addView - Adds a View to the ObjectBag. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD addView PRIVATE + expose objectBag --viewBag + use strict arg modelClass, modelInstance, viewClass, viewId + --say "ObjectMgr-addView-01." + -- Get view's instanceName + viewInstance = viewId~identityHash + + -- First, add View name to arr[2] of Model's entry in ObjectBag: + modelName = modelClass||"-"||modelInstance + modelName = modelName~upper() + viewClass = viewClass~upper() + viewName = viewClass||"-"||viewInstance + arr = objectBag[modelName] + arr[2] = viewName + -- Now add the View to the ObjectBag: + self~addComponentId(viewClass, viewInstance, viewId) + --say "ObjectMgr-addView-02: list with new View class:" + --self~list + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + removeView - Removes a view from the ObjectBag. (Used by RcView & ResView.) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD removeView PUBLIC + expose objectBag + use arg viewClass, viewInstance + viewClass = viewClass~upper() -- View class was uppered in addView method. + viewClassInst = viewClass||"-"||viewInstance + --say "ObjectMgr-removeView-01: viewClassInst:" "'"||viewClass||"'" "'"||viewClassInst||"'" + r = objectBag~remove(viewClassInst) + --say "ObjectMgr-removeView-02: r =" r + do i over objectBag + arr = objectBag[i] + if arr[2] = viewClassInst then arr[2] = .nil + end + --say "ObjectMgr-removeView-03: ObjectBag List:" + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*----------------------------------------------------------------------- + list - Produces a list on stdout of the classes and their Instances + that are in the Object Bag. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + ::METHOD list PUBLIC + expose objectBag viewBag + say; say "Object Bag List:" + say " ----------------------------------------------------------------------------" + say " Class-Instance Model Id ViewClass-Inst" + say " ------------------------ ------------------------ ------------------------" + do name over objectBag + arrItems = objectBag[name] + viewClass = arrItems[2] + if viewClass = .nil then viewClass = ".nil" + modelId = arrItems[1] + --say "ObjectBag-list-01: ModelID =" modelId ";" modelId~objectName + say " " name~left(25) modelId~objectName~left(25) viewClass~left(25) + end + say " ----------------------------------------------------------------------------" + say + /*say; say "Latest View Instances:" + say " View Class Instance" + say " ------------------------- ---" + do viewClass over viewBag + viewNo = viewBag[viewClass] + say viewClass~left(25) viewNo~right(7) + end + say + */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/RcView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/RcView.rex new file mode 100755 index 0000000..0b9163b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/RcView.rex @@ -0,0 +1,143 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Support + + Support - RcView v01-00 01Feb13 + ---------------- + A simple superclass class for the Model-View framework. + Code is idential to that in ResView. + + Changes: + v01-00 09Aug12: First version. + 11Jan13: Commented-out the 'say' instructions. + 01Feb13: Add comment; remove some commented-out 'say's. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + --say "RcView." +::REQUIRES "ooDialog.cls" +--::REQUIRES "ObjectMgr.rex" + +/*============================================================================*/ + +::CLASS 'RcView' SUBCLASS RcDialog PUBLIC + + --::ATTRIBUTE offsetParentDlg + ::ATTRIBUTE viewMgr + + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectMgr + --say "RcView-init-01." + forward class (super) continue + objectMgr = .local~my.ObjectMgr -- Needed to clear up when dialog closed. + self~viewMgr = .local~myViewMgr + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + activate - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose viewClass viewInstance -- needed for tidy-up on close. + use arg modelId + -- Get View Instance name and View Class for tidy-up when dialog is closed. + viewInstance = self~identityHash + dlgName = self~objectName + parse var dlgName . viewClass + modelData = modelId~query + return modelData + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + loadList - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD loadList Wait till check out how do ShowModel for List. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + expose objectMgr viewClass viewInstance + objectMgr~removeView(viewClass, viewInstance) + -- Note - we do not remove the Model. Should we? If so, not from here! + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Popup Offsets + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setOffsetParent - set the parent dialog id for later offsetting of a child + dialog. + **** Note: This method not used in Exercise07. **** */ + ::METHOD setOffsetParent + use strict arg parentDlg + viewMgr = .local~my.ViewMgr + viewMgr~parentOffsetDlg = self + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + offset - offsets a "child" dialog from its "parent" dialog (i.e. the dialog + from which the child is "popped up"). + **** Note: This method not used in Exercise07. **** */ + ::METHOD offset + --say "RcView-offset-1." + offset = .local~my.ViewMgr~dlgOffset + parentDlg = .local~my.ViewMgr~parentOffsetDlg + popupPos = parentDlg~getRealPos + popupPos~incr(offset,offset) + self~moveTo(popupPos, "SHOWWINDOW") + self~ensureVisible() + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invokes offset. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + self~offset + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ResView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ResView.rex new file mode 100755 index 0000000..466ba01 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ResView.rex @@ -0,0 +1,145 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Exercise07 + + Support - ResView v01-00 11Jan13 + ---------------- + A simple superclass class for the Model-View framework. + Code is idential to that in RcView. + + Versions: + v01-00 21Aug12: First version. + 11Jan13: Comment-out say instructions. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + --say "ResView." +::REQUIRES "ooDialog.cls" +--::REQUIRES "ObjectMgr.rex" + +/*============================================================================*/ + +::CLASS 'ResView' SUBCLASS ResDialog PUBLIC + + --::ATTRIBUTE offsetParentDlg + ::ATTRIBUTE viewMgr + + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectMgr + --say "ResView-init-01." + forward class (super) continue + objectMgr = .local~my.ObjectMgr -- Needed to clear up when dialog closed. + self~viewMgr = .local~myViewMgr + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + activate - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose viewClass viewInstance + use arg modelId + -- Get View Instance name and View Class for tidy-up when dialog is closed. + --say ".ResView~activate-01: class = " viewClass + viewInstance = self~identityHash + dlgName = self~objectName + --say ".ResView~activate-02: dlgName = " dlgName + parse var dlgName "a " viewClass + --say ".ResView~activate-03: class name = '"||viewClass||"'" + --say ".ResView-activate-04: viewInstance =" viewInstance + --say ".ResView-activate-05: modelId =" modelId + modelData = modelId~query + return modelData + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + loadList - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD loadList Wait till check out how do ShowModel for List. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + expose objectMgr viewClass viewInstance + --say "RcView-leaving-01. viewClass =" viewClass "viewInstance =" viewInstance + objectMgr~removeView(viewClass, viewInstance) + -- Note - we do not remove the Model. Should we? If so, not from here! + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Popup Offsets + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setOffsetParent - set the paprent dialog id for later offsetting of a child + dialog. */ + ::METHOD setOffsetParent + use strict arg parentDlg + viewMgr = .local~my.ViewMgr + viewMgr~parentOffsetDlg = self + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + offset - offsets a "child" dialog from it "parent" dialog (i.e. the dialog + from which the child is "popped up"). */ + ::METHOD offset + offset = .local~my.ViewMgr~dlgOffset + parentDlg = .local~my.ViewMgr~parentOffsetDlg + popupPos = parentDlg~getRealPos + popupPos~incr(offset,offset) + self~moveTo(popupPos, "SHOWWINDOW") + self~ensureVisible() + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invokes offset. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + self~offset + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/UdView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/UdView.rex new file mode 100755 index 0000000..d24f4b9 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/UdView.rex @@ -0,0 +1,140 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Exercise07 + + Support - UdView v00-01 06Sep12 + ---------------- + A simple superclass class for the Model-View framework. + Code is idential to that in RcView. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "ooDialog.cls" + + +/*============================================================================*/ + +::CLASS 'UdView' SUBCLASS UserDialog PUBLIC + + --::ATTRIBUTE offsetParentDlg + ::ATTRIBUTE viewMgr + + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectMgr + say "UdView-init-01." + forward class (super) continue + objectMgr = .local~my.ObjectMgr -- Needed to clear up when dialog closed. + self~viewMgr = .local~myViewMgr + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + activate - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose viewClass viewInstance + use arg modelId + -- Get View Instance name and View Class for tidy-up when dialog is closed. + say ".UdView~activate-01: class = " viewClass + viewInstance = self~identityHash + dlgName = self~objectName + say ".UdView~activate-02: dlgName = " dlgName + parse var dlgName "a " viewClass + say ".UdView~activate-03: class name = '"||viewClass||"'" + say ".UdView-activate-04: viewInstance =" viewInstance + say ".UdView-activate-05: modelId =" modelId + modelData = modelId~query + return modelData + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + loadList - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD loadList Wait till check out how do ShowModel for List. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + expose objectMgr viewClass viewInstance + say "UdView-leaving-01. viewClass =" viewClass "viewInstance =" viewInstance + objectMgr~removeView(viewClass, viewInstance) + -- Note - we do not remove the Model. Should we? If so, not from here! + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Popup Offsets + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setOffsetParent - set the paprent dialog id for later offsetting of a child + dialog. */ + ::METHOD setOffsetParent + use strict arg parentDlg + viewMgr = .local~my.ViewMgr + viewMgr~parentOffsetDlg = self + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + offset - offsets a "child" dialog from it "parent" dialog (i.e. the dialog + from which the child is "popped up"). */ + ::METHOD offset + offset = .local~my.ViewMgr~dlgOffset + parentDlg = .local~my.ViewMgr~parentOffsetDlg + popupPos = parentDlg~getRealPos + popupPos~incr(offset,offset) + self~moveTo(popupPos, "SHOWWINDOW") + self~ensureVisible() + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invokes offset. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + self~offset + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ViewMgr.rex b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ViewMgr.rex new file mode 100755 index 0000000..ccec9db --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise07/Support/ViewMgr.rex @@ -0,0 +1,122 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ViewMgr v01-00 13Feb13 + ---------- + A singleton component that manages Views and view-related function + such as Popup Offsetting. + + Changes: + v01-00 23Apr12: First version + 11Jan13: Comment-out 'say' instructions. + 13Feb13: Remove code not used. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::REQUIRES "ObjectMgr.rex" + +::CLASS 'ViewMgr' PUBLIC + + :: ATTRIBUTE dlgOffset -- A single number of dialog units by which a + -- child dialog is offset (vertically and + -- horizontally) from a parent. + :: ATTRIBUTE parentOffsetDlg -- The dialog from which a "child" dialog is + -- "popped up". + + /*---------------------------------------------------------------------------- + init - initialises the ViewMgr + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + --expose dlgOffset + --say "ViewMgr-init." + .local~my.ViewMgr = self + self~dlgOffset = 200 + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + setPopupParent - Remembers the id of a parent dlg that is "popping up" + a child dialog. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setPopupParent PUBLIC + use strict arg parentDlg -- the dialog id of the Parent View + self~parentDlg = parentDlg + say "ViewMgr-setPopupParent-01. Parent View =" parentDlg + + /*---------------------------------------------------------------------------- + offsetDlg - Calculates the desired position of a "child" dialog given + the dlg id of the "parent" dialog and offsets it from the + parent dialog by the "dlgOffset". + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ::METHOD offsetDlg PUBLIC + use strict arg childDlg + say "ViewMgr-popupChild-01. Parent View, Child View:" parentDlg childDlg + parentPos = parentView~getRealPos + childPos = incr(dlgOffset, dlgOffset) + return +*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + + + /*---------------------------------------------------------------------------- + showModel - Surface a View. Uses the ObjectMgr to see if the view already + exists, and if so, to surface it; else the ObjectMgr causes the + required view to be created. + *** Note - Not supported by MessageSender in Exercise07. *** + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel PUBLIC + use strict arg modelClass, modelInstance + say "ViewMgr-showModel-01: class / instance:" modelClass "/" modelInstance + -- Get the ObjectMgr to do the work: + dlg = .local~my.ObjectMgr~showModel(modelClass, modelInstance) + if dlg = .false then do + say "ViewMgr-showModel-02: bad response from ObjectMgr." + return .false + end + else do + --say "ViewMgr-showModel-03: good response from ObjectMgr." + return .true + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerFile.txt new file mode 100644 index 0000000..651d7bc --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerFile.txt @@ -0,0 +1,6 @@ +CustNo | CustName | CustDisc | CustAddr | Zip +AB0784 | ABC Enterprises Inc. | B1 | 2145 Engle Blvd,Hardtown,FL | 37043 +AC0027 | Frith Motors Inc. | B1 | 124 Freeview St.,Mackfield,TX | 78254 +BA0314 | LMN & Partners | C2 | 116 High St.,Ensleigh,NV | 84394 +BA0526 | EJ Smith United Inc. | C1 | 3 Ventry Rd,Ventry,MS | 38216 +CU0003 | Red-On & Locus Inc. | A1 | 43 Main St,Plingford,AR | 48231 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.h new file mode 100644 index 0000000..62b5eb4 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDI_CUSTLIST_DLGICON 103 +#define IDD_CUSTLIST_DIALOG 104 +#define IDR_CUSTLIST_MENU 105 +#define IDC_CUSTLIST_LIST 1001 +#define IDM_CUSTLIST_NEWCUST 40000 +#define IDC_CUSTLIST_SHOWCUST 40001 +#define IDM_CUSTLIST_ABOUT 40002 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.rc new file mode 100644 index 0000000..073d8f2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "CustomerListView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUSTLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUSTLIST_NEWCUST + } + POPUP "Help" + { + MENUITEM "About...", IDM_CUSTLIST_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUSTLIST_DIALOG DIALOG 0, 0, 225, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Customer List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_CUSTLIST_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING | LVS_NOSORTHEADER , 15, 10, 190, 215 + DEFPUSHBUTTON "Show Customer", IDC_CUSTLIST_SHOWCUST, 89, 235, 54, 14, WS_DISABLED +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_CUSTLIST_DLGICON ICON ".\\customer\\bmp\\CustList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.rex new file mode 100755 index 0000000..bbdf746 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerListView.rex @@ -0,0 +1,260 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The Customer ListView v03-00 24May13 + + Contains: classes "CustomerListView" and "HRSclv". + + Pre-requisite: CustomerListView.rc, CustomerListView.h, CustList.ico + + Description: Provides a list of Customers and supports viewing any given + Customer via a double-click on that Customer's item in the list. + This is an "Intermediate" component - it is invoked by OrderMgmt, + and invokes CustomerView. + + v01-00 06Jun12: First Version. + v02-00 08Jan13: Removed stand-alone startup code (not needed after Ex06) + Commented out say's. + v03-00 24May13: Updated to use View and Component mixins. + + Outstanding Problems: None reported. +*******************************************************************************/ + + +.Application~addToConstDir("Customer\CustomerListView.h") + +::REQUIRES "ooDialog.cls" +::REQUIRES "customer\customerview.rex" +::REQUIRES "Support\View.rex" +::REQUIRES "Support\Component.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerListView v03-00 24May13 + ---------------- + The view of a list of Customers. + Changes: + v01-01: First version + v01-02: Corrected for standalone invocation. + v01-03 28Jan12: Changed name of HRS class to HRSplv. + v01-04 11Feb12: moved .application~setDefaults() to app startup file. + changed to .application~addToConstDir() here. + v01-05 19Feb12: Moved .Application~addToConstDir statement from newInstance + method to top of file - just before ::requires statement(s). + v01-06 29Mar12: Very minor mods - all just minor clean-ups. All comments removed + v02-00 17Aug12: Exercise07 - modified to use the MVF. + 08Jan13: Removed stand-alone startup (not now needed). + v03-00 24May13: Inherits directly from RcDialog plus the View & Component mixins + + + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::CLASS CustomerListView SUBCLASS RcView PUBLIC +::CLASS CustomerListView SUBCLASS RcDialog PUBLIC INHERIT View Component + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg idCustomerListModel, rootDlg + --say "CustomerListView-newInstance-01: instName, rootDlg =" idCustomerListModel rootDlg + dlg = self~new("Customer\CustomerListView.rc", "IDD_CUSTLIST_DIALOG") + --say "CustomerListView-newInstance-02: dlg =" dlg + dlg~activate(idCustomerListModel, rootDlg) -- Must be the last statement. + return dlg + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + self~initView + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + menuBar = .ScriptMenuBar~new("Customer\CustomerListView.rc", "IDR_CUSTLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg modelData + use arg idCustomerListModel, rootDlg + --say "CustomerListView-activate-01." + forward class (super) continue -- required for MVF + modelData = RESULT -- super gets my data! + --say "CustomerListView-activate-02: rootDlg =" rootDlg + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_CUSTLIST_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvCustomers btnShowCustomer modelData + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + lvCustomers = self~newListView("IDC_CUSTLIST_LIST"); + lvCustomers~addExtendedStyle("GRIDLINES FULLROWSELECT") + lvCustomers~insertColumnPX(0,"Number",60,"LEFT") + lvCustomers~insertColumnPX(1,"Name",220,"LEFT") + lvCustomers~insertColumnPX(2,"Zip",80,"LEFT") + self~connectListViewEvent("IDC_CUSTLIST_LIST","CLICK",itemSelected) -- Single click + self~connectButtonEvent("IDC_CUSTLIST_SHOWCUST","CLICKED",showCustomer) + self~connectListViewEvent("IDC_CUSTLIST_LIST","ACTIVATE",openItem) -- Double-click + --self~connectListViewEvent("IDC_CUSTLIST_LIST","BEGINDRAG",beginDM) -- Button 1 down + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newCustomer UNGUARDED + self~noMenuFunction(.HRSclv~newCust) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSclv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSclv~noMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected UNGUARDED + use arg id, itemIndex, columnIndex, keyState + /* This method is fired when the user clicks on a row in the ListView. + If the user clicks on an empty row, then itemIndex is set to -1, else + the itemIndex is set to the 0-based row number. + If the user double-clicks on a row, this method is fired in response + to the first click but not to the second. If the row is empty, the second + click of the double-click is ignored, else the double-click method is + fired. + */ + if itemIndex > -1 then self~enableControl("IDC_CUSTLIST_SHOWCUST") + else self~disableControl("IDC_CUSTLIST_SHOWCUST") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + -- User double-clicked on an item in the ListView. + -- Note: does not get fired if double-click was on an empty row. + self~showCustomer + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showCustomer UNGUARDED + expose lvCustomers rootDlg + item = lvCustomers~selected + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSclv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvCustomers~getItemInfo(item, info) then do + --say "CustomerListView-showCustomer-02: info~text =" info~text + objectMgr = .local~my.ObjectMgr -- Ex07 + objectMgr~showModel("CustomerModel", info~text, rootDlg) -- Ex07 + self~disableControl("IDC_CUSTLIST_SHOWCUST") -- Ex07 + end + else do + say "CustomerListView-showCustomer-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvCustomers modelData -- Ex07 + --say "CustomerListView-LoadList-00: modelData =" modelData + -- modelData is a directory. + --say "CustomerListView-loadList-01: No Records =" modelData[count] + rows = modelData[count] -- Ex07 - number of rows + arrData = modelData[records] + --say "CustomerListView-loadList-02:Dims =" arrData~dimension(1) arrData~dimension(2) + do i = 1 to rows -- Ex07 - omit the header line. + --say "CustomerListView-loadList-02: arr[i,1 =" arrData[i,1] + lvCustomers~addRow( , ,arrData[i,1],arrData[i,2],arrData[i,5]) + end + lvCustomers~setColumnWidth(1) -- set width of 2nd column to longest text entry. + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSclv (Human-Readable Strings for CustomerListView) v01-00 06Jun12 + --- + The HRSclv class provides constant character strings for user-visible messages + issued by the CustomerListView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSclv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newCust "New Customer" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerModelsData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerModelsData.rex new file mode 100755 index 0000000..d781345 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerModelsData.rex @@ -0,0 +1,242 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: Customer Models and Data Classes v02-00 24May13 + + Contains: classes "CustomerModel" "CustomerListModel" and "CustomerData". + + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. + v02-00 11Jan13: Modified to use the Model-View Framework with data read from + file using the GenericFile class. CustomerListModel added. + Commented out 'say' instructions. + 31Jan13: Removed 'query' method (it's in the superclass) from both + Customer and CustomerList - also removed code storing data + in self~myData. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + 24May13: Updated comments only to say Ex08. + +------------------------------------------------------------------------------*/ + +::REQUIRES "Support\GenericFile.rex" +::REQUIRES "Support\Model.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerModel v01-01 09Aug12 + ------------ + The "model" part of the Customer component. + + Changes: + v01-00 07Jun12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE myData + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + expose noDataError + use strict arg instanceName + --say ".CustomerModel-newInstance-01; class name =" self~objectName + -- Get my data via my superclass: + forward class (super) continue + customerId = RESULT + return customerId + + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + use strict arg dirData + return self + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerListModel v02-00 13Jan08 + ---------------- + The model for a list of Customers. + Changes: + v00-01 15Aug12: First version + v02-00 13Jan08: Runs under MVF (Ex07). Commented out 'say's. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerListModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE myData + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg instanceName + self~wantList = .true -- set super's attribute + forward class (super) continue + return RESULT + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + use arg dirData + --self~myData = arrdata + --say "CustomerListModel-init-01: myData =" self~myData + return self + +-- ::METHOD query PUBLIC + /*---------------------------------------------------------------------------- + query - returns an array of all Customer data. + In MVF this method is invoked by the RcView (or ResView) superclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --say "CustomerListModel-query-01." +-- return self~myData + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerData v01-01 09Aug12 + ------------ + The "data" part of the Customer component. + Changes: + v01-00 07Jun12: First version. + v02-00 09Aug12: Second version - subclasses GenericFile to read data from + a disk file. + 08Jan13: Commented out some 'say' instructions. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerData SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC -- Invoked by ObjectMgr + --use strict arg instanceName + if self~created = "CREATED" then do -- If this is first time + --say ".CustomerData-newInstance-01." + customerDataId = self~new() + self~created = .true + return customerDataId + end + else do + say ".CustomerData-newInstance-02 - Error - Singleton component, so can't have more than one instance." + return .false + end + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init PUBLIC + expose fileName numRecords + fileName = "Customer\CustomerFile.txt" + columns = 5 -- colums in the Customer "table" + numRecords = self~init:super(fileName, columns) + --say "CustomerData-init-01: numRecords:" numRecords + /* + if numRecords > 0 then do + say "CustomerData-init-02: Array is:" + say self~fileArray~tostring + end + */ + return self + + +/*============================================================================*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerDT - A business data type for Customer data. v00-01 05May12 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS CustomerDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE custNo -- custNo Customer Number + ::ATTRIBUTE custName -- custName Customer Name + ::ATTRIBUTE discount -- discount Discount code + ::ATTRIBUTE address -- address Customer's address + ::ATTRIBUTE zipCode -- zip ZipCode + + ::METHOD makeDir + dir = .Directory~new + dir["custNo"] = self~custNo + dir["custName"] = self~custName + dir["discount"] = self~discount + dir["address"] = self~address + dir["zipCode"] = self~zipCode + return dir + + ::METHOD list PUBLIC + expose custNo custName discount address zipCode + say "---------------" + say "CustomerDT-List:" + say "CustNo: " custNo " CustName:" custName + say "Address: " address + say "Zip: " zipCode " Discount:" discount + say "---------------" + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.h new file mode 100644 index 0000000..26d87d2 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.h @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_CUST_DIALOG 102 +#define IDR_CUST_MENU 103 +#define IDI_CUST_DLGICON 105 +#define IDC_CUST_LBL_CUSTNO 1001 +#define IDC_CUST_LBL_DISCOUNT 1002 +#define IDC_CUST_BTN_SHOWLASTORDER 1003 +#define IDM_CUST_NEW 40000 +#define IDM_CUST_UPDATE 40001 +#define IDM_CUST_PRINT 40002 +#define IDM_CUST_LAST_ORDER 40003 +#define IDC_CUST_EDT_CUSTNO 40043 +#define IDC_CUST_EDT_CUSTNAME 40044 +#define IDC_CUST_BTN_RECORDCHANGES 40069 +#define IDC_CUST_LBL_CUSTNAME 40070 +#define IDC_CUST_LBL_CUSTADDR 40071 +#define IDC_CUST_LBL_ZIP 40072 +#define IDC_CUST_LBL_LASTORDER 40073 +#define IDC_CUST_STC_LASTORDERDETAILS 40077 +#define IDC_CUST_EDT_CUSTADDR 40078 +#define IDC_CUST_EDT_DISCOUNT 40079 +#define IDC_CUST_EDT_CUSTZIP 40080 +#define IDC_CUST_STC_ERRORMSG 40081 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.rc new file mode 100644 index 0000000..cab2d63 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.rc @@ -0,0 +1,85 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "customerview.h" + + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_CUST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Customer...", IDM_CUST_NEW + MENUITEM "&Update...", IDM_CUST_UPDATE + MENUITEM "Print...", IDM_CUST_PRINT + MENUITEM "Last Order", IDM_CUST_LAST_ORDER + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_CUST_DIALOG DIALOG 0, 0, 275, 239 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "*CustomerName*" +FONT 8, "Microsoft Sans Serif" +{ + LTEXT "Name:", IDC_CUST_LBL_CUSTNAME, 18, 47, 22, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNO, 85, 20, 65, 15, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Customer Number:", IDC_CUST_LBL_CUSTNO, 18, 22, 59, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTNAME, 85, 45, 165, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Address:", IDC_CUST_LBL_CUSTADDR, 18, 72, 28, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTADDR, 85, 70, 167, 40, ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + LTEXT "Zip Code:", IDC_CUST_LBL_ZIP, 20, 120, 32, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_CUSTZIP, 85, 120, 65, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Last Order:", IDC_CUST_LBL_LASTORDER, 18, 177, 36, 8, SS_LEFT + LTEXT " ", IDC_CUST_STC_LASTORDERDETAILS, 88, 177, 145, 8, SS_LEFT + LTEXT "Discount Code:", IDC_CUST_LBL_DISCOUNT, 18, 149, 50, 8, SS_LEFT + EDITTEXT IDC_CUST_EDT_DISCOUNT, 85, 145, 20, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT " ", IDC_CUST_STC_ERRORMSG, 18, 215, 8, 8, SS_LEFT + DEFPUSHBUTTON "Record Changes", IDC_CUST_BTN_RECORDCHANGES, 130, 195, 58, 14, WS_DISABLED + PUSHBUTTON "Show Last Order", IDC_CUST_BTN_SHOWLASTORDER, 195, 195, 58, 14 +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_CUST_DLGICON ICON ".\\customer\\bmp\\Customer.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.rex new file mode 100755 index 0000000..5a9ffa8 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/CustomerView.rex @@ -0,0 +1,352 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The CustomerView component v03-00 06Jun13 + + Contains: class "CustomerView"; routine "startCustomerView". + Pre-requisites: RcView.rex, CustomerView.rc, CustomerView.h. + + Description: A sample Customer View component - part of the sample + Order Management application. This is a "leaf" component - + it does not invoke other components. + + Changes: + v01-00 01Jun12: First version (Exercise04). + v01-01 07Jun12: Minor changes for Exercise06. + .... + v02-00 09Aug12: Changed to use MVF. + 09Jan13: Removed stand-alone startup (not now needed). + Changes to CustomerView (not at v03-00). + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v03-00 24May13: Inherits directly from RcDialog plus the View & Component mixins + 06Jun13: Added set self as drag/drop source in initDialog method. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Customer\CustomerView.h") + +::REQUIRES "ooDialog.cls" +--::REQUIRES "support\RcView.rex" +::REQUIRES "support\View.rex" +::REQUIRES "support\Component.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + CustomerView v03-00 24May13 + ------------- + The "view" (or "gui") part of the Customer component - part of the sample + Order Management application. + Changes: + v00-02: Prevented close on enter key by providing no-op "ok" method. + Changed tab order on window by changing sequence of controls in .rc file + v00-03: Changed symbolic IDs to conform with naming convention + Added initAutoDetection method because deleted dlgData. from + dlg~new statement in starter.rex. + v00-04: Took out the OK method - include that in Exercise05. + v00-05: Modified to use CustomerData and CustomerModel classes. + Mods after Exercise04: + v02-00: Added "newInstance" class method - removed routine "StartCustomerView". + v02-01 19Sep11: Corrected for stand-alone invocation. + v02-02 04Oct11: Added msgbox for unimplemented menu item. + v02-03 28Jan12: Changed class name HRS to HRSclv to allow for multiple + HRS classes in same file at some future time. + v02-04 11Feb12: moved .application~setDefaults() to app startup file. + changed to .application~addToConstDir() here. + v02-05 19Feb12: Moved .Application~addToConstDir statement from newInstance + method to top of file - just before ::requires statement(s). + v03-00 09Aug12: Changed to use MVF. Stand-alone startup removed. + 09Jan13: Removed stand-alone startup (not now needed). + Commented out most 'say' instructions. + Removed 'getData' method - redundant with MVF. + Modified handling of Cust Address due to change in data + format of Cust Address (now provided as string via MVF + from Customer File). + Deleted a number of "say" instructions. + 24May13: Changed inheritance to use the View & Component mixins. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS CustomerView SUBCLASS RcDialog PUBLIC INHERIT View Component -- v03-00 + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC UNGUARDED + use arg idCustomerModel, rootDlg -- Ex07 + -- Create an instance of CustomerView and show it: + dlg = .CustomerView~new("Customer\CustomerView.rc", "IDD_CUST_DIALOG") + dlg~activate(idCustomerModel, rootDlg) -- Ex07 + --say ".CustomerView-newInstance-01: dlg =" dlg + return dlg -- Ex07 + + + /*---------------------------------------------------------------------------- + Dialog Creation Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Init - creates the dialog instance but does not make it visible. --*/ + ::METHOD init + expose menuBar + --say "CustomerView-init-01." + + forward class (super) continue + self~initView -- initialize the mixin. + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Create Menu Bar - Creates the menu bar on the dialog. --*/ + ::METHOD createMenuBar + expose menuBar + menuBar = .ScriptMenuBar~new("Customer\CustomerView.rc", "IDR_CUST_MENU", , , .true) + return .true + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Activate - Shows the Dialog - i.e. makes it visible to the user. --*/ + ::METHOD activate unguarded + expose custData + use arg idCustomerModel, rootDlg -- ADDED FOR EXERCISE06. Params reversed for Ex07. + forward class (super) continue -- Ex07: Required for MV framework. + custData = RESULT -- Ex07: instance data returned by super + -- Ex07: ('forward' returns any result via 'RESULT'.) + --say "CustomerView-activate-01." + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_CUST_DLGICON") -- Ex07: deleted "standalone" startup. + --say "CustomerView-activate-01." + return + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + InitDialog - Called by ooDialog -- */ + ::METHOD initDialog + expose menuBar custControls + --say "CustomerView-initDialog-01." + menuBar~attachTo(self) + -- Create objects that map to the edit controls defined by the "customer.rc" + -- so they can be programmatically used elsewhere in the class: + custControls = .Directory~new + custControls[ecCustNo] = self~newEdit("IDC_CUST_EDT_CUSTNO") + custControls[ecCustName] = self~newEdit("IDC_CUST_EDT_CUSTNAME") + custControls[ecCustAddr] = self~newEdit("IDC_CUST_EDT_CUSTADDR") + custControls[ecCustZip] = self~newEdit("IDC_CUST_EDT_CUSTZIP") + custControls[ecCustDiscount] = self~newEdit("IDC_CUST_EDT_DISCOUNT") + custControls[stLastOrder] = self~newStatic("IDC_CUST_STC_LASTORDERDETAILS") + -- Create an object for the "Record Change" pushbutton in order to be able + -- to change its focus later: + custControls[btnRecordChanges] = self~newPushButton("IDC_CUST_BTN_RECORDCHANGES") + -- Define event handler methods for push-buttons: + self~connectButtonEvent("IDC_CUST_BTN_RECORDCHANGES","CLICKED",recordChanges) + self~connectButtonEvent("IDC_CUST_BTN_SHOWLASTORDER","CLICKED",showLastOrder) + + self~setTitle(.HRScv~dlgTitle) -- set dialog title. + + -- set self as drag/drop source. + r = self~dmSetAsSource:super("Customer\bmp\Customer.cur") + + -- Show app data: + self~showData + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + MenuBar Methods: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + New Customer... Not fully implemented - merely tells user to use the + Customer List object. --*/ + ::METHOD newCustomer unguarded + answer = MessageDialog(.HRScv~useList, self~hwnd,.HRScv~useListCap,"INFORMATION") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Update - Sets fields to edit mode so that user can change the data. + Business Rule: Customer Number cannot be changed. --*/ + ::METHOD update unguarded + expose custControls + custControls[ecCustName]~setReadOnly(.false) + custControls[ecCustAddr]~setReadOnly(.false) + custControls[ecCustZip]~setReadOnly(.false) + custControls[ecCustDiscount]~setReadOnly(.false) + self~enableControl("IDC_CUST_BTN_RECORDCHANGES") + custControls[btnRecordChanges]~state = "FOCUS" -- Put focus on the button + self~focusControl("IDC_CUST_EDT_CUSTNAME") -- place cursor in the CustName edit control. + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Last Order - Displays info about the last order placed by this customer.--*/ + ::METHOD lastOrder unguarded + expose custControls + use arg button + orderDate="31/12/11"; orderNum = "ZZ999"; orderTotal = "$999.99" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Print - Not implemented yet --*/ + ::METHOD print unguarded + msg = "The 'Print...' menu item is not yet implemented." + ret = MessageDialog(.HRScv~noPrint, self~hwnd, .HRScv~noPrintCap, 'WARNING') + + + /*---------------------------------------------------------------------------- + PushButton Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Record Changes - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg and disables + the button. --*/ + ::METHOD recordChanges unguarded + expose custControls custData newCustData + + newCustData = .directory~new + newCustData[custName] = custControls[ecCustName]~getLine(1) + newCustData[custAddr] = .array~new + do i=1 to custControls[ecCustAddr]~lines + newCustData[custAddr][i] = custControls[ecCustAddr]~getLine(i) + end + newCustData[custZip] = custControls[ecCustZip]~getLine(1) + newCustData[custDiscount] = custControls[ecCustDiscount]~getLine(1) + + -- Check if anything's changed: + result = self~checkForChanges + --if result then say "CustomerView-recordChanges-01: There were changes!" + --else say "CustomerView-recordChanges-02: No Changes Found" + + /* Send new data to be checked by CustomerModel (not implemented). */ + + /* Disable controls that were enabled by menu "File-Update" selection: */ + custControls[ecCustName]~setReadOnly(.true) + custControls[ecCustAddr]~setReadOnly(.true) + custControls[ecCustZip]~setReadOnly(.true) + custControls[ecCustDiscount]~setReadOnly(.true) + self~disableControl("IDC_CUST_BTN_RECORDCHANGES") + + + /*---------------------------------------------------------------------------- + Show Last Order - displays mock sales order info in the Last_Order_Details + field; info is hard-coded in this method. --*/ + ::METHOD showLastOrder unguarded + expose CustControls + -- Notionally get last order from "SalesOrder" component. + orderDate="12/2/11"; orderNum = "AB123"; orderTotal = "$524.58" + lastOrder = orderDate " " orderNum " " orderTotal + custControls[stLastOrder]~setText(lastOrder) + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + showData - displays data in the dialog's controls. */ + ::METHOD showData + expose custData custControls + -- Show CustNo and CustName: + custControls[ecCustNo]~setText(custData["CustNo"]) + custControls[ecCustName]~setText(custData["CustName"]) + -- Re-format Cust Address from a comma-separated string into a -- Ex07 + -- line-end-separated string. + strCustAddr = custData["CustAddr"]~changeStr(",",.endOfLine) + custControls[ecCustAddr]~setText(strCustAddr) + -- Finally, show Zip and Discount: + custControls[ecCustZip]~setText(custData["Zip"]) + custControls[ecCustDiscount]~setText(custData["CustDisc"]) + + + /*-------------------------------------------------------------------------- + checkForChanges - after "Record Changes" actioned by the user, check whether + any data has actually changed. If it has: (a) assign new data to old data; + (b) return .true. If it hasn't: return .false. + Note: cannot just compare the two directories since data format in Address + is different. --*/ + ::METHOD checkForChanges + expose custData newCustData + changed = .false + if newCustData[custName] \= custData[custName] then do + custData[custName] = newCustData[custName] + changed = .true + end + if custData[custAddr] \= newCustData[custAddr] then changed = .true + if newCustData[custZip] \= custData[custZip] then do + custdata[custZip] = newCustData[custZip] + changed = .true + end + if newCustData[custDiscount] \= custData[custDiscount] then do + custData[custDiscount] = newCustData[custDiscount] + changed = .true + end + -- If no changes after all, display message box: + if \changed then do + msg = .HRScv~nilChanged + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRScv~nilChangedCap,"OK","WARNING","DEFBUTTON2 APPLMODAL") + end + else do + custData = newCustData + end + return changed + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRScv) v02-04 13Jan12 + -------- + This class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRScv PRIVATE -- Human-Readable Strings + ::CONSTANT nilChanged "Nothing was changed! Update not done." + ::CONSTANT nilChangedCap "Update Customer" + ::CONSTANT noPrint "The 'Print...' menu item is not yet implemented." + ::CONSTANT noPrintCap "*Customer Name*" + ::CONSTANT dlgTitle "*Customer*" + ::CONSTANT useList "Please use the Customer List to create a new Customer (not yet implemented)." + ::CONSTANT useListCap "Create New Customer" +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/CustList.BMP b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/CustList.BMP new file mode 100644 index 0000000..962bee3 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/CustList.BMP differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/CustList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/CustList.ico new file mode 100644 index 0000000..c9d2566 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/CustList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/Customer.cur b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/Customer.cur new file mode 100644 index 0000000..87e0636 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/Customer.cur differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/Customer.ico b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/Customer.ico new file mode 100644 index 0000000..e6bc7cc Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Customer/bmp/Customer.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonFile.txt new file mode 100644 index 0000000..ca0078f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonFile.txt @@ -0,0 +1,6 @@ +number | familyName | firstName | dob | jobDescr | baseSalary +PA100 | Bloggs | Joseph | 721224 | Director | 250400 +PA150 | James | Alfred | 751513 | Packer | 38000 +PB100 | Smithson | John | 951704 | Programmer | 40170 +PB104 | Patterson | Patricia | 790331 | Office Manager | 76430 +PC200 | Cardaj | Jacob | 740615 | Plant Manager | 148250 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonModelData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonModelData.rex new file mode 100755 index 0000000..4944d2c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonModelData.rex @@ -0,0 +1,195 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + + Samples: Person Model and Data Classes v02-00 26May13 + + Contains: classes "PersonModel" and "PersonData". + + Pre-requisites: Model-View Framework. + + Outstanding Problems: + None. + + Changes: + v01-00 01Oct12: First version. + 09Jan13: Removed or commented-out 'say' instructions. + 05Feb13: Removed 'query' method since it's available in the superclass. + 14Feb13: Removed (commented-out) 'return self' from the init method. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. Also, 'Samples' folder + changed name to 'Extras'. + 26May13: Extras folder moved to within Exercises. Mod to file path made. + + +------------------------------------------------------------------------------*/ + + +::REQUIRES "Support\GenericFile.rex" +::REQUIRES "Support\Model.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonModel v01-00 09Jan13 + ------------ + + The "model" part of the Person component - a simple "Model" class that + illustrates use of the Model-View framework. + See comments that include the string 'MFV'. + + Changes: + v01-00 01Oct12: First version. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS 'PersonModel' SUBCLASS Model PUBLIC + + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName -- Instance name of required instance is + -- provided by MVF as result of sending + -- a 'showModel' message to the Object Manager. + forward class (super) continue -- As part of MVF, super does the ~new + -- and provide's the model's instance + -- data as a param on the init. + modelId = RESULT -- MVF requires the model instance + return modelId -- ('modelId') to be returned. + + + + /*---------------------------------------------------------------------------- + init + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose dirPerson + use strict arg dirPerson -- Super gets data from PersonData and passes + -- that data when it creates this instance with + -- '~new'. + -- The data is in a directory: + + self~myData = dirPerson -- Store the data in my superclass. + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + test - a method to demonstrate Message Sender method store. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD test + return 25 + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonData- The data resource for Persons. v01-00 23Sep12 + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS 'PersonData' SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + + ::METHOD newInstance CLASS PUBLIC -- Invoked by ObjectMgr + --use strict arg instanceName + if self~created = "CREATED" then do -- If this is first time + --say ".PersonData-newInstance-01." + personDataId = self~new() -- the object id of the PersonData component. + self~created = .true + return personDataId + end + else do + say ".PersonData-newInstance-02 - Error - Singleton component, so can't have more than one instance." + return .false + end + + + ::METHOD init PRIVATE + fileName = "Extras\Person\PersonFile.txt" + columns = 6 -- colums in the Persons "table" + records = self~init:super(fileName, columns) + --say "PersonData-init-01: records:" records + + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonDT - A business data type for Person data. v00-01 05May12 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS PersonDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE number -- number Person Number + ::ATTRIBUTE familyName -- familyName Person Family Name + ::ATTRIBUTE firstName -- firstName Person First Name + ::ATTRIBUTE dob -- dob Date of Birth (format: yymmdd) + ::ATTRIBUTE jobDescr -- jobDescrip Job Description + ::ATTRIBUTE baseSalary -- baseSalary Basic Salary + + ::METHOD makeDir + dir = .Directory~new + dir["number"] = self~number + dir["familyName"] = self~familyName + dir["firstName"] = self~firstName + dir["dob"] = self~dob + dir["jobDescr"] = self~jobDescr + dir["baseSalary"] = self~baseSalary + + return dir + + ::METHOD list PUBLIC + expose number name price uom description size + say "---------------" + say "PersonDT-List:" + say "Number: " number " Family Name:" familyName + say "DOB:" dob " First Name:" firstName + say "Base Salary:" baseSalary + say "Job:" jobDescr + say "---------------" + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.h new file mode 100644 index 0000000..bd1631f --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_DIALOG1 100 +#define IDC_PERS_NO 1000 +#define IDC_PERS_DOB 1001 +#define IDC_PERS_FIRSTNAME 1009 +#define IDC_PERS_FAMILYNAME 1010 +#define IDC_PERS_POSITION 1013 +#define IDC_PERS_SALARY 1014 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.rc new file mode 100644 index 0000000..d2d5e4b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2012-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +// Generated by ResEdit 1.5.11 +// Copyright (C) 2006-2012 +// http://www.resedit.net + +#include +#include +#include +#include "PersonView.h" + + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_DIALOG1 DIALOG 0, 0, 179, 166 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | WS_VISIBLE | DS_SHELLFONT | WS_CAPTION | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Person Record" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 66, 142, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 121, 142, 50, 14 + LTEXT "Personnel No:", IDC_STATIC, 75, 19, 46, 8, SS_LEFT + EDITTEXT IDC_PERS_NO, 125, 15, 40, 14, ES_AUTOHSCROLL | ES_READONLY + LTEXT "Family Name:", IDC_STATIC, 11, 36, 43, 8, SS_LEFT + EDITTEXT IDC_PERS_FAMILYNAME, 10, 45, 85, 14, ES_AUTOHSCROLL + EDITTEXT IDC_PERS_FIRSTNAME, 106, 45, 60, 14, ES_AUTOHSCROLL + LTEXT "First Name:", IDC_STATIC, 107, 37, 36, 8, SS_LEFT + LTEXT "DOB:", IDC_STATIC, 12, 71, 18, 8, SS_LEFT + EDITTEXT IDC_PERS_DOB, 45, 70, 50, 15, ES_AUTOHSCROLL + LTEXT "Position:", IDC_STATIC, 12, 95, 28, 8, SS_LEFT + LTEXT "Salary:", IDC_STATIC, 12, 119, 22, 8, SS_LEFT + EDITTEXT IDC_PERS_POSITION, 45, 93, 120, 14, ES_AUTOHSCROLL + EDITTEXT IDC_PERS_SALARY, 45, 117, 40, 14, ES_AUTOHSCROLL +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.rex new file mode 100755 index 0000000..14009f6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/Person/PersonView.rex @@ -0,0 +1,146 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Samples: Person View Class v02-00 26May13 + + Contains: classes "PersonView". + + Pre-requisites: Model-View Framework. + + Outstanding Problems: + None. + + Changes: + v01-00 01Oct12: First version. + 01Apr13: After ooDialog 4.2.2, Samples folder renamed to 'Extras' + and Support moved to within execise foldes. + so changes to ::Requires and ~addToConstDir needed. + v02-00 26May13: For exercise 8, Person updated to use mixins. + + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Extras\Person\PersonView.h") + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PersonView v01-00 01Oct12 + ---------- + A simple class that shows how to exploit the Model-View framework. + See comments that include the string 'MFV'. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Support\View.rex" +::REQUIRES "Support\Component.rex" + + +::CLASS 'PersonView' SUBCLASS 'RcDialog' PUBLIC INHERIT View Component + + /*---------------------------------------------------------------------------- + newInstance - creates an instance of the View: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS + use strict arg modelId, rootDlg -- MVF provides id of this view's Model; + -- not used in this sample. + dlg = .PersonView~new("Extras\Person\PersonView.rc", "IDD_DIALOG1") + dlg~activate(modelId, rootDlg) + return dlg -- required by MVF. + + + /*---------------------------------------------------------------------------- + init - initialises the dialog + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + self~initView -- init the View mixin. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + activate - Model's data is provided by the superclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose personData + use strict arg modelId, rootDlg + forward class (super) continue -- Required by MVF to get this View's + -- data from its Model component. + personData = RESULT -- personData returned by superclass + self~popupAsChild(rootDlg, "SHOWTOP") + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + initDialog - invoked automatically after the dialog has been created. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose personData ecPersNo ecPersFamilyName ecPersFirstName ecPersDOB ecPersPosition ecPersSalary + --say "PersonView-initDialog-01." + ecPersNo = self~newEdit("IDC_PERS_NO") + ecPersFamilyName = self~NewEdit("IDC_PERS_FAMILYNAME") + ecPersFirstName = self~newEdit("IDC_PERS_FIRSTNAME") + ecPersDob = self~newEdit("IDC_PERS_DOB") + ecPersPosition = self~newEdit("IDC_PERS_POSITION") + ecPersSalary = self~newEdit("IDC_PERS_SALARY") + self~setMyData(personData) -- Note: cannor use 'setData' as this + -- would conflict with ooDialog's + -- setData method. + --self~offset:super -- offsetting logic is in the superclass. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + setData - sets (or "populates") controls with data provided in the + method's argument. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setMyData + expose ecPersNo ecPersFamilyName ecPersFirstName ecPersDOB ecPersPosition ecPersSalary + use arg personData + ecPersNo~setText( personData["number"]) + ecPersFamilyName~setText(personData["familyName"]) + ecPersFirstName~setText( personData["firstName"]) + ecPersDOB~setText( personData["dob"]) + ecPersPosition~setText( personData["jobDescr"]) + ecPersSalary~setText( personData["baseSalary"]) + return + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/ReadMe.txt b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/ReadMe.txt new file mode 100644 index 0000000..f95760c --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Extras/ReadMe.txt @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + ReadMe + + 1. ooDialog - Additional Examples to Accompany the ooDialog User Guide + ----------------------------------------------------------------------- + + This subdirectory tree contains the example programs referred to in the + appendix of the ooDialog User Guide. The programs are intended to give + context to the discussions in the User Guide, and may, or may not, be of + use to ooRexx programmers by themselves. + + The structure of the subdirectory tree and the programs themselves are + explained in the ooDialog User Guide. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.h new file mode 100644 index 0000000..8fe196a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.h @@ -0,0 +1,33 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDR_ORDFORM_MENU 102 +#define IDI_ORDFORM_DLGICON 107 +#define IDD_ORDFORM_DIALOG 113 +#define IDD_ORDFORM_CUST_DIALOG 114 +#define IDD_ORDFORM_ORDLINES_DIALOG 115 +#define IDC_CUSTDTLS_NUM 1000 +#define IDC_ORDFORM_TOTCOST 1000 +#define IDC_CANCEL 1001 +#define IDC_CUSTDTLS_DISC 1001 +#define IDC_ORDFORM_TOTDISC 1002 +#define IDC_ORDFORM_TOTDISCCOST 1003 +#define IDC_ORDFORM_TOTTAX 1004 +#define IDC_ORDFORM_ORDTOT 1005 +#define IDM_ORDFORM_PLACE 40000 +#define IDM_ORDFORM_ABOUT 40001 +#define IDC_ORDFORM_DATE 40002 +#define IDM_ORDFORM_SAVE 40003 +#define IDM_ORDFORM_CANCEL 40004 +#define IDC_ORDFORM_ORDNO 40005 +#define IDC_ORDFORM_TABS 40009 +#define IDC_ORDFORM_PLACEORDER 40010 +#define IDC_ORDLINES_LIST 40026 +#define IDC_ORDLINES_PRODNO 40027 +#define IDC_ORDLINES_QTY 40028 +#define IDC_ORDLINES_ADD 40029 +#define IDC_ORDLINES_DELETE 40030 +#define IDC_CUSTDTLS_FIND 40031 +#define IDC_CUSTDTLS_ADDR 40037 +#define IDC_CUSTDTLS_NAME 40038 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.rc new file mode 100644 index 0000000..b6c0977 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.rc @@ -0,0 +1,99 @@ +// Generated by ResEdit 1.5.11 +// Copyright (C) 2006-2012 +// http://www.resedit.net + +#include +#include +#include +#include "OrderFormView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDFORM_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "Place Order...", IDM_ORDFORM_PLACE + MENUITEM "Save Order...", IDM_ORDFORM_SAVE + MENUITEM "Cancel Order", IDM_ORDFORM_CANCEL + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDFORM_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_CUST_DIALOG DIALOG 6, 15, 206, 127 +STYLE DS_3DLOOK | DS_CONTROL | DS_SHELLFONT | WS_CHILDWINDOW +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Customer Name:", IDC_STATIC, 16, 37, 53, 8, SS_LEFT + EDITTEXT IDC_CUSTDTLS_NAME, 79, 32, 100, 14, WS_DISABLED | ES_AUTOHSCROLL + EDITTEXT IDC_CUSTDTLS_NUM, 79, 11, 53, 14, ES_AUTOHSCROLL + LTEXT "Customer Number:", IDC_STATIC, 16, 16, 59, 8, SS_LEFT + PUSHBUTTON "Find Customer", IDC_CUSTDTLS_FIND, 145, 11, 50, 14, WS_DISABLED + EDITTEXT IDC_CUSTDTLS_ADDR, 80, 55, 100, 35, WS_DISABLED | ES_AUTOHSCROLL | ES_MULTILINE + LTEXT "Customer Address:", IDC_STATIC, 16, 57, 60, 8, SS_LEFT + LTEXT "Customer Discount:", IDC_STATIC, 16, 99, 62, 8, SS_LEFT + EDITTEXT IDC_CUSTDTLS_DISC, 80, 96, 40, 14, WS_DISABLED | ES_AUTOHSCROLL +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_DIALOG DIALOG 0, 0, 272, 278 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Order Form" +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_ORDFORM_DATE, DATETIMEPICK_CLASS, WS_TABSTOP | DTS_APPCANPARSE | DTS_RIGHTALIGN, 185, 9, 70, 15 + EDITTEXT IDC_ORDFORM_ORDNO, 50, 9, 40, 14, ES_AUTOHSCROLL + LTEXT "Order No.", IDC_STATIC, 10, 12, 32, 8, SS_LEFT + LTEXT "Date", IDC_STATIC, 158, 12, 16, 8, SS_LEFT + LTEXT "Total Cost:", IDC_STATIC, 116, 194, 35, 8, SS_LEFT + LTEXT "Discount", IDC_STATIC, 116, 208, 29, 8, SS_LEFT + PUSHBUTTON "Place Order", IDC_ORDFORM_PLACEORDER, 200, 244, 50, 14 + LTEXT "Tax", IDC_STATIC, 116, 222, 13, 8, SS_LEFT + RTEXT "0.00", IDC_ORDFORM_TOTDISC, 164, 208, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ORDFORM_TOTTAX, 164, 222, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ORDFORM_ORDTOT, 215, 222, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ORDFORM_TOTCOST, 215, 194, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ORDFORM_TOTDISCCOST, 215, 208, 40, 8, SS_RIGHT + CONTROL "", IDC_ORDFORM_TABS, WC_TABCONTROL, 0, 15, 35, 245, 150 + PUSHBUTTON "Cancel Order", IDC_CANCEL, 132, 244, 46, 14 +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDFORM_ORDLINES_DIALOG DIALOG 6, 15, 240, 132 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_POPUP | WS_SYSMENU +FONT 8, "Ms Shell Dlg" +{ + CONTROL "", IDC_ORDLINES_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT, 5, 5, 230, 90 + EDITTEXT IDC_ORDLINES_PRODNO, 7, 103, 40, 14, ES_AUTOHSCROLL + LTEXT "Product No.", IDC_STATIC, 9, 119, 39, 8, SS_LEFT + EDITTEXT IDC_ORDLINES_QTY, 62, 103, 38, 14, ES_AUTOHSCROLL + LTEXT "Quantity", IDC_STATIC, 65, 119, 27, 8, SS_LEFT + DEFPUSHBUTTON "Add OrderLine", IDC_ORDLINES_ADD, 122, 105, 50, 14 + PUSHBUTTON "Delete OrderLine", IDC_ORDLINES_DELETE, 177, 105, 58, 14 +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDFORM_DLGICON ICON ".\\Order\\bmp\\OrderForm.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.rex new file mode 100755 index 0000000..03fd27e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderFormView.rex @@ -0,0 +1,953 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The OrderFormView class v03-01 06Jun13 + OrderFormView.rex + + Contains: class "OrderFormView", class "HRSofv". + Pre-requisite files: OrderFormView.rc, OrderFormView.h. + + Changes: + v01-00 07Jun12: First version. + v02-00 08Jan13: OrderFormView Modified to use the Model-View Framework (MVF). + Removed stand-alone startup (not now needed). + 25Feb13: Added control dialogs in tab sheet. + 27Feb13: Made Order Date functional. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v03-00 27Apr13: Add ability to populate Order with Customer Details and + Order Lines. + 25May13: Now inherits directly from RcDialog plus the View & + Component mixins. + v03-01 06Jun13: Added drag/drop code (method 'dmDrop') to make + OrderFormView a target. Also added code to the Customer + Details control dialog so that Customer can be provided by + drag/drop or by entering Cutomer Number. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Order\OrderFormView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "support\View.rex" -- v03 + +/*============================================================================== + OrderFormView v02-01 06Jun13 + ------------- + The "view" (or "gui") Data Entry part of the Sales Order component. + + Changes: + v01-00 07Jun12: First Version + v02-00 05Oct12: Modified to use the Model-View Framework (MVF) including + removal of stand-alone startup. + 27Feb13: Changed to show tabs (control dialogs). + Corrected the Order Date control and limited order date to + one year ahead. + Commented-out say's. + 20May13: Now inherits directly from RcDialog plus the View & Component mixins + v02-01 06Jun13: Added drag/drop code to make OrderFormView a target. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::CLASS OrderFormView SUBCLASS RcView PUBLIC +::CLASS OrderFormView SUBCLASS RcDialog PUBLIC INHERIT View Component -- v03 + + ::ATTRIBUTE tabContent + ::ATTRIBUTE orderTotals + + ::METHOD newInstance CLASS PUBLIC + use strict arg idModel, rootDlg + --say; say ".OrderFormView-newInstance: rootDlg =" rootDlg + dlg = self~new("Order\OrderFormView.rc", "IDD_ORDFORM_DIALOG") + dlg~activate(idModel, rootDlg) + return dlg + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- creates the dialog instance but does not make it visible. + expose menuBar + --say "OrderFormView-init-01" + + forward class (super) continue + self~initView + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "OrderFormView-createMenuBar-01" + menuBar = .ScriptMenuBar~new("Order\OrderFormView.rc", IDR_ORDFORM_MENU, , , .true) + + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg idModelInstance orderData cd1 cd2 orderTotal custDiscount - + taxRate eventMgr + use strict arg idModelInstance, rootDlg + forward class (super) continue + orderData = RESULT + + -- set up tabs for Customer Details and Order Lines: + cd1 = .CustomerDetailsDlg~new("Order\OrderFormView.rc", IDD_ORDFORM_CUST_DIALOG) + cd2 = .OrderLinesDlg~new("Order\OrderFormView.rc", IDD_ORDFORM_ORDLINES_DIALOG) + tabContent = .array~of(cd1, cd2) + --say "OrderFormView-activate-01: tabContent =" tabContent[1]||"," tabContent[2] + cd1~ownerDialog = self + cd2~ownerDialog = self + self~prep(tabContent) + + -- Send OrderFormView dlg id to the two Control Dialogs so that they can + -- communicate with OrderFormView. + cd1~setOrderFormDlg(self) + cd2~setOrderFormDlg(self) + cd2~rootDialog(rootDlg) -- Tell cd2 what the root dialog is. + + -- Set up Order Totals and initialise CustDiscount: + orderTotal = 0 + --orderTotals = .OrderTotals~new + custDiscount = 0 -- Default customer discount + taxRate = 0.05 -- 5% tax on discounted order total + + -- Tell EventMgr that we want to know when app closes: + --eventMgr = .local~my.EventMgr + --r = eventMgr~registerInterest("appClosing",self) + self~registerInterest("appClosing",self) + --say "OrderFormView-activate-03: eventMgr response =" r + + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_ORDFORM_DLGICON") + --say "OrderFormView-activate-04." + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- Called by ooDialog after SHOWTOP. + expose menuBar ecOrderNo orderData tabContent tabControl orderDate - + stCost stDisc stDiscCost stTax stTot orderTotals controlDialogsClosed + --say "OrderFormView-initDialog-01" + + menuBar~attachTo(self) + + -- Tab stuff starts: + cd1 = tabContent[1] + cd2 = tabContent[2] + cd1~execute + cd2~execute + + -- Add the tabs to the tab control. + tabControl = self~newTab(IDC_ORDFORM_TABS) + tabControl~addSequence("Customer Details", "Order Lines") + -- tab stuff ends + + ecOrderNo = self~newEdit("IDC_ORDFORM_ORDNO") + --say "OrderFormView-initDialog-02: ecOrderNo =" ecOrderNo + btnCancelOrder = self~newPushButton("IDC_CANCEL") + btnPlaceOrder = self~newPushButton("IDC_ORDFORM_PLACEORDER") + self~connectButtonEvent("IDC_CANCEL","CLICKED",cancel) + self~connectButtonEvent("IDC_ORDFORM_PLACEORDER","CLICKED",placeOrderBtn) + + -- Get proxy for Order date and set its format. By default, it shows today. + --Also, set allowable date range selected to between today and 1 year's time. + orderDate = self~newDateTimePicker(IDC_ORDFORM_DATE); + orderDate~setFormat("MMM dd',' yyyy") + today = .DateTime~today + maxOrderDate = today~addYears(1) + orderDate~setRange(.array~of(today,maxOrderDate)) + -- Get proxies for Order Total Amounts: + stCost = self~newStatic("IDC_ORDFORM_TOTCOST") + stDisc = self~newStatic("IDC_ORDFORM_TOTDISC") + stDiscCost = self~newStatic("IDC_ORDFORM_TOTDISCCOST") + stTax = self~newStatic("IDC_ORDFORM_TOTTAX") + stTot = self~newStatic("IDC_ORDFORM_ORDTOT") + + ecOrderNo~setText(orderData[formNumber]) + + -- Tab stuff starts: + -- Determine the position and size of the display area of the tab control. + self~calculateDisplayArea + -- Position and show the control dialog used for the first page of the tab. + self~positionAndShow(1) + -- tab stuff ends + controlDialogsClosed = .false +/* + Following did not work - it gave Cust Details on both tabs!! + cd2 = tabContent[2] + say "***** cd2 =" cd2 + cd2~ownerDialog = self -- trial 21:45 + cd2~execute +*/ + -- Set as target for Drag/Drop: + self~dmSetAsTarget:super() + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + -- This method not used - message goes to the class. Left in just for the + -- time being. Delete when all drag/drop OK. + --::METHOD dmQueryDrop + --use strict arg sourceDlg, mousePos -- try also without mousepos. + --say "OrderFormView-dmQueryDrop-01." + --return .true + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD dmDrop PUBLIC + expose cd1 cd2 + use strict arg sourceModel, sourceDlg + --say "OrderFormView-dmDrop-01; sourceModel, sourceDlg =" sourceModel||"," sourceDlg + --say "OrderFormView-dmDrop-02: cd1, cd2 =" cd1||"," cd2 + parse var sourceModel . modelName + select + when modelName = "CUSTOMERMODEL" then do + cd1~getCustomer(sourceModel); return .true + end + when modelName = "PRODUCTMODEL" then do + --say "OrderFormView-dmDrop-03: Product dropped."; + cd2~getProduct(sourceModel); return .true + end + end + return .false + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showTotals PUBLIC + expose custDiscount taxRate stCost stDisc stDiscCost stTax stTot orderTotal + use arg orderLineAmount + --if custDiscount = "CUSTDISCOUNT" then custDiscount = 0 -- If user enters products first. + --say "OrderFormView-showTotals-01: custDiscount, orderLineAmount =" custDiscount orderLineAmount + + orderTotal = orderTotal + orderLineAmount + discount = (orderTotal * custDiscount)~format(,0) + --say "OrderFormView-showTotals-01: discount =" discount + discountedTotal = orderTotal - discount + tax = (discountedTotal * taxRate)~format(,0) + finalTotal = discountedTotal + tax + --say "OrderFormView-showTotals-02: discount / tax =" discount||" / "||tax + + -- Format numbers from nnnnn to nnn.nn for display: + x = myFormat(orderTotal); --say "OrderFormView-showTotals-03:" x + stCost~setText(myFormat(orderTotal)) + --stCost~setText( (orderTotal/100)~format(,2)) + stDisc~setText(myFormat(discount)) + --if discount = 0 then do; stDisc~setText("0.00"); end + --else do; stDisc~setText((discount/100)~format(,2)); end + stDiscCost~setText(myFormat(discountedTotal)) + --stDiscCost~setText( (discountedTotal/100)~format(,2)) + stTax~setText(myFormat(tax)) + --stTax~setText( (tax/100)~format(,2)) + stTot~setText(myFormat(finalTotal)) + --stTot~setText( (finalTotal/100)~format(,2)) + + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setCustDiscount + expose custDiscount + use arg custDiscount + --say "OrderFormView-setDustDiscount-01: discount =" custDiscount + -- Use only first character - A, B or C: + code = custDiscount~left(1) + select + when code = "A" then custDiscount = 0.15 -- 15% discount + when code = "B" then custDiscount = 0.1 -- 10% discount + when code = "C" then custDiscount = 0.05 -- 5% discount + otherwise custDiscount = 0 + end + --say "OrderFormView-setDustDiscount-01: discount =" custDiscount + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD updateTotals + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Button Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD placeOrderBtn UNGUARDED + ret = MessageDialog(.HRSofv~NoBtn, self~hwnd, "Place Order Button", 'WARNING') + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD placeOrder UNGUARDED + self~noMenuFunction(.HRSofv~PlaceOrder) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD saveOrder UNGUARDED + self~noMenuFunction(.HRSofv~SaveOrder) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD CancelOrder UNGUARDED + self~cancel + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSofv~HelpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSofv~NoMenu, self~hwnd, title, 'WARNING') + + /*---------------------------------------------------------------------------- + Methods to tidy up when Order Form is closed. + ---------------------------------------------------------------------------*/ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Cancel: This method over-rides the default Windows action of 'cancel window' + for an Escape key. 'endExecution' (via the closeControlDialogs method + is required else dialog hangs when user tried to close. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + expose tabContent controlDialogsClosed + --say "OrderFormView-cancel-01." + if controlDialogsClosed = .true then do + --say "OrderFormView-cancel-02: Control Dialogs closed." + self~deRegisterInterest("appClosing",self) -- de-register interest in any events + return self~cancel~super + end + else do -- Control dialogs not yet cancelled + response = askDialog(.HRSofv~QExit, "N") + --say "OrderFormView-cancel-03: response =" response + if response = 1 then do -- '1' means the 'Yes' button pressed + self~deRegisterInterest("appClosing",self) -- de-register interest in any events + self~closeControlDialogs + return self~cancel:super + end + -- if response = 0 then do nothing - user chnaged his/her mind about closing. + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD ok + -- Invoked when enter key pressed - if passed to superclass, cancels dialog. + say "OrderFormView-ok-01." + return -- do not close dialog - appears as a no-op to the user. + + + /*---------------------------------------------------------------------------- + notify - Invoked by the Event Manager when a registered event occurs. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD notify PUBLIC + expose controlDialogsClosed + use strict arg event + --say "OrderFormView-notify-01: event =" event + if event = "appClosing" then do + self~closeControlDialogs + controlDialogsClosed = .true + end + + + /*---------------------------------------------------------------------------- + closeControlDialogs. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD closeControlDialogs PRIVATE + expose tabContent + do dlg over tabContent + dlg~endExecution(.false) + end + + + /*---------------------------------------------------------------------------- + myFormat - A routine to format numbers into currency - e.g. converts + "123456" into "1.234.56". + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::ROUTINE myFormat + use arg number + number = number~right(9,0) -- left-pad with zeros + parse var number mill 2 thou 5 hun 8 dec + decs = "."||dec + select + when mill > 0 then number = mill||","||thou||","||hun||decs + when thou > 0 then number = thou~strip(,0)||","||hun||decs + when hun > 0 then number = hun~strip(,0)||decs + otherwise number = "0"||decs + end + return number + /*--------------------------------------------------------------------------*/ + + + /*---------------------------------------------------------------------------- + deRegisterInterest - tell Event Manager that any events registered are no + longer of interest. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ::METHOD deRegisterInterest PRIVATE + expose eventMgr + --say "OrderFormView-deRegisterInterest-01." + eventMgr~deRegisterInterest("appClosing",self) +*/ + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes - but not when it's + closed by closing the app - i.e. closing OrderMgrView. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + expose tabcontent cd1 cd2 + --say "OrderFormView-leaving-01." +/* do dlg over tabContent + dlg~endExecution(.false) + end +*/ --forward class (super) continue + + + /*---------------------------------------------------------------------------- + Methods to set up Control Dialogs + ---------------------------------------------------------------------------*/ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + calculateDisplayArea + - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD calculateDisplayArea PRIVATE + expose tabControl displayRect + + -- Given a rectangle describing the tab control's size and position, the tab + -- control itself will calculate the display area's size and position. + r = tabControl~windowRect + tabControl~calcDisplayRect(r) + + -- Save the size of the display area, we need it later. + s = .Size~new(r~right - r~left, r~bottom - r~top) + + -- Now we need to map the display area's position on the screen, to the client + -- co-ordinates of the main dialog. The control dialog(s) are children windows + -- of the main dialog, which is why we need to use the client-area of the + -- dialog, not the client area of the tab control. + p = .Point~new(r~left, r~top) + self~screen2client(p) + + -- Create our display rectangle. This is used in setWindowPosition(), which + -- takes a point / size rectangle. ooDialog defines a point / size rectangle + -- as using the left and top attributes for the position of the upper left + -- corner of a rectangle, using the right attribute for the width of the + -- rectangle, and using the bottom attribute for the height of the rectangle. + displayRect = .Rect~new(p~x, p~y, s~width, s~height) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + positionAndShow() + Used to resize and reposition one of the control dialogs so it occupies + the display area of the tab control. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD positionAndShow private + expose tabControl tabContent displayRect lastSelected havePositioned + use strict arg index + --say "OrderFormView-positionAndShow-01; index =" index + -- We can not position the control dialog until the underlying Windows dialog + -- is created. If the system is heavily loaded for some reason, this may not + -- have happened yet. We need to wait for it. + dlg = tabContent[index] + do i = 1 to 10 + if dlg~hwnd <> 0 then leave + z = SysSleep(.01) + end + --say "OrderFormView-positionAndShow-02." + if dlg~hwnd == 0 then do + say "Error creating dialog for the tab with index:" index", aborting" + return self~cancel + end + + if lastSelected <> 0 then tabContent[lastSelected]~hide + + -- Now resize and reposition the control dialog to the tab control's display + -- area. We need to position the control dialog *above* the tab control in + -- the Z-order so that it shows. + dlg~setWindowPos(tabControl~hwnd, displayRect, "SHOWWINDOW NOOWNERZORDER") + --say "OrderFormView-positionAndShow-03."; say + + lastSelected = index + havePositioned[index] = .true + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + onNewTab - Invoked when user selects another tab. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onNewTab + expose tabControl tabContent havePositioned lastSelected + --say "OrderFormView-onNewTab-01." + index = tabControl~selectedIndex + 1 + --say "OrderFormView-onNewTab-02: index =" index + dlg = tabContent[index] + --say "OrderFormView-onNewTab-03: dlg, havePositioned[index] =" dlg havePositioned[index] + + if havePositioned[index] then do + last = tabContent[lastSelected] + last~hide + dlg~show + lastSelected = index + end + else do + --dlg~ownerDialog = self + --dlg~execute + self~positionAndShow(index) + end + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD prep + expose tabContent lastSelected havePositioned + use strict arg tabContent + --say "OrderFormView-prep-01." + -- The havePositioned array is used to determine if the page dialogs have been + -- positioned or not. Mark all 5 dialogs as not having been positioned yet. + havePositioned = .array~of(.false, .false) + -- No tab has been selected yet + lastSelected = 0 + + -- Connect the event handling methods to the events we are interested in. + --self~connectButtonEvent(IDC_PB_PREVIOUS, CLICKED, onPrevious) + --self~connectButtonEvent(IDC_PB_NEXT, CLICKED, onNext) + self~connectTabEvent(IDC_ORDFORM_TABS, SELCHANGE, onNewTab) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + + +/*============================================================================*/ + + + +/*============================================================================== + CustomerDetailsDlg - a Page in the OrderFormView + ------------------ + The "view" (or "gui") Customer Ordering part of the OrderFormView component. + ----------------------------------------------------------------------------*/ + ::CLASS CustomerDetailsDlg SUBCLASS RcControlDialog + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + initDialog + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose pbFindCust ecCustNum ecCustName ecCustAddr ecCustDisc objectMgr + --say "OrderFormView/CustomerDetailsDlg-initDialog-01: tabControl =" tabControl + + -- Get ObjectMgr object id for later use. + objectMgr = .local~my.objectMgr + + ecCustNum = self~newEdit("IDC_CUSTDTLS_NUM") + ecCustName = self~newEdit("IDC_CUSTDTLS_NAME") + ecCustAddr = self~newEdit("IDC_CUSTDTLS_ADDR") + ecCustDisc = self~newEdit("IDC_CUSTDTLS_DISC") + pbFindCust = self~newPushButton("IDC_CUSTDTLS_FIND") + -- pfFindCust is disabled in the .rc file, and is enabled when the focus + -- is placed on the Customer Number field. The button is disabled when pushed. + self~connectEditEvent("IDC_CUSTDTLS_NUM","GOTFOCUS",custNumGotFocus) + self~connectButtonEvent("IDC_CUSTDTLS_FIND","CLICKED",findCustomer) + --say "CustomerDetailsDlg-initDialog-01." + + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setOrderFormDlg - Invoked by OrderFormView dialog so that this Control Dialog + can communicate with OrderFormView. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setOrderFormDlg + expose dlgOrderForm + use arg dlgOrderForm + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + CustNumGotFocus - invoked when user puts focus on Customer Number field, + in which case the "Find Customer" pushbutton is enabled. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD CustNumGotFocus UNGUARDED + expose pbFindCust + --say "CustomerDetailsDlg-CustNumGotFocus-01." + pbFindCust~style = "DEFPUSHBUTTON" + pbFindCust~enable + --self~focusControl("IDC_CUSTDTLS_FIND") + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + findCustomer - invoke when the "Find Customer" button is pressed. + Gets Customer details for the Cust Number in ecCustNum. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD findCustomer UNGUARDED + expose ecCustNum ecCustName ecCustAddr ecCustDisc pbFindCust objectMgr dlgOrderForm + --say "CustomerDetailsDlg-findCust-01." + custNo = ecCustNum~getLine(1) + idCust = objectMgr~getComponentId("CustomerModel",custNo) + --say "OrderFormView/CustomerDetailsDlg-findCustomer-01: idCustNo =" idCust + if idCust = .false then do + r = ErrorDialog(.HRSofv~noCust) + pbFindCust~disable + return + end + dirCustData = idCust~query + if dirCustData = .false then do + say "OrderFormView/CustomerDetailsDlg-findCustomer-02: query returned error." + return + end + self~setCustomer(dirCustData) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getCustomer - invoked by main OrderFormView dialog when a Customer is + dropped on the Order Form. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getCustomer UNGUARDED + expose ecCustNum + use strict arg customerId + dirCustData = customerId~query + -- set Customer Number in dialog control - this not done by the setCustomer + -- method because it's keyed in by the user when not using drag/drop. + ecCustNum~setText(dirCustData["CustNo"]) + self~setCustomer(dirCustData) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setCustomer - invoke when a Customer is dropped on the Order Form. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setCustomer UNGUARDED + expose ecCustNum ecCustName ecCustAddr ecCustDisc pbFindCust objectMgr dlgOrderForm + use strict arg dirCustData + -- Got Cust details - now populate controls (Name, Address, Discount): + ecCustName~setText(dirCustData["CustName"]) + -- Replace commas with eols: + strCustAddr = dirCustData["CustAddr"]~changeStr(",",.endOfLine) + -- Add the zip: + strCustAddr = strCustAddr||" "||dirCustData["Zip"] + ecCustAddr~setText(strCustAddr) + ecCustDisc~setText(dirCustData["CustDisc"]) + -- disble the "Find Customer" button. + pbFindCust~disable + -- Finally, tell the OrderFormView about what the Customer discount code is: + dlgOrderForm~setCustDiscount(dirCustData["CustDisc"]) + -- Re-calc totals to take account of Customer Discount if Cust entered after + -- order lines or a different Customer is selected half-way through the order. + dlgOrderForm~showTotals(0) -- provide ordeLineAmount as zero. + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + +/*============================================================================== + OrderLinesDlg - a Page in the OrderFormView + ------------- + + The "view" (or "gui") Products Ordering part of the OrderFormView. + ----------------------------------------------------------------------------*/ +::CLASS OrderLinesDlg SUBCLASS RcControlDialog INHERIT View + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + initDialog + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose objectMgr ecProdNum ecQty lvOrderItems + + -- Get ObjectMgr object id for later use. + objectMgr = .local~my.objectMgr + + lvOrderItems = self~newListView("IDC_ORDLINES_LIST") + lvOrderItems~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvOrderItems~insertColumnPX(0,"ProdNo", 50,"LEFT") + lvOrderItems~insertColumnPX(1,"Product Name", 150,"LEFT") + lvOrderItems~insertColumnPX(2,"UOM", 40,"RIGHT") + lvOrderItems~insertColumnPX(3,"Qty", 40,"RIGHT") + lvOrderItems~insertColumnPX(4,"Amount", 60,"RIGHT") + --say "OrderLinesDlg-initDialog-01." + + -- Test an edit field: + ecProdNum = self~newEdit("IDC_ORDLINES_PRODNO") + --say "OrderLinesDlg-initDialog-02; ecProdNum =" ecProdNum + ecQty = self~newEdit("IDC_ORDLINES_QTY") + pbAddOrderLine = self~newPushButton("IDC_ORDLINES_ADD") + self~connectEditEvent("IDC_ORDLINES_PRODNO","GOTFOCUS",prodNumGotFocus) + self~connectButtonEvent("IDC_ORDLINES_ADD","CLICKED",addOrderLine) + self~connectButtonEvent("IDC_ORDLINES_DELETE","CLICKED",deleteOrderLine) + self~connectListViewEvent("IDC_ORDLINES_LIST","ACTIVATE",showProduct) -- double-click + + --say "OrderLinesDlg-initDialog-03: ecProdNum =" ecProdNum + -- Set focus on the Product Number field: + self~focusControl("IDC_ORDLINES_PRODNO") + --pbAddOrderLine~state = "FOCUS" + self~initView -- required by View mixin. + + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setOrderFormDlg - Invoked by OrderFormView dialog so that this Control Dialog + can communicate with OrderFormView. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setOrderFormDlg + expose OrderFormDlg + use arg OrderFormDlg + --say "OrderFormView/OrderLinesDlg-setOrderFormDlg-01." + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + prodNumGotFocus + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD prodNumGotFocus UNGUARDED + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + addOrderLine - invoked when user presses the "Add OrderLine" button. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD addOrderLine UNGUARDED + expose ecProdNum ecQty lvOrderItems objectMgr OrderFormDlg + --say "OrderFormView/OrderLinesDlg-addOrderLine-01." + -- Get data that user has entered: + prodNum = ecProdNum~getLine(1) + qtyOrdered = ecQty~getLine(1) + --say "OrderFormView/OrderLinesDlg-addOrderLine-02: prodNum =" prodNum + if qtyOrdered < 1 then do + r = ErrorDialog(.HRSofv~noQty) + return + end + -- Get product details from Product Model component: + idProduct = objectMgr~getComponentId("ProductModel",prodNum) + --say "OrderFormView/OrderLinesDlg-addOrderLine-03: idProduct =" idProduct + if idProduct = .false then do + r = ErrorDialog(.HRSofv~noProduct) + --pbFindCust~disable + return + end + dirProductData = idProduct~query + if dirProductData = .false then do + say "OrderFormView//OrderLinesDlg-addOrderLine-04: Product not found." + return + end + + -- State at this point: Product found and qty entered. + + -- Calculate Total Price: + total = qtyOrdered*dirProductData["ListPrice"] + --say "OrderFormView/OrderLinesDlg-addOrderLine-05: total =" total + -- Ensure display total has 2 decimal places: + --displayTotal = total/100~format(,2) + displayTotal = myFormat(total) + lvOrderItems~addRow( , , prodnum, dirProductData["ProdName"], - + dirProductData["UOM"], qtyOrdered, displayTotal) + + -- Send amount of Order to the OrderFormView dialog: + OrderFormDlg~showTotals(total) + + -- Blank out fields ready for next order line: + ecProdNum~settext("") + ecQty~settext("") + self~focusControl("IDC_ORDLINES_PRODNO") + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getProduct - invoked by main OrderFormView dialog when a Product is + dropped on the Order Form. + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getProduct UNGUARDED + expose ecProdNum + use strict arg productId + --say "OrderFormView/OrderLinesDlg-getProduct: ecProdNum =" ecProdNum +--trace i + dirProdData = productId~query + -- set Product Number in dialog control: + ecProdNum~setText(dirProdData["ProdNo"]) + self~focusControl("IDC_ORDLINES_QTY") +--trace off + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + deleteOrderLine + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD deleteOrderLine + expose lvOrderItems + item = lvOrderItems~selected + say "OrderFormView/OrderLinesDlg-01: item selected =" item + if item = -1 then do -- if no item selected. + r = ErrorDialog(.HRSofv~noOrdLine) + return + end + lvOrderItems~delete(item) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD rootDialog + expose rootDlg + use strict arg rootDlg + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + showProduct + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showProduct UNGUARDED + expose lvOrderItems rootDlg + item = lvOrderItems~selected + if item = -1 then do + ret = MessageDialog(.HRSofv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info = .Directory~new + if lvOrderItems~getItemInfo(item, info) then do + --say "OrderLinesDlg-showProduct-01: info~text =" info~text "rootDlg =" rootDlg + r = self~showModel:super("ProductModel", info~text, rootDlg) + end + else do + say "OrderLinesDlg-showProduct-04: ~getItemInfo returned .false." + end + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + --expose objectMgr viewClass viewInstance + --objectMgr~removeView(viewClass, viewInstance) + --say "OrderFormView/OrderLinesDlg-leaving-01." + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderTotals v01-00 03May13 + ----------- + This class is the set of Order Totals. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + ::CLASS OrderTotals PUBLIC + ::ATTRIBUTE amount + ::ATTRIBUTE discount + ::ATTRIBUTE discountedAmount + ::ATTRIBUTE tax + ::ATTRIBUTE taxedAmount + + ::METHOD init + self~amount = 0.00 + self~discount = 0.00 + self~discountedAmount = 0.00 + self~tax = 0.00 + self~taxedAmount = 0.00 + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + PROBABLY REUNDANT!! + Order Grid (OrderGrid) v01-00 03May13 + -------- + This class is a table or grid of Order Line Items. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + ::CLASS OrderGrid PRIVATE + + ::ATTRIBUTE lines -- Array of Order lines + ::ATTRIBUTE totals + ::ATTRIBUTE numLines + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - set up Order Grid + - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + self~lines = .array~new + self~totals = .array~new + self~totals[1,1]=0; + self~totals[2,1]=0; self~totals[2,2]=0 + self~totals[3,1]=0; self~totals[3,2]=0 + self~numLines = 0 + + ::METHOD addLine + use strict arg dirLine + + ::METHOD delLine + use strict arg lineNo + /*- - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Order Header v01-00 06May13 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + ::CLASS OrderHeader + ::attribute orderNumber + ::attribute orderDate + ::attribute custNo + ::attribute custName + ::attribute address + ::attribute discount +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Order Line v01-00 06May13 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + ::CLASS OrderLine + ::attribute prodNo + ::attribute prodName + ::attribute UOM + ::attribute qty + ::attribute amount +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSofv) v01-00 07Jun12 + -------- + The HRSofv class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSofv PRIVATE -- Human-Readable Strings + ::CONSTANT CancelOrder "Cancel Order" + ::CONSTANT HelpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + ::CONSTANT NoBtn "This button is not yet implemented." + ::CONSTANT NoCust "Customer not found." + ::CONSTANT NoOrdLine "No Order Line selected." + ::CONSTANT NoMenu "This menu item is not yet implemented." + ::CONSTANT NoProduct "Product not found." + ::CONSTANT NoQty "No valid quantity." + ::CONSTANT PlaceOrder "Place Order" + ::CONSTANT QExit "Are you sure you want to cancel this Order and throw away all changes?" + ::CONSTANT SaveOrder "Save Order" +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderHeadersFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderHeadersFile.txt new file mode 100644 index 0000000..7f4bfeb --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderHeadersFile.txt @@ -0,0 +1,6 @@ +OrderNo | CustNo | Date | Disc | Cmtd +SO-1234 | AB0784 | 120821 | 2 | N +SO-2345 | BA0314 | 110815 | 1.5 | Y +SO-3456 | BA0314 | 120527 | 0 | Y +SO-4567 | CU0003 | 120630 | 0 | Y +SO-4569 | AC0027 | 120824 | 5 | N diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderLinesFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderLinesFile.txt new file mode 100644 index 0000000..38c61df --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderLinesFile.txt @@ -0,0 +1,13 @@ +OrderNo | ProdNo | Qty +SO-1234 | AB100/W | 5 +SO-1234 | CF300/X | 6 +SO-1234 | EF500/W | 15 +SO-2345 | AB100/W | 5 +SO-3456 | XY200 | 7 +SO-3456 | LM400 | 4 +SO-4567 | XY200 | 12 +SO-4567 | CU003 | 1 +SO-4569 | AB100/W | 10 +SO-4569 | LM400 | 8 +SO-4569 | CU003 | 5 +SO-4569 | XY200 | 12 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.h new file mode 100644 index 0000000..bc886a6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDLIST_LISTVIEW 106 +#define IDI_ORDLIST_DLGICON 107 +#define IDR_ORDLIST_MENU 108 +#define IDC_ORDLIST_LIST 1000 +#define IDC_ORDLIST_SHOWORDER 1001 +#define IDM_ORDLIST_NEWORDER 40000 +#define IDM_ORDLIST_ABOUT 40001 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.rc new file mode 100644 index 0000000..317a390 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.rc @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderListView.h" + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Order...", IDM_ORDLIST_NEWORDER + } + POPUP "Help" + { + MENUITEM "About...", IDM_ORDLIST_ABOUT + } +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDLIST_LISTVIEW DIALOG 0, 0, 255, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Order List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_ORDLIST_LIST, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING, 15, 10, 225, 215 + DEFPUSHBUTTON "Show Order", IDC_ORDLIST_SHOWORDER, 89, 235, 42, 14, WS_DISABLED +} + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDLIST_DLGICON ICON ".\\order\\bmp\\OrderList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.rex new file mode 100755 index 0000000..394077e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderListView.rex @@ -0,0 +1,255 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The Order ListView v03-00 24May13 + + Contains: class "OrderListView", "HRSolv" + + Pre-requisite files: OrderListView.rc, OrderListView.h. + + Description: Provides a list of Orders and supports viewing any given + Order via a double-click on that Order's item in the list. + This is an "Intermediate" component - it is invoked by OrderMgmt, + and invokes OrderView. + + Changes: + v01-00 07Jun12: First Version (Ex06). + v02-00 25Aug12: Updated for Ex07 using the MVF. + 08Jan13: Removed stand-alone startup (not now needed). + 11Jan13: Commented-out 'say' instructions. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v03-00 24May13: Exercice08 Update to use View & Component mixin. + + Outstanding Problems: None reported. + +*******************************************************************************/ + + +.Application~addToConstDir("Order\OrderListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Order\OrderView.rex" +--::REQUIRES "Support\RcView.rex" +::REQUIRES "Support\View.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderListView v01-01 25Aug12 + ------------- + The view of a list of products. + Changes: + v01-00 07Jun12: First version + v02-00 25Aug12: Updated for Ex07 using the MVF. + v03-00 24May13: Update for Ex08 to use View & Component mixin. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderListView SUBCLASS RcDialog PUBLIC INHERIT View Component -- v03 + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use strict arg idModel, rootDlg --Ex07 + --say ".OrderListView-newInstance-01: root, idModel =" rootDlg idModel + dlg = self~new("Order\OrderListView.rc", "IDD_ORDLIST_LISTVIEW") + --say ".OrderListView-newInstance-02." + dlg~activate(idModel, rootDlg) --Ex07 + return dlg --Ex07 + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + forward class (super) continue + self~initView + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "OrderListView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Order\OrderListView.rc", "IDR_ORDLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg modelData --Ex07 + use strict arg idModel, rootDlg --Ex07 + --say "OrderListView-activate-01: idModel, root =" idModel rootDlg + forward class (super) continue --Ex07 + modelData = RESULT --Ex07 + --say "OrderListView-activate-02: modelData =" modelData + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_ORDLIST_DLGICON") + --return self --Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvOrders btnShowOrder modelData --Ex07 + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + --say "OrderListView-initDialog-01"; say + lvOrders = self~newListView("IDC_ORDLIST_LIST"); + lvOrders~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvOrders~insertColumnPX(0,"OrderNo",60,"LEFT") + lvOrders~insertColumnPX(1,"CustNo",80,"LEFT") + lvOrders~insertColumnPX(2,"CustName",130,"LEFT") + lvOrders~insertColumnPX(3,"Date",80,"LEFT") + self~connectListViewEvent("IDC_ORDLIST_LIST","CLICK",itemSelected) + self~connectListViewEvent("IDC_ORDLIST_LIST","ACTIVATE",openItem) -- double-click + self~connectButtonEvent("IDC_ORDLIST_SHOWORDER","CLICKED",showOrder) + + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newOrder UNGUARDED + self~noMenuFunction(.HRSolv~newOrder) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSolv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSolv~noMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected unguarded + expose lvOrders --btnShowOrder + use arg id, itemIndex, columnIndex, keyState + if itemIndex > -1 then self~enableControl("IDC_ORDLIST_SHOWORDER") + else self~disableControl("IDC_ORDLIST_SHOWORDER") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + --say "OrderListView-openItem-01: item selected =" item + self~showOrder + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showOrder unguarded + expose lvOrders rootDlg + item = lvOrders~selected + --say "OrderListView-showOrder-01: item selected =" item + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSolv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvOrders~getItemInfo(item, info) then do + --say "OrderListView-showOrder-02: info~text =" info~text + objectMgr = .local~my.ObjectMgr + objectMgr~showModel("OrderModel", info~text, rootDlg) --Ex07 + self~disableControl("IDC_ORDLIST_SHOWORDER") + end + else do + say "OrderListView-showOrder-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvOrders modelData -- Ex07 + --say "OrderListView-loadList-01: dataArray =" modelData -- Ex07 + rows = modelData[count] -- Ex07 - number of rows + arrData = modelData[records] + --say "OrderListView-loadList-02:Dims =" modelData~dimension(1) modelData~dimension(2) + do i = 1 to rows + --say "OrderListView-loadList-04a: modelData[i,2] =" modelData[i,2] + -- Change date to display format - i.e. yymmdd to (US format!) mm-dd-yy): + date = arrData[i,3] + displayDate = date~substr(3,2)||"/"||date~substr(5)||"/"||date~substr(1,2) + lvOrders~addRow( , ,arrData[i,1], arrData[i,2], arrData[i,6], displayDate) + end + lvOrders~setColumnWidth(2) -- set width of 3rd column to longest text entry. + + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSolv (Human-Readable Strings for OrderListView) v01-00 07Jun12 + --- + The HRSolv class provides constant character strings for user-visible messages + issued by the OrderListView class. + + Changes: + v01-00 07Jun12: First Version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSolv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newOrder "New Order" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderModelsData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderModelsData.rex new file mode 100755 index 0000000..7afdbba --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderModelsData.rex @@ -0,0 +1,517 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The OrderModel and OrderData Classes v02-01 06Jun13 + + Contains: classes "OrderModel", OrderListModel, and "OrderData". --Ex07 + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v01-00 07Jun12: First version. + v02-00 08Jan13: Modified to use the MVF. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v02-01 06Jun13: Added drag/drop code to OrderFormModel + +------------------------------------------------------------------------------*/ + + +::REQUIRES "Support\Model.rex" +::REQUIRES "Support\GenericFile.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderModel v01-00 08Feb13 + ------------ + The "model" part of the Order component. + + Changes: + v01-00 07Jun12: First version. + 24Aug12: Modified to use the MVF. + 11Jan13: Commented-out 'say' instructions. + 08Feb13: Minor changes to comments only. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderModel SUBCLASS Model PUBLIC --Ex07 + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName --Ex07 + forward class (super) continue --Ex07 + modelId = RESULT --Ex07 + return modelId --Ex07 + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init - Superclass 'Model', in its newInstance method, queries the Data + component for this instance's data, then does the self~new(myData) + which invokes this 'init' method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose orderData + use strict arg orderData -- Ex07: data provided by Superclass. + self~myData = orderData -- Ex07: store in superclass's attribute. + --say "OrderModel-init-01: orderData =" orderData + --say "OrderModel-init-02: self~myData =" self~myData + + -- MVF gives gets the Order's Header data for the OrderModel, and OrderDetails for + -- the OrderListModel. Here we've got the Order Headers; now we need to ask + -- the OrderData component for the Order Details for this Order only: + --objMgr = .local.my~ObjectMgr + --idOrderData = objMgr~getComponentId("ProductData", "The") + --headerData = idOrderData~getHeaders( = + + return self -- Ex07 + + +-- ::METHOD query PUBLIC +-- use arg orderNo +-- if orderNo = "ORDERNO" then -- param not supplied +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderFormModel v02-00 06Jun13 + -------------- + The model component for the OrderForm business component. + + Changes: + v01-00 04Oct12. + v02-00 06Jun13: Added drag/drop class method (dmQueryDrop) which checks + whether the dragged source is a Customer. + + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderFormModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE nextOrderNumber CLASS + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + newInstance - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName -- invoked by ObjectMgr + --say ".OrderFormModel-newInstanceName-01." + forward class (super) continue --Ex07 + modelId = RESULT --Ex07 + return modelId --Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + dmQueryDrop - Check whether a drag/drop operation is allowed to drop + on an order form. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD dmQueryDrop CLASS PUBLIC + use arg sourceClassName + --say ".OrderFormModel-dmQueryDrop-01 sourceClassName =" sourceClassName + if sourceClassName = "CUSTOMERMODEL" then return .true + if sourceClassName = "PRODUCTMODEL" then return .true + else return .false + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getInstanceName - over-rides super's method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD getInstanceName CLASS PUBLIC + --say ".OrderFormModel-getInstanceName-01." + if self~nextOrderNumber = "NEXTORDERNUMBER" then do -- No instance name set + self~nextOrderNumber = "SO-4999" + end + number = self~nextOrderNumber~right(4) + number += 1 + self~nextOrderNumber = "SO-"||number + --say ".OrderFormModel-getInstanceName-02: instanceName =" self~nextOrderNumber + return self~nextOrderNumber + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD init + expose orderData + use strict arg orderData -- Ex07: data provided by Superclass. + self~myData = orderData -- Ex07: store in superclass's attribute. + --say "OrderModel-init-01: orderData =" orderData + return self + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderListModel v01-00 24Aug12 + -------------- + The "ListModel" for the SalesOrder business component. + + Changes: + v01-00 24Aug12. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderListModel SUBCLASS Model PUBLIC + + ::ATTRIBUTE myData +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName + self~wantList = .true -- MVF - for List models only. + forward class (super) continue -- MVF: super does the ~new and + -- passes data as a param on the init. + modelId = RESULT -- MVF + --say ".OrderListModel-newInstance-01: id =" modelId + return modelId -- MVF - could just say 'return modelId'. + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init - stores received data in attribute 'arrData' and returns self. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose arrData + use strict arg arrData + self~myData = arrData + --say "OrderListModel-init-01: data = " self~myData + --say "OrderListModel-init-02: type and dimensions:" self~myData self~myData~dimension + return self + + + /*---------------------------------------------------------------------------- + query - returns an array of all OrderHeader data. + In MVF this method is invoked by the RcView (or ResView) superclass. + But the list also needs the name of the Customer. So this model + also gets the Customer Name from the appropriate Customer Model. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD query PUBLIC + --say "OrderListModel-query-01: self~myData =" self~myData + -- myData is an array of records. Now get Customer + return self~myData + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderData v01-00 07Jun12 + ------------ + The "data" part of the Order component. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderData SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + ::ATTRIBUTE dirOrderHeaders PUBLIC -- a directory containing all records in + -- the SalesOrderHeaders.txt file joined + -- with Customer Name and Address from + -- the Customer file. + ::ATTRIBUTE dirOrderLines PUBLIC -- a directory containing all records in + -- the SalesOrderLines.txt file joined + -- with product Description from the + -- Product File. +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName + if self~created = "CREATED" then do + orderDataId = self~new() + return orderDataId + end + else do + say "... singleton component, so can't have more than one instance." + return .false + end + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - Invoked super to read the OrderHeader file, which is stored by super + in super's 'fileAsDirectory' attribute - and also the 'raw' form of + the file is stored in super's 'fileArray' attribute. + The OrderDetail file is read separately by invoking super's 'readFile' + method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD init --Ex07 + expose filename numRecords + -- Read the OrderHeaders file: + filename = "Order\OrderHeadersFile.txt"; columns = 5 + -- invoke super to read the OrderHeaders file (read into super's + -- fileAsDirectory attribute): + numRecords = self~init:super(fileName, columns) + self~dirOrderHeaders = self~fileAsDirectory + -- List the OrderHeaders + /*say "OrderData-init-01: numRecords:" numRecords + if numRecords > 0 then do + say "OrderData-init-02: Array is:" + say self~fileArray~tostring -- fileArray is super's attribute. + end */ + -- Read the OrderLines file: + self~dirOrderLines = self~readFile:super("Order\OrderLinesFile.txt", 3) + + -- At this point, the OrderHeader file is the dirOrderHeadersattribute, + -- and the OrderLines file is in self~dirOrderLines. + -- Now, for the OrderHeaders, do a 'join' with Customer to add the + -- customer's name and address to the order headers in self~dirOrderHeaders: + self~addCustomerInfo + -- And now add Product info to the order lines in self~dirOrderLines: + self~addProductInfo + --self~listOrders + return self -- MVF + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + addCustomerInfo - Called by init - adds customer info from the CustomerData + component to each of the OrderHeader lines. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD addCustomerInfo PRIVATE + -- (1) Add column headers (field names) from Customer to OrderHeaders: + columnHeaders = self~dirOrderHeaders[headers] + columnHeaders[6] = "CustName"; columnHeaders[7] = "CustDisc" + columnHeaders[8] = "CustAddr"; columnHeaders[9] = "Zip" + self~dirOrderHeaders[headers] = columnHeaders + + -- (2) Add values for custName, Discount, CustAddress and Zip for each order header line: + arrData = self~dirOrderHeaders[records] + --say "OrderData-getFile-02 arrData, dims =" arrData arrData~dimension + -- (2a) First get id for CustomerData: + objMgr = .local~my.ObjectMgr + idCustData = objMgr~getComponentId("CustomerData", "The") + if idCustData = .false then return .false + -- (2b) For each order header, get the cust name & addr from CustomerData + -- and add it to the OrderHeader in-memory file: + do i=1 to self~dirOrderHeaders[count] -- loop over the Order Headers records: + -- get Customer record from CustomerData: + --say "OrderData-getFile-04: arrOrderHeaders[i,2] =" arrOrderHeaders[i,2] + orderCustNo = arrData[i,2] + custDir = idCustdata~getRecord(orderCustNo) + -- add customer's Name and Address to the end of the record: + arrData[i,6] = custDir["CustName"] + arrData[i,7] = custDir["CustDisc"] + arrData[i,8] = custDir["CustAddr"] + arrData[i,9] = custDir["Zip"] + end + self~dirOrderHeaders[records] = arrData + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + addProductInfo - Called by init - adds product name from the ProductData + component to each of the OrderLine records + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -.*/ + ::METHOD addProductInfo PRIVATE -- Invoked by init. + -- (1) Add column header from Product to the headers (field labels) array: + columnHeaders = self~dirOrderLines[headers] + columnHeaders[4] = "ProdName" + self~dirOrderLines[headers] = columnHeaders + + -- (2) Add values for ProdName to each order header line: + arrData = self~dirOrderLines[records] + -- (2a) First get id for ProductData: + objMgr = .local~my.ObjectMgr + idProductData = objMgr~getComponentId("ProductData", "The") + if idProductData = .false then return .false + -- (2b) For each order line, get the product name from ProductData + -- and add it to the OrderLines in-memory file: + do i=1 to self~dirOrderLines[count] -- loop over the Order Lines records: + -- get Product record from ProductData: + orderProductNo = arrData[i,2] + prodDir = idProductData~getRecord(orderProductNo) + orderProductName = prodDir["ProdName"] + -- add product's Name to the end of the record: + arrData[i,4] = orderProductName + end + self~dirOrderLines[records] = arrData + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + dirData = .Directory~new + do j=1 to columns + header = self~FileHeaders[j] + dirData[header] = self~fileRecords[recordNo,j] + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getRecord - returns a directory 'dirOrderRecord' containing all the data for + a given Order, including both Order Headers and Order Lines. + The format of the directory is: + Index Item + ------- ------- + OrderNo the order number (from dirOrderHeaders} + CustNo customer number (from dirOrderHeaders} + Date order date (from dirOrderHeaders} + Disc discount (from dirOrderHeaders} + Cmtd committed? (from dirOrderHeaders} + CustDisc customer discount (from dirOrderHeaders) + OrderLineHdrs (from dirOrderLines) + OrderLines (from dirOrderLines) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC + use strict arg orderNo + if orderNo = "" then return .false + + -- (1) Get the data from the two directories that contain data from the two + -- files. Call these the "src" (source) variables: + arrSrcOrderHeaderLabels = self~dirOrderHeaders[headers] -- note naming clash but never mind... + arrSrcOrderHeaders = self~dirOrderHeaders[records] + numSrcOrderHeaders = self~dirOrderHeaders[count] + arrSrcOrderLineLabels = self~dirOrderLines[headers] + arrSrcOrderLines = self~dirOrderLines[records] + numSrcOrderLines = self~dirOrderLines[count] + + -- (2) Find the Order Header record: + found = .false + do recordNo = 1 to numSrcOrderHeaders + if arrSrcOrderHeaders[recordNo,1] = orderNo then do + found = .true; leave + end + end + if \found then return .false + + -- (3) Now build the dirOrderRecord + -- (3a) Put the Order headers(i,e, the field labels) into dirOrderRecord: + dirOrderRecord = .Directory~new + -- Put the OrderHeader info into dirOrderRecord: + columns = arrSrcOrderHeaderLabels~items + do j=1 to columns + itemName = arrSrcOrderHeaderLabels[j] + dirOrderRecord[itemName] = arrSrcOrderHeaders[recordNo,j] + end + -- (3b) Put the Headers (Field Labels) for the order lines into the record: + arrOLH = .Array~new + arrOLH = arrSrcOrderLineLabels + dirOrderRecord[OrderLineHdrs] = arrOLH + -- (3c) Now Put OrderLines for this order into dirOrderRecord's array + arrOrderLines = .Array~new + rows = arrSrcOrderLines~dimension(1) -- number of lines or rows + j = 1 + do i =1 to rows -- iterate over all rows in arrSrcOrderLines + --say "Orderdata-getRecord-02:" orderNo arrSrcOrderLines[i,1] + if arrSrcOrderLines[i,1] = orderNo then do + --say "OrderData-getRecord-02a: j arrSrcOrderLines[i,1] orderNo:" j arrSrcOrderLines[i,1] orderNo + arrOrderLines[j,1] = arrSrcOrderLines[i,1] + arrOrderLines[j,2] = arrSrcOrderLines[i,2] + arrOrderLines[j,3] = arrSrcOrderLines[i,3] + arrOrderLines[j,4] = arrSrcOrderLines[i,4] + j = j+1 + end + end + --say "OrderData-getRecord-03: arrOrderLines dimensions =" arrOrderLines~dimension(1) arrOrderLines~dimension(2) + dirOrderRecord[OrderLines] = arrOrderLines + + return dirOrderRecord + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getFile - Invoked by Model for an xxxListModel component; + returns all OrderHeaders including customer info. */ + ::METHOD getFile PUBLIC + return self~dirOrderHeaders + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + listOrders - lists the file. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD listOrders PUBLIC + say; say "----List-Orders--------------------------------" + say "Number of Orders:" self~dirOrderHeaders[Count] + arrOHH = self~dirOrderHeaders[Headers] + say "Order Headers: Headers or Field Names ("||arrOHH~items "columns):" + do i=1 to 9 + say "Order Headers FieldNames:" arrOHH[i] + end + say " " arrOHH[1] arrOHH[2] arrOHH[3] arrOHH[4] arrOHH[5] arrOHH[6] arrOHH[7] arrOHH[8] arrOHH[9] + say "Order Headers - Records" + arrOHR = self~dirOrderHeaders[Records] + do i = 1 to arrOHR~dimension(1) + say i||". " arrOHR[i,1] arrOHR[i,2] arrOHR[i,3] arrOHR[i,4] + say " " arrOHR[i,5] arrOHR[i,6] arrOHR[i,7] + say " " arrOHR[i,8] arrOHR[i,9] + end + say + say "Number of Order Lines:" self~dirOrderLines[Count] + arrOLH = self~dirOrderLines[Headers] + say "Order Lines: Headers or FieldNames ("||arrOLH~items "columns):" + say arrOLH[1] arrOLH[2] arrOLH[3] arrOLH[4] + say "Order Lines - Records" + arrOLR = self~dirOrderLines[Records] + do i = 1 to arrOLR~dimension(1) + say i||". " arrOLR[i,1] arrOLR[i,2] arrOLR[i,3] arrOLR[i,4] + end + say "-----------------------------------------------" + say + return .true + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.h new file mode 100644 index 0000000..9b72260 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.h @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDER_DIALOG 108 +#define IDI_ORDER_DLGICON 109 +#define IDR_ORDER_MENU 110 +#define IDC_ORDER_NAMEADDR 1000 +#define IDC_ST_DISCOUNT_PC 1005 +#define IDM_ORDER_DOTHIS 40000 +#define IDM_ORDER_ABOUT 40001 +#define IDC_ORDER_ORDNO 40007 +#define IDC_ORDER_CUSTNO 40008 +#define IDC_ORDER_ITEMS 40009 +#define IDC_ST_TAX_PC 40010 +#define IDC_ST_DISCOUNT 40011 +#define IDC_ST_TAX 40012 +#define IDC_ST_NET 40013 +#define IDC_ST_TOTAL 40014 +#define IDC_ORDER_DATE 40017 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.rc new file mode 100644 index 0000000..3c77c08 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.rc @@ -0,0 +1,101 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include +#include +#include +#include "OrderView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDER_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "An Action", IDM_ORDER_DOTHIS + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDER_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDER_DIALOG DIALOG 0, 0, 272, 270 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Sales Order" +FONT 8, "Ms Shell Dlg" +{ + EDITTEXT IDC_ORDER_ORDNO, 217, 30, 40, 14, ES_CENTER | ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_ORDER_CUSTNO, 217, 50, 40, 14, ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY + LTEXT "Order No.", IDC_STATIC, 169, 33, 32, 8, SS_LEFT + LTEXT "Customer No.", IDC_STATIC, 169, 53, 44, 8, SS_LEFT + CONTROL "", IDC_ORDER_ITEMS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT, 17, 70, 240, 115 + LTEXT "Date", IDC_STATIC, 169, 13, 16, 8, SS_LEFT + LTEXT "Net Cost:", IDC_STATIC, 113, 195, 30, 8, SS_LEFT + LTEXT "Discount:", IDC_STATIC, 113, 209, 31, 8, SS_LEFT + DEFPUSHBUTTON "Close", IDCANCEL, 17, 234, 35, 14 + LTEXT "Tax:", IDC_STATIC, 113, 223, 15, 8, SS_LEFT + RTEXT "0.00", IDC_ST_DISCOUNT_PC, 161, 209, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ST_TAX_PC, 161, 223, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ST_TAX, 212, 223, 40, 8, SS_RIGHT + RTEXT "0.00", IDC_ST_NET, 212, 195, 40, 8, SS_RIGHT, WS_EX_RIGHT + RTEXT "0.00", IDC_ST_DISCOUNT, 212, 209, 40, 8, SS_RIGHT + EDITTEXT IDC_ORDER_NAMEADDR, 17, 23, 103, 39, ES_AUTOHSCROLL | ES_MULTILINE | ES_READONLY + LTEXT "Customer:", IDC_STATIC, 19, 9, 32, 8, SS_LEFT + LTEXT "Total Cost:", IDC_STATIC, 113, 237, 35, 8, SS_LEFT + RTEXT "0.00", IDC_ST_TOTAL, 212, 237, 40, 11, WS_BORDER | SS_RIGHT + EDITTEXT IDC_ORDER_DATE, 217, 10, 40, 14, ES_CENTER | ES_AUTOHSCROLL | ES_READONLY +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_ORDER_DLGICON ICON ".\\Order\\bmp\\OrderForm.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.rex new file mode 100755 index 0000000..88163d1 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/OrderView.rex @@ -0,0 +1,283 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The OrderView class v03-00 26May13 + + OrderFormView.rex + + Contains: class "OrderView". + Pre-requisite files: OrderView.rc, OrderView.h. + + Description: A sample Order View component - part of the sample + Order Management application. + This is a "leaf" component - invoked by OrderListView. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version (Exercise06) + v02-00 08Jan13: Ex07 - changed to use the MVF. + 11Jan13: Removed stand-alone operation. + Commented-out 'say' instructions. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v03-00 26May13: Update to use View & Component mixins. + Comment-out the "Are you sure" when dialog closes. + Delete commented-out code in the 'showData' method. + +------------------------------------------------------------------------------*/ + + +.Application~addToConstDir("Order\OrderView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Order\OrderModelsData.rex" +--::REQUIRES "Support\RcView.rex" +::REQUIRES "Support\View.rex" + +/*============================================================================== + OrderView v01-01 25Aug12 + ------------- + The "view" (or "gui") part of the Order component - part of the sample + Order Management application. + + Changes: + v01-00 07Jun12: First Version. + v02-00 25Aug12: Ex07 - changed to use the MVF. + 08Jan13: Extraneous comments removed; some 'say' stmts commented out. + 11Jan13: Commented-out 'say' instructions. + v03-00 26May13: Update to use View & Component mixins. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderView SUBCLASS RcDialog PUBLIC INHERIT View Component -- Ex08 + + ::METHOD newInstance CLASS PUBLIC + use strict arg idModel, rootDlg -- Ex07 + --say ".OrderView-newInstance: rootDlg =" rootDlg + dlg = self~new("Order\OrderView.rc", "IDD_ORDER_DIALOG") + dlg~activate(idModel, rootDlg) -- Ex07 + return dlg -- Ex07 + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- creates the dialog instance but does not make it visible. + expose menuBar + --say "OrderView-init-01" + + forward class (super) continue + self~initView -- Ex08 + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "OrderView-createMenuBar-01" + menuBar = .ScriptMenuBar~new("Order\OrderView.rc", IDR_ORDER_MENU, , , .true) + + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose rootDlg orderData + use strict arg idModelInstance, rootDlg -- Ex07 + forward class (super) continue -- Ex07 - MVF: required to get Model's data + orderData = RESULT -- Ex07 - MVF: model's data returned by super + --say "OrderView-activate-00: orderData = " orderData + + -- Shows the Dialog - i.e. makes it visible to the user. + --say "OrderView-activate-01: OrderNumber = " orderData["OrderNo"] orderData~orderNo + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_ORDER_DLGICON") + return self -- Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + -- Called by ooDialog after SHOWTOP. + expose menuBar orderControls orderData -- Ex07 + --say "OrderView-initDialog-01" + + menuBar~attachTo(self) + + orderControls = .Directory~new + orderControls[ecOrderNameAddr] = self~newEdit( "IDC_ORDER_NAMEADDR") + orderControls[ecOrderDate] = self~newEdit( "IDC_ORDER_DATE" ) + orderControls[ecOrderNo] = self~newEdit( "IDC_ORDER_ORDNO" ) + orderControls[ecCustNo] = self~newEdit( "IDC_ORDER_CUSTNO" ) + orderControls[lvOrderItems] = self~newListView("IDC_ORDER_ITEMS" ) + orderControls[stNetCost] = self~newStatic( "IDC_ST_NET" ) + orderControls[stDiscountPC] = self~newStatic( "IDC_ST_DISCOUNT_PC") + orderControls[stDiscount] = self~newStatic( "IDC_ST_DISCOUNT" ) + orderControls[stTaxPC] = self~newStatic( "IDC_ST_TAX_PC" ) + orderControls[stTax] = self~newStatic( "IDC_ST_TAX" ) + orderControls[stTotal] = self~newStatic( "IDC_ST_TOTAL" ) + + -- Each Order Item consists of ProdNo, ProdName, Qty: + orderItems = orderControls[lvOrderItems] + orderItems~addExtendedStyle(GRIDLINES FULLROWSELECT) + orderItems~insertColumnPX(0,"Product No.",110,"LEFT") + orderItems~insertColumnPX(1,"Product Name",160,"LEFT") + orderItems~insertColumnPX(2,"Quantity",85,"LEFT") + self~connectListViewEvent("IDC_ORDER_ITEMS","ACTIVATE",showProduct) -- double-click + + --font = self~createFontEx("Ariel", 10) + font = self~createFontEx("Courier", 8) + orderControls[lvOrderItems]~setFont(font) + self~showData + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showProduct + expose orderControls rootDlg + --say "OrderView-showProduct-01: Show Product requested." + productItem = orderControls[lvOrderItems]~selected + --say "OrderView-showProduct-01: item selected =" productItem + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSolv~nilSelected, self~hwnd, title, 'WARNING') + return + end + + info=.Directory~new + if orderControls[lvOrderItems]~getItemInfo(productItem, info) then do + --say "OrderView-showOrder-02: info~text =" info~text + objectMgr = .local~my.ObjectMgr + objectMgr~showModel("ProductModel", info~text, self) --Ex07 + self~disableControl("IDC_ORDLIST_SHOWORDER") + end + else do + say "OrderListView-showOrder-04: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD anAction UNGUARDED + self~noMenuFunction(.HRSov~anAction) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSov~HelpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSov~NoMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showData + expose orderControls orderData + --say "orderData['CustNo']:" orderData['CustNo'] -- orderData~CustNo, orderData~'CustNo' - neither work. + --say "--------------------" + -- Format & show the address: + custAddr = orderData["CustAddr"] + parse var custAddr street "," city "," state + --say "OrderView-showData-01: address =" street city state orderData["Zip"] + eol = .endOfLine + custNameAddr = orderData["CustName"]||eol||street||eol||city||eol||state orderData["Zip"] + orderControls[ecOrderNameAddr]~setText(custNameAddr) + -- Format & show the order date: + orderDate = orderData["Date"] + yy = orderDate~left(2); dd = orderDate~right(2); mm = orderDate~substr(3,2) + orderDate = mm||"/"||dd||"/"||yy + orderControls[ecOrderDate]~setText(orderDate) + -- Show the Order NUmber: + orderControls[ecOrderNo]~setText(orderData["OrderNo"]) + -- Show the Customer NUmber: + orderControls[ecCustNo]~setText(orderData["CustNo"]) + + -- Show the Order Items (aka Order Lines): + lvOrderLines = orderControls[lvOrderItems] + arr = orderData[OrderLines] + --say "OrderView-showData-02: order lines array dims =" arr~dimension + --do i = 1 to arr~dimension(1) + --say arr[i,1] "-" arr[i,2] arr[i,3] arr[i,4] + --end + do i=1 to arr~dimension(1) + qty = arr[i,3]~right(8," ") + lvOrderLines~addRow( , , arr[i,2], arr[i,4], qty ) + end + --lvOrderLines~setColumnWidth(0) -- set width of 2nd column to longest text entry. + --lvOrderLines~setColumnWidth(1) + --lvOrderLines~setColumnWidth(3) + --say "OrderView-showData-02: arrOrderLines =" arrOrderLines + --orderControls[lvOrderItems] + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + -- "Cancel" - This method over-rides the default Windows action of + -- 'cancel window' for an Escape key. + /* + ::METHOD cancel + response = askDialog(.HRSov~QExit, "N") + if response = 1 then forward class (super) + return +*/ +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSov) v01-00 07Jun12 + -------- + The HRSofv class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSov PRIVATE -- Human-Readable Strings + ::CONSTANT anAction "An Action" + ::CONSTANT NoMenu "This menu item is not implemented." + ::CONSTANT QExit "Are you sure you want to cancel this Order View?" + ::CONSTANT HelpAbout "About Sales Order" + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderForm.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderForm.bmp new file mode 100644 index 0000000..2c2ca38 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderForm.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderForm.ico b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderForm.ico new file mode 100644 index 0000000..7b5e883 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderForm.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderList.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderList.bmp new file mode 100644 index 0000000..4cc094e Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderList.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderList.ico new file mode 100644 index 0000000..1c5b303 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Order/bmp/OrderList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.h new file mode 100644 index 0000000..1511da6 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.h @@ -0,0 +1,59 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_ORDMGR 100 +#define IDR_ORDMGR_MENU 102 +#define IDC_ORDMGR_RESET 1000 +#define IDC_ORDMGR_EXIT 1001 +#define IDC_ORDMGR_ICONS 1002 +#define IDM_ORDMGR_NEWORDER 40000 +#define IDM_ORDMGR_ORDERLIST 40001 +#define IDM_ORDMGR_CUSTLIST 40002 +#define IDM_ORDMGR_CUSTSEARCH 40003 +#define IDM_ORDMGR_PRODLIST 40004 +#define IDM_ORDMGR_PRODSEARCH 40005 +#define IDM_ORDMGR_ORDERSEARCH 40006 +#define IDM_ORDMGR_PRODNEW 40007 +#define IDM_ORDMGR_CUSTNEW 40008 +#define IDM_ORDMGR_ORDERNEW 40009 +#define IDM_ORDMGR_ABOUT 40010 +#define IDM_MESSAGE_SENDER1 40011 +#define IDM_PERSON1 40012 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.rc new file mode 100644 index 0000000..abc4f0b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.rc @@ -0,0 +1,98 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "OrderMgrView.h" + + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_ORDMGR_MENU MENU +{ + POPUP "Orders" + { + MENUITEM "New Order...", IDM_ORDMGR_NEWORDER + MENUITEM "Order List...", IDM_ORDMGR_ORDERLIST + MENUITEM "Order Search...", IDM_ORDMGR_ORDERSEARCH + } + POPUP "Customers" + { + MENUITEM "Customer List...", IDM_ORDMGR_CUSTLIST + MENUITEM "Customer Search...", IDM_ORDMGR_CUSTSEARCH + } + POPUP "Products" + { + MENUITEM "Product List...", IDM_ORDMGR_PRODLIST + MENUITEM SEPARATOR + MENUITEM "Product Search...", IDM_ORDMGR_PRODSEARCH + } + POPUP "New" + { + MENUITEM "Product...", IDM_ORDMGR_PRODNEW + MENUITEM "Customer...", IDM_ORDMGR_CUSTNEW + MENUITEM "Order...", IDM_ORDMGR_ORDERNEW + } + POPUP "Help" + { + MENUITEM "About", IDM_ORDMGR_ABOUT + MENUITEM "Message Sender", IDM_MESSAGE_SENDER1 + MENUITEM "Person", IDM_PERSON1 + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_ORDMGR DIALOG 0, 0, 310, 209 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU | WS_MINIMIZEBOX +CAPTION "Dialog" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Exit Application", IDC_ORDMGR_EXIT, 245, 186, 60, 15 + PUSHBUTTON "Reset Icons", IDC_ORDMGR_RESET, 5, 186, 50, 15 + CONTROL "", IDC_ORDMGR_ICONS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_ICON, 5, 5, 300, 175 +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.rex new file mode 100755 index 0000000..80be2e7 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/OrderMgrView.rex @@ -0,0 +1,411 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: OrderMgrView.rex v03-00 11May13 + + Contains: class: "OrderMgrView", "HRSomv" + + Description: The Order Manager View class - the container for of the + Order Management application. + + Pre-requisites: MVF. + + Description: A sample Order Manager View class - part of the sample + Order Manager component. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + v01-01 18Jan13: Version 1.1 - dialog sizing now uses resizingAdmin. + v02-00 20Feb13: + 1. Added get id of ObjectMgr in init method. + 2. Added menu item "Help - Person" to surface a Person Model in order to + illustrate MVF using Person class early in Chapter 7. + 3. Added menu item "Help - Message Sender" to surface the Message Sender. + 4. Updated 'showModel' method to use the MVF (via ObjectMgr) to surface + List Views that are populated with data read from disk (instead of data + hard-coded in the ListView) also give listview the instance name of "a" + to indicate an anonymous component to ObjectMgr. + 5. Added methods "person" and "messageSender" which launch a PersonModel + and a Message Sender respectively. + 27Feb13: Commented-out several 'say's. + 08May13: Modified some comments - no change to function. + v03-00 11May13: Added triggering of event "appClosing". + 30Jly14: Corrected .ImageList~create(...) statement in + createIconList method. +------------------------------------------------------------------------------*/ + +-- Use the global .constDir for symbolic IDs - load them from OrderMgrView.h +.Application~addToConstDir("OrderMgr\OrderMgrView.h") + +call "OrderMgr\RequiresList.rex" + +::REQUIRES "ooDialog.cls" +::REQUIRES "Support\Component.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + OrderMgrView v02-00 20Feb13 + -------------------- + To the user, this class is the Order Management Application. It provides + access to the various functions required for managing Sales orders. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS OrderMgrView SUBCLASS RcDialog PUBLIC INHERIT ResizingAdmin Component +-- ::CLASS OrderMgrView SUBCLASS View PUBLIC INHERIT ResizingAdmin + ::ATTRIBUTE lv PRIVATE -- The ListView that contains the icons. + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + --say ".OrderMgrView-newInstance-01." + dlg = .OrderMgrView~new("OrderMgr\OrderMgrView.rc", IDD_ORDMGR) + dlg~activate + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + expose menuBar records idObjectMgr + --say "OrderMgrView-init-01; next stmt is 'forward class (super) continue'." + forward class (super) continue + --say "OrderMgrView-init-02." + menuBar = .ScriptMenuBar~new("OrderMgr\OrderMgrView.rc", IDR_ORDMGR_MENU, , , .true) + self~createIconList + records = self~initRecords + idObjectMgr = .local~my.ObjectMgr + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineDialog + --say "OrderMgrView-defineDialog-01." + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + --say "OrderMgrView-activate-01." + self~execute("SHOWTOP", IDI_DLG_OOREXX) + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar records iconList + --say "OrderMgrView-initDialog-01." + menuBar~attachTo(self) + + -- Create a proxy for the List View and store in instance variable 'lv'. + self~lv = self~newListView(IDC_ORDMGR_ICONS) + + -- Add the Image List to the ListView: + self~lv~setImageList(iconList, NORMAL) + -- Add icons (i.e. records) to the ListView: + do i=1 to records~items + self~lv~addRow(, i-1, records[i]~name) + end + + self~connectListViewEvent(IDC_ORDMGR_ICONS, "ACTIVATE", "onDoubleClick") + -- Following line required to allow icons to be dragged around the listview. + self~connectListViewEvent(IDC_ORDMGR_ICONS, "BEGINDRAG", "DefListDragHandler") + self~connectButtonEvent("IDC_ORDMGR_EXIT", "CLICKED",exitApp) + self~connectButtonEvent("IDC_ORDMGR_RESET","CLICKED",resetIcons) + self~setTitle(.HRSomv~WindowTitle) -- set dialog title. + + --self~saySomething -- Test for Component mixin - delete any time. + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD defineSizing + --say "OrderMgrView-defineSizing-01." + -- Called automatically by ooDialog. + -- Order of arrays: left, top, right, bottom. + -- Order of array items: pinType, edge-of-other-window, id of other window + self~controlSizing(IDC_ORDMGR_RESET, - + .array~of('STATIONARY', 'LEFT' ), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'BOTTOM' ), - + .array~of('MYTOP', 'TOP' ) - + ) + self~controlSizing(IDC_ORDMGR_EXIT, - + .array~of('STATIONARY', 'RIGHT' ), - + .array~of('STATIONARY', 'BOTTOM'), - + .array~of('MYLEFT', 'RIGHT' ), - + .array~of('MYTOP', 'TOP' ) - + ) + self~controlSizing(IDC_ORDMGR_ICONS, - + .array~of('STATIONARY', 'LEFT' ), - + .array~of('STATIONARY', 'TOP' ), - + .array~of('STATIONARY', 'RIGHT' ), - + .array~of('STATIONARY', 'BOTTOM') - + ) + return .false + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createIconList PRIVATE + -- This method simulates getting the icon "data" for the OrderMgr view. + -- The icon data is loaded into 'iconList' which is an 'ImageList' as + -- required by the ListView control. + expose iconList + --say "OrderMgrView-createIconList." + imgCustList = .Image~getImage("customer\bmp\CustList.bmp") + imgProdList = .Image~getImage("product\res\ProdList.bmp") + imgOrderList = .Image~getImage("order\bmp\OrderList.bmp") + imgOrderForm = .Image~getImage("order\bmp\OrderForm.bmp") + iconList = .ImageList~create(.Size~new(64, 64), .Image~toId(ILC_COLOR4), 4, 0) + -- Boldly assume no errors in creating the Image List or in the ~getImage statements. + iconList~add(imgCustList) -- item 0 in iconList (item 1 in records) + iconList~add(imgProdList) -- item 1 in iconList (item 2 in records) + iconList~add(imgOrderList) -- item 2 in iconList (item 3 in records) + iconList~add(imgOrderForm) -- item 3 in iconList (item 4 in records) + imgCustList~release + imgProdList~release + imgOrderList~release + imgOrderForm~release + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initRecords PRIVATE + -- This method simulates getting the "data" for the OrderMgr view. + expose records + records = .array~new() + + rec = .directory~new + rec~ID = "CustomerListModel" -- class name + rec~name = "Customer List" + records[1] = rec + + rec = .directory~new + rec~ID = "ProductListModel" + rec~name = "Product List" + records[2] = rec + + rec = .directory~new + rec~ID = "OrderListModel" + rec~name = "Sales Orders" + records[3] = rec + + rec = .directory~new + rec~ID = "OrderFormModel" + rec~name = "New Order" + records[4] = rec + + return records + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ::METHOD initDialog + expose records iconList + --say "OrderMgrView-initDialog." + self~initDialog:super + -- Add the Image List to the ListView: + self~lv~setImageList(iconList, NORMAL) + -- Add icons (i.e. records) to the ListView: + do i=1 to records~items + self~lv~addRow(, i-1, records[i]~name) + end +*/ + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - Orders - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newOrder UNGUARDED + expose records + self~showModel(records[4]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD orderList UNGUARDED + expose records + self~showModel(records[3]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD orderSearch UNGUARDED + self~noMenuFunction(.HRSomv~OrdSrch) + + /*- - Customers - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customerList UNGUARDED + expose records + self~showModel(records[1]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customerSearch UNGUARDED + self~noMenuFunction(.HRSomv~CustSrch) + + /*- - Products - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD productList + expose records + self~showModel(records[2]) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD productSearch UNGUARDED + self~noMenuFunction(.HRSomv~ProdSrch) + + /*- - New - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD product UNGUARDED + self~noMenuFunction(.HRSomv~NewProd) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD customer UNGUARDED + self~noMenuFunction(.HRSomv~NewCust) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD order UNGUARDED + self~newOrder + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSomv~HelpAbout) + + /*- - Message Sender- - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD messageSender UNGUARDED + --say "OrderMgrView-messageSender." + .MessageSender~newInstance(self) + --self~noMenuFunction(.HRSomv~HelpAbout) + + /*- - Message Sender- - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD person UNGUARDED + expose idObjectMgr + --say "OrderMgrView-Person." + objectMgr = .local.my.ObjectMgr + idObjectMgr~showModel("PersonModel","PA150", self) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg title + ret = MessageDialog(.HRSomv~NoMenu, self~hwnd, title, 'WARNING') + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Icon Double-Click + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onDoubleClick UNGUARDED + expose records + --use arg id + --say "OrderMgrView-onDoubleClick-01." + -- Get the index of the item with the focus, use the index to retrieve + -- the item's record: + index = self~lv~focused -- lv is an attribute of the superclass. + record = records[index+1] + --say "OrderMgrView-onDoubleClick-02: Record ID =" record~ID + self~showModel(record) + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - PushButton Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD resetIcons + r = self~lv~arrange + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD exitApp UNGUARDED + --say "OrderMgrView-exitApp-01." + self~cancel + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + response = askDialog(.HRSomv~QExit, "N") + --say "OrderMgrView-cancel-01: response to ask dialog =" response + if response = 0 then return + -- Response was 1 so close down: + self~triggerEvent("appClosing") + --eventMgr = .local~my.EventMgr + --r = eventMgr~triggerEvent("appClosing") -- if r = 0 then no-one's registered. + --say "OrderMgrView-cancel: triggerEvent response =" r + forward class (super) -- Closes the whole app. + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD ok + -- Invoked when enter key pressed - if passed to superclass, cancels dialog. + return -- do not close dialog - appears as a no-op to the user. + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel UNGUARDED + /* Surface the view of an icon (i.e. view of the model represented by the icon). + */ + expose idObjectMgr + use arg record -- record is a directory object. + className = record~ID + --say "OrderMgrView-showModel-01: className =" className -- Ex07 + r = idObjectMgr~showModel(classname, "a", self) -- Ex07 + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + /*::METHOD triggerEvent + use strict arg event + idEventMgr = .local~my.EventMgr + */ +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSomv (Human-Readable Strings for OrderMgrView) v01-00 07Jun12 + --- + The HRSomv class provides constant character strings for user-visible messages + issued by the OrderMgrBaseView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSomv PRIVATE -- Human-Readable Strings + ::CONSTANT QExit "Are you sure you want to close all windows and exit the application?" + ::CONSTANT NoMenu "This menu item is not yet implemented." + ::CONSTANT OM "Order Manager" + ::CONSTANT OrdSrch "Order Search" + ::CONSTANT CustSrch "Customer Search" + ::CONSTANT ProdSrch "Product Search" + ::CONSTANT NewCust "New Customer" + ::CONSTANT NewProd "New Product" + ::CONSTANT HelpAbout "Help - About" + ::CONSTANT WindowTitle "Sales Order Management" -- Dialog Caption + ::CONSTANT Reset "Reset Icons" -- PushButton + ::CONSTANT ExitApp "Exit Application" -- PushButton + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/RequiresList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/RequiresList.rex new file mode 100755 index 0000000..5d6ccb8 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/OrderMgr/RequiresList.rex @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: RequiresList.rex v02-00 09May13 + + Contains: The list of View components that OrderMgrView requires. + + Pre-requisites: Class "OrderMgrView + + Description: This script is called by OrderMgrView. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v02-00 09May13: Added View.rex to the requires list. + +------------------------------------------------------------------------------*/ + +--say "OrderMgr RequiresList." + +::REQUIRES "Customer\CustomerListView.rex" +::REQUIRES "Product\ProductListView.rex" +::REQUIRES "Order\OrderListView.rex" +::REQUIRES "Order\OrderFormView.rex" +::REQUIRES "Support\MessageSender.rex" +--::REQUIRES "Support\View.rex" + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductFile.txt b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductFile.txt new file mode 100644 index 0000000..a475007 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductFile.txt @@ -0,0 +1,7 @@ +ProdNo | ProdName | ListPrice | UOM | Size | Description +AB100/W | Baffle | 995 | 20 | S | 3" aluminium baffles - suitable for all bonderers. +CF300/X | Widget Box | 2895 | 6 | M | A 10 litre case with flat sides capable of holding quite a lot of stuff. +CU003 | Widget, 5in | 12499 | 100 | M | Meets all possible Widget needs, except those not possible. +EF500/W | Slodget | 1730 | 10 | S | 5" slodget for use with 3" baffles. +LM400 | Driblet, 10 guage | 34000 | 25 | L | 2' driblet guaranteed to dribletize most clambers. +XY200 | Blad Anchor | 3845 | 1 | M | Fixes all small or medium blads. diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.h new file mode 100644 index 0000000..67f5489 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODLIST_DIALOG 102 +#define IDR_PRODLIST_MENU 104 +#define IDI_PRODLIST_DLGICON 105 +#define IDC_PRODLIST_SHOWPRODUCT 1000 +#define IDC_PRODLIST_LISTVIEW 1001 +#define IDM_PRODLIST_NEWPROD 40000 +#define IDM_PRODLIST_ABOUT 40001 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.rc new file mode 100644 index 0000000..539fa1e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.rc @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + +#include +#include +#include +#include "ProductListView.h" + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODLIST_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "New Product...", IDM_PRODLIST_NEWPROD + } + POPUP "Help" + { + MENUITEM "About...", IDM_PRODLIST_ABOUT + } +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODLIST_DIALOG DIALOG 0, 0, 225, 273 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product List" +FONT 8, "Ms Shell Dlg" +{ + PUSHBUTTON "Cancel", IDCANCEL, 150, 235, 50, 14 + CONTROL "", IDC_PRODLIST_LISTVIEW, WC_LISTVIEW, WS_BORDER | LVS_ALIGNLEFT | LVS_REPORT | LVS_SORTASCENDING, 15, 10, 190, 215 + DEFPUSHBUTTON "Show Product", IDC_PRODLIST_SHOWPRODUCT, 90, 235, 50, 14, WS_DISABLED +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_PRODLIST_DLGICON ICON ".\\product\\res\\ProdList.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.rex new file mode 100755 index 0000000..4021c3a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductListView.rex @@ -0,0 +1,255 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Exercise08 + + ProductListView v03-00 20May13 + ------------- + The view of a list of products. + + Changes: + v01-00 06Jun12: First version + v02-00 21Aug12: Modified for Exercise07 to use the Model-View Framework. + 11Jan13: Commented-out 'say' instructions. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v03-00 20May13: Now inherits directly from RcDialog plus the View & + Component mixins. + + Contains: classes "ProductListView, HRSplv (for human-readable strings) + + Pre-requisites: ProductListView.rc, ProductListView.h, ProdList.ico + + Description: An "intermediate" component - called by OrderMgr, + invokes "ProductView". + + Outstanding Problems: None reported. +*******************************************************************************/ + +.Application~addToConstDir("Product\ProductListView.h") + + +::REQUIRES "ooDialog.cls" +::REQUIRES "Product\ProductView.rex" +::REQUIRES "Support\View.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductListView v03-00 24May13 + ------------- + The view of a list of products. + Changes: + v01-00 06Jun12: First version + v02-00 21Aug12: Modified to use the Model-View Framework. + Comment "Ex07" shows where changes from Ex06 have been made. + 09Jan13: 'Say' instructions commented out or removed. + Standalone operation removed (not now needed). + v03-00 24May13: ProducView now inherits directly from ResDialog plus the + View & Compoment mixins. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductListView SUBCLASS RcDialog PUBLIC INHERIT View Component + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg idModel, rootDlg -- Ex07 + --say ".ProductListView-newInstance-01: rootDlg =" rootDlg + dlg = self~new("Product\ProductListView.rc", "IDD_PRODLIST_DIALOG") + --say ".ProductListView-newInstance-02." + dlg~activate(idModel,rootDlg) -- Ex07 + return dlg -- Ex07 + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + forward class (super) continue + self~initView + if \ self~createMenuBar then do -- if there was a problem + self~initCode = 1 + return + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD createMenuBar + -- Creates the menu bar on the dialog. + expose menuBar + --say "ProductListView-createMenuBar-01." + menuBar = .ScriptMenuBar~new("Product\ProductListView.rc", "IDR_PRODLIST_MENU", , , .true) + return .true + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg modelData idModel -- Ex07 + use arg idModelInstance, rootDlg -- Ex07 + forward class (super) continue -- Ex07: required to get Model's data + modelData = RESULT -- Ex07: model's data returned by super + --say "ProductListView-activate-01: root =" root + self~popupAsChild(rootDlg, "SHOWTOP", ,"IDI_PRODLIST_DLGICON") + return self -- Ex07 + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar lvProducts btnShowProduct modelData idModel -- Ex07 + -- Called by ooDialog after SHOWTOP. + + menuBar~attachTo(self) + + --say "ProductListView-initDialog-01"; say + lvProducts = self~newListView("IDC_PRODLIST_LISTVIEW"); + lvProducts~addExtendedStyle(GRIDLINES FULLROWSELECT) + lvProducts~insertColumnPX(0,"Number", 60,"LEFT") + lvProducts~insertColumnPX(1,"Name", 160,"LEFT") + lvProducts~insertColumnPX(2,"Price", 50,"RIGHT") -- Ex07 (Right-adjust) + lvProducts~insertColumnPX(3,"UOM", 40,"RIGHT") -- Ex07 (added) + self~connectListViewEvent("IDC_PRODLIST_LISTVIEW","CLICK",itemSelected) + self~connectListViewEvent("IDC_PRODLIST_LISTVIEW","ACTIVATE",openItem) + self~connectButtonEvent("IDC_PRODLIST_SHOWPRODUCT","CLICKED",showProduct) + + -- Set model instance name into the Titlebar: + --parse var self~objectName + self~loadList + + + /*---------------------------------------------------------------------------- + Event-Handler Methods - Menu Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newProduct UNGUARDED + self~noMenuFunction(.HRSplv~newProd) + + /*- - Help - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + self~noMenuFunction(.HRSplv~helpAbout) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD noMenuFunction UNGUARDED + use arg caption + ret = MessageDialog(.HRSplv~noMenu, self~hwnd, caption, 'WARNING') + + /*---------------------------------------------------------------------------- + Event Handling Methods - List Items + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD itemSelected unguarded + expose lvProducts + use arg id, itemIndex, columnIndex, keyState + --say "ProductListView-itemSelected: itemIndex, columnIndex, keyState:" itemIndex columnIndex keyState + --say "ProductListView-itemSelected: item selected is:"lvProducts~selected + if itemIndex > -1 then self~enableControl("IDC_PRODLIST_SHOWPRODUCT") + else self~disableControl("IDC_PRODLIST_SHOWPRODUCT") + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD openItem UNGUARDED + --say "ProductListView-openItem-01: item selected =" item + self~showProduct + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD showProduct UNGUARDED + expose lvProducts rootDlg + item = lvProducts~selected + --say "ProductListView-showProduct-01: item selected =" item + if item = -1 then do -- if no item selected. + ret = MessageDialog(.HRSplv~nilSelected, self~hwnd, title, 'WARNING') + return + end + info=.Directory~new + if lvProducts~getItemInfo(item, info) then do + --say "ProductListView-showProduct-02: info~text =" info~text + --say "ProductListView-showProduct-03; root =" root + objectMgr = .local~my.ObjectMgr + objectMgr~showModel("ProductModel", info~text, rootDlg) --Ex07 + --say "ProductListView-showProduct-04: after startProductView" + self~disableControl("IDC_PRODLIST_SHOWPRODUCT") + end + else do + say "ProductListView-showProduct-05: ~getItemInfo returned .false." + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD loadList + expose lvProducts modelData -- Ex07 + --say "ProductListView-loadList-01: dataArray =" modelData -- Ex07 + rows = modelData[count] -- Ex07 - number of rows + arrData = modelData[records] + --say "ProductListView-loadList-02:Dims =" arrData~dimension(1) arrData~dimension(2) + do i = 1 to rows + -- Change file price to display format (i.e. cents to dollars.cents): + displayPrice = (arrData[i,3]/100)~format(,2) + lvProducts~addRow( , ,arrData[i,1], arrData[i,2], displayPrice, arrData[i,4]) + end + lvProducts~setColumnWidth(1) -- set width of 2nd column to longest text entry. + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + HRSplv (Human-Readable Strings for ProductListView) v01-00 06Jun12 + ------ + The HRS class provides constant character strings for user-visible messages + issued by the ProductListView class. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +::CLASS HRSplv PRIVATE -- Human-Readable Strings + ::CONSTANT noMenu "This menu item is not yet implemented." + ::CONSTANT newProd "New Product" + ::CONSTANT helpAbout "Help - About" + ::CONSTANT nilSelected "Please select an item first." + +/*============================================================================*/ + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductModelsData.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductModelsData.rex new file mode 100755 index 0000000..4235a89 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductModelsData.rex @@ -0,0 +1,266 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: v02-00 24May13 + + The ProductModel, ProductListModel, and ProductData Classes + + Contains: classes "ProductModel", "ProductListModel, "ProductData", + and "ProductDT". + Pre-requisites: None. + + Outstanding Problems: + None. + + Changes: + v00-02: 21Jly11 + v00-03: Correct "return" statement not in right place (typo in code!!) + Renamed the ProductDT attributes (initial "prod" deemed extraneous) + - 26Aug11: added some comments - no change to function. + v00-04 21Aug12: ProducListModel added. Modified to fit the MV Framework. + v02-00 13Jan12: Ex07: Some 'say' instructions removed or commented out. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + 24May13: Minor changes to comments for Ex08. + +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductModel v00-02 12Jly11 + ------------ + The "model" part of the Product component. + + interface productModel{ + aProductModel newInstance() -- Class method. + null activate() + aProductDT query() + }; + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "Support\GenericFile.rex" +::REQUIRES "Support\Model.rex" + +::CLASS ProductModel SUBCLASS Model PUBLIC + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + -- Creates an instance and returns it. + use strict arg instanceName --Ex07 + forward class (super) continue --Ex07 + modelId = RESULT --Ex07 + return modelId --Ex07 + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + -- Gets its data from ProductData. + expose prodData + use strict arg prodData --Ex07 + return self --Ex07 + + + ::METHOD query PUBLIC + -- Returns data requested (no argument = return all) + -- self~myData (super's attribute) is a DT. So ask the data component for its + -- directory version of the data (an attribute of ProductData). + expose prodData + --say "ProductModel-query-01: prodData =" prodData + dir = .directory~new + return prodData +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductListModel v00-01 20Aug12 + ---------------- + The model for a list of Products. + Changes: + v00-01 20Aug12: First version + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductListModel SUBCLASS Model PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD newInstance CLASS PUBLIC + use arg instanceName + --self~myInstanceName = instanceName + self~wantList = .true -- set super's attribute + forward class (super) continue + id = RESULT + --say "ProductListModel-newInstance-01: id =" id + return id + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + ::METHOD init + expose arrData + use strict arg data + --self~myData = data + --say "ProductListModel-init-01: myData =" self~myData + return self + +-- ::METHOD query PUBLIC + /*---------------------------------------------------------------------------- + query - returns an array of all Product data. + In MVF this method is invoked by the RcView (or ResView) superclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --say "ProductListModel-query-01." +-- return self~myData + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductData v01-00 20Jly11 + ------------ + The "data" part of the Product component. + [interface (idl format)] + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductData SUBCLASS GenericFile PUBLIC + + ::ATTRIBUTE created CLASS + ::ATTRIBUTE dirData + +/*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + use strict arg instanceName + if self~created = "CREATED" then do + self~created = .true + productDataId = self~new() + --if r = .true then self~created = .true + return productDataId + end + else do + say "... singleton component, so can't have more than one instance." + return .false + end + + +/*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init PUBLIC + expose filename numRecords + filename = "Product\ProductFile.txt"; columns = 6 + numRecords = self~init:super(filename, columns) + --say "ProductData-init-01: numRecords:" numRecords + return self + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getData PUBLIC -- ???? Use the DT??? + expose data + --say "ProductData-getData-01." + return data + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Find - forward to super, then pack data into a ProductDT. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC + use strict arg dataKey + --say "ProductData-getRecord-00: dataKey = <"||dataKey||">" + forward class (super) continue + dirData = RESULT -- Generic File returns a directory. + --say "ProductData-getRecord-01: dirData =" dirData + self~dirData = dirData + if dirData = .false then return .false + -- Now convert dirData to a DT, pack it into dirData then return dirData: + dt = .ProductDT~new + dt~number = dirData["ProdNo"] + dt~name = dirData["ProdName"] + dt~price = dirData["ListPrice"] + dt~uom = dirData["UOM"] + dt~description = dirData["Description"] + dt~size = dirData["Size"] + dirData["DT"] = dt + return dirData + + +/*============================================================================*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductDT - A business data type for Product data. v00-02 07Aug11 + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/ + +::CLASS ProductDT PUBLIC + + -- dtName XML Name Description + -- --------- ---------- ------------------------------- + -- ProductDT product + ::ATTRIBUTE number -- number Product Number + ::ATTRIBUTE name -- name Product Description + ::ATTRIBUTE price -- price Product Price (rightmost two digits are 100ths of currency unit) +--::ATTRIBUTE currency -- currency Three-letter currency code + ::ATTRIBUTE uom -- uom Product Unit of Measure + ::ATTRIBUTE description -- descrip Product Description + ::ATTRIBUTE size -- size Produce Size Category (S/M/L) + + ::METHOD list PUBLIC + expose number name price uom description size + say "---------------" + say "ProductDT-List:" + say "Number: " number "Name:" name + say "Price:" price "UOM:" uom "Size:" size + say "Description:" description + say "---------------" +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.h new file mode 100644 index 0000000..b22805a --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.h @@ -0,0 +1,69 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define IDD_PRODUCT_VIEW 106 +#define IDR_PRODUCT_VIEW_MENU 107 +#define IDD_PRODUCT_VIEW_ABOUT 108 +#define IDB_PROD_ICON 112 +#define IDI_PROD_DLGICON 113 +#define IDC_PRODABT_ICON_PLACE 1000 +#define IDC_PROD_NO 1000 +#define IDC_PROD_UOM 1001 +#define IDC_PROD_DESCRIPTION 1002 +#define IDC_PROD_STATIC2 1003 +#define IDC_PROD_STATIC3 1004 +#define IDC_PROD_STATIC1 1005 +#define IDC_PROD_STATIC4 1007 +#define IDC_PROD_STATIC5 1008 +#define IDM_PROD_UPDATE 40000 +#define IDM_PROD_REFRESH 40001 +#define IDM_PROD_CLOSE 40002 +#define IDM_PROD_PRINT 40003 +#define IDM_PROD_ABOUT 40004 +#define IDC_PROD_NAME 40010 +#define IDC_PROD_LIST_PRICE 40012 +#define IDC_PROD_SIZE_GROUP 40013 +#define IDC_PROD_SAVE_CHANGES 40014 +#define IDC_PROD_RADIO_SMALL 40015 +#define IDC_PROD_RADIO_MEDIUM 40016 +#define IDC_PRODABT_STATIC1 40017 +#define IDC_PROD_RADIO_LARGE 40017 +#define IDC_PRODABT_STATIC2 40018 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.rc new file mode 100644 index 0000000..742651b --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.rc @@ -0,0 +1,124 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + + + +#include +#include +#include +#include "ProductView.h" + + + + +// +// Bitmap resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDB_PROD_ICON BITMAP ".\\res\\producticon.bmp" + + + +// +// Menu resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDR_PRODUCT_VIEW_MENU MENU +{ + POPUP "Actions" + { + MENUITEM "&Update Product", IDM_PROD_UPDATE + MENUITEM "Refresh Data", IDM_PROD_REFRESH + MENUITEM "Print...", IDM_PROD_PRINT + MENUITEM "Close", IDM_PROD_CLOSE + } + POPUP "Help" + { + MENUITEM "About...", IDM_PROD_ABOUT + } +} + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW DIALOG 0, 0, 248, 228 +STYLE DS_3DLOOK | DS_CENTER | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_THICKFRAME | WS_SYSMENU +EXSTYLE WS_EX_WINDOWEDGE +CAPTION "Product" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Product Number:", IDC_PROD_STATIC1, 25, 28, 54, 8, SS_LEFT + LTEXT "Product Name:", IDC_PROD_STATIC2, 25, 53, 48, 8, SS_LEFT + LTEXT "List Price:", IDC_PROD_STATIC3, 25, 78, 32, 8, SS_LEFT + LTEXT "UOM:", IDC_PROD_STATIC5, 151, 78, 20, 8, SS_LEFT + LTEXT "Description", IDC_PROD_STATIC4, 25, 103, 36, 8, SS_LEFT + EDITTEXT IDC_PROD_NO, 95, 25, 50, 14, NOT WS_TABSTOP | ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_NAME, 95, 51, 130, 13, ES_AUTOHSCROLL | ES_READONLY + EDITTEXT IDC_PROD_LIST_PRICE, 95, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + EDITTEXT IDC_PROD_UOM, 175, 75, 40, 14, ES_AUTOHSCROLL | ES_READONLY, WS_EX_RIGHT + GROUPBOX "Size Category", IDC_PROD_SIZE_GROUP, 31, 151, 189, 30, WS_GROUP, WS_EX_CLIENTEDGE + AUTORADIOBUTTON "Small", IDC_PROD_RADIO_SMALL, 46, 165, 33, 8, WS_DISABLED + AUTORADIOBUTTON "Medium", IDC_PROD_RADIO_MEDIUM, 110, 165, 41, 8, WS_DISABLED + AUTORADIOBUTTON "Large", IDC_PROD_RADIO_LARGE, 168, 165, 34, 8, WS_DISABLED + DEFPUSHBUTTON "Save Changes", IDC_PROD_SAVE_CHANGES, 180, 195, 52, 14, WS_DISABLED + EDITTEXT IDC_PROD_DESCRIPTION, 95, 100, 125, 30, ES_MULTILINE +} + + + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDD_PRODUCT_VIEW_ABOUT DIALOG 0, 0, 204, 109 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU +CAPTION "About Product View" +FONT 8, "Ms Shell Dlg" +{ + DEFPUSHBUTTON "OK", IDOK, 143, 88, 50, 14 + CONTROL "", IDC_PRODABT_ICON_PLACE, WC_STATIC, SS_BITMAP | SS_NOTIFY | SS_REALSIZECONTROL, 16, 7, 102, 71 + LTEXT "A view of a Product component.", IDC_PRODABT_STATIC1, 15, 84, 110, 15, SS_LEFT + LTEXT "An example of an About box using .ResDialog.", IDC_PRODABT_STATIC2, 130, 9, 65, 65, SS_LEFT +} + + + +// +// Icon resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +IDI_PROD_DLGICON ICON ".\\res\\Product.ico" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.rex new file mode 100755 index 0000000..ea39788 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/ProductView.rex @@ -0,0 +1,501 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: ProductView.rex - The ProductView component v03-00 18May13 + + Contains: classes "ProductView", "AboutDialog", and "HRSpv". + + Pre-requisites: ProductView.dll, ProductView.h, Pproduct.ico, ProductIcon.bmp, + Support\NumberOnlyEditEx.cls (copied from ooDialog Samples + into the folder Exercise06\Support) + + Description: A sample Product View component - part of the sample + Order Management application. + + Outstanding Problems: None reported. + + Changes: + v01-00 03Jun12: First version for Exercise05. + v01-01 06Jun12: Minor changes for Exercise06. + v02-00 11Jan12: Removed stand-alone operation, plus some comments. + Method 'getData' removed (now redundant). + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v03-00 24May13: ProducView now inherits directly from ResDialog plus the View + & Compoment mixins. + 18Jun13: Make product a drag/drop source - added stmt in initDialog. +------------------------------------------------------------------------------*/ + +.Application~addToConstDir("Product\ProductView.h") + + +::requires "ooDialog.cls" +::requires "Support\NumberOnlyEditEx.cls" +::requires "Product\ProductModelsData.rex" +::REQUIRES "support\View.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ProductView v03-00 18Jun13 + ----------- + The "view" part of the Product component. Now designed to operate from its own + folder. Should be invoked from immediately outside the Product folder. + [interface (idl format)] + + Changes: + v01-00 03Jun12: First version. + v01-01 06Jun12: Minor changes for Exercise06. + v02-00 09Jan13: Removed stand-alone startup (not now needed), plus some + comments. + v03-00 24May13: ProducView now inherits directly from ResDialog plus the + View & Component mixins. + 18Jun13: Make product a drag/drop source - added stmt in initDialog. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS ProductView SUBCLASS ResDialog PUBLIC INHERIT View Component + + ::ATTRIBUTE dialogState PRIVATE -- States are: 'closable' or 'inUpdate". + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC UNGUARDED + use arg idModel, rootDlg --Ex07 + --say ".ProductView-newInstance-01: model, rootDlg =" idModel rootDlg + .Application~addToConstDir("Product\ProductView.h") + -- Create an instance of ProductView and show it: + dlg = self~new("Product\res\ProductView.dll", IDD_PRODUCT_VIEW) + dlg~activate(idModel, rootDlg) --Ex07 + return dlg --Ex07 + + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Dialog Setup Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + forward class (super) continue + self~initView -- v03 + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose prodData + use arg idModel, rootDlg, prodData --Ex07- note: prodData is a ProductDT. + forward class (super) continue -- MVF: required to get Model's data + dirdata = RESULT -- MVF: model's data returned by super + prodData = dirData[DT] -- dirData is a directory - 'DT' + -- for 'DataType' is in the directory. + self~dialogState = "closable" + self~popUpAsChild(rootDlg,"SHOWTOP",,"IDI_PROD_DLGICON") + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose menuBar prodControls prodData --Ex07 + --say "ProductView-initDialog-01" + + menuBar = .BinaryMenuBar~new(self, IDR_PRODUCT_VIEW_MENU, , self, .true) + + prodControls = .Directory~new + prodControls[ecProdNo] = self~newEdit("IDC_PROD_NO") + prodControls[ecProdName] = self~newEdit("IDC_PROD_NAME") + prodControls[ecProdPrice] = self~newEdit("IDC_PROD_LIST_PRICE") + prodControls[ecUOM] = self~newEdit("IDC_PROD_UOM") + prodControls[ecProdDescr] = self~newEdit("IDC_PROD_DESCRIPTION") + prodControls[gbSizes] = self~newEdit("IDC_PROD_SIZE_GROUP") + prodControls[rbSmall] = self~newRadioButton("IDC_PROD_RADIO_SMALL") + prodControls[rbMedium] = self~newRadioButton("IDC_PROD_RADIO_MEDIUM") + prodControls[rbLarge] = self~newRadioButton("IDC_PROD_RADIO_LARGE") + prodControls[pbSaveChanges] = self~newPushButton("IDC_PROD_SAVE_CHANGES") + self~connectButtonEvent("IDC_PROD_SAVE_CHANGES","CLICKED",saveChanges) + + -- Use NumberOnlyEditEx.cls to enforce numeric only entry for Price and UOM: + prodControls[ecProdPrice]~initDecimalOnly(2,.false) -- 2 decimal places, no sign. + prodControls[ecUOM]~initDecimalOnly(0,.false) -- 0 decimal places, no sign. + prodControls[ecProdPrice]~connectCharEvent(onChar) + prodControls[ecUOM]~connectCharEvent(onChar) + + self~showData -- Show the data + + -- Make product a drag/drop source: + r = self~dmSetAsSource:super("Product\res\Product.cur") + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - MenuBar Events: + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD updateProduct UNGUARDED + expose prodControls + + -- Enable the controls to allow changes to the data: + prodControls[ecProdName]~setReadOnly(.false) + prodControls[ecProdPrice]~setReadOnly(.false) + prodControls[ecUOM]~setReadOnly(.false) + prodControls[ecProdDescr]~setReadOnly(.false) + prodControls[rbSmall]~enable + prodControls[rbMedium]~enable + prodControls[rbLarge]~enable + self~enableControl("IDC_PROD_SAVE_CHANGES") + prodControls[pbSaveChanges]~state = "FOCUS" -- Put input focus on the button + self~tabToNext() -- put text cursor on Product Description + -- (as if the user had pressed tab) + self~dialogState = "inUpdate" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD refreshData UNGUARDED + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~showData + self~dialogState = "closable" + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD print UNGUARDED + ans = MessageDialog(.HRSpv~printMsg) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD close UNGUARDED + return self~cancel:super + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD about UNGUARDED + dlg = .AboutDialog~new("ProductView.dll", IDD_PRODUCT_VIEW_ABOUT) + dlg~execute("SHOWTOP") + + + /*---------------------------------------------------------------------------- + Event Handler Methods - PushButton Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "Save Changes" - Collects new data, checks if there has indeed been a + change, and if not, issues a warning msg. Disables the + button when valid changes made. */ + ::METHOD saveChanges UNGUARDED + expose prodControls prodData + + -- Transform data from view format (as in controls) to app format (a directory): + newProdData = self~xformView2App(prodControls) + + -- Check if anything's changed; if not, show msgbox and exit with controls enabled. + -- If changed, go on to validate data. + result = self~checkForChanges(newProdData) + if result = .false then do + msg = .HRSpv~nilSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","WARNING","DEFBUTTON2 APPLMODAL") + return + end + + -- Now validate data: + result = self~validate(newProdData) -- returns a null string or error messages. + -- Better would be a set of error numbers. + -- If no problems, then show msgbox and go on to disable controls. + if result = "" then do + msg = .HRSpv~saved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","INFORMATION","DEFBUTTON1 APPLMODAL") + end + -- If problems, then show msgbox and leave user to try again or refresh or exit. + else do + msg = result||.EndOfLine||.HRSpv~notSaved + hwnd = self~dlgHandle + answer = MessageDialog(msg,hwnd,.HRSpv~updateProd,"OK","ERROR","DEFBUTTON1 APPLMODAL") + return + end + + -- Send new data to be checked by CustomerModel object (not implemented). + + -- Disable controls that were enabled by menu "ActionsFile-->Update" selection: + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUom]~setReadOnly(.true) + if newProdData~size \= "S" then prodControls[rbSmall]~disable + if newProdData~size \= "M" then prodControls[rbMedium]~disable + if newProdData~size \= "L" then prodControls[rbLarge]~disable + self~disableControl("IDC_PROD_SAVE_CHANGES") + self~dialogState = "closable" + + prodData = newProdData + say "ProductView-saveChanges: new values are:" + prodData~list + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Handler Methods - Keyboard Events + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onChar UNGUARDED + -- called for each character entered in the price or UOM fields. + forward to (arg(6)) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + "OK" - This is a no-op method that over-rides the default Windows action + of 'close window' for an Enter key --*/ + ::METHOD ok unguarded + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD cancel + -- If in the process of updating, then ask whether any changes should be + -- thrown away and dialog closed. If yes then close by calling the superclass, + -- else nop. If not in update, then close immediately + if self~dialogState = "inUpdate" then do + ans = MessageDialog(.HRSpv~closeInUpdate, self~dlgHandle, .HRSpv~updateIP, "YESNO", "WARNING", "DEFBUTTON2") + if ans = .PlainBaseDialog~IDYES then return self~cancel:super + else nop + end + else return self~cancel:super + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showData + -- Transfrom data (where necessary) to display format, and then disable controls. + expose prodControls prodData + -- Set data in controls: + prodControls[ecProdNo]~setText( prodData~number ) + prodControls[ecProdName]~setText( prodData~name ) + -- Price in prodData has no decimal point - 2 decimal places are implied - hence /100 for display. + -- Pad with zeros if necessary. + displayPrice = (prodData~price/100)~format(,2) -- corrected in Ex07 + prodControls[ecProdPrice]~setText(displayPrice) + prodControls[ecUOM]~settext( proddata~uom ) + prodControls[ecProdDescr]~setText(prodData~description ) + size = prodData~size + -- Disable controls + prodControls[ecProdName]~setReadOnly(.true) + prodControls[ecProdPrice]~setReadOnly(.true) + prodControls[ecUOM]~setReadOnly(.true) + prodControls[ecProdDescr]~setReadOnly(.true) + prodControls[rbSmall]~disable + prodControls[rbMedium]~disable + prodControls[rbLarge]~disable + -- But check correct button and enable it to highlight it to the user: + select + when size = "S" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_SMALL") + prodcontrols[rbSmall]~enable + end + when size = "M" then do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_MEDIUM") + prodcontrols[rbMedium]~enable + end + otherwise do + .RadioButton~checkInGroup(self,"IDC_PROD_RADIO_SMALL","IDC_PROD_RADIO_LARGE","IDC_PROD_RADIO_LARGE") + prodcontrols[rbLarge]~enable + end + end + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD checkForChanges + -- Check whether any data has actually changed when "Save Changes" button + -- has been pressed. Return .true if data changed, else returns .false. + expose prodData + use arg newProdData + + changed = .false + select + when newProdData~name \= prodData~name then changed = .true + when newProdData~price \= prodData~price then changed = .true + when newProdData~uom \= prodData~uom then changed = .true + when newProdData~description \= prodData~description then changed = .true + when newProdData~size \= ProdData~size then changed = .true + otherwise nop + end + return changed + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD validate + -- Validation: 1. Check price/UOM not changed > 50% up or down. + -- 2. Cannot change from Large to Small without UOM increasing + -- by at least 100%; nor from Small to Large without + -- decreasing by more than 50%. + -- 3. Product Description <= 100 characters. + -- 4. Product Name <= 30 characters. + -- Returns string of messages - the null string if all OK. + expose prodData + use arg newProdData + msg = "" + + -- Check Price (catches decimal point errors also): + price = prodData~price; newPrice = newProdData~price + oldUom = prodData~uom; newUom = newProdData~uom -- 'oldUom - avoids name conflict with 'uom' in newProddata~uom. + if ((price/oldUom)*1.5 < newPrice/newUom) | (newPrice/newUom < (price/oldUom)/2) then do + msg = msg||.HRSpv~badRatio||" " + end + + -- Check Size vs UOM: + if prodData~size = "L" & newProdData~size = "S" - -- Large to Small + & prodData~uom/2 < newProdData~uom then do + msg = msg||.HRSpv~uomTooBig||" " + end + if prodData~size = "S" & newProdData~size = "L" - -- Small to Large + & prodData~uom*2 > newProdData~uom then do + msg = msg||.HRSpv~uomTooSmall||" " + end + + -- Check Product Description length: + if newProdData.description~length > 80 then do + msg = msg||.HRSpv~descrTooBig||" " + end + + -- Check Product Name length: + if newProdData~name~length > 30 then do + msg = msg||.HRSpv~prodNameTooBig + end + + return msg + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD xformView2App + -- Transforms Product Data from View form (in the GUI controls) to + -- App form (a directory with address as an array). + expose prodControls + prodData = .ProductDT~new + prodData~number = prodControls[ecProdNo]~gettext() + prodData~name = prodControls[ecProdName]~getText() + price = prodControls[ecProdPrice]~getText() + -- Data entered has or assumes a decimal point; but data in "application" + -- is a whole number (e.g. $42.42 is recorded in the database as "4242"). + -- So re-format data from decimal to whole number: + priceTwoDecs = price~format(,2) -- force 2 dec positions + -- Re-display price properly formatted (in case the user did not format correctly - e.g. entered "42" or "38.4"): + prodControls[ecProdPrice]~setText(priceTwoDecs) + -- Now format price to "application" format: + price = (priceTwoDecs*100)~format(,0) -- multiply by 100 and then force whole number. + prodData~price = price + prodData~uom = prodControls[ecUOM]~getText() + prodData~description = prodControls[ecProdDescr]~getText() + select + when prodControls[rbSmall]~checked then prodData~size = "S" + when prodControls[rbMedium]~checked then prodData~size = "M" + otherwise prodData~size = "L" + end + + return prodData + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + AboutDialog v01-00 03Jun12 + ------------- + The "About" class - shows a dialog box that includes a bitmap - part of the + ProductView component. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS AboutDialog SUBCLASS ResDialog + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method initDialog + expose font image + resImage = .ResourceImage~new(self) -- Create an instance of a resource image + image = resImage~getImage(IDB_PROD_ICON) -- Create an image from the Product bitmap + stImage = self~newStatic(IDC_PRODABT_ICON_PLACE)~setImage(image) -- Create a static text control and set the image in it + font = self~createFontEx("Ariel", 12) -- Create up a largish font with which to display text and ... + self~newStatic(IDC_PRODABT_STATIC2)~setFont(font) -- ... set the static text to use that font. + -- Provide for a double-click in Product icon: + self~connectStaticNotify("IDC_PRODABT_ICON_PLACE", "DBLCLK", showMsgBox) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method showMsgBox + --say "AboutDialog-showMsgBox-01." + ans = MessageDialog(.HRSpv~AboutDblClick) + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method leaving + expose font image + self~deleteFont(font) + image~release() + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSpv) v01-00 03Jun12 + ------------------------------ + The HRSpv class provides constant character strings for user-visible messages. + + Changes: + v00-03 11Feb12: Changed class name NRS to HRSpv + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSpv PRIVATE -- Human-Readable Strings + ::CONSTANT AboutDblClick "You double-clicked!" + ::CONSTANT badRatio "The new price/UOM ratio cannot be changed more than 50% up or down." + ::CONSTANT closeInUpdate "Any changes made will be lost. Exit anyway?" + ::CONSTANT descrTooBig "The Product Description is too long." + ::CONSTANT nilSaved "Nothing was changed! Data not saved." + ::CONSTANT notSaved "Changes Not Saved!" + ::CONSTANT prodNameTooBig "The Product Name is too long." + ::CONSTANT saved "Changes saved." + ::CONSTANT uomTooBig "The new UOM is too large." + ::CONSTANT uomTooSmall "The new UOM is too small." + ::CONSTANT updateIP "Update in process" + ::CONSTANT updateProd "Update Product" + ::CONSTANT printMsg "The 'Print...' menu item is not yet implemented." + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProdList.BMP b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProdList.BMP new file mode 100644 index 0000000..6e4e8c1 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProdList.BMP differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProdList.ico b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProdList.ico new file mode 100644 index 0000000..51333f8 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProdList.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/Product.cur b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/Product.cur new file mode 100644 index 0000000..4ccb17d Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/Product.cur differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/Product.ico b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/Product.ico new file mode 100644 index 0000000..64a7c78 Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/Product.ico differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProductIcon.bmp b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProductIcon.bmp new file mode 100644 index 0000000..13ca9ac Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProductIcon.bmp differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProductView.dll b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProductView.dll new file mode 100644 index 0000000..9ba536c Binary files /dev/null and b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/ProductView.dll differ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/res.mak b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/res.mak new file mode 100644 index 0000000..42aefbc --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Product/res/res.mak @@ -0,0 +1,50 @@ +#/*----------------------------------------------------------------------------*/ +#/* */ +#/* Copyright (c) 2013-2014 Rexx Language Association. All rights reserved. */ +#/* */ +#/* This program and the accompanying materials are made available under */ +#/* the terms of the Common Public License v1.0 which accompanies this */ +#/* distribution. A copy is also available at the following address: */ +#/* https://www.oorexx.org/license.html */ +#/* */ +#/* 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. */ +#/* */ +#/* Neither the name of Rexx Language Association nor the names */ +#/* of its contributors may be used to endorse or promote products */ +#/* derived from this software without specific prior written permission. */ +#/* */ +#/* 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 */ +#/* OWNER 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. */ +#/* */ +#/*----------------------------------------------------------------------------*/ + +# nMake-compatible Make file for the ProductView resource-only DLL. + +all: ProductView.dll + +ProductView.dll: ProductView.res + link /NOLOGO $(@B).res /NOENTRY /DLL /MACHINE:$(MACHINE) /OUT:$(@B).dll + +# Create .res from .rc +ProductView.res: ..\ProductView.rc + rc -r -fo$(@B).res ..\$(@B).rc + +clean: + del *.res *.dll 1>nul 2>&1 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/RequiresList.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/RequiresList.rex new file mode 100755 index 0000000..7e3b5db --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/RequiresList.rex @@ -0,0 +1,87 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The Order Management Application + Startup.rex v01-02 26May13 + + Description: This file is the "application" or "root" or "starter" part + of the sample Order Management application. + + Changes: + v01-00 06Jun12: First version. + v01-01 07Aug12: Support for ObjectMgr and ViewMgr added. MessageSender is + optional. + 11Jan13: Deleted Commented-out startup of MessageSender. + 21Mar13: Added Copyright notice. + v01-02 01Apr13: After ooDialog 4.2.2, "Samples" folder changed name to + "Extras", so change to ::Requires needed. + 26May13: Corrected paths for ::REQUIRES afrer re-factoring. + +------------------------------------------------------------------------------*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + RequiresList v01-01 25May13 + ---- + The list of files containing classes invoked by the ObjectMgr + + Changes: + v01-00 16Sep12: First version. + 11Jan13: Commented-out 'say' instruction. + v01-01 25May13: Changed ::REQUIRES for Person is folder Person2 which uses + new mixins introduced in Ex08. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--say "RequiresList-01." +::REQUIRES "Customer\CustomerView.rex" +::REQUIRES "Customer\CustomerModelsData.rex" +::REQUIRES "Customer\CustomerListView.rex" +::REQUIRES "Product\ProductModelsData.rex" +::REQUIRES "Product\ProductListView.rex" +::REQUIRES "Order\OrderFormView.rex" +::REQUIRES "Order\OrderListView.rex" +::REQUIRES "Order\OrderModelsData.rex" +::REQUIRES "Order\OrderView.rex" +--::REQUIRES "Extras\Wow4\WowView.rex" +--::REQUIRES "Extras\Wow4\WowModel.rex" +--::REQUIRES "Extras\Wow4\WowData.rex" +::REQUIRES "Extras\Person\PersonView.rex" +::REQUIRES "Extras\Person\PersonModelData.rex" +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Startup.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Startup.rex new file mode 100755 index 0000000..bbfd444 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Startup.rex @@ -0,0 +1,81 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: The Order Management Application + Startup.rex v01-02 25May13 + + Description: This file is the "application" or "root" or "starter" part + of the sample Order Management application. + + Changes: + v01-00 06Jun12: First version. + v01-01 07Aug12: Support for ObjectMgr and ViewMgr added. MessageSender is + optional. + 11Jan13: Deleted Commented-out startup of MessageSender. + 01Apr13: After ooDialog 4.2.2, Support folder moved to exercise + folder, so change to ::Requires needed. + v01-02 11May13: Added instantiation of Event Manager (class EventMgr) + 25May13: mods to comments only. + +------------------------------------------------------------------------------*/ + +parse arg pwOption +if pwOption = "enterPW" then do + pwd = PasswordBox("Please enter your password","Sign In") + if pwd \= "Password" then exit +end + +-- Set application defaults: +.Application~setDefaults("O", , .false) + +-- Create Object Manager, View Manager, and Event Manager: +om = .ObjectMgr~new +vm = .ViewMgr~new +em = .EventMgr~new +dm = .DragMgr~new + +-- Start OrderMgrView: +.OrderMgrView~newInstance + +::REQUIRES "OrderMgr\OrderMgrView.rex" +::REQUIRES "Support\ObjectMgr.rex" +::REQUIRES "Support\ViewMgr.rex" +::REQUIRES "Support\EventMgr.rex" +::REQUIRES "Support\DragMgr.rex" +::REQUIRES "Support\MessageSender.rex" + +/******************************************************************************/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/Component.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/Component.rex new file mode 100755 index 0000000..ac37348 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/Component.rex @@ -0,0 +1,118 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Support + Exercise 08: View.rex + + Component v01-00 13May13 + --------- + A superclass for all components (View, Model and data). Part of the MVF. + + Contains: class: "Component" + + Description: *** To be provided. *** + + Pre-requisites: None. + + Outstanding Problems: None reported. + + Changes: + v01-00 13May13: First Version. + +------------------------------------------------------------------------------*/ + + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Object v01-00 13May13 + ------ + The superclass for all application components. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::CLASS View SUBCLASS RcDialog PUBLIC +::CLASS Component PUBLIC MIXINCLASS Object + + + /*---------------------------------------------------------------------------- + init - initialises the dialog - not used. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method init + say "Component-init-01." + + ::METHOD saySomething + say "Component-saySomething: Hi there!." + return .true + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Event Management + --------------------------------------------------------------------------*/ + + /*---------------------------------------------------------------------------- + registerInterest + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD registerInterest + use strict arg eventName, interestedObject + eventMgr = .local~my.EventMgr + --say "Component~registerInterest-01: event =" eventName||"; object =" interestedObject + r = eventMgr~registerInterest(eventName,interestedObject) + return r + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + triggerEvent + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD triggerEvent + use arg eventName + eventMgr = .local~my.EventMgr + --say "Component-triggerEvent-01: event =" eventName||"; r =" r + r = eventMgr~triggerEvent(eventName) -- if r = 0 then no-one's registered. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + deRegisterInterest + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD deRegisterInterest + use arg eventName, uninterestedObject + eventMgr = .local~my.EventMgr + --say "Component-deRegisterIntrest-01: event =" eventName||"; object =" uninterestedObject||" r =" r + r = eventMgr~deregisterInterest(eventName, uninterestedObject) -- if r = 0 then no-one's registered. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/DragMgr.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/DragMgr.rex new file mode 100755 index 0000000..a6d6bbd --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/DragMgr.rex @@ -0,0 +1,352 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Exercise08 + + Support - DragMgr v01-00 26Jun13 + --------------------- + A singleton component that manages direct manipulation. + + Notes: A 'source' view is a dialog that's "picked up" by pressing and holding + button 1 (usually the left button) of the mouse. + A 'target' view is a dialog that's dropped onto by releasing + button 1 over the target dialog. + + Interface DragMgr { + setTarget + setSource + removeDlg + list lists tables of source & target dialogs. + dmPickup captures mouse - i.e. sets the mouse capture to the window + of this mouse instance. + moving If over a target (as supered by a dlg instance): + - check if this is a valid target AND is topmost window + - If over a valid drop area send dmQueryDrop(sourceDlg,mousePos) + to target. + - If response is .true then show dropOKCursor + else show noDropCursor (system-provided). + dmDrop - If cursor is no-drop then no-op. + Else send dmDrop(sourceDlg) to drop target. + } + + Changes: + v01-00 06Jun13: First version. + 18Jun13: Changed 'drop' method name to 'dmDrop'. + 26Jun13: Change 'queryTables' method name to 'list' (to conform with + other Managers). + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES ooDialog.cls +::REQUIRES "Order\OrderModelsData.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================*/ +::CLASS DragMgr PUBLIC + + ::ATTRIBUTE targetDialogs PRIVATE -- dlg - hwnd, dropArea + ::ATTRIBUTE sourceDialogs PRIVATE -- dlg - mouse, dropOkCursor, pickupArea + ::ATTRIBUTE dragInProgress + --::ATTRIBUTE draggingSourceDlg PRIVATE + + + /*---------------------------------------------------------------------------- + init - initialises the Drag Manager + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose icons dragging cursorIsNoDrop noDropCursor + .local~my.DragMgr = self + --say "DragMgr-init-01: .local~my.DragMgr =" .local~my.DragMgr + self~dragInProgress = .false + self~targetDialogs = .Table~new -- Index = dlg id + -- Item = an Array: hwnd, dropArea, + self~sourceDialogs = .Table~new -- Index = dlg id, + -- Item = an Array: mouse, cursor, pickupArea + noDropCursor = .Mouse~loadCursor("NO") + if noDropCursor == 0 then do + say "DragManager-init-02:" .HRSdm~badNoDropCursor .SystemErrorCode + end + + cursorIsNoDrop = .false + dragging = .false + + return self + + + /*---------------------------------------------------------------------------- + setTarget - Adds a target view component to the Targets table + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setTarget PUBLIC + --expose targetDialogs + use strict arg dlg, hwnd, dropArea + items = .Array~new + items[1] = hwnd; items[2] = dropArea + self~targetDialogs[dlg] = items + + + /*---------------------------------------------------------------------------- + setSource - Adds a source view component to the Targets table + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setSource PUBLIC + --expose sourceDialogs dropOkCursor + --use strict arg dlg, mouse, cursorFile, pickupArea, control + use strict arg sourceWin, mouse, cursorFile, pickupArea, srcDlg -- *** + -- cursorFile is relative path and filename e.g. "bmp\customer.cur". + --say "DragManager-setSource-01: sourceWin, Area =" sourceWin||"," pickupArea + + dropOkCursor = .Mouse~loadCursorFromFile(cursorFile) + if dropOkCursor == 0 then do + say "DragManager-setSource-02:" .HRSdm~badOkCursor .SystemErrorCode + end + + items = .Array~new + items[1] = mouse; items[2] = dropOkCursor; + items[3] = pickupArea; items[4] = srcDlg + self~sourceDialogs[sourceWin] = items + + + /*---------------------------------------------------------------------------- + RemoveDlg - Removes a dialog from the Targets table when the dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD removeDlg PUBLIC + use strict arg dlg + -- Check in SourceDlgs: + self~sourceDialogs~remove(dlg) + self~targetDialogs~remove(dlg) + + + /*---------------------------------------------------------------------------- + dmPickup - Handles drag initiation when the user "picks up" a dialog. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD dmPickup PUBLIC + expose cursorIsNoDrop dragging dropOkCursor mouse noDropCursor oldCursor overTarget + use strict arg sourceWin, keyState, mousePos + + --say "DragMgr-dmPickup-00; sourceWin =" sourceWin + arrItems = self~sourceDialogs[sourceWin] -- mouse,srcCursor,pickupArea,sourceDlg + mouse = arrItems[1] + dropOkCursor = arrItems[2] + dragging = .false +--trace i + if keyState \== 'lButton' | \ mousePos~inRect(arrItems[3]) then return .false +--trace off + if mouse~dragDetect(mousePos) then do + --say "DragManager-dmPickup-01: dropOkCursor =" dropOkCursor + if dropOkCursor == 0 then do + nop --say "DragManager-dmPickup-02:" .HRSdm~badOkCursor .SystemErrorCode + end + --say 'DragManager-dmPickup-03: Detected dragging.' + mouse~capture() + oldCursor = mouse~setCursor(noDropCursor) + cursorIsNoDrop = .true + dragging = .true + validTarget = .false + overTarget = .false + end + --say "DragManager-dmPickup-04: dragging =" dragging + return + + + /*---------------------------------------------------------------------------- + moving - Handles mouse movements - detects when mouse over a dialog, and if + it's a 'target' dialog, asks it whether it will accept a drop. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD moving PUBLIC + expose cursorIsNoDrop dragging dropOkCursor mouse noDropCursor overTarget dropTarget + use arg sourceWin, sourceDlg, keyState, mousePos + -- overTarget - true when the cursor is over a potential target dialog, + -- regardless of whether the target refuses a drop or not. + -- sourceWin is the window (dialog or control) that has captured the mouse. + -- Note: new APIs introduced in ooDialog Build 7449 + --say "DragManager-moving-00; sourceDlg, sourceWin, dragging =" sourceDlg||"," sourceWin||"," dragging + if \dragging then return + --say "DragManager-moving-00A: Flags:" cursorIsNoDrop dragging overTarget + -- Find out if mouse is over a target dialog: + targetDlg = 0 + do i over self~targetDialogs -- items: 1 = hwnd, 2 = droparea + targetHwnd = self~targetDialogs[i][1] + droparea = self~targetDialogs[i][2] + --say "DragMgr-moving-00B: targetHwnd, dropArea =" targetHwnd||"," dropArea + -- Prevent showing drop when over a target that is under another window: + screenPt = mousePos~copy() -- Point in source dialog (i.e. top left of dlg is 0,0) + --say "DragManager-moving-01: screenPt =" screenPt + sourceWin~client2screen(screenPt) + --sourceDlg~client2screen(screenPt) -- screenPt is set to screen position (i.e. top left of screen is 0,0) + --say "DragManager-moving-02: screenPt =" screenPt + screenHwnd = .DlgUtil~windowFromPoint(screenPt) -- Get hwd of topmost window that mouse is over + --say "DragManager-moving-03: screenHwnd =" screenHwnd + + pDlg = mousePos~copy + --sourceDlg~mapWindowPoints(targetHwnd, pDlg) -- MousePos relative to targetHwnd + sourceWin~mapWindowPoints(targetHwnd, pDlg) -- MousePos relative to targetHwnd + --say "DragManager-moving-04: pDlg =" pDlg + childHwnd = i~childWindowFromPoint(pDlg) -- Get the hwnd visible under mouse pointer + --say "DragManager-moving-05: childHwnd, pDlg =" childHwnd||"." pDlg + + if screenHwnd == childHwnd then do + p1 = mousePos~copy() + --sourceDlg~mapWindowPoints(targetHwnd,p1) + sourceWin~mapWindowPoints(targetHwnd,p1) + --say "DragManager-moving-06: p1 =" p1 + if p1~inRect(droparea) then do + targetDlg = i + -- next two statements for debug only + --tgtNumber = i~queryNumber + --say "DragManager-moving-07: Target found - hwnd =" targetHwnd tgtNumber + leave -- Stop looping - target found! + end + end + end + --say "DragManager-moving-060." + if targetDlg \= 0 then do -- If we're over a target + if targetDlg = sourceDlg then return -- If target is also the source + -- then it's not a target (in this version!). + if \overTarget then do -- if first time over target + + --Get the model class for the source View: + objectMgr = .local~my.ObjectMgr + sourceClassName = objectMgr~modelClassFromView(sourceDlg) + targetClassName = objectMgr~modelClassFromView(targetDlg) + --say "DragMgr-moving-06a: source Class =" sourceClassName + --say "DragMgr-moving-06b: target Class =" targetClassName + --parse value a~class with . className . + interpret "r = ."||targetClassName||"~dmQueryDrop("||sourceClassName||")" + --say "DragManager-moving-07a: first time - queryDrop returned" r + if r = .true then do -- if target accepts a drop + validTarget = .true + dropTarget = targetDlg -- for drop method ... + end + else do -- if target refuses drop + validTarget = .false + overTarget = .true + dropTarget = .false + return + end + -- It's a valid target! + overTarget = .true + mouse~setCursor(dropOkCursor) + cursorIsNoDrop = .false + end + end + else do -- Not over a target + if overTarget then do -- Mouse has just come off target + validTarget = .false + overTarget = .false + mouse~setCursor(noDropCursor) + cursorIsNoDrop = .true + dropTargetDlg = 0 + end + end + + + + /*---------------------------------------------------------------------------- + dmDrop - Handles things when the user drops onto a target. + Invoked by "View" (the superclass). + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD dmDrop PUBLIC + expose cursorIsNoDrop dragging mouse oldCursor dropTarget + use strict arg sourceDlg, keyState, mousePos + --say "DragManager-dmDrop-01: the mouse is at ("mousePos~x", "mousePos~y")" + --say "DragManager-dmDrop-02: cursorIsNoDrop =" cursorIsNoDrop + + if dragging then do + okayToDrop = (cursorIsNoDrop \== .true) -- if cind = .false then okToDrop is true; + -- if cind = .true then okToDrop is false + dragging = .false + cursorIsNoDrop = .false + mouse~releaseCapture() + mouse~setCursor(oldCursor) + --say "DragManager-dmDrop-02a: mouse released; old cursor set." + -- Jiggle the mouse so it is redrawn immediately (OS: seems to make no diff.) + p = mouse~getCursorPos; p~incr; mouse~setCursorPos(p) + + if okayToDrop then do + --say "DragManager-dmDrop-03: sourceDlg =" sourceDlg +-- objectMgr = .local~my.ObjectMgr +-- sourceClassName = objectMgr~modelClassFromView(sourceDlg) +-- targetClassName = objectMgr~modelClassFromView(targetDlg) + objectMgr = .local~my.ObjectMgr + sourceModelId = objectMgr~modelIdFromView(sourceDlg) + dropTarget~dmDrop(sourceModelId, sourceDlg) + --say "DragManager-dmDrop-04: Drop Happened OK!!" + end + else nop --say "DragManager-dmDrop-05: Drop Did Not Occur." + end + + return + + + /*---------------------------------------------------------------------------- + list - A debug mehod that lists source and target dialogs on the console. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD list PUBLIC -- Debug method + say; say "=======================================" + say "DragManager Tables" + say "-------------------------------------" + say "Sources:" + --say "asking dlg =" dlg + do i over self~SourceDialogs + say "i =" i + items = self~SourceDialogs[i] + say "mouse = " items[1] + say "cursor = " items[2] + say "area = " items[3] + say "dialog = " items[4] + end + say "-------------------------------------" + say "Targets:" + arr = self~targetDialogs[dlg] + do i over self~targetDialogs + say "i =" i + items = self~TargetDialogs[i] + say "hwnd = " items[1] + say "dropArea = " items[2] + end + say "======================================="; say + +/*============================================================================*/ + + +/*============================================================================== + Human-Readable Strings (HRSdm) v00-01 23Jan12 + -------- + The HRSdm class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSdm PRIVATE -- Human-Readable Strings + ::CONSTANT badNoDropCursor "Error loading NoDrop Cursor, sys error code:" + ::CONSTANT badOkCursor "Error loading DropOK Cursor, sys error code:" diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/EventMgr.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/EventMgr.rex new file mode 100755 index 0000000..44b850e --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/EventMgr.rex @@ -0,0 +1,134 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: EventMgr.rex v01-00 11May13 + + Contains: class: "EventMgr" + + Description: The Event Manager records interest in events, and sends + notification messages when the event is triggered by receipt of + a "triggerEvent" message. + + Pre-requisites: None. + + Outstanding Problems: None reported. + + Changes: + 11May13: First Version. + +------------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + EventMgr v01-00 09May13 + -------- + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + ::CLASS EventMgr PUBLIC + + ::ATTRIBUTE dirEvents PRIVATE + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + -- Initiated by the MVF object. + self~dirEvents = .directory~new + .local~my.EventMgr = self + return self + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD registerInterest PUBLIC + use strict arg event, object + -- Check if dir has an entry for this event yet + -- NOTE: In this version: + -- Multiple registrations by an object for same event NOT checked! + -- That means if it doesn't de-register, it gets multiple notifies! + if self~dirEvents[event] = .nil then do + --say "EventList-registerInterest-01: No event array for '"||event||"'" + arr = .array~new + self~dirEvents[event]=arr + end + --say "EventMgr-registerInterest-02: event= '" ||event||"' object = '"||object + arr = self~dirEvents[event] + if arr~hasItem(object) then nop -- no point in registering twice! + else arr~append(object) + return .true + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD triggerEvent PUBLIC + -- If event not registered, returns .false; else invokes "notify" on all + -- objects registered for the event and returns .true. + use strict arg event + --say "EventMgr-triggerEvent-01: event =" event + arr = self~dirEvents[event] + if arr = .nil then return .false -- event not registered. + else do + do i over arr + --say "EventMgr-triggerEvent-02: sending 'notify' for" event "to" i + i~notify(event) + end + return .true + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD deRegisterInterest PUBLIC + use strict arg event, object + -- Returns .false if event not registered or if object not registered; + -- else removes the object from the event array and returns .true. + use strict arg event, object + --say "EventMgr-deRegisterInterest-01: event =" event + arr = self~dirEvents[event] + if arr = .nil then return .false -- event not registered. + r = arr~removeItem(object) + if r = .nil then do -- object not found + return .false + end + return .true + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD list + say "EventMgr-list-01." + say "----Event-List---------------" + do i over self~dirEvents + arr = self~dirEvents[i] + str = "" + do j over arr + str = str||j||", " + end + say "Event '"||i||"':" str + end + say "-----------------------------"; say diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/GenericFile.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/GenericFile.rex new file mode 100755 index 0000000..6d27ceb --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/GenericFile.rex @@ -0,0 +1,274 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise08: GenericFile v02-00 24May13 + + Contains: class "GenericFile". + + Pre-requisites: None. + + Desription: A component that opens and reads a text file that has a specific + format. + Outstanding problems: None reported. + + Changes: + v01-00 + 21Jly12: First version. + 25Aug12: Moved file open from init method to a separate method. + 16Dec12: Trivial correction of a couple of comments. + 11Jan13: Commented-out 'say' instructions. + v02-00 + 24May13: Added inherit from the 'Component' mixin. + + Constraints: Format of each record must be: + recordId | field2 | field3 | .... | fieldn + Note that the RecordId or Key must be in the first column. + } +------------------------------------------------------------------------------*/ + +::REQUIRES "Support\Component.rex" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + GenericFile v01-01 24Aug12 + ----------- + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS GenericFile PUBLIC INHERIT Component + + ::ATTRIBUTE fileHeaders GET PUBLIC -- a 1D array of column labels/headers + ::ATTRIBUTE fileHeaders SET PRIVATE + ::ATTRIBUTE fileRecords GET PUBLIC -- a 2D array of records + ::ATTRIBUTE fileRecords SET PRIVATE + ::ATTRIBUTE fileArray GET PUBLIC -- a 1D array of raw data from the file. + ::ATTRIBUTE fileArray SET PRIVATE + ::ATTRIBUTE fileAsDirectory GET PUBLIC -- a directory containing: + -- * headers: a 1D array + -- * records: a 2D array + -- * count: the number of records + ::ATTRIBUTE fileAsDirectory SET PRIVATE + + /*---------------------------------------------------------------------------- + Class Methods - none. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Instance Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + init - Given a filename and the number of columns in the file, loads the + fileinto attribute 'fileArray', a 1-dimensional array where each item + is a single "raw" file line or record. + Returns the number of records in the file (or, if unsuccesful at reading + the file, returns 0 (.false) if file doesn't exist, or -1 if no records + in the file. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init PUBLIC + expose columns recordCount fileArray filename + use arg filename, columns + dirFile = self~readFile(fileName, columns) + if dirFile = .false | dirFile = -1 then return .false + self~fileAsDirectory = dirFile -- store whole file in the attribute + self~fileHeaders = dirFile[headers] -- store fileHeaders in the attribute + self~fileRecords = dirFile[records] -- store fileRecords in the attribute + recordCount = dirFile[count] -- store no. records in the attribute + return recordCount + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + readFile - Given a filename and the number of columns, reads a file and + returns it in "fileAsDirectory" format. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD readFile PRIVATE + expose recordCount + use strict arg fileName, columns + recordCount = 0 + --say "GenericFile-readFile-01: fileName =" fileName "columns =" columns + file = .stream~new(filename) + --say "GenericFile-readFile-02: file~query(exists):" file~query("exists") + if file~query("exists") = "" then do + say "GenericFile-readFile-03: file" filename " does not exist." + return .false + end + recordCount = file~lines + if recordCount < 2 then do + recordCount = 0 + return -1 -- Problem - no records, only headers - or nothing!. + end + recordCount = recordCount - 1 -- Exclude columns headers line from the count. + arrRawfile = file~makearray -- read file into an array; each line is an array item + file~close + --say "GenericFile-readFile-04:" filearray~string + self~fileArray = arrRawFile -- (deprecated) store "raw" file array in attribute + + -- Now turn the raw file data into a directory: + -- (1) get a 1D array of column headers or "field labels": + fileHeaders = arrRawFile[1] + arrFileHeaders = self~parseLine(fileHeaders, columns) + self~fileHeaders = arrFileHeaders + -- (2) get a 2D array of field values from data records: + arrFileRecords = .Array~new + do i=1 to recordCount -- get a 2D array of file records + arrRecord = self~parseLine(arrRawFile[i+1], columns) + do j = 1 to columns + arrFileRecords[i,j] = arrRecord[j] + end + end + self~fileRecords = arrFileRecords + -- (3) Build a directory containing headers, records, and lines (or record count). + dirFile = .directory~new + dirFile[headers] = arrFileHeaders + dirFile[count] = recordCount + dirFile[records] = arrFileRecords + return dirFile -- Returns a directory containing the file and file info. + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + parseLine - parse text from file line and place into an array. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD parseLine PRIVATE -- returns a 1D array of fields + use strict arg line, columns + arr = .Array~new + do i=1 to columns + parse var line field "|" line + field = field~strip + arr[i] = field + end + return arr + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + list - Lists a file in raw form on the console. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD list PUBLIC + expose recordCount filename + if recordCount = 0 then do + return .false + end + say; say "GenericFile-list: records in File '"||filename||"'" + say self~fileHeaders + do i=1 to recordCount + say self~fileRecords[i] + end + return .true + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getRecord - Given a "key", returns a directory containing the record data + associated with that key. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getRecord PUBLIC + -- Returns a directory containing the data for the record with the requested + -- key (dataKey). + expose recordCount columns + use strict arg dataKey + if dataKey = "" then return .false + --say "GenericFile-getRecord-01: dataKey=" dataKey + if recordCount = 0 then do + --say "GenericFile-getRecord: recordCount is zero - no records!" + return .false -- File empty or does not exist + end + + found = .false + do recordNo = 1 to recordCount + --say "GenericFile-getRecord-02: self~fileRecords dims:" self~fileRecords~dimension + recordId = self~fileRecords[recordNo,1] + --say "GenericFile-getRecord-03: recordId, dataKey = <"||recordId||">" "<"||dataKey||">" + if recordId = dataKey then do + found = .true; leave; + end + end + if \found then return .false -- Records exist, but specified record not found. + + dirData = .Directory~new + do j=1 to columns + header = self~FileHeaders[j] + dirData[header] = self~fileRecords[recordNo,j] + end + -- say "GenericFile-getRecord-04: Results:" + -- do i over dirData + -- say "'"||i||"' = '"||dirData[i]||"'" + -- end + --say "GenericFile-getRecord-05: record =" + return dirData + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + getFile - returns file as a directory, with indices 'headers', 'records', 'count'. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getFile PUBLIC + --say "GenericFile-getFile-01: self~fileAsDirectory =" self~fileAsDirectory + --do i over self~fileAsDirectory + --say "GenericFile-getFile-02 index & type =" i i~objectName + --end + --arrData = self~fileAsDirectory[records] + --say "GenericFile-getFile-03 - arrData =" arrData + --say "GenericFile-getFile-04 - arrData[1,1] =" arrData[1,1] + return self~fileAsDirectory + + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + ::METHOD update -- INCOMPLETE!!! + -- Given a record as a Directory, replaces the existing record with the + -- new data and writes the whole file to disk. + -- Returns .false (a) if a record with the provided key does not exist, or + -- (b) if values for all fields are not provided. + + expose recordCount columns fileArray fileName + use arg recordKey, dirRecord -- record key + new record + + -- Find the record: + do i=2 to recordCount + record = fileArray[i] + parse var record recordId . -- assume recordId is first column + if recordId = recordKey then do + found = .true; leave; + end + end + if \found then return .false -- Records exist, but specified record not found. + + -- found record is i'th. Now replace that array item with the new data: + currentRecord = fileArray[i] +---- This method is only opartially completed. !!!!!!!!!!!! + newrecord = "" + do j=1 to columns + --fileArray[i]field = + end + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.h b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.h new file mode 100644 index 0000000..8f5c4b5 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.h @@ -0,0 +1,14 @@ +#ifndef IDC_STATIC +#define IDC_STATIC (-1) +#endif + +#define DLG_MESSAGESENDER 103 +#define IDC_MS_ERRORMSG 1000 +#define IDC_MS_CLEAR 1002 +#define IDC_MS_DATA 1010 +#define IDC_MS_REPLY 1011 +#define IDC_MS_SEND 1012 +#define IDC_MS_COMPONENT 1015 +#define IDC_MS_METHOD 1016 +#define IDC_MS_STORETARGET 1018 +#define IDC_MS_STOREMETHOD 1020 diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.rc b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.rc new file mode 100644 index 0000000..8b3ad36 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.rc @@ -0,0 +1,35 @@ +// Generated by ResEdit 1.5.11 +// Copyright (C) 2006-2012 +// http://www.resedit.net + +#include +#include +#include +#include "MessageSender.h" + + + + +// +// Dialog resources +// +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +DLG_MESSAGESENDER DIALOG 0, 0, 262, 156 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_POPUP | WS_SYSMENU +CAPTION "Message Sender" +FONT 8, "Ms Shell Dlg" +{ + LTEXT "Target:", IDC_STATIC, 8, 17, 24, 8, SS_LEFT + LTEXT "Method:", IDC_STATIC, 8, 38, 27, 8, SS_LEFT + LTEXT "Data:", IDC_STATIC, 9, 60, 18, 8, SS_LEFT + EDITTEXT IDC_MS_DATA, 40, 55, 210, 35, WS_VSCROLL | ES_MULTILINE + LTEXT "Reply:", IDC_STATIC, 10, 101, 21, 8, SS_LEFT + EDITTEXT IDC_MS_REPLY, 40, 101, 210, 35, WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL | ES_MULTILINE + DEFPUSHBUTTON "Send", IDC_MS_SEND, 211, 15, 40, 14 + PUSHBUTTON "Clear", IDC_MS_CLEAR, 211, 35, 40, 14, WS_DISABLED + LTEXT "", IDC_MS_ERRORMSG, 13, 142, 225, 10, SS_LEFT + COMBOBOX IDC_MS_COMPONENT, 40, 15, 125, 15, WS_TABSTOP | CBS_DROPDOWN | CBS_HASSTRINGS | CBS_SORT + COMBOBOX IDC_MS_METHOD, 40, 35, 115, 30, WS_TABSTOP | CBS_DROPDOWN | CBS_HASSTRINGS | CBS_SORT + AUTOCHECKBOX "Store", IDC_MS_STORETARGET, 172, 17, 33, 8 + AUTOCHECKBOX "Store", IDC_MS_STOREMETHOD, 163, 36, 33, 9 +} diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.rex new file mode 100755 index 0000000..52827b9 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/MessageSender.rex @@ -0,0 +1,590 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise 08: MessageSender.rex v01-01 26Jun13 + + Contains: classes: "MessageSender", "HRSms" + + Message Sender is a test/debug/utility support class that enables a user to + send a message to a component and see what's returned. + + Pre-requisites: the Object Manager (objectMgr.rex). In addition, Message + Sender should be launched from some other dialog, since it + uses popupAsChild. + + Description: A sample Message Sender utility for sending messages to + components. Note that the messages that can be sent are probably + limited, since a full test has not been done. + + Outstanding Problems: None reported. + + Changes: + v01-00 07Jun12: First Version + 07Aug12: Changed self~execute() to popupAsChild. Launched via a menu + item in the Order Management dialog (OrderMgr.rex) + 14Jan13: Commented-out use of ViewMgr (ViewMgr function incomplete) + 05Feb13: Changed edit controls to comboboxes for Target and Method. + Provided for user add of methods and target components + (not saved over a dialog close). + 11Feb13: No change to function - minor tidy-up of a few comments. + 14Feb13: Correct text in the Help dialog. + v01-01 25May13: Added Event Manager to list of target objects. + 26Jun13: Added Drag Manager to list of target objects. + 03Jly13: Changed "Exercise07" to "Exercise08" for .h file folder. + + Description: + Target: className instanceName + Method: a single method name + Data: Either strings separated by "|" (will be sent as an array), or: + [name]value [name] value ... (will be sent as a directory), or: + space-separated strings (each is interpreted as a separate + attribute, so a parameter such as 'aaa bbb' cannot be sent + at least not in this version). + +------------------------------------------------------------------------------*/ + +.Application~addToConstDir("..\Exercise08\Support\MessageSender.h") + +::REQUIRES "ooDialog.cls" + + +::CLASS 'MessageSender' SUBCLASS rcDialog PUBLIC + + /*---------------------------------------------------------------------------- + Class Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + newInstance - class method to create a msg sender. */ + + ::METHOD newInstance CLASS PUBLIC + use arg rootDlg + --say ".MessageSender-newInstance." + dlg = .MessageSender~new("..\Exercise08\Support\MessageSender.rc", "DLG_MESSAGESENDER") --,,"MessageSender.h") + dlg~activate(rootDlg) + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + init + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectMgr eventMgr dragMgr + --say "MessageSender-init-01." + forward class (super) continue + objectMgr = .local~my.objectMgr + eventMgr = .local~my.eventMgr + dragMgr = .local~my.dragMgr + .local~my.MsgSender = self + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Activate - Shows the Dialog - i.e. makes it visible to the user. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate unguarded + expose rootDlg + use arg rootDlg + --say "MessageSender-activate-01." + self~popupAsChild(rootDlg, "SHOWTOP") --, ,"IDI_CUSTLIST_DLGICON") + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - initialises the MessageSender + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + expose cbTarget cbMethod ecData ecReply btnSend btnClear stErrorMsg objectMgr - + chkStoreTarget chkStoreMethod arrTargets arrMethods + --say "MessageSender-initDialog-01." + cbTarget = self~newComboBox("IDC_MS_COMPONENT") + cbMethod = self~newComboBox("IDC_MS_METHOD") + ecData = self~newEdit("IDC_MS_DATA") + ecReply = self~newEdit("IDC_MS_REPLY") + stErrorMsg = self~newStatic("IDC_MS_ERRORMSG") + btnSend = self~newPushButton("IDC_MS_SEND") + btnClear = self~newPushButton("IDC_MS_CLEAR") + chkStoreTarget = self~newCheckBox("IDC_MS_STORETARGET") + chkStoreMethod = self~newCheckBox("IDC_MS_STOREMETHOD") + self~connectButtonEvent("IDC_MS_SEND","CLICKED",sendMessage) + self~connectButtonEvent("IDC_MS_CLEAR","CLICKED",clearEntries) + self~connectHelp(onHelp) + + errorFont = self~createFontEx("Arial Italic") + stErrorMsg~setFont(errorFont) + stErrorMsg~settext(.HRSms~helpMsg) + + -- Get id of ObjectMgr: + --objectMgr = .local~my.objectMgr + --say "MessageSender-initDialog-02 - objectMgr =" objectMgr + if objectMgr = .nil then do -- Check if ObjectMgr is present - .nil if not. + stErrorMsg~setText(.HRSms~prefix1||.HRSms~noObjectMgr) + btnSend~disable() + end + + arrTargets = .array~of("ObjectMgr The","EventMgr The","PersonModel PA150") + arrMethods = .array~of("showModel","query","list") + do i over arrTargets + cbTarget~add(i) + end + do i over arrMethods + cbMethod~add(i) + end + + return + + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + Event Handler Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + sendMessage - Sends a message to the specified component. + Returns .false if error found. + Note 1: the return from the target object must be either a bool + or a directory. (Later versions may add array and string). + Note 2: The "parseData" method displays any error messages + resulting from errors in the data provided by the user. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD sendMessage + expose objectMgr eventMgr ecReply stErrorMsg btnClear chkStoreTarget - + chkStoreMethod cbTarget cbMethod arrTargets arrMethods + --say; say "---------------------------------------------------------" + --say "MessageSender-sendMessage-01." + ecReply~setText("") -- Clear any reply data from previous requests. + --error = .false -- if true, indicates error in data provided. + message = self~parseData -- data is a directory, array, string; .false if error. + + if message = .false then do -- if errors found in the data. + --say "MessageSender-sendMessage-02: message =" message + btnClear~enable() -- allow user to clear entries. + chkStoreTarget~uncheck; chkStoreMethod~uncheck + return .false + end + if message = "special" then do -- message to ObjectMgr has been dealt with. + btnClear~enable + chkStoreTarget~uncheck; chkStoreMethod~uncheck + return .true + end + + -- Get the component ID (object ref) from the Object Manager: + componentRef = objectMgr~getComponentId(message["class"], message["instance"]) + if componentRef = .false then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + ecReply~setText(.HRSms~rc||" "||componentRef) + stErrorMsg~setText(.HRSms~prefix1||" "||.HRSms~noObject) + btnClear~enable + return .false + end + + -- Send the Message and Display the response: + --say "MessageSender-sendMessage-03: message[data] =" message["data"] + response = sendMsg(componentRef, message["method"],message["data"]) + select + when response = "SendMsg - Syntax Error" then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + stErrorMsg~setText(.HRSms~noResponse) + btnClear~enable + return + end + when response = "SendMsg - No Method" then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + stErrorMsg~setText(.HRSms~noTgtMethod) + btnClear~enable + return + end + when response = .false then do + chkStoreTarget~uncheck; chkStoreMethod~uncheck + ecReply~setText(.HRSms~rc||" "||response) + return + end + + when response~isa(.String) then do + ecReply~setText(response) + end + when response~isa(.Directory) then do + replyText = "" + do i over response + replyText = replyText||i||":" response[i]||"; " + end + ecReply~setText(replyText) + end + otherwise do + ecReply~setText(.HRSms~noDir1 response .HRSms~noDir2) + end + end + btnClear~enable + -- say "MessageSender-sendMessage-04: response =" response + + -- Message sent successfully - so now action the checkboxes: + self~storeEntry(cbTarget, chkStoreTarget) + self~storeEntry(cbMethod, chkStoreMethod) + + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + storeEntry - Store a new item in either Target or Method comboboxes if a + checkbox has been checked. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD storeEntry PRIVATE + use strict arg comboBox, checkBox + --say "MessageSender-storeEntry-01." + if checkBox~getCheckState = "CHECKED" then do + newItem = comboBox~getEditControl()~getLine(1) + ix = comboBox~find(newitem) -- case-insensitive find + if ix = 0 then do -- if item not found, then add it. + comboBox~add(newItem) + end + checkBox~uncheck() + end + return + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + clearEntries - Clear user entries and error messages. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD clearEntries + expose cbTarget cbMethod ecData ecReply stErrorMsg btnClear + cbTarget~setText("") + cbMethod~setText("") + ecData~setText("") + ecReply~setText("") + stErrorMsg~setText("") + btnClear~disable + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + onHelp - Display help. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD onHelp + cr = .endOfLine + msg = .HRSms~help2||cr||.HRSms~help3||cr - + ||.HRSms~help4||cr||.HRSms~help5||cr - + ||.HRSms~help6||cr||.HRSms~help7||cr - + ||.HRSms~help8 + title = .HRSms~help1 + buttons = "OK" + --ans = MessageDialog(msg, 0, title, "OK", "INFORMATION") + ans = MessageDialog(msg, self~dlgHandle, title, "OK", "INFORMATION") + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Application Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + parseData - Check the message info provided by the user. + + Required data formats are: + Target component: "class instance". Allowed are: multiple spaces between + "class" and "instance"; leading spaces before "class". (Later version may + provide for class messages). + Method: a method name - a single string, e.d. "doThat". Any leading or + trailing spaces are removed. + Message Parameters: A string, and array, or a directory, as follows: + String, e.g.: "AB123, Joe Bloggs Inc., 124.50" The first non-white-space + character must not be "[" or "|", as these characters are used to decide + whether the data format is string, array or directory. + Array, e.g.: "| AB123 | Joe Bloggs Inc. | 124.50 " + The separator between elements is "|". Leading and trailingspaces are + removed from each array item. Thus the result of the above example would + be: "AB123|Joe Bloggs Inc.|124.50". + Directory, e.g.: "[CustNo] AB123 [Name] Joe Bloggs Inc. [Debt] 124.50". + The indices are in square brackets. Leading and trailing spaces of both + indices and items are removed. + Returns: + If no errors found, this method returns the message data in the directory + "message". This has four indexes: "class", "instance", "method", "data". + If format errors are found, a message is displayed, and .false is returned. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD parseData + expose cbTarget cbMethod ecData stErrorMsg objectMgr eventMgr dragMgr rootDlg + stErrorMsg~setText("") -- remove any previous error message. + --say; say "MessageSender-parseData-01." + message = .Directory~new + + -- get target component name: + --target = cbTarget~getText(1) + target = cbTarget~getEditControl()~getLine(1) + --say "MessageSender-parseData-02 target =" target + parse var target class instance + targetError = .false + if class = "" | instance = "" then targetError = .true + else do + message["class"] = class~strip; + message["instance"] = instance~strip + end + + -- get Method/Message Name: + targetMethodError = .false + targetMethod = cbMethod~getEditControl()~getLine(1) + --say "MessageSender-parseData-03 targetMethod =" targetMethod + if targetMethod~words \= 1 then targetMethodError = .true + else message["method"] = targetMethod~strip + + -- Special Treatments: + if message["class"] = "ObjectMgr" & message["instance"] = "The" then do + -- Only List and ShowModel allowed (at present). + --say "MessageSender-parseData-04: msg to ObjectMgr." + method = message["method"] + method = method~upper + select + when method = "LIST" then do + objectMgr~list + return "special" + end + when method = "SHOWMODEL" then do -- assume data is a string + modelName = ecData~getLine(1) + parse var modelName modelClass " " modelInstance + modelClass = modelClass~strip; modelInstance = modelInstance~strip + --say "MessageSender-parseData-05: ViewMgr~parentOffsetDialog = self." + -- Setup self as "Parent" dialog for offsetting the view to be shown + --(do it here because other components may have done it previously): + .local~my.ViewMgr~parentOffsetDlg = self + -- Now show the model: + --say "MessageSender-parseData-06: objectMgr~showModel." + r = objectMgr~showModel(modelClass, modelInstance, rootDlg) + --say "MessageSender-parseData-07: return =" r + return "special" + end + otherwise do + --say "MessageSender-parseData-08:" method "is invalid." + targetMethodError = .true + --return .false + end + end + end + if message["class"] = "EventMgr" & message["instance"] = "The" then do + method = message["method"] + method = method~upper + if method = "LIST" then do + eventMgr~list + return "special" + end + else do + targetMethodError = .true + return .false + end + end + if message["class"] = "DragMgr" & message["instance"] = "The" then do + method = message["method"] + method = method~upper + if method = "LIST" then do + dragMgr~list + return "special" + end + else do + targetMethodError = .true + return .false + end + end + +-- Following Code does not work - left here in case needed in any following exercises. +/* else do + --say "MessageSender-parseData-01d." + if message["class"] = "ViewMgr" & message["instance"] = "The" then do + method = message["method"] + method = method~upper + if method = "SHOWMODEL" then do + modelName = ecData~getLine(1) + parse var modelName modelClass " " modelInstance + modelClass = modelClass~strip; modelInstance = modelInstance~strip + .local~my.ViewMgr~parentOffsetDlg = self + -- Now show the model: + r = .local~my.ViewMgr~showModel(modelClass, modelInstance, rootDlg) + --say "MessageSender-parseData-01e: return =" r + return "special" + end + end + end +*/ + + -- Normal treatments: + + -- get Message Data, and put in an array, directory or string: + -- Note: ecData~lines returns 1 if control is empty(!). + msgData = "" + do i=1 to ecData~lines() + msgData = msgData||ecData~getLine(i) + --say "MessageSender-parseData-02: Data = '"||msgData||"'" + end + -- Everything now in a single text string. So now check the data type: + --say "chars = '"||msgData||"'" + msgData = strip(msgData) -- remove leading & trailing blanks. + if left(msgData,1) = "" then msgDataType = .false -- i.e. no data + else if left(msgData,1) = "[" then msgDataType = "dir" + else if left(msgData,1) = "|" then msgDataType = "arr" + else msgDataType = "str" + --say "msgDataType =" msgDataType; + + formatError = .false + Select + when msgDataType = .false then msgData = "" + + when msgDataType = "dir" then do + dirMsgData = .Directory~new + separators = msgData~countStr("["); closers = msgData~countStr("]") + if separators \= closers then formatError = .true + if \formatError then do + do i = 1 to separators + parse var msgData "[" index "]" msgData + parse var msgData item "[" + dirMsgData[index] = item~strip + end + message["data"] = dirMsgData + end + end + + when msgDataType = "arr" then do + arrMsgData = .Array~new + separators = msgData~countStr("|") + --say "No. Separators =" separators + msgData = msgData~substr(2) -- strip leading "|" + do i=1 to separators + parse var msgData item "|" msgData + item = item~strip + arrMsgData[i] = item + --say "item =" "'"||item||"'" + end + message["data"] = arrMsgData + end + + otherwise do -- msgDataType = "str" + message["data"] = msgData + end + end -- Select + + -- Check for errors: + errors = 0 + if targetError then errors += 1; if targetMethodError then errors += 1 + if formatError then errors += 1 + if errors = 1 then errortext = .HRSms~prefix1 + if errors > 1 then errortext = .HRSms~prefix2 + if errors > 0 then do + if targetError then errorText = errorText||.HRSms~badTarget + if targetMethodError then errorText = errorText||" "||.HRSms~badMethod + if formatError then errorText = errorText||" "||.HRSms~badData + stErrorMsg~setText(errorText) + return .false + end + + return message + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getObjectRef + expose objectMgr + use arg target + parse var target class "-" instance + ref = objectMgr~getComponentRef(class, instance) + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + sendMsg - a 'Send Message' Routine. v00-01 08May12 + -------- + This routine sends the message to the specified component instance. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::ROUTINE sendMsg + use arg targetObject, targetMethod, data + --say "MessageSender-sendMsg-01: targetObject targetMethod data =" targetObject targetMethod data + SIGNAL ON SYNTAX NAME catchIt1 + SIGNAL ON NOMETHOD NAME catchIt2 + msg = .Message~new(targetObject, targetMethod, i, data) + response = msg~send + --say "MessageSender-sendMsg-02: response =" response + return response + catchIt1: say "MessageSender-sendMsg-03: CatchIt1 - Syntax." + SIGNAL OFF SYNTAX + return "SendMsg - Syntax Error" + catchIt2: say "MessageSender-sendMsg-04: CatchIt2 - NoMethod." + SIGNAL OFF NOMETHOD + return "SendMsg - No Method" +/*============================================================================*/ + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + Human-Readable Strings (HRSms) v01-00 05May12 + -------- + This class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRSms PRIVATE + ::CONSTANT prefix1 "*** Error: " + ::CONSTANT prefix2 "*** Errors: " + ::CONSTANT badTarget "Invalid class or Instance name." + ::CONSTANT badMethod "Invalid method." + ::CONSTANT badData "Invalid data format." + ::CONSTANT noObject "Target component not found." + ::CONSTANT noTgtMethod "No such method in target component." + ::CONSTANT noResponse "Note: No response received from target object." + ::CONSTANT rc "Return Code:" + ::CONSTANT noObjectMgr "The Object Manager was not found. Cannot work without it." + ::CONSTANT noDir1 "Reply is a" + ::CONSTANT noDir2 "- cannot display with this version." + ::CONSTANT help1 "Formats for data parameters:" + ::CONSTANT help2 "Target: Class Instance - e.g. 'CustomerModel CU0003'" + ::CONSTANT help3 "Method: method name - e.g. 'query'" + ::CONSTANT help4 "Data: Formats for message data are:" + ::CONSTANT help5 " Directory: '[aaa] [bbb] [c cc]'" + ::CONSTANT help6 " Array: '|aaa|bbb|c cc'" + ::CONSTANT help7 " String: 'aaa bbb'" + ::CONSTANT help8 "Note: a 'saved' target or method is not saved over a close." + ::CONSTANT helpMsg "Press F1 for help on allowable data formats." +/*============================================================================*/ + + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/Model.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/Model.rex new file mode 100755 index 0000000..f0bf6f0 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/Model.rex @@ -0,0 +1,187 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + Exercise08 + + Support - Model v02-00 24May13 + ---------------- + A superclass for the Model-View framework. + + v01-00 09Aug12: First version. + 11Jan13: Commented-out "say"s. + 31Jan13: Store model's data in 'myData'. + 27Feb13: Commented-out some "say" instructions. + v02-00 24May13: Added inherit from the 'Component' mixin. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::REQUIRES "Support\Component.rex" + +/*============================================================================*/ + +::CLASS 'Model' PUBLIC INHERIT Component + + ::ATTRIBUTE wantList CLASS PUBLIC -- for List subclasses + ::ATTRIBUTE myData + + /*---------------------------------------------------------------------------- + newInstance - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD newInstance CLASS PUBLIC + expose noDataError -- .true if data not found. + use strict arg instanceName + --say ".Model-newInstance-01: instanceName =" instanceName + -- Check that the model's Data object is up and running. If not, then return .false: + if noDataError = .true then return .false + -- Now get the name of the Data component (FredModel or FredListModel --> FredData): + -- Get my root name (i.e. the root name of the subclass): + className = self~objectName -- objectName for a class Foo is "The Foo class" + className = className~upper() -- When class name is in quotes, then it's mixed case. + -- Upper here to make everthing upper case for parse var. + -- Handling Forms: + -- If this is a "Form" then there's no data to get (the user will provide + -- the data). So just create the Form Model (e.g. Order Form) and return. + -- Assume that the instance name is the Form Number (e.g. for an OrderForm, + -- the Form Number will be the new Order Number). + p = className~pos("FORM") + if p > 0 then do -- if this is a "Form" component. + instData = .Directory~new + instData[formNumber] = instanceName + formObject = self~new(instData) + formObject~myData = instData -- store instance data for subclasses to access. + --say ".Model-newInstance-011: formObj, instanceName =" formObject||"," instanceName + return formObject + end + -- End of Handling Forms. + + -- If there's "LIST" in the name, then set "get all" for the file access + -- (as opposed to the default of "get 1 record") + getAllRecords = .false + p = className~pos("LIST") + if p > 0 then getAllRecords = .true + -- if there's a "LIST" in the name, strip it out 'cos an xListModel gets data from xData + parse var className . root1 "MODEL" . + parse var root1 root "LIST" + dataClassName = root||"Data" + --say ".Model-newInstance-02, dataClassName =" dataClassName + -- Get the id of Data component: + objMgr = .local~my.ObjectMgr + --say ".Model-newInstance-03: objMgr =" objMgr + myDataId = objMgr~getComponentId(dataClassName, "The") + if myDataId = .false then do -- if instantiation failed + say ".Model-newInstance-04: getting ID of Data Class failed." + noDataError = .true + return .false + end + -- Got my data id, now get data for this model instance. + -- But distinguish between Entity Models and List Models - the former needs + -- a single record, the latter a group of records. + -- say ".Model-newInstance-05a: getAllRecords =" getAllRecords + if getAllRecords then instData = myDataId~getFile() -- returns a 2D array + else instData = myDataId~getRecord(instanceName) -- a directory + -- say ".Model-newInstance-05b: array dimensions: =" instData~dimension + if instData = .false then return .false -- if ID (key) not found + -- All is well, then make new instance: + --say ".Model-newInstance-06: instData =" instData + id = self~new(instData) + id~myData = instData + --say ".Model-newInstance-07: instData =" id + return id + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + getInstanceName - For an "anonymous" instance only (e.g. CustomerList) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getInstanceName CLASS PUBLIC + expose anonInstanceName + if anonInstanceName = "ANONINSTANCENAME" then anonInstanceName = 1 + else anonInstanceName = anonInstanceName + 1 + return anonInstanceName + + + /*---------------------------------------------------------------------------- + query - returns a Model's data. + Standard protocol: + Accept a .nil, directory, array, or string of names (case-sensitive). + if .nil then return all fields; else return values for the names in + the directory, array, or string. String is assumed to be data + names separated by one or more spaces. + All returns are a Directory containing names and values. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD query PUBLIC + use arg dataNames + --say "Model-query-01: dataNames:" dataNames + dirReturn = .Directory~new + select + when dataNames = .nil | dataNames = "" then return self~myData + + when dataNames = "DATANAMES" then return self~myData + + -- Caller is requesting specific data items: + when dataNames~isa(.Directory) then do + --say "Model-query-02; dataNames =" dataNames + do i over dataNames + dirReturn[i] = self~myData[i] + end + end + + when dataNames~isa(.Array) then do + do i over dataNames + dirReturn[i] = self~myData[i] + end + end + + when dataNames~isa(.String) then do + dataNames = dataNames~strip + n = dataNames~countStr(" ")+1 + do i = 1 to n + parse var dataNames name " " dataNames + if name = " " then iterate -- ignore extraneous leading spaces. + dirReturn[name] = self~myData[name] + end + end + + otherwise return .false + end + + return dirReturn + +/*============================================================================*/ + + +/*============================================================================*/ diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/NumberOnlyEditEx.cls b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/NumberOnlyEditEx.cls new file mode 100644 index 0000000..9613851 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/NumberOnlyEditEx.cls @@ -0,0 +1,526 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * The NumberOnlyEditEx class extends the .Edit class to provide an edit + * control which restricts entry to decimal only, or signed decimal only, + * numbers. + * + * The NumberOnlyEditEx.cls file is meant to be included in any ooDialog + * program where this extension to the edit control is desired. The programmer + * needs to take 4 steps to gain the functionality of a signed decimal number + * only edit control: + * + * 1.) Require the NumberOnlyEditEx.cls file (this file.) + * + * ::requires 'NumberOnlyEditEx.cls' + * + * 2.) Invoke the initDecimalOnly() method on each edit control object that is + * to be a decimal number only edit control. If initDecimalOnly() is not + * invoked, the behaviour of the edit control is unchanged. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~initDecimalOnly(decimalPlaces, allowSign) + * + * arguments: + * + * decimalPlaces [optional] The number of decimal places allowed in the + * number. The default is 2. Specifying 0 + * decimal places is acceptable. + * + * allowSign [optional] If a sign character (+ or -) is allowed as the + * leading character of the number. The default + * is .false. Specify .true to allow a sign + * character. + * + * 3.) For each decimal only edit control, the character event must be + * connected to a method in the Rexx dialog object. + * + * editObject = self~newEdit(IDC_EDIT) + * editObject~connectCharEvent(onChar) + * + * 4.) In the connected character event handler, the message and its arguments + * must be forwarded on to the onChar() method of the edit control. The + * 6th argument to the event handler is the dialog control object where the + * character event occurred. That is the object the event must be forwared + * to. + * + * When the programmer connects the character event to a method named + * onChar, the event handler is simple: + * + * ::method onChar unguarded + * forward to (arg(6)) + * + * If the programmer chooses a different method name for the event handler, + * then he must be sure to forward to the onChar() method of the edit + * control: + * + * ::method myOwnMethodName unguarded + * forward message 'onChar' to (arg(6)) + * + * And of course there is no reason why the event handler can not be coded + * using the explicit arguments: + * + * ::method myOwnMethodName unguarded + * use arg char, isShift, isCtrl, isAlt, misc, control + * forward message 'onChar' to (control) + */ + + -- Extend the .Edit control by inheriting the .NumberOnlyEditEx mixin class. + + .Edit~inherit(.NumberOnlyEditEx, .EditControl) + +::requires 'ooDialog.cls' +::requires 'winsystm.cls' + +::class 'NumberOnlyEditEx' public mixinclass object + +-- Users of the signed decimal number only edit control must invoke +-- initDecimalOnly() first to assign decimal places and specify if the sign +-- character is allowed. Until this is done, there is no change to the +-- behaviour of the Edit control object. +::method initDecimalOnly + expose decimalPlaces signOk initialized clipBoard + use strict arg decimalPlaces = 2, plusMinus = .false + + if plusMinus~isA(.String), plusMinus~datatype('O') then signOk = plusMinus + else signOk = .false + + initialized = .true + clipBoard = .WindowsClipboard~new + +-- The onChar() method should be inovked at every character event. Returning +-- true allows the character, returning false disallows the character. When a +-- character is not allowed, an edit ballon is set with a message explaining to +-- the user why the character is not appearing when they type. +::method onChar unguarded + expose decimalPlaces initialized signOk + use arg char, isShift, isCtrl, isAlt, misc, control + + if \ var('initialized') then return .true + + if misc~pos("extended") <> 0, self~isExtendedKey(char) then return .true + + if char == 8 then return .true + if signOk, (char == 43 | char == 45) then return self~checkSign + if char == 46 then return self~checkDecimal + if char >= 48, char <= 57 then return self~checkDigit + + if isCtrl, \isAlt, \isShift then return self~checkControlKey(char) + + reply .false + self~charBalloon + + +/** checkDigit() + * + * Checks that the digit being typed, at the cursor position, is allowed. + */ +::method checkDigit private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if signOk, cursorPos == 1 then do + c = text~left(1) + + if c == '-' | c == '+' then do + reply .false + self~showBalloon(.MT~NUM_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + return .true + end + + if decimalPos == 0 then return .true + + if cursorPos <= decimalPos then return .true + + if text~length < (decimalPos + decimalPlaces) then return .true + + reply .false + + msg = self~decimalPlacesUsedMsg + self~showBalloon(.MT~NUM_TITLE, msg, "ERROR") + + +/** checkSign() + * + * Checks that the sign character being typed is allowed at the current cursor + * position. Note that this method is only invoked when the sign character is + * allowed. + */ +::method checkSign private unguarded + expose decimalPlaces + + text = self~getText + cursorPos = self~getCaretPos + + if cursorPos == 1 then do + if self~hasSign(text) then do + reply .false + self~showBalloon(.MT~SIGN_TITLE, .MT~HAS_SIGN, "ERROR") + return + end + + return .true + end + + reply .false + + decimalPos = text~pos('.') + if decimalPos <> 0 | decimalPlaces == 0 then msg = .MT~ONLY_NUMBER + else msg = .MT~ONLY_DECIMAL_NUMBER + + self~showBalloon(.MT~SIGN_TITLE, msg, "ERROR") + + +/** checkDecimal() + * + * Checks that the decimal point being typed is allowed at the current cursor + * position. + */ +::method checkDecimal private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + if decimalPlaces == 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if decimalPos <> 0 then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if cursorPos == 1, signOk, self~hasSign(text) then do + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + return + end + + if text~length < cursorPos + decimalPlaces then return .true + + reply .false + self~decimalPointBalloon(decimalPos, cursorPos, text) + + +/** checkControlKey() + * + * Invoked for a control key combination (Ctrl-?). Anything other than Ctrl-V + * is automatically allowed. Ctrl-V is of course the paste operation. For + * Ctrl-V, we check that the result after pasting the text would be a valid + * signed decimal number, under the constraints for this object. If not, it + * is disallowed and a ballon set. + */ +::method checkControlKey private unguarded + expose clipBoard decimalPlaces + use strict arg char + + if char \== 22 then return .true -- Not Ctrl-V + + -- If there is no text data available we don't care, pasting it will not do + -- any harm. + if \ clipBoard~isDataAvailable then return .true + + pastedText = clipBoard~paste + + -- We have text to paste, need to check is the text acceptable, + -- and is it acceptable for where it will be placed. + text = self~getText + len = text~length + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + -- isValidDecimal() checks that the resulting text after inserting the pasted + -- text is valid. + if \ self~isValidDecimal(pastedText, text, cursorPos) then do + reply .false + self~pasteBalloon(pastedText, text, cursorPos) + return + end + + return .true + + +/** decimalPointBalloon() + * + * This method produces the proper balloon message text when a decimal point has + * been typed, but is not allowed at the current position. + */ +::method decimalPointBalloon private unguarded + expose decimalPlaces signOk + use strict arg decimalPos, cursorPos, text + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~DEC_TITLE, msg, "ERROR") + + +/** charBalloon() + * + * This method produces the proper balloon message when a character is typed. + */ +::method charBalloon private unguarded + expose decimalPlaces signOk + + text = self~getText + decimalPos = text~pos('.') + cursorPos = self~getCaretPos + + msg = .MT~ONLY_NUMBER + + select + when cursorPos == 1 then do + if self~hasSign(text) then msg = .MT~HAS_SIGN + else if decimalPlaces == 0, signOk then msg = .MT~ONLY_WHOLE_SIGNED_NUMBER + else if decimalPlaces == 0, \signOk then msg = .MT~ONLY_WHOLE_NUMBER + else if decimalPos == 0, signOk then msg = .MT~ONLY_SIGNED_DECIMAL_NUMBER + else if decimalPos == 0, \signOk then msg = .MT~ONLY_DECIMAL_NUMBER + else if signOk then msg = .MT~ONLY_SIGNED_NUMBER + else msg = .MT~ONLY_NUMBER + end + when decimalPlaces == 0 then do + msg = .MT~ONLY_WHOLE_NUMBER + end + when decimalPos == 0 then do + msg = .MT~ONLY_DECIMAL_NUMBER + end + when cursorPos <= decimalPos then do + msg = .MT~ONLY_NUMBER + end + when (decimalPos + decimalPlaces) > text~length then do + msg = .MT~ONLY_NUMBER + end + otherwise do + msg = self~decimalPlacesUsedMsg + end + end + -- End select + + self~showBalloon(.MT~CHAR_TITLE, msg, "ERROR") + + +/** pasteBalloon() + * + * This method produces the proper balloon message when text is pasted into the + * edit control that is not allowed. + */ +::method pasteBalloon private unguarded + expose decimalPlaces signOk + use strict arg pastedText, text, cursorPos + + if signOk then do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE_SIGNED + else msg = .MT~ONLY_PASTE_A_SIGNED decimalPlaces .MT~ONLY_PASTE_B + end + else do + if decimalPlaces == 0 then msg = .MT~ONLY_PASTE_WHOLE + else msg = .MT~ONLY_PASTE_A decimalPlaces .MT~ONLY_PASTE_B + end + + resultText = text~substr(1, cursorPos - 1) || pastedText || text~substr(cursorPos) + + -- Balloon text has to be less than 1023 characters. If we don't exceed that + -- length, we will show the incorrect text to the user. Otherwise we just + -- show the short message. Note that new line characters can be used to + -- format the balloon text. + len = msg~length + resultText~length + .MT~PASTED_A~length + .MT~PASTED_B~length + 8 + + if len < 1023 then do + msg ||= .endOfLine~copies(2) || .MT~PASTED_A || - + .endOfLine~copies(2) || '"'resultText'"' || - + .endOfLine~copies(2) || .MT~PASTED_B + end + + self~showBalloon(.MT~PASTE_TITLE, msg, "ERROR") + + +/** decimalPlacesUsedMsg() + * + * Convenience method to return the proper message for the situation where the + * allowable number of decimal places have been filled. + */ +::method decimalPlacesUsedMsg private unguarded + expose decimalPlaces + + if decimalPlaces == 1 then return .MT~ONLY_1_DECIMAL + else return .MT~ONLY_DECIMALS_A decimalPlaces .MT~ONLY_DECIMALS_B + + +/** isValidDecimal() + * + * Checks that the resulting text after the pasted text is inserted into text at + * the current position, results in a valid number using the current + * restrictions. Decimal places and sign allowed or not. + */ +::method isValidDecimal private unguarded + expose decimalPlaces signOk + use strict arg pasteText, text, cursorPos + + resultText = text~substr(1, cursorPos - 1) || pasteText || text~substr(cursorPos) + + -- Can't have any type of space character, tab, new line, etc.. + if resultText \== resultText~space(0) then return .false + + -- Eliminate obvious problems with decimals. + countDots = resultText~countStr(".") + if countDots > 1 then return .false + if decimalPlaces == 0, countDots > 0 then return .false + + -- Eliminate any problems with the sign character. + if signOk then do + if resultText~pos('-') > 1 | resultText~pos('+') > 1 then return .false + end + else do + if resultText~pos('-') <> 0 | resultText~pos('+') <> 0 then return .false + end + + + decimalPos = resultText~pos('.') + if decimalPos > 0 then do + if resultText~length - decimalPos > decimalPlaces then return .false + + -- Remove the decimal char so we can test for all digits. + resultText = resultText~changeStr('.', '') + end + + -- Remove the sign character if it exists. + if self~hasSign(resultText) then resultText = resultText~substr(2) + + -- Exponential notation can not be allowed. + if resultText~caselessPos('E') <> 0 then return .false + + if \ resultText~datatype('W') then return .false + + return .true + + +/** isExtendedKey + * + * Convenience method to test if the character, char, is an extended key we want + * to pass on to the edit control + */ +::method isExtendedKey private + use strict arg char + + if char >= 33, char <= 40 then return .true + if char == 45 | char == 46 | char == 8 then return .true + return .false + + +/** hasSign + * + * Convenience method to test if a text string starts with a sign (+ or -) + * character. + */ +::method hasSign private + use strict arg text + + c = text~left(1) + if c == '-' | c == '+' then return .true + return .false + + +/** getCaretPos() + * + * Returns the current caret (cursor) position of this edit control. + */ +::method getCaretPos private + return self~selection~startChar + + +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + Class: MT + + This class is used to provide constant character strings. The strings are + used for the balloon messages put up by the NumberOnlyEditEx mixin class. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'MT' private +::constant CHAR_TITLE "Unacceptable Character" +::constant DEC_TITLE "Unacceptable Decimal Point" +::constant NUM_TITLE "Unacceptable Number" +::constant SIGN_TITLE "Unacceptable Sign Character" +::constant PASTE_TITLE "Unacceptable Pasted Text" + +::constant ONLY_NUMBER "You can only type a number here." +::constant ONLY_SIGNED_NUMBER "You can only type a number or the sign here." +::constant ONLY_DECIMAL_NUMBER "You can only type a number or the decimal point here." +::constant ONLY_SIGNED_DECIMAL_NUMBER "You can only type a number, the sign, or the decimal point here." +::constant ONLY_WHOLE_NUMBER "You can only type a number here. Only whole numbers are allowed." +::constant ONLY_WHOLE_SIGNED_NUMBER "You can only type a number or the sign here. Only whole numbers are allowed." + +::constant HAS_SIGN "You can not type here. The sign character is already in place." +::constant ONLY_1_DECIMAL "You can not type here. Only 1 decimal place is allowed." +::constant ONLY_DECIMALS_A "You can not type here. Only" +::constant ONLY_DECIMALS_B "decimal places are allowed." + +::constant ONLY_PASTE_WHOLE "You can only paste text here that produces a whole number." +::constant ONLY_PASTE_WHOLE_SIGNED "You can only paste text here that produces a signed whole number." +::constant ONLY_PASTE_A_SIGNED "You can only paste text here that produces a signed decimal number with" +::constant ONLY_PASTE_A "You can only paste text here that produces a decimal number with" +::constant ONLY_PASTE_B "or less decimal places." +::constant PASTED_A "Resulting text of:" +::constant PASTED_B "is not valid." diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/ObjectMgr.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/ObjectMgr.rex new file mode 100755 index 0000000..8ef9161 --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/ObjectMgr.rex @@ -0,0 +1,352 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide + + Support - ObjectMgr v01-01 06Jun13 + ------------------- + A singleton component that manages model objects. + + Should ensure that only one instance is created. This version doesn't. + + Provides an object reference given a class and an instance name. Stores these + in an "object bag", which is a table of classes, where each table item is a + table of instance names, the item being the object reference. + + Interface ObjectMgr { + bool init + cmptId getComponentId( in string className, in string instanceName ) + bool addCmptRef( in string className, in string instanceName, in objref cmptRef ) + void list( ) + bool showModel( in string modelClass, in string modelInstance ) + } + + Changes: + v01-00 23Apr12: First version. + 11Jan13: Commented-out 'say' instructions. + 21Jan13: Make 'addView' private and 'removeView' explicitly public. + Minor typos in comments corrected. + v01-01 06Jun13: Added methods 'modelClassFromView and 'modelIdFromView - + given a view (a dialog), which return the model class name + and model object id respectively. Purpose: to support + Drag/Drop. + + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + + +call "RequiresList.rex" + + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================*/ +::CLASS 'ObjectMgr' PUBLIC + + ::ATTRIBUTE objectBag PRIVATE-- a bag of objects - i.e. instances of Distributed + -- Components or DCs. + + /*---------------------------------------------------------------------------- + init - initialises the ObjectManager + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + expose objectBag viewBag + --say "ObjectMgr-init. Classes:" .CustomerModel .CustomerData .CustomerView + .local~my.ObjectMgr = self + objectBag = .directory~new -- holds "class-inst" "id-ViewName" + viewBag = .directory~new -- holds view class and latest view instance. + return .true + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + getComponentId - Returns a Component Id if it's in the ObjectBag, + else calls doNewInstance to get id, else returns .false. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD getComponentId PUBLIC + expose objectBag + use strict arg className, instanceName + className = className~upper; instanceName = instanceName~upper + --say "ObjectMgr-getComponentId-00: className =" className "instanceName =" instanceName + ObjectName = className||"-"||instanceName + if objectBag~hasIndex(objectName) then do -- if class-instance already registered: + --say "ObjectMgr-getComponentId-01: Class Found:" objectName + arr = objectBag[objectName] -- Get info array for this class-instance. + componentId = arr[1] + return componentId -- return component id + end + -- If we've got to here, then there's no id stored. So go get one: + componentId = self~doNewInstance(className,instanceName) + --say "ObjectMgr-getComponentId-03: componentId =" componentId + if componentId = .false then return .false -- Bad object name + self~addComponentId(className,instanceName,componentId) + return componentId + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + /*---------------------------------------------------------------------------- + doNewInstance - Instantiates the requested object and returns the object id + (aka component id). If class not found, or class returns + .false to ~newInstance, then returns .false. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD doNewInstance PRIVATE + use strict arg className, instanceName + SIGNAL ON NOMETHOD NAME catchIt + interpret "componentId = ."||className||"~newInstance("||"'"||instanceName||"'"||")" + --say "ObjectMgr-doNewInstance-01: componentId =" componentId + -- add to object bag: + return componentId + catchIt: + say "ObjectMgr-doNewInstance-02: component" className instanceName "not found." + return .false + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + /*---------------------------------------------------------------------------- + addComponentId - Adds an Instance of a Class to the Object Bag. + If instance already exists, return .false + Format of ObjectBag (note - directory indices are case-sensitive, i.e. + if entry is created with index "AbC" then 'say dir["ABC")' may return nil. + + +---------------------------------+ + | Index | Item (an Array) | + +---------------------------------+ + | | | View | + | Class-Inst | objId | Class-Inst | + |---------------------------------| + | PersM-AB12 | x'12' | PersV-1 | + |- - - - - - |- - - -|- - - - - - | + | PersM-CD34 | x'5A' | .nil | + |- - - - - - |- - - -|- - - - - - | + | PersV-1 | x'7B' | .nil | + |- - - - - - |- - - -|- - - - - - | + | | | | + +---------------------------------+ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::method addComponentId PRIVATE + expose objectBag + use strict arg className, instanceName, componentId + --say "ObjectMgr-addComponentId-01:" classname instancename componentId + objectName = className||"-"||instanceName + arr = .Array~new + arr[1] = componentId + arr[2] = .nil -- Space for a View Name ('class-inst') + objectBag[objectName] = arr + --self~list + return + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + + + /*---------------------------------------------------------------------------- + showModel - Shows a view of a model. Lacking a config file that links + model class to one or more View classes, we heroically assume + that all models are called "xxxModel" and its View is called + xxxView. Assume only one View per Model. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel PUBLIC + expose objectBag + use arg modelClass, modelInstance, parentDlg + --say "ObjectMgr-showModel-01a - modelNames:" modelClass modelInstance + --say "ObjectMgr-showModel-01b - parentDlg: " parentDlg + --say "ObjectMgr-showModel-02 - modelClass: '"||modelClass||"'; modelInstance: '"||modelInstance||"'" + -- If this is an "anonymous" component (instance name "A"|"a"), ask its + -- class object for an instance name: + if modelInstance = "A" | modelInstance = "a" then do + anonModelClass = "."||modelClass + interpret "modelInstance = "||anonModelClass||"~getInstanceName" + --say "ObjectMgr-showModel-02 - modelInstance: " modelInstance + end + modelId = self~getComponentId(modelClass, modelInstance) + --say "ObjectMgr-showModel-03 - modelId:" modelId + if modelId = .false then do + say "ObjectMgr-showModel-03b: Model" modelClass modelInstance "could not be found." + return .false + end + + -- Check if View exists - if so, surface it: + modelName = modelClass||"-"||modelInstance + modelName = modelName~upper + arr = objectBag[modelName] + viewName = arr[2] + --say "ObjectMgr-showModel-03c: ViewName =" viewName + if viewName \= .nil then do -- if view exists + arr = objectBag[viewName] + viewId = arr[1] + viewId~show("SHOWTOP") -- if minimized, doesn't work. + viewId~show("NORMAL") -- if hidden, doesn't work + return .true + end + + -- View does not exist - so construct the view name and send the class a + -- newInstance(modelId, parentDlg). + parse var modelClass root "Model" + viewClass = root||"View" + viewClassId = "."||viewClass + --say "ObjectMgr-showModel-04: viewClassId =" viewClassId + interpret "targetObject =" viewClassId + --say "ObjectMgr-showModel-05: parentDlg =" parentDlg + msg = .Message~new(targetObject, "newInstance", "I", modelId, parentDlg) + --say "ObjectMgr-showModel-06: Class is:" .CustomerView .ObjectMgr + viewId = msg~send + --say "ObjectMgr-showModel-07 - viewId:" viewId + + self~addView(modelClass, modelInstance, viewClass, viewId) + --self~addView(modelClass, modelInstance, "CustomerView", viewId) + return .true + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + modelIdFromView - Returns the model for a given view. + (Added to support drag/drop) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD modelIdFromView PUBLIC + expose objectBag + use strict arg viewId + parse var viewId . viewClassName + --say "ObjectMgr-modelIdFromView-01: viewName =" viewClassName + viewInstanceName = viewId~identityHash + searchClassInst = viewClassName||"-"||viewInstanceName + do label myLoop i over objectBag + arr = objectBag[i] + viewClassInst = arr[2] + if viewClassInst = searchClassInst then do + modelId = arr[1] + leave myLoop + end + end myLoop + --say "ObjectMgr-modelIdFromView-02: modelId =" modelId + return modelId + + /*---------------------------------------------------------------------------- + modelClassFromView - Returns the class name of the model for a given view. + (Added to support drag/drop) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD modelClassFromView PUBLIC + expose objectBag + use strict arg viewId -- the object id of a View dialog. + modelName = .nil + parse var viewId . viewClassName + --say "ObjectMgr-modelClassFromView-01: viewName =" viewClassName + viewInstanceName = viewId~identityHash + searchClassInst = viewClassName||"-"||viewInstanceName + do label myLoop i over objectBag + arr = objectBag[i] + viewClassInst = arr[2] + if viewClassInst = searchClassInst then do + modelName = i + leave myLoop + end + end myLoop + parse var modelName className "-" . + --say "ObjectMgr-modelClassFromView-02: modelName, className =" modelName||"," classname + return className + + + /*---------------------------------------------------------------------------- + addView - Adds a View to the ObjectBag. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD addView PRIVATE + expose objectBag --viewBag + use strict arg modelClass, modelInstance, viewClass, viewId + --say "ObjectMgr-addView-01." + -- Get view's instanceName + viewInstance = viewId~identityHash + + -- First, add View name to arr[2] of Model's entry in ObjectBag: + modelName = modelClass||"-"||modelInstance + modelName = modelName~upper() + viewClass = viewClass~upper() + viewName = viewClass||"-"||viewInstance + arr = objectBag[modelName] + arr[2] = viewName + -- Now add the View to the ObjectBag: + self~addComponentId(viewClass, viewInstance, viewId) + --say "ObjectMgr-addView-02: list with new View class:" + --self~list + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + removeView - Removes a view from the ObjectBag. (Used by RcView & ResView.) + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD removeView PUBLIC + expose objectBag + use arg viewClass, viewInstance + viewClass = viewClass~upper() -- View class was uppered in addView method. + viewClassInst = viewClass||"-"||viewInstance + --say "ObjectMgr-removeView-01: viewClassInst:" "'"||viewClass||"'" "'"||viewClassInst||"'" + r = objectBag~remove(viewClassInst) + --say "ObjectMgr-removeView-02: r =" r + do i over objectBag + arr = objectBag[i] + if arr[2] = viewClassInst then arr[2] = .nil + end + --say "ObjectMgr-removeView-03: ObjectBag List:" + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*----------------------------------------------------------------------- + list - Produces a list on stdout of the classes and their Instances + that are in the Object Bag. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + ::METHOD list PUBLIC + expose objectBag viewBag + say; say "Object Bag List:" + say " ----------------------------------------------------------------------------" + say " Class-Instance Model Id ViewClass-Inst" + say " ------------------------ ------------------------ ------------------------" + do name over objectBag + arrItems = objectBag[name] + viewClass = arrItems[2] + if viewClass = .nil then viewClass = ".nil" + modelId = arrItems[1] + --say "ObjectBag-list-01: ModelID =" modelId ";" modelId~objectName + say " " name~left(25) modelId~objectName~left(25) viewClass~left(25) + end + say " ----------------------------------------------------------------------------" + say + /*say; say "Latest View Instances:" + say " View Class Instance" + say " ------------------------- ---" + do viewClass over viewBag + viewNo = viewBag[viewClass] + say viewClass~left(25) viewNo~right(7) + end + say + */ + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/View.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/View.rex new file mode 100755 index 0000000..cde9acc --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/View.rex @@ -0,0 +1,363 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/* ooDialog User Guide - Support + Exercise 08: View.rex + + ViewMixin v01-02 18Jun13 + --------- + A mixin superclass for View components (part of the Model-View Framework). + + Contains: class: "ViewMixin" + + Description: A mixin superclass for all xxxView components. + + Pre-requisites: MVF. + + Outstanding Problems: None reported. + + Changes: + v01-00 12May13: First Version. + v01-01 06Jun13: Added drag/drop methods. Also store model id as an + attribute ('myModel') to save subclases having to do it. + Note - some drag/drop methods are there as catch-alls for + when a subclass does not implement them. Default action + still to be verified. + 18Jun13: Changed "drop" method to "dmDrop" and "pickup" to "dmPickup" + (both sent to DragMgr). + +------------------------------------------------------------------------------*/ + +::REQUIRES "ooDialog.cls" +::REQUIRES "support\Component" + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ViewMixin v01-00 13May13 + --------- + A mixin superclass for View classes. the Order Management dialog. Handles interest registration, + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::CLASS View SUBCLASS RcDialog PUBLIC +::CLASS View PUBLIC MIXINCLASS PlainBaseDialog + + ::ATTRIBUTE viewMgr + ::ATTRIBUTE objectMgr + ::ATTRIBUTE dragMgr + ::ATTRIBUTE myModel + + /*---------------------------------------------------------------------------- + initView - initialises the mixin instance - invoked from ??? + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::method init -- Results in hang! + ::METHOD initView + --say "View-initView-01." + self~objectMgr = .local~my.ObjectMgr -- Needed to clear up when dialog closed. + self~viewMgr = .local~myViewMgr + -- Direct Manipulation: + self~dragMgr = .local~my.DragMgr + --say "View-initView-01: dragMgr =" self~dragMgr + + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + activate - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD activate UNGUARDED + expose viewClass viewInstance -- needed for tidy-up on close. + use arg modelId + -- Store model id for use by subclasses: + self~myModel = modelId + --say "View-activate-01: self =" self + -- Get View Instance name and View Class for tidy-up when dialog is closed. + viewInstance = self~identityHash + dlgName = self~objectName + parse var dlgName . viewClass + modelData = modelId~query + --say "View-activate-02." + return modelData + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + showModel - forwards to ObjectMgrloadList - for invocation by subclasses. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel + use strict arg modelClass, modelInstance, parentDlg + r = self~ObjectMgr~showModel(modelClass, modelInstance, parentDlg) + if r = .false then say "View-showModel - ObjectMgr returned .false." + return r + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + loadList - must be invoked by subclass. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD loadList Wait till check out how do ShowModel for List. + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + leaving - invoked by ooDialog when a dialog closes. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD leaving UNGUARDED + expose viewClass viewInstance + --say "View-leaving-01. objectMgr =" objectMgr + self~objectMgr~removeView(viewClass, viewInstance) + self~dragMgr~removeDlg(self) -- closing, so tell DragManager + -- Note - we do not remove the Model. Should we? If so, not from here! + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Popup Offsets + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + setOffsetParent - set the parent dialog id for later offsetting of a child + dialog. + **** Note: This method not used in Exercise07. **** */ + ::METHOD setOffsetParent + use strict arg parentDlg + viewMgr = .local~my.ViewMgr + viewMgr~parentOffsetDlg = self + + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + offset - offsets a "child" dialog from its "parent" dialog (i.e. the dialog + from which the child is "popped up"). + **** Note: This method not used in Exercise07. **** */ + ::METHOD offset + --say "RcView-offset-1." + offset = .local~my.ViewMgr~dlgOffset + parentDlg = .local~my.ViewMgr~parentOffsetDlg + popupPos = parentDlg~getRealPos + popupPos~incr(offset,offset) + self~moveTo(popupPos, "SHOWWINDOW") + self~ensureVisible() + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + initDialog - invokes offset. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD initDialog + say "ViewMixin-initDialog-01." + self~offset + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + Drag/Drop Methods + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*---------------------------------------------------------------------------- + dmSetAsSource - called by a view component to define itself as a drag source. + Typically invoked from subclass' initDialog method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD dmSetAsSource PRIVATE -- DM setup method + -- Each source dialog should invoke this only once. + -- Invoking it more than once may well result in errors. + -- Note: a dialog may be both source and target. + expose mouse dmSourceControl sourceWin + use arg dmSourceCursorFile, dmSourceArea, dmSourceControl + if dmSourceCursorFile = .nil then do + say "View-dmSetAsSource-00:" .HRS~dmSrcNulCursor + return .false + end + --say "View-dmSetAsSource-01: dmSourceCursorFile, dmSourceArea, dmSourceControl:" + --say " '"||dmSourceCursorFile||"', "||dmSourceArea", "||dmSourceControl + + if dmSourceArea = "DMSOURCEAREA" then do -- set default pickup area + dmSourceArea = self~clientRect() + dmSourceArea~left += 10; dmSourceArea~top += 10; - + dmSourceArea~right -= 10; dmSourceArea~bottom -= 10 + --say "View-dmSetAsSource-02 - default pickup client area =" dmSourceArea + end + --else say "View-dmSetAsSource-03 - pickup client area =" dmSourceArea + + if dmSourceControl = "DMSOURCECONTROL" then do -- The source is a dialog. + --say "View-dmSetAsSource-04: source is a dialog." + sourceWin = self + mouse = .Mouse~new(sourceWin) + mouse~connectEvent('MOUSEMOVE',dmOnMove) + mouse~connectEvent('LBUTTONDOWN', dmOnLBdown) + mouse~connectEvent('LBUTTONUP', dmOnLBup) + --self~dragMgr~setSource(self, mouse, dmSourceCursorFile, dmSourceArea, .nil) + self~dragMgr~setSource(self, mouse, dmSourceCursorFile, dmSourceArea, self) -- *** + end + else do -- The source is a control (such as a ListView). + --say "View-dmSetAsSource-05: source is a control." + sourceWin = dmSourceControl + mouse = .Mouse~new(dmSourceControl) + mouse~connectEvent('MOUSEMOVE',dmOnMove) + mouse~connectEvent('LBUTTONDOWN', dmOnLBdown) + mouse~connectEvent('LBUTTONUP', dmOnLBup) + --self~dragMgr~setSource(self, mouse, dmSourceCursorFile, dmSourceArea, dmSourceControl) + self~dragMgr~setSource(sourceWin, mouse, dmSourceCursorFile, dmSourceArea, self) -- *** + end + --mouse~connectEvent('MOUSELEAVE', dmLeave) + --say "View-dmSetAsSource-06: source is:" sourceWin + + + return .true + + /*---------------------------------------------------------------------------- + dmSetAsTarget - called by a view component to define itself as a drag target. + Typically invoked from subclass' initDialog method. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD dmSetAsTarget -- DM setup method + -- Each target dialog should invoke this only once. + -- Invoking it more than once may well result in errors. + -- Note: a dialog may be both source and target. + expose dmIsTargetDlg + use arg dmDropArea + --say "View-dmSetAsTarget-01." + + if dmDropArea = "DMDROPAREA" then do -- set default. Better is to check the type. + dmDropArea = self~clientRect() + dmDropArea~left += 10; dmDropArea~top += 10; dmDropArea~right -= 30; dmDropArea~bottom -= 30 + end + + self~dragMgr~setTarget(self, self~hwnd, dmDropArea) + + return .true + + -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ::METHOD dmOnLBdown + expose sourceWin + use arg keyState, mousePos + --say "View-dmOnLBdown-00; self, keystate, mousePos =" self||"," keystate||"," mousePos + info = self~dmGetItemInfo -- for listviews + if info = 0 then nop --say "View-dmOnLBdown-01 - info is zero." + + else do + nop --say "View-dmOnLBdown-02; info, sourceWin =" info||"," sourceWin + -- store the info somewhere - how about "drag data"?. + -- Drag data = classname, instance name. + end + --self~DragMgr~dmPickup(self, keyState, mousePos, dragData) - not right yet + self~DragMgr~dmPickup(sourceWin, keyState, mousePos) -- pre-listview + return 0 + + ::METHOD dmGetItemInfo -- Dummy method for when sublcass does not + -- implement it. + return 0 + + + -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ::METHOD dmOnMove + expose sourceWin + use arg keyState, mousePos + --say "View-dmOnMove: self, sourceWin =" self||"," sourceWin + self~dragMgr~moving(sourceWin, self, keystate, mousePos) + --say "View-dmOnMove" + return 0 + + -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ::METHOD dmOnLBup + use arg keyState, mousePos + --say "View-dmOnLBup-01; self =" self + self~dragMgr~dmDrop(self, keyState, mousePos) + --return r -- throws error, as done no return at all. + return 0 + say 'DMSource-onLButtonUp: the mouse is at ('mousePos~x',' mousePos~y') with these qualifiers:' keyState + + -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +/* ::METHOD dmNeverDrop + -- Invoked by a target object to prevent any drop (e.g. if a sales order is + -- complete and should not now be altered). The red/white target icon is + -- changed to grey. + expose dmTargetIconImage dmIcons dmTargetInactive + use arg dmTargetInactive + if dmTargetInactive then dmTargetIconImage~setImage(dmIcons[dmTgtInactiveIcon]) + else dmTargetIconImage~setImage(dmIcons[dmTgtReadyIcon]) +*/ + + ::METHOD dmQueryDrop + use arg dmSourceDlg, mousePos + --say "View-dmQueryDrop-01." + return .true -- Default is to accept the drop. + + ::METHOD dmDrop + use arg sourceDlg + --say "View-dmDrop-01." + return .true + +/* ::METHOD cancel + expose dmDragMgr + say "View-Cancel-01." + dmDragMgr~removeDlg(self) -- closing, so tell DragManager + return self~cancel:super +*/ +/* + ::METHOD ok + say "View-ok-01." + self~dragMgr~removeDlg(self) -- closing, so tell DragManager + return self~ok:super +*/ + + + /*---------------------------------------------------------------------------- + Event Management Methods. *** INCOMPLETE *** + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + --::METHOD triggerEvent + -- use strict arg event + -- idEventMgr = .local~my.EventMgr + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD viewDoIt + --say "View-viewDoIt-01." + + +/*============================================================================*/ + + + +/*============================================================================== + Human-Readable Strings (HRS) v00-01 13Jan12 + -------- + The HRS class provides constant character strings for user-visible messages. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +::CLASS HRS PRIVATE -- Human-Readable Strings + ::CONSTANT dmSrcNulCursor "View-dmSetAsSource - Error: Source Cursor is null." + ::CONSTANT dmTgtBadParam "View-dmSetAsTarget - Error: null dlg or null hwnd or both." + + diff --git a/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/ViewMgr.rex b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/ViewMgr.rex new file mode 100755 index 0000000..ccec9db --- /dev/null +++ b/modules/windows/oodialog/userGuide/exercises/Exercise08/Support/ViewMgr.rex @@ -0,0 +1,122 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2011-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/*////////////////////////////////////////////////////////////////////////////// + ============================================================================== + ViewMgr v01-00 13Feb13 + ---------- + A singleton component that manages Views and view-related function + such as Popup Offsetting. + + Changes: + v01-00 23Apr12: First version + 11Jan13: Comment-out 'say' instructions. + 13Feb13: Remove code not used. + = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = */ + +--::REQUIRES "ObjectMgr.rex" + +::CLASS 'ViewMgr' PUBLIC + + :: ATTRIBUTE dlgOffset -- A single number of dialog units by which a + -- child dialog is offset (vertically and + -- horizontally) from a parent. + :: ATTRIBUTE parentOffsetDlg -- The dialog from which a "child" dialog is + -- "popped up". + + /*---------------------------------------------------------------------------- + init - initialises the ViewMgr + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD init + --expose dlgOffset + --say "ViewMgr-init." + .local~my.ViewMgr = self + self~dlgOffset = 200 + return + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + /*---------------------------------------------------------------------------- + setPopupParent - Remembers the id of a parent dlg that is "popping up" + a child dialog. + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD setPopupParent PUBLIC + use strict arg parentDlg -- the dialog id of the Parent View + self~parentDlg = parentDlg + say "ViewMgr-setPopupParent-01. Parent View =" parentDlg + + /*---------------------------------------------------------------------------- + offsetDlg - Calculates the desired position of a "child" dialog given + the dlg id of the "parent" dialog and offsets it from the + parent dialog by the "dlgOffset". + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ +/* ::METHOD offsetDlg PUBLIC + use strict arg childDlg + say "ViewMgr-popupChild-01. Parent View, Child View:" parentDlg childDlg + parentPos = parentView~getRealPos + childPos = incr(dlgOffset, dlgOffset) + return +*/ + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + + + + + /*---------------------------------------------------------------------------- + showModel - Surface a View. Uses the ObjectMgr to see if the view already + exists, and if so, to surface it; else the ObjectMgr causes the + required view to be created. + *** Note - Not supported by MessageSender in Exercise07. *** + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + ::METHOD showModel PUBLIC + use strict arg modelClass, modelInstance + say "ViewMgr-showModel-01: class / instance:" modelClass "/" modelInstance + -- Get the ObjectMgr to do the work: + dlg = .local~my.ObjectMgr~showModel(modelClass, modelInstance) + if dlg = .false then do + say "ViewMgr-showModel-02: bad response from ObjectMgr." + return .false + end + else do + --say "ViewMgr-showModel-03: good response from ObjectMgr." + return .true + end + + /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ + +/*============================================================================*/ diff --git a/modules/windows/oodialog/wav/byebye.wav b/modules/windows/oodialog/wav/byebye.wav new file mode 100644 index 0000000..41f4ce8 Binary files /dev/null and b/modules/windows/oodialog/wav/byebye.wav differ diff --git a/modules/windows/oodialog/wav/cancel.wav b/modules/windows/oodialog/wav/cancel.wav new file mode 100644 index 0000000..3605b24 Binary files /dev/null and b/modules/windows/oodialog/wav/cancel.wav differ diff --git a/modules/windows/oodialog/wav/clap.wav b/modules/windows/oodialog/wav/clap.wav new file mode 100644 index 0000000..9b2dfad Binary files /dev/null and b/modules/windows/oodialog/wav/clap.wav differ diff --git a/modules/windows/oodialog/wav/elephant.wav b/modules/windows/oodialog/wav/elephant.wav new file mode 100644 index 0000000..104597b Binary files /dev/null and b/modules/windows/oodialog/wav/elephant.wav differ diff --git a/modules/windows/oodialog/wav/goat.wav b/modules/windows/oodialog/wav/goat.wav new file mode 100644 index 0000000..78f98c2 Binary files /dev/null and b/modules/windows/oodialog/wav/goat.wav differ diff --git a/modules/windows/oodialog/wav/gotcha.wav b/modules/windows/oodialog/wav/gotcha.wav new file mode 100644 index 0000000..b386d8c Binary files /dev/null and b/modules/windows/oodialog/wav/gotcha.wav differ diff --git a/modules/windows/oodialog/wav/guess.wav b/modules/windows/oodialog/wav/guess.wav new file mode 100644 index 0000000..29d199e Binary files /dev/null and b/modules/windows/oodialog/wav/guess.wav differ diff --git a/modules/windows/oodialog/wav/help.wav b/modules/windows/oodialog/wav/help.wav new file mode 100644 index 0000000..86dca89 Binary files /dev/null and b/modules/windows/oodialog/wav/help.wav differ diff --git a/modules/windows/oodialog/wav/horse.wav b/modules/windows/oodialog/wav/horse.wav new file mode 100644 index 0000000..ff6ae5c Binary files /dev/null and b/modules/windows/oodialog/wav/horse.wav differ diff --git a/modules/windows/oodialog/wav/inst.wav b/modules/windows/oodialog/wav/inst.wav new file mode 100644 index 0000000..ddc98a9 Binary files /dev/null and b/modules/windows/oodialog/wav/inst.wav differ diff --git a/modules/windows/oodialog/wav/jackpot.wav b/modules/windows/oodialog/wav/jackpot.wav new file mode 100644 index 0000000..5320fa8 Binary files /dev/null and b/modules/windows/oodialog/wav/jackpot.wav differ diff --git a/modules/windows/oodialog/wav/moose.wav b/modules/windows/oodialog/wav/moose.wav new file mode 100644 index 0000000..dc464de Binary files /dev/null and b/modules/windows/oodialog/wav/moose.wav differ diff --git a/modules/windows/oodialog/wav/nope.wav b/modules/windows/oodialog/wav/nope.wav new file mode 100644 index 0000000..d298b4c Binary files /dev/null and b/modules/windows/oodialog/wav/nope.wav differ diff --git a/modules/windows/oodialog/wav/philcake.wav b/modules/windows/oodialog/wav/philcake.wav new file mode 100644 index 0000000..2fc4726 Binary files /dev/null and b/modules/windows/oodialog/wav/philcake.wav differ diff --git a/modules/windows/oodialog/wav/phileat.wav b/modules/windows/oodialog/wav/phileat.wav new file mode 100644 index 0000000..45cc7d0 Binary files /dev/null and b/modules/windows/oodialog/wav/phileat.wav differ diff --git a/modules/windows/oodialog/wav/philhelp.wav b/modules/windows/oodialog/wav/philhelp.wav new file mode 100644 index 0000000..a33a3e6 Binary files /dev/null and b/modules/windows/oodialog/wav/philhelp.wav differ diff --git a/modules/windows/oodialog/wav/philouch.wav b/modules/windows/oodialog/wav/philouch.wav new file mode 100644 index 0000000..3241abe Binary files /dev/null and b/modules/windows/oodialog/wav/philouch.wav differ diff --git a/modules/windows/oodialog/wav/philslep.wav b/modules/windows/oodialog/wav/philslep.wav new file mode 100644 index 0000000..98787a7 Binary files /dev/null and b/modules/windows/oodialog/wav/philslep.wav differ diff --git a/modules/windows/oodialog/wav/philstop.wav b/modules/windows/oodialog/wav/philstop.wav new file mode 100644 index 0000000..ebcaf35 Binary files /dev/null and b/modules/windows/oodialog/wav/philstop.wav differ diff --git a/modules/windows/oodialog/wav/philstrt.wav b/modules/windows/oodialog/wav/philstrt.wav new file mode 100644 index 0000000..aee7eaf Binary files /dev/null and b/modules/windows/oodialog/wav/philstrt.wav differ diff --git a/modules/windows/oodialog/wav/philwait.wav b/modules/windows/oodialog/wav/philwait.wav new file mode 100644 index 0000000..310c798 Binary files /dev/null and b/modules/windows/oodialog/wav/philwait.wav differ diff --git a/modules/windows/oodialog/wav/readme.txt b/modules/windows/oodialog/wav/readme.txt new file mode 100644 index 0000000..bfc128b --- /dev/null +++ b/modules/windows/oodialog/wav/readme.txt @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +Because of restrictions on the redistribution of sample code, not all of the sound +files used in the samples are included in this directory. + +The following ".WAV" files of the Windows directory are used by the samples: + + CHIMES.WAV + CHORD.WAV + DING.WAV + TADA.WAV + +The files do not need to be copied into this directory, since the sample application +will locate them in the Windows directory automatically. +All of the samples will also run without any ".WAV" files. diff --git a/modules/windows/oodialog/wav/rhino.wav b/modules/windows/oodialog/wav/rhino.wav new file mode 100644 index 0000000..d30bd4e Binary files /dev/null and b/modules/windows/oodialog/wav/rhino.wav differ diff --git a/modules/windows/oodialog/wav/sample.wav b/modules/windows/oodialog/wav/sample.wav new file mode 100644 index 0000000..4205423 Binary files /dev/null and b/modules/windows/oodialog/wav/sample.wav differ diff --git a/modules/windows/oodialog/wav/sealion.wav b/modules/windows/oodialog/wav/sealion.wav new file mode 100644 index 0000000..2a3ef69 Binary files /dev/null and b/modules/windows/oodialog/wav/sealion.wav differ diff --git a/modules/windows/oodialog/wav/start.wav b/modules/windows/oodialog/wav/start.wav new file mode 100644 index 0000000..412e470 Binary files /dev/null and b/modules/windows/oodialog/wav/start.wav differ diff --git a/modules/windows/oodialog/wav/take.wav b/modules/windows/oodialog/wav/take.wav new file mode 100644 index 0000000..5e6b3ee Binary files /dev/null and b/modules/windows/oodialog/wav/take.wav differ diff --git a/modules/windows/oodialog/wav/tiger.wav b/modules/windows/oodialog/wav/tiger.wav new file mode 100644 index 0000000..1813a33 Binary files /dev/null and b/modules/windows/oodialog/wav/tiger.wav differ diff --git a/modules/windows/oodialog/wav/whistle.wav b/modules/windows/oodialog/wav/whistle.wav new file mode 100644 index 0000000..935b2c8 Binary files /dev/null and b/modules/windows/oodialog/wav/whistle.wav differ diff --git a/modules/windows/oodialog/wav/yourgood.wav b/modules/windows/oodialog/wav/yourgood.wav new file mode 100644 index 0000000..f510f24 Binary files /dev/null and b/modules/windows/oodialog/wav/yourgood.wav differ diff --git a/modules/windows/oodialog/winsystem/deskicon.rex b/modules/windows/oodialog/winsystem/deskicon.rex new file mode 100755 index 0000000..7f22caa --- /dev/null +++ b/modules/windows/oodialog/winsystem/deskicon.rex @@ -0,0 +1,99 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*****************************************************************************/ +/* Name: DESKICON.REX */ +/* Type: Open Object Rexx Script */ +/* */ +/* Description: Sample how to create a desktop icon using the AddDesktopIcon */ +/* method from the WindowsProgramManager class */ +/* */ +/* TODO change this to a GUI application by creating a dialog */ +/* that explains what is happening and has push buttons */ +/* to iniate the actions. */ +/* */ +/*****************************************************************************/ + +pm = .WindowsProgramManager~new + +/* Create a shortcut to notepad editor with shortcut key CONTROL+ALT+N. + * The shortcut will be a personal shortcut for the current user. "PERSONAL" + * is the default. + */ +rc = pm~AddDesktopIcon("My Notepad 1","%SystemRoot%\system32\notepad.exe",,,"%HOMEDRIVE%%HOMEPATH%",,,"n") + +if rc then call errorDialog "Error. Could not create the 'My Notepad 1' shortcut." + +/* Create a shortcut to run REXXTRY, use the REXX.ICO icon, working diretory is + * %TEMP%, th argument is REXXTRY, the shortcut key is CTRL+ALT+T. The shortcut + * should be common for all users, but on Vista you can not write to the all + * users area unless you have elevated Administrator pivileges. + */ +parse value SysVersion() with name version +if version >= 6 then do + msg = "The next shortcut is intended to be an 'All Users' shortcut." || '0d0a0d0a'x || - + "But, on Vista you can not write to the 'All Users' area without" || '0d0a'x || - + "elevated privileges. If you run this program with elevated" || '0d0a'x || - + "privileges, then creating an 'All Users' shortcut will succeed," || '0d0a'x || - + "otherwise it will fail. You can choose to create an 'All Users'" || '0d0a'x || - + "shortcut, or a 'Personal' shortcut. (Creating a 'Personal'" || '0d0a'x || - + "shortcut will always succeed.)"|| '0d0a0d0a'x || - + "Create an 'All Users' shortcut?" + + isYes = askDialog(msg) + if isYes then location = "COMMON" + else location = "PERSONAL" +end +else do + location = "COMMON" +end + +rc = pm~AddDesktopIcon("RexxTry","rexx.exe","rexx.ico",0,"%TEMP%",location,"rexxtry","T","MAXIMIZED") + +if rc then call errorDialog "Error. Could not create the 'RexxTry' shortcut." + +/* Create a shortcut to NOTEPAD editor, with the working diretory as c:\temp. + * The shortcut will be a personal shortcut for the current user. + */ +rc = pm~AddDesktopIcon("My Notepad 2","notepad.exe", , ,VALUE( 'TEMP',, 'ENVIRONMENT' ) || '\',"PERSONAL", , ,"MAXIMIZED") + +if rc then call errorDialog "Error. Could not create the 'My Notepad 2' shortcut." + +return 0 + +::requires "winsystm.cls" +::requires "ooDialog.cls" diff --git a/modules/windows/oodialog/winsystem/desktop.rex b/modules/windows/oodialog/winsystem/desktop.rex new file mode 100755 index 0000000..1887b67 --- /dev/null +++ b/modules/windows/oodialog/winsystem/desktop.rex @@ -0,0 +1,66 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: DESKTOP.REX */ +/* Type: Open Object Rexx Script */ +/* */ +/* Description: Sample how to add groups and shortcuts to the desktop */ +/* Creates a group and shortcuts to programs on the windows dektop */ +/* using the WindowsProgramManager class */ +/* */ +/* TODO change this to a GUI application. */ +/* */ +/****************************************************************************/ + +pm = .WindowsProgramManager~new + +pm~AddGroup("My Own Group") +pm~AddItem("My own notepad", "notepad.exe", "NOTEPAD.EXE",0) +pm~AddItem("My own calculator", "calc.exe",,,,1) +pm~AddItem("My own write", "write.exe",,,"c:\") +pm~ShowGroup("My own group", "MAX") +say "press enter to delete the 'My own write' item" +pull +pm~DeleteItem("My own write") + +pm~ShowGroup("My Own Group") +say "press enter to delete the 'My Own Group' group" +pull +pm~DeleteGroup("My Own Group") + +::requires "winsystm.cls" diff --git a/modules/windows/oodialog/winsystem/displayAnyMenu.rex b/modules/windows/oodialog/winsystem/displayAnyMenu.rex new file mode 100755 index 0000000..a2a16ac --- /dev/null +++ b/modules/windows/oodialog/winsystem/displayAnyMenu.rex @@ -0,0 +1,189 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: displayAnyMenu.rex + * Type: Example ooRexx program + * + * Description: Displays the menu hierarchy for a window that the user picks. + * + * The user is prompted for the title of an open, top-level, + * window. This program then parses the details of the menubar + * for that window and displays them graphically. + * + * The example uses a mixture of ooDialog and winsystm. + * + * In addition, the example uses some of the public functions + * provided by the windowsSystem.frm package. That framweowork + * is an example of how to extract common function into a + * package and share that function with any number of ooRexx + * programs. + * + * The table below lists the external functions and classes used in this + * program and shows where to go to examine the source code for them. + * + * External function Source + * --------------------------------------------------- + * RcDialog ooDialog + * errorDialog() ooDialog + * askDialog() ooDialog + * infoDialog() ooDialog + * MenuDetailer windowsSystem.frm + * findTheWindow() windowsSystem.frm + */ + +sd = locate() +.application~useGlobalConstDir("O", sd"winSystemDlgs.h") + +-- Prompt the user for a window title +dlg = .UserPrompt~new(sd"winSystemDlgs.rc", IDD_USER_PROMPT) + +if dlg~initCode <> 0 then do + msg = "Error initializing the UserPrompt dialog." || '0d0a0d0a'x || - + "The dislplayAnyMenu example will have to quit." + j = errorDialog(msg) + return 99 +end + +-- A return of 2 means the user canceled, and we will just quit. +if dlg~execute("SHOWTOP") == 2 then return 2 + +-- The UserPrompt dialog validates the data, i.e. it enforces that either a +-- valid WindowObject is obtained, or that the user cancels. Here, we ask the +-- dialog for the window object that the user picked, create a MenuDetailer +-- object using that window object, and then display the menu. + +topWnd = dlg~getUserPick +md = .MenuDetailer~new(topWnd) +md~display + +-- Return 0 for okay +return 0 + +::requires 'windowsSystem.frm' + +/** class UserPrompt + * Our user prompt dialog subclasses the RcDialog. The RcDialog class takes + * care of all the details of the dialog and we just over-ride the ok method + * to take care of validating the user input. We also add a method, + * getUserPick(), which is used to return the window object representing the + * window the user selected. + */ +::class 'UserPrompt' subclass RcDialog inherit AdvancedControls MessageExtensions + +/** ok() + * The over-ride of the ok() method is basically simple. It verifies that the + * user entered something in the edit control and then attempts to contstruct + * a .WindowObject using the text from the edit control as the title of a + * window. + * + * The method will only end the dialog with the 'ok' value if a valid window + * object is constructed. Otherwise it forces the user to either try again, + * or to cancel. + */ +::method ok + expose wnd edit + + -- Get the edit control object and then the text the user entered. We only + -- instantiate the edit control object the first time through. + + if \ edit~isA(.EditControl) then edit = self~newEdit(IDC_EDIT_NAME) + title = edit~getText~strip + + -- Check that the user entered something. + if title~length == 0 then do + msg = "You must enter the title of a window whose menu" || '0d0a'x || - + "you want displayed." || '0d0a0d0a'x || - + "Would you rather cancel?" + if askDialog(msg) then return self~cancel + else return + end + + -- Warn the user that constructing the window object may take a little bit of + -- time. + msg = "It may take a second or two find the window" || '0d0a'x || - + "you picked. Be patient." || '0d0a0d0a'x || - + "This dialog will be disabled during the search." + j = infoDialog(msg) + + -- Disable the dialog so that an impatient user can not fiddle with it. + self~disable + edit~disable + self~disableItem(IDOK) + self~disableItem(IDCANCEL) + + -- The big step, get a window object with the title entered by the user. + wnd = findTheWindow(title) + + -- Re-enable the dialog. + self~enable + edit~enable + self~enableItem(IDOK) + self~enableItem(IDCANCEL) + + -- If we don't have a window object, give the user a chance to try again, or + -- to cancel. If the user does not want to try again, we end the dialog by + -- invoking our cancel() method. + if wnd == .nil then do + msg = "Failed to find the window with title:" || '0d0a'x || - + " " title || '0d0a0d0a'x || - + "The window title has to match exactly." || '0d0a0d0a'x || - + "Try again?" + if askDialog(msg) then return + else return self~cancel + end + + -- Okay, we have a window object. We end the dialog by inoking the superclass + -- ok() method. + return self~ok:super + +/** cancel() + * Just to keep things tidy, if the user cancels, we make sure that wnd is .nil. + * Then if getUserPick() is called, .nil is returned. Presumably, if the user + * cancels, getUserPick() would not be invoked. However, if someone were to + * take this dialog class implementation and extend it, this simple detail might + * be overlooked. + */ +::method cancel + expose wnd + wnd = .nil + return self~cancel:super + +/** getUserPick() Return the window object to the caller */ +::method getUserPick + expose wnd + return wnd diff --git a/modules/windows/oodialog/winsystem/displayWindowTree.rex b/modules/windows/oodialog/winsystem/displayWindowTree.rex new file mode 100755 index 0000000..f9a2c12 --- /dev/null +++ b/modules/windows/oodialog/winsystem/displayWindowTree.rex @@ -0,0 +1,275 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: displayWindowTree.rex + * Type: Example ooRexx program + * + * Description: Allows the user to pick an open top-level window and then + * displays the window hiearchy for that window. The program + * uses both ooDialog and winsystm classes. + * + * This example uses some of the public functions provided by + * the windowsSystem.frm package. That framework contains + * functions shared with other example programs shipped with + * ooRexx that use winsystm.cls. + * + * External function Source + * --------------------------------------------------- + * errorDialog() ooDialog + * getWindowTree() windowsSystem.frm + * showWindowTree() windowsSystem.frm + * + */ + +sd = locate() + +-- Use the global .constDir for symbolic IDs and turn auto detection off. +.application~setDefaults("O", sd"winSystemDlgs.h", .false) + +-- Create and show our ooDialog dialog. The logic of the program is contained +-- within the WindowListDlg class. +dlg = .WindowListDlg~new(sd"winSystemDlgs.rc", IDD_WINDOW_List) +if dlg~initCode == 0 then do + dlg~execute("SHOWTOP") + return 0 +end +else do + msg = "Failed to instantiate the .WindowListDlg object." || '0d0a0d0a'x || - + "Aborting on error." + j = errorDialog(msg) + return 99 +end + + +::requires "windowsSystem.frm" + +::class 'WindowListDlg' public subclass RcDialog + +/** initdialog() + * Initialize the state of our dialog controls. + */ +::method initDialog + expose listView windows inError + + -- If some un-anticipated error happens we will change the behaviour of the + -- dialog. inError is used to flag an error. + inError = .false + + -- Instantiate an array that will be used to hold all the top-level window + -- objects. + windows = .array~new + + -- If we can't get the list view control, something is wrong. + listView = self~newListView(IDC_LV_WINDOWS) + if listView == .nil then return self~putInErrorState("NOLISTVIEW") + + -- The extended list view styles can only be added after the list view control + -- has been created. + -- + -- The FULLROWSELECT style highlights the entire row when row is selected + -- rather than just part of the row. + -- + -- The LABLETIP style will cause a tool-tip like label to appear that displays + -- the entire text of the column, if the text is longer than will fit in the + -- column, when the user puts their mouse over the row. + listView~addExtendedStyle("FULLROWSELECT LABELTIP") + + -- We want to set the width of column 0, (the first column,) to the width of + -- the list view control, minus the width of a scroll bar if there is one. + -- + -- We can find out the width of a scroll bar from the system metrics and can + -- query the width of the list view control directly. + -- + -- Note that the system metric figure is in pixels and the column width needs + -- to be in dialog units. Therefore the width of the scroll bar is more than + -- we actually need, but it is close enough. + parse value listView~getSize with width height + + SM_CXVSCROLL = 20 + width -= SystemMetrics(SM_CXVSCROLL) + + -- Insert our one and only column for the list view control. + listView~insertColumn(0, "Window Title", width) + + -- Connect the push buttons to our event handling methods. + self~connectButton(IDC_PB_SHOW, onShow) + self~connectButton(IDC_PB_QUIT, onQuit) + self~connectButton(IDC_PB_REFRESH, onRefresh) + + -- The logic / code to fill the list view control is in the onRefresh() + -- method. So, we simply invoke the method ourselves to populate the list + -- view. + self~onRefresh + + +/** onRefresh() + * This method contains the logic to populate the list view control with the + * titles of the current top-level windows. The method is connected to the + * Refresh button, so it is invoked when the user pushes that button. + * + * However, it can also be invoked internally to populate the list view. This + * is done when the dialog is initialized, from the initDialog() method. And + * it is also invokde if an invalid window handle is detected in the onShow() + * method. + */ +::method onRefresh + expose listView windows inError + + -- Be sure the windows array is empty + windows~empty + + -- Be sure the list view control is empty + listView~deleteAll + + -- Instantiate a WindowManager object and get the desktop window. + mgr = .WindowsManager~new + deskTop = mgr~desktopWindow + + -- Build an array of all the children windows of the desktop. Skip any window + -- that does not have a title or that is invisible. + child = deskTop~firstChild + do while child <> .nil + if child~title~strip \== "", child~state~caselessWordpos("invisible") == 0 then windows~append(child) + child = child~next + end + + -- If we don't have any windows, something is wrong. + if windows~isEmpty then return self~putInErrorState("NOWINDOWS") + + -- Now, for each window, add a row using the window title as the text for the + -- row. + do wnd over windows + listView~addRow( , , wnd~title) + end + + -- Select the first row, so that we are guaranteed that a row is selected. + -- Note that the row numbers are zero-indexed. + listView~select(0) + + +/** onShow() + * The user pushed the 'Show' button. In the unlikely event that we are in an + * error state we will quit. Otherwise, we will display the window hiearchy of + * the window the user selected. + */ +::method onShow + expose listView inError windows + + if inError then return self~cancel + + -- Get the row number selected. Note that we are guarenteed that a row is + -- selected because we selected a row to begin with and we have provided no + -- way for the user to deselect a row. Because of this we do not have to + -- check for -1. Since the rows are zero-indexed, we add 1 to the selected + -- row number, to produce the index into our array of windows. + wnd = windows[listView~selected + 1] + + -- It is conceivable / possible that the user has closed a window since the + -- time the list view was populated. This can be detected because the window + -- state will be 'Illegal Handle.' + if wnd~state == "Illegal Handle" then return self~badHandle + + -- Display the window hierarchy of the selected window. + tree = getWindowTree(wnd) + success = showWindowTree(tree) + + +/** onQuit() + * The user pushed the 'Quit' button. This is easy, just quit the dialog. + */ +::method onQuit + return self~cancel + + +/** badHandle() + * This private method is invoked when the user picks a window that has been + * closed since the list view was originally populated. We tell the user the + * problem and refresh the list view. + */ +::method badHandle private + expose listView + + -- Get the text of the selected item to use in the error message. + title = listView~itemText(listView~selected) + + msg = "The window you selected appears to have been closed." || '0d0a0d0a'x || - + "Window title:" title || '0d0a0d0a'x || - + "The window list is being refreshed. Select a new window." + j = infoDialog(msg) + self~onRefresh + return 0 + + +/** putInErrorState() + * This private method is used when some un-recoverable error is detected. + * + * It displays an error message to the user based on the reason for the error, + * sets the error state flag, and tries to disable the Show push button. + */ +::method putInErrorState private + expose inError + use strict arg reason + + inError = .true + select + when reason == "NOWINDOWS" then do + msg = "For some reason no top-level windows were located." || '0d0a'x || - + "This is not correct, the sample program is not" || '0d0a'x || - + "executing correctly." + end + when reason == "NOLISTVIEW" then do + msg = "An internal error is preventing this sample program" || '0d0a'x || - + "from executing correctly. The ListControl object" || '0d0a'x || - + "could not be obtained." + end + otherwise do + msg = "The sample program is not executing correctly," || '0d0a'x || - + "some unknown error." + end + end + -- End select + + msg = msg || '0d0a0d0a'x || "Please just quit." + j = errorDialog(msg) + + -- We will try to disable the 'Show' push button. But, if the dialog is not + -- working correctly, it could be that this won't work. + pb = self~newPushButton(IDC_PB_SHOW) + if pb <> .nil then pb~disable + + return 0 diff --git a/modules/windows/oodialog/winsystem/eventlog.rex b/modules/windows/oodialog/winsystem/eventlog.rex new file mode 100755 index 0000000..f387689 --- /dev/null +++ b/modules/windows/oodialog/winsystem/eventlog.rex @@ -0,0 +1,529 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: eventlog.rex */ +/* Type: Open Object Rexx Script */ +/* */ +/* Description: Example of how to use the WindowsEventLog class */ +/* */ +/****************************************************************************/ + +/* main program */ + +log = .WindowsEventLog~new + +/******************************************************************************/ +say "==============================================================================" +say " Display some basic attibutes of a WindowsEventLog object. Consult the" +say " documentation for an explanation of the meaning of these attributes." +say +/******************************************************************************/ +say " Events attribute: " log~events +say " Current minimum read buffer size:" log~minimumReadBuffer "bytes" +say " Current minimum read buffer size:" log~minimumRead "KBs" +say " Minimum read buffer range: " log~minimumReadMin "KBs to" log~minimumReadMax "KBs" +say + +/******************************************************************************/ +say "==============================================================================" +say " Open each event log on this computer and display information about the" +say " log. Then close the log." +say +/******************************************************************************/ +logNames = .array~new +ret = log~getLogNames(logNames) + +if ret == 0 then do name over logNames + ret = log~open( , name) + + if ret == 0 then do + say " Event log: " name + say " Total records: " log~getNumber + say " First record number" log~getFirst + say " Last record number " log~getLast + say " Log is full? " logicalToText(log~isFull) + log~close + end + else do + say " Error opening the" name "event log rc:" ret + end + say +end + + +/******************************************************************************/ +say "==============================================================================" +say "Going to read the 3 oldest records in the Application event Log," +say "oldest first. The log is not opened before reading. The open and" +say "close are done implicitly." +/******************************************************************************/ +ok = doPause(.false) + +count = 0 + +if log~getNumber < 3 then do + say "To few records ("log~getNumber") for this demonstration." +end +else do + -- If the user has set the overwrite option for the event log, the first + -- record is not always 1. FORWARDS is the default. + firstRec = log~getFirst + ret = log~readRecords( , , , firstRec, 3) + + if ret == 0 then do + count = displayRecords(log~events) + end + else do + say "Error reading the Application event log rc:" ret + end +end + +say "==========================================================================" +say count "records read" +say + +/******************************************************************************/ +say "==========================================================================" +say "Going to read the 3 most recent records in the System event Log, the" +say "most recent first. The log is not opened before reading. The open" +say "and close are done implicitly." +/******************************************************************************/ +ok = doPause(.false) + +count = 0 + +if log~getNumber("", "System") < 3 then do + say "To few records (" || log~getNumber("", "System") || ") for this demonstration." +end +else do + -- If the user has set the overwrite option for the event log, the most recent + -- record is not always the same as the record number. + lastRec = log~getLast( , "System") + ret = log~readRecords("BACKWARDS", , "System", lastRec, 3) + + if ret == 0 then do + count = displayRecords(log~events) + end + else do + say "Error reading the System event log rc:" ret + end +end + +say "==========================================================================" +say count "records read" +say + +/******************************************************************************/ +say "==========================================================================" +say "Going to read the 3 oldest records in the System event Log, in reverse" +say "chronological older. The log is opened before any operation, then" +say "closed when all operations are done. This allows specifying the log" +say "name only once." +/******************************************************************************/ +ok = doPause(.false) + +count = 0 + +ret = log~open("", "System") + +if ret == 0 then do + totalRecs = log~getNumber + + if totalRecs < 3 then do + say "To few records (" || totalRecs || ") for this demonstration." + end + else do + -- If the user has set the overwrite option for the event log, the first + -- record is not always number 1. + firstRec = log~getFirst + + -- Now calculate the record number we are going to start at. + startRec = firstRec + 3 - 1 -- Same as firstRec + 2 of course. + + ret = log~readRecords("BACKWARDS", , , startRec, 3) + + if ret == 0 then do + count = displayRecords(log~events) + end + else do + say "Error reading the System event log rc:" ret + end + end +end +else do + say "Error opening the System event log rc:" ret +end + +-- It is always safe to invoke the close() method. If no log is open, then the +-- method does nothing. +log~close + +say "==========================================================================" +say count "records read" +say + + +/******************************************************************************/ +say "==========================================================================" +say "Going to read the complete Security event log forwards. If there are" +say "a log of records, this will produce substantial output. You can cancel" +say "if you wish." +/******************************************************************************/ +ok = doPause(.true) +count = 0 + +if ok then do + + ret = log~readRecords("FORWARDS", , "Security") + select + when when ret == 0 & log~events~items == 0 then do + -- On many systems the security log is empty. + say "The Security event log has no event records." + end + + when ret <> 0 then do + say "Error reading the Security event log rc:" ret + end + + otherwise do + count = displayRecords(log~events) + end + end + -- End select +end +else do + say "Skipping this demonstartion." +end + +say "==========================================================================" +say count "records read" +say + + +/******************************************************************************/ +say "==========================================================================" +say "Going to read the complete System event log in reverse chronological" +say "order. If there are a lot of records, this will produce substantial" +say "output. You can cancel if you wish." +/******************************************************************************/ +ok = doPause(.true) +count = 0 + +if ok then do + + ret = log~readRecords("BACKWARDS", , "System") + select + when when ret == 0 & log~events~items == 0 then do + say "The System event log has no event records." + end + + when ret <> 0 then do + say "Error reading the System event log rc:" ret + end + + otherwise do + count = displayRecords(log~events) + end + end + -- End select +end +else do + say "Skipping this demonstartion." +end + +say "==========================================================================" +say count "records read" +say + + +/******************************************************************************/ +say "==========================================================================" +say "Going to write some records to the Application event log." +say "You can skip this step if you do not want records added to" +say "your Application event log." + +/* Some notes on how the event logging service works. Typically, applications + that want to write records to one of the event logs, add entries to the + registry. These registry entries control how the event logging service + handles the writing of a record. + + The registry entries are written to subkeys under the Event log service. + + If an application has not added the registry entries, then the event records + are *always* written to the Application log. This can not be over-ridden. + + So, say there is an application, MyApplication that wants to write a record + using the source name of MyApplication to an event log. To do that the + source name must be a subkey of a logfile entry under the EventLog key in the + registry. + + If MyApplication should be written to the System log the registry key must + be added like this: + + HKEY_LOCAL_MACHINE + System + CurrentControlSet + Services + EventLog + System + MyApplication + Security + System + + If the key does not exists, the Application event log is always used. +*/ + +/******************************************************************************/ +ok = doPause(.true) + +if ok then do + source = "MyLog" + type = 4 -- Information + category = 22 + id = 33 + binaryData = "01 1a ff 4b 0C"x + + ret = log~write( , source, type, category, id, binaryData, "String1", "sTring2") + if ret == 0 then + say "Record" source "successfully written" + else + say "Error writing record" source "rc:" ret + + -- The default type for writing a record is 'Error' This might look a little + -- scary to a user, so we will use Information for the type. + type = 4 -- Information + + ret = log~write(, "Application2", type,,, "1A 1B 1C 0000 00"x, "First String", "Second String") + if ret == 0 then + say "Record Application2 successfully written" + else + say "Error writing record Application2 rc:" ret + + ret = log~write(, "Security1", type,,,"1A1B1C000000"x, "Tom", "John", "Larry", "Frank") + if ret == 0 then + say "Record Security1 successfully written" + else + say "Error writing record Security1 rc:" ret + + ret = log~write(,"Security2", type,,,"04 03 01 1B 1C 00 FF 00 FE 00 FD"x, "One", "Two") + if ret == 0 then + say "Record Security2 successfully written" + else + say "Error writing record Security2 rc:" ret + + ret = log~write(, "System1", type,,,"1A 1B 1C 00 00 00"x, "1", "2", "3", "4") + if ret == 0 then + say "Record System1 successfully written" + else + say "Error writing record System1 rc:" ret + + ret = log~write(, "System2", type,,,"1A1B1C000000"x, "House", "Apartment") + if ret == 0 then + say "Record System2 successfully written" + else + say "Error writing record System2 rc:" ret + + ret = log~write(, "NotRegisteredAppliaction1", type,,,"1A1B1C0000FF00"x, "Cat", "Dog", "Rabbit") + if ret == 0 then + say "Record NotRegisteredAppliaction1 successfully written" + else + say "Error writing record NotRegisteredAppliaction1 rc:" ret + + rawData = "4d 61 72 6b 20 4d 69 65 73 66 65 6c 64 0d 0a"x + ret = log~write(, "NotRegisteredAppliaction2", type,,, rawData, "ooRexx", "example") + if ret == 0 then + say "Record NotRegisteredAppliaction2 successfully written " + else + say "Error writing record NotRegisteredAppliaction2 rc:" ret +end +else do + say "Skipping this demonstartion." +end + +say "==========================================================================" +say + + +/******************************************************************************/ +say "==============================================================================" +say "The next and last demonstration will clear the Application event log." +/******************************************************************************/ + +backupFile = getWriteableFileName() + +if backupFile == "" then do + say "Could not determine with certainty a writeable location for a backup file." + say "You may want to skip this demonstration, the log will not be backed up." +end +else do + say "The log will first be backed up to this file:" + say " " backupFile +end + +say +say "You can skip this step if you do not want to clear" +say "your Application event log." +say +say "If this is the first time you ran this example, you" +say "may want to skip this test so that you can see the" +say "records written to the log in the previous demonstration." +say "(If you elected to write any records.)" +say +say "If you previously ran this example and saved the Application" +say "log, you may want to move the back up file to a different" +say "location. The same back up file name is used each time the" +say "example executes." + +ok = doPause(.true) +if ok then do + if backupFile \== "" then ret = log~clear(, , backupFile) + else ret = log~clear + + if ret == 0 then say "The Application event log was cleared successfully." + else say "Error clearing the Application event log rc:" ret +end + +return 0 /* leave program */ + +::requires "winsystm.cls" + +/* Routine to display the event log records */ +::routine displayRecords + use strict arg records + + say records~items "records read" + + do record over records + say "==========================================================================" + parse var record type date time "'" sourcename"'" id userid computer "'" string "'" "'" data "'" + say 'Type : 'type + say 'Date : 'date + say 'Time : 'time + say 'Source : 'sourcename + say 'ID : 'id + say 'UserId : 'userid + say 'Computer : 'computer + say 'Detail : 'string + say 'Data : 'data + end + +return records~items + +/* Simple routine to do a logical into text */ +::routine logicalToText + use strict arg logical + if logical then return "True" + else return "False" + +/* Simple routine to pause the program */ +::routine doPause + use arg confirm + + say + if confirm then do + say "Continue? (y/n)" + parse lower pull answer + ok = (answer~left(1) == 'y') + end + else do + say "Press Enter to continue" + pull + ok = .true + end + say + +return ok + +::routine getWriteableFileName + + -- Find this user's Documents directory, surely that is writeable. + + shell = .oleObject~new('Shell.Application') + folderConstant = '5'~x2d() + folderObj = shell~nameSpace(folderConstant) + folderItem = folderObj~self + documentsFolder = folderItem~path + + backupFile = "" + + -- Check that we got a good directory + if SysIsFileDirectory(documentsFolder) then do + -- Unfortunately, we can not use a network mapped drive and it is not + -- uncommon for people to have their My Documents directory on a network + -- share. + drv = documentsFolder~left(2) + if SysDriveMap(drv, "REMOTE")~caselessWordPos(drv) == 0 then do + backupFile = documentsFolder || '\applicationBackup_01.evt' + end + end + + if backupFile == "" then do + -- Keep looking, see if we can write to the current directory. + currentDir = directory() + if canWriteToDir(currentDir) then do + backupFile = currentDir || "\applicationBackup_01.evt" + end + else do + -- As a last resort, try the temp directory + tempDir = value("TEMP", , 'ENVIRONMENT') + if canWriteToDir(tempDir) then do + backupFile = tempDir || "\applicationBackup_01.evt" + end + end + end + +return backupFile + +::routine canWriteToDir + use strict arg dir + + tmpFile = dir || '\' || "tmpFileWriteTest.deleteMe" + + -- Write to the file, close it, test it, delete it. + j = lineout(tmpFile, "Delete this file if you find it") + j = lineout(tmpFile) + if SysIsFile(tmpFile) then do + answer = .true + end + else do + answer = .false + end + + 'del /F /Q' tmpFile '1>nul 2>&1' + +return answer diff --git a/modules/windows/oodialog/winsystem/getTheWindow.rex b/modules/windows/oodialog/winsystem/getTheWindow.rex new file mode 100755 index 0000000..a30f5aa --- /dev/null +++ b/modules/windows/oodialog/winsystem/getTheWindow.rex @@ -0,0 +1,199 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: getTheWindow.rex + * Type: Example ooRexx program + * + * Description: This example shows how to find a window without using the + * exact window title. + * + * The WindowsManager class provides the find() method to get a + * top-level window using its title. But, you need to use the + * exact title. This example uses a method of the + * WindowsManager, desktopWindow(), that is available in ooRexx + * 4.0.0 and later. Once you get the desktop window, you can + * enumerate all its children windows and compare their titles + * in a custom matching function. + * + */ +say +say +say 'This sample program will find an open top-level window' +say 'using a substring of the window title. Case does not' +say 'matter.' +say +say 'Enter part of the title of the window you want found' +.stdout~charout(" Substring: ") +parse pull text + +-- Instantiate a WindowManager object and get the desktop window. +mgr = .WindowsManager~new +deskTop = mgr~desktopWindow + +say +say +say 'First some information about the desktop window:' +say 'Desktop: ' desktop +say ' Class: ' deskTop~wClass +say ' Position:' deskTop~coordinates +say +say + +text = text~strip +if text == "" then do + say 'Sorry the empty string is not going to work.' + say 'Try again when you are serious about finding' + say 'a window.' + say + return 99 +end + +-- This function is where the real work is done. +wnd = fuzzyFindWindow(deskTop, text) + +if wnd <> .nil then do + say 'Found your window.' + say ' Title: ' wnd~title + say ' Class: ' wnd~wClass + say ' Position:' wnd~coordinates + say ' Styles: ' wnd~getStyle +end +else do + say 'Could not find your window' + say ' Are you sure' text 'is a substring' + say ' of the window title?' +end + +-- fuzzyFindWindow() returns the first matching window. We'll use another, +-- similar, function to get all matching windows. +say +say +say 'This is a similar exercise, but will find all matching' +say 'windows, using a substring of the window title.' +say +say 'Enter part of the title of the window(s) you want found' +.stdout~charout(" Substring: ") +parse pull text +say +say + +text = text~strip +if text == "" then do + say 'Sorry the empty string is not going to work.' + say 'Try again when you are serious about finding' + say 'a window.' + say + return 99 +end + +-- This function will return an array with all matching windows. An empty array +-- signals no match. +windows = fuzzyFindWindows(deskTop, text) + +if windows~items > 0 then do wnd over windows + say 'Found this window.' + say ' Title: ' wnd~title + say ' Class: ' wnd~wClass + say ' Position:' wnd~coordinates + say ' Styles: ' wnd~getStyle + say +end +else do + say 'Could not find any matching windows.' + say ' Are you sure' text 'is a substring' + say ' of some open window title?' +end +say + +return 0 + +::requires 'winsystm.cls' + +/** fuzzyFindWindow() + * Searches the desktop children window for a window whose title contains the + * text specified. + * + * @param desktopWnd The desktop window object. + * @param text The text to look for, case is not significant. + * + * @return The window object if a window is found, otherwise .nil. + * + * @note Although in this program, only the desktop window is used, the + * function itself would work for any window. + */ +::routine fuzzyFindWindow + use strict arg deskTopWnd, text + + -- Set up the default return. + wnd = .nil + + -- Starting with the first child window, look at each window's title and see + -- if it contains the specified text. The first match found is returned. + child = deskTopWnd~firstChild + do while child <> .nil + title = child~title + if title~caselessPos(text) <> 0 then do + wnd = child + leave + end + + child = child~next + end + +return wnd + +/** fuzzyFindWindows() + * This is the exact same function as the above, except it returns an array of + * all the windows that contain the specified text. + */ +::routine fuzzyFindWindows + use strict arg deskTopWnd, text + + -- Set up the default return. + w = .array~new + + -- Starting with the first child window, look at each window's title and see + -- if it contains the specified text. Add each matching window to the array. + child = deskTopWnd~firstChild + do while child <> .nil + title = child~title + if title~caselessPos(text) <> 0 then w~append(child) + child = child~next + end + +return w diff --git a/modules/windows/oodialog/winsystem/menuCalc.rex b/modules/windows/oodialog/winsystem/menuCalc.rex new file mode 100755 index 0000000..43b1012 --- /dev/null +++ b/modules/windows/oodialog/winsystem/menuCalc.rex @@ -0,0 +1,183 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: menuCalc.rex + * Type: Example ooRexx program + * + * Description: Displays the menu hierarchy of the Windows Calculator + * application. The menu hierachy for both the Calculator's + * standard view and its scientific view are printed to the + * console. + * + * This is a very simple program so that it is easeier to see + * the details. + * + * The example uses a mixture of ooDialog and winsystm. + * + * In addition, the example uses some of the public functions + * provided by the windowsSystem.frm package. That framweowork + * is an example of how to extract common function into a + * package and share that function with any number of ooRexx + * programs. + * + * The below table lists the external functions and classes used in this + * program and shows where to go to examine the source code for them. + * + * External function Source + * --------------------------------------------------- + * getPathToSystemExe() windowsSystem.frm + * errorDialog() ooDialog + * findTheWindow() windowsSystem.frm + * MenuDetailer windowsSystem.frm + */ + + +-- Get the complete path to the calculator application to be sure we start the +-- the program we want. +calcExe = getPathToSystemExe("calc.exe") + +-- If we could not get the complete path, just quit. +if calcExe == .nil then do + msg = "Faild to locate a definitive path to the Windows" || '0d0a'x || - + "Calculator application. This sample can not execute." + return errorDialog(msg) +end + +-- This will start the calculator application as a separate process. +"start" calcExe + +-- Get the calculator window object, quit if that fails. +calcWnd = getCalcWindow() +if calcWnd == .nil then return 99 + +-- First, display the menu for the 'Standard' view. The calculator application +-- may already be in the standard view. But, if it is not, we will first switch +-- to that view. +-- +-- When the calculator program switches views, it actually creates a whole new +-- dialog window. Because of that, if we do switch views we need to re-find the +-- window. +-- +-- The way we switch to Standard view is to simulator clicking on the View menu, +-- and then clicking the Standard menu item. + +if \ inStandardView(calcWnd) then do + calcWnd~ProcessMenuCommand("&View","S&tandard") + calcWnd = getCalcWindow() + if calcWnd == .nil then return 99 +end + +-- To print the menu, we instantiate a MenuDetailer object using the Calculator +-- window object. Then we tell the menu detailer object to 'print.' Printing +-- sends the output to the console. + +say; say "Printing the Calculator's Standard View menu" +menuDetail = .MenuDetailer~new(calcWnd) +menuDetail~print + +-- Switch to the Scientific view and print that menu. Switching to Scientific +-- view is done as above, we simulate clicking on the Scientific menut item. +-- +-- When we switch views we need to re-find the window and likewise we will need +-- a new MenuDetailer object. + +calcWnd~ProcessMenuCommand("&View","&Scientific") +calcWnd = getCalcWindow() +if calcWnd == .nil then return 99 + +say; say; say "Printing the Calculator's Scientific View menu" +menuDetail = .MenuDetailer~new(calcWnd) +menuDetail~print + +-- Now close the Calculator by simulating clicking on the System menu, and then +-- clicking the Close menu item. +calcWnd~SendSysCommand("Close") + +return 0 + +::requires 'windowsSystem.frm' + +/** getCalcWindow() + * A simple helper routine. We need to find and re-find the calculator window + * several times. Each time we need to check for .nil and notify the user if + * there is an error. + * + * The same steps, repeated more than once, is a good signal to put the code + * into its own routine (or own method when using objects.) + */ +::routine getCalcWindow + + calcWnd = findTheWindow("Calculator") + if calcWnd == .nil then do + msg = "Could not find the Calculator application window." || '0d0a0d0a'x || - + "This sample with have to abort." + j = errorDialog(msg) + end +return calcWnd + +/** inStandardView() + * Another simple helper routine. + * + * This tests if the calculator is in standard view by seeing if the menu item + * for standard view is checked. + * + * Note that this one line is sufficient for the test: + * + * return calc~menu~submenu(1)~isChecked(0) + * + * But, it is always possible that getting a menu or submenu will fail and + * return .nil. For that reason, and to make it a little easier to see what + * the steps are, the test is in several steps. + * + * Note that the submenu and the menu item are obtained by position and the + * position index is zero-based. + */ +::routine inStandardView + use strict arg calc + + menuBar = calc~menu + if menuBar <> .nil then do + viewMenu = menuBar~subMenu(1) + + if viewMenu <> .nil then do + return viewMenu~isChecked(0) + end + end + +-- If we had an error, just return false. +return .false diff --git a/modules/windows/oodialog/winsystem/menuNotepad.rex b/modules/windows/oodialog/winsystem/menuNotepad.rex new file mode 100755 index 0000000..ecee394 --- /dev/null +++ b/modules/windows/oodialog/winsystem/menuNotepad.rex @@ -0,0 +1,109 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: menuNotepad.rex + * Type: Example ooRexx program + * + * Description: This example displays the hierarchy of the Notepad menu. + * + * The MenuObject class in winsystm.cls allows you to work with + * the menus in a Windows window. You can do things like + * simulate a user selecting a menu item. This in turn allows + * you to 'remote control' a window. However in order to + * simulate selecting a menu item you need to know either its + * text or its id. These items can be difficult to learn + * becuase often times a menu item's text has hidden characters + * in it and the id of menu items are usually only known by the + * application developer. + * + * This examle shows how to use the MenuObject to discover the + * text and id numbers of any item in the Notepad menu. + * + * The example uses some of the public functions provided by + * the windowsSystem.frm package. That framework contains + * functions shared with other example programs shipped with + * ooRexx that use winsystm.cls. + * + * This example does not have much comment. To understand more + * of the details of starting and closing Notepad automatically, + * take a closer look at the writeWithNotepad.rex example. + * + * External function Source + * --------------------------------------------------- + * getPathToSystemExe() windowsSystem.frm + * errorDialog() ooDialog + * findTheWindow() windowsSystem.frm + * MenuDetailer windowsSystem.frm + * + * The external functions used by this program allow you to read through the + * code here and get the over-all picture of how the program works. To + * understand the finer details, you will need to look at the implementation + * of the external functions contained in windowsSystem.frm. + */ + +notepadExe = getPathToSystemExe("notepad.exe") + +if notepadExe == .nil then do + msg = "Faild to locate a definitive path to the Windows" || '0d0a'x || - + "Notepad application. This sample can not execute." + return errorDialog(msg) +end + +"start" notepadExe + +np = findTheWindow("Untitled - Notepad") +if np == .nil then do + msg = "Could not find the Notepad application window." || '0d0a0d0a'x || - + "This sample with have to abort." + return errorDialog(msg) +end + +-- To really understand how the MenuDetailer class works, take a look at its +-- implementation in windowsSystem.frm. + +-- The MenuDetailer can either print or display the menu hierarchy. Here we do +-- both. print() shows the hierarchy on the console in text format. display() +-- shows it in a graphical dialog. +md = .MenuDetailer~new(np) +md~print +md~display + +-- Close the Notepad window. +np~SendSysCommand("Close") + +::requires 'windowsSystem.frm' diff --git a/modules/windows/oodialog/winsystem/quickCalc.rex b/modules/windows/oodialog/winsystem/quickCalc.rex new file mode 100755 index 0000000..2936c9d --- /dev/null +++ b/modules/windows/oodialog/winsystem/quickCalc.rex @@ -0,0 +1,221 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: menuCalc.rex + * Type: Example ooRexx program + * + * Description: Demonstrates how to control an application programmatically + * using the winsystm classes. Does some simple calculations + * using the Windows Calculator application. + * + * This program is similar to userwmgr.rex but more simple to + * better show what is going on. + * + * This example uses some of the public functions provided by + * the windowsSystem.frm package. That framweowork is an + * example of how to extract common function into a package and + * share that function with any number of ooRexx programs. + * + * To really understand how this program works, you will need to examine the + * the code for the external functions in windowsSystem.frm. + * + * The table below lists the external functions and classes used in this + * program and shows where to go to examine the source code for them. + * + * External function Source + * --------------------------------------------------- + * errorDialog() ooDialog + * infoDialog() ooDialog + * getPathToSystemExec() windowsSystem.frm + * findTheWindow() windowsSystem.frm + */ + +-- Get the complete path to the calculator executable. This ensures we start +-- the correct application. +calcExe = getPathToSystemExe("calc.exe") + +-- Abort if we have an error. +if calcExe == .nil then do + msg = "Faild to locate a definitive path to the Windows" || '0d0a'x || - + "Calculator application. This sample can not execute." + return errorDialog(msg) +end + +-- Start calculator as a separate process. +"start" calcExe + +-- It takes some finite period of time for an application to start. This can +-- vary substantially depending on the system load. findTheWindow() allows for +-- this, but will eventually time out if the window can not be located. +calc = findTheWindow("Calculator") +if calc == .nil then do + msg = "Could not find the Calculator application window." || '0d0a0d0a'x || - + "This example program will have to abort." + return errorDialog(msg) +end + +-- Make the calculator the top-most window. +calc~ToForeground + +/* Each button in a dialog has a resource ID. When the button is pushed or + * clicked, the button sends a command (WM_COMMAND) notification to its parent + * window. The command notification contains the resource ID of the button that + * was pushed. This is how the dialog knows what button(s) the user pushes or + * clicks. + * + * We can simulate a user pushing buttons by sending commands to the dialog + * using the resource ID of the button we want pushed. Here we define variables + * with the IDs of some of the buttons in the calculator application. You can + * verify that these are the correct ID numbers by exploring the window hiearchy + * of the calculator application using the displayWindowTree.rex example program + * that is included with the ooRexx distribution. + */ + +divide = 90 +multiply = 91 +plus = 92 +minus = 93 +equals = 112 + +clear = 81 +memClear = 113 +memReturn = 114 +memSave = 115 + +zero = 124 +one = 125 +two = 126 +three = 127 +four = 128 +five = 129 +six = 130 +seven = 131 +eight = 132 +nine = 133 + +-- We also want to get a WindowObject that represents the answer field in the +-- calculator application so that we can get the answer. It so happens that +-- this is the first child window of the calculator. +answerField = calc~firstChild + +-- Check that we got the right window, abort on error. The answer field is a +-- window whose class is EDIT. +if \ answerField~isA(.WindowObject) | answerField~wClass \== "Edit" then do + msg = "Failed to locate the answer field in the Calculator application." || '0d0a0d0a'x || - + "This example program will have to abort." + j = errorDialog(msg) + + -- Try to close the calculator application, although we may be hosed and this + -- won't work. + calc~sendSysCommand("Close") + return 99 +end + +-- We will calculate 10 * 16. After each button push we will pause a bit so +-- that the user can see the numbers appear on the calculator. Then we will get +-- the answer and display a message box showing the whole thing. This starts +-- our message. +msg = "10 * 16 =" + +calc~sendCommand(one) +j = SysSleep(.5) +calc~sendCommand(zero) +j = SysSleep(.5) +calc~sendCommand(multiply) +j = SysSleep(.5) +calc~sendCommand(one) +j = SysSleep(.5) +calc~sendCommand(six) +j = SysSleep(.5) +calc~sendCommand(equals) +j = SysSleep(.5) + +-- Now get the answer. The 'title' of a window is the text of the window. In +-- this case the 'title' of the answer field window is the answer of the +-- calculation. +msg = msg answerField~title +j = infoDialog(msg) + +-- Push the clear button +calc~sendCommand(clear) + +-- Do one more calculation. +msg = "(5 + 5) * 16 / (2 + 1) =" + +calc~sendCommand(memClear) + +calc~sendCommand(two) +j = SysSleep(.5) +calc~sendCommand(plus) +j = SysSleep(.5) +calc~sendCommand(one) +j = SysSleep(.5) +calc~sendCommand(equals) +j = SysSleep(.5) + +calc~sendCommand(memSave) + +calc~sendCommand(five) +j = SysSleep(.5) +calc~sendCommand(plus) +j = SysSleep(.5) +calc~sendCommand(five) +j = SysSleep(.5) +calc~sendCommand(equals) +j = SysSleep(.5) +calc~sendCommand(multiply) +j = SysSleep(.5) +calc~sendCommand(one) +j = SysSleep(.5) +calc~sendCommand(six) +j = SysSleep(.5) +calc~sendCommand(equals) +j = SysSleep(.5) + +calc~sendCommand(divide) +calc~sendCommand(memReturn) +calc~sendCommand(equals) + +-- Now get the answer. +msg = msg answerField~title +j = infoDialog(msg) + +-- Close the calculator by pressing Close in the system menu. +calc~sendSysCommand("Close") + +::requires 'windowsSystem.frm' diff --git a/modules/windows/oodialog/winsystem/quickShowAllMenus.rex b/modules/windows/oodialog/winsystem/quickShowAllMenus.rex new file mode 100755 index 0000000..492b761 --- /dev/null +++ b/modules/windows/oodialog/winsystem/quickShowAllMenus.rex @@ -0,0 +1,94 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: quickShowAllMenus.rex + * Type: Example ooRexx program + * + * Description: The main purpose of this example is to demonstrate how you + * can quickly put together an ooRexx script that does real + * work once you have a created a package of useful functions. + * + * This program uses the windowsSystem.frm package to print out + * a menu outline of every open window that has a menu. + * + * The below table lists the external functions and classes used in this + * program and shows where to go to examine the source code for them. + * + * External function Source + * --------------------------------------------------- + * MenuDetailer windowsSystem.frm + */ + + -- Instantiate a WindowManager object and get the desktop window. + mgr = .WindowsManager~new + deskTop = mgr~desktopWindow + + -- Instantiate a MenuDetailer object using the desktop window. The desktop + -- window does not have a menu, so we won't bother displaying it. + menuLister = .MenuDetailer~new(desktop) + + -- Keep track of how many windows we found, and how many have a menu. The + -- desktop window has a surprisingly large number of windows that we don't + -- see. + windowCount = 0 + menuCount = 0 + + -- Enumerate all the desktop child windows, printing a menu outline for each + -- window that has a menu. + -- + -- Note this: many up-to-date Windows applications no longer use true menus. + -- Instead they use a number of new Windows controls that give the appearance + -- of menus. These applications do not have a menu to display. + --- + -- Also, some of the menus printed are likely to belong to invisible windows. + child = deskTop~firstChild + do while child <> .nil + windowCount += 1 + if child~menu <> .nil then do + menuCount += 1 + + menuLister~setWindow(child) + menuLister~print + say; say + end + child = child~next + end + + say 'Found' windowCount 'windows, of which' menuCount 'had menus.' + +::requires 'windowsSystem.frm' diff --git a/modules/windows/oodialog/winsystem/registry.rex b/modules/windows/oodialog/winsystem/registry.rex new file mode 100755 index 0000000..71644d3 --- /dev/null +++ b/modules/windows/oodialog/winsystem/registry.rex @@ -0,0 +1,196 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2018 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/****************************************************************************/ +/* Name: REGISTRY.REX */ +/* Type: Open Object Rexx Script */ +/* */ +/* Description: */ +/* This examples demonstrates the use of the WindowsRegistry class to read */ +/* and manipulate the Windows registry */ +/* */ +/****************************************************************************/ + +regeditor = "REGEDIT" + +FileControl = "\control.reg" +FileNewKey = "\testuser.reg" + +r = .WindowsRegistry~new /* create a new registry object */ + +/* r~Current_Key always refers to the most recently opened or created key + and is used if the keyhandle argument is omitted. r~Current_Key is initially + set to HKEY_LOCAL_MACHINE. */ + +/* Open the HKEY_LOCAL_MACHINE\System key. On NT it is not possible to open + this key with ALL access rights */ +if r~open(,"SYSTEM","QUERY WRITE") \= 0 then do + syskey = r~Current_Key + if r~List(,keys.) = 0 then do /* Get a list of System's subkeys */ + bk = r~open(,keys.1||"\Control") /* open System's first subkey's Control key */ + if bk \= 0 then do + + q. = r~Query /* Get and displeay information about the Control key. */ + say "Control is of class" q.class", was last modified" q.date "at" q.time, + || ", has" q.subkeys "subkeys, and" q.values "values." + + if r~List(,vals.) = 0 then /* list all subkeys of Control */ + do i=1 to q.subkeys + say vals.i + end + say "-----" + drop vals. + drop name data type /* these 3 symbols must be uninitialized */ + + /* list all values of the first subkey */ + if r~ListValues(,vals.) = 0 then do i = 1 to q.values + say vals.i.name "=" vals.i.data "("vals.i.type")" + end + /* save HKEY_LOCAL_MACHINE\System\XXX\Control to a file */ + saveret = r~Save(bk,FileControl) + if saveret = 183 then say "The file" FileControl "already exists" + else say "HKEY_LOCAL_MACHINE\System\"keys.1"\Control has been saved to" FileControl + end + r~Close(bk) /* close Control key */ + end + r~Close(syskey) /* close System key */ + say "-----" +end + +/* open the HKEY_LOCAL_MACHINE\SOFTWARE key. */ +if r~open(r~Local_Machine,"SOFTWARE") \= 0 then do + /* Get a list of ...\Software's subkeys */ + kinfo. = r~query /* r~Current_Key is used again */ + say "class name =" kinfo.class + say "subkeys =" kinfo.subkeys + say "values =" kinfo.values + say "date =" kinfo.date + say "time =" kinfo.time + say "-- list --" + if r~List(,keys.) = 0 then do i over keys. + say keys.i + end + say "-----" + r~Close /* close HKEY_LOCAL_MACHINE\SOFTWARE */ +end + +/* create a new subkey under HKEY_CURRENT_USER and modify it */ +savekey = 0 +if r~create(r~Current_User,"TEST_USER") \= 0 then do + + savekey = r~Current_Key /* Current_Key was set to HKEY_CURRENT_USER\TEST_USER */ + r~setvalue(,"","Test User") /* set the default value */ + + /* add other values */ + r~setvalue(,"PROFESSION","Developer") + r~setvalue(,"BIRTHYEAR","1972","NUMBER") /* type NUMBER for numbers */ + r~setvalue(,"LOCATION","EUROPE","EXPAND") + + /* Add multiple zero-terminated strings. The last character must be a 0x as well */ + A_Multi_SZ = "This is the first line" || "0"x || "This is the second line", + || "0"x || "And this is the last line!" || "0"x + r~setvalue(,"ADDITIONAL",A_Multi_SZ,"MULTI") /* use type MULTI */ + ret = RxMessageBox("Explore key \\HKEY_CURRENT_USER\TEST_USER and close RegEdit to continue.",, + "WindowsRegistry", "OK") + regeditor /* start registry editor */ + + /* retrieve the previously added values */ + say "The following entries have been added to the registry:" + st. = r~getvalue(,"") + say "default:" st.data + st. = r~getvalue(,"PROFESSION") + say "PROFESSION:" st.data + st. = r~getvalue(,"BIRTHYEAR") + say "BIRTHYEAR:" st.data "of type" st.type + st. = r~getvalue(,"LOCATION") + say "LOCATION:" st.data + + say "ADDITIONAL:" + st. = r~getvalue(,"ADDITIONAL") + /* that's how a multiple zero terminated string can be processed */ + if st.type = "MULTI" then /* that's what we expect */ + do while st.data~length \= 0 + p = st.data~pos(d2c(0)) /* find hex 0 */ + if p < st.data~length then do + say " " st.data~left(p-1) /* display substring */ + st.data = st.data~substr(p+1) /* remove substring */ + end + else st.data = "" + end + + r~DeleteValue(,"BIRTHYEAR") /* delete a value */ + sk = r~Current_Key + r~create(,"OREXX\DATA1") /* Create a key and a subkey at once */ + /* Create another key + subkey (use previously stored key handle) */ + lk = r~create(sk,"OREXX\DATA2") + if lk \= 0 then r~delete(sk, "OREXX\DATA2") /* Delete subkey DATA2 */ +end + +if savekey \= 0 then do + /* save newly created key TEST_USER to a file */ + saveret = r~Save(savekey,FileNewKey) + if saveret = 183 then say "The file" FileNewKey "already exists" + if saveret = 0 then + say "\\HKEY_CURRENT_USER\TEST_USER has been saved to" FileNewKey + r~close(savekey) + /* It is not possible to delete a key and its subkeys at once, */ + /* so delete the key's subkeys first step by step */ + rc = r~Delete(r~Current_User,"TEST_USER\OREXX\DATA1") + rc = r~Delete(r~Current_User,"TEST_USER\OREXX") + rc = r~Delete(r~Current_User,"TEST_USER") /* and now delete the key */ + + if rc = 0 then do + ret = RxMessageBox("\\HKEY_CURRENT_USER\TEST_USER has been deleted.", + || " Explore and close RegEdit to continue.", "WindowsRegistry", "OK") + regeditor + end + else say "Delete of key TEST_USER failed ("rc")" + if r~create(r~Current_User,"TEST_USER") \= 0 then do /* create key again to restore */ + rc = r~Restore(,FileNewKey) /* restore previously saved key */ + if rc = 0 then do + ret = RxMessageBox("\\HKEY_CURRENT_USER\TEST_USER has been restored.", + || " Explore and close RegEdit to continue.", "WindowsRegistry", "OK") + regeditor + say "Please remove \\HKEY_CURRENT_USER\TEST_USER using" RegEditor + end + else say "Restoring failed ("rc")" + end + say "The files" FileControl "and" FileNewKey "have been created, please delete manually to cleanup." +end + +/* winsystm.cls contains the WindowsRegistry class definition */ +::requires "winsystm.cls" diff --git a/modules/windows/oodialog/winsystem/usewmgr.rex b/modules/windows/oodialog/winsystem/usewmgr.rex new file mode 100755 index 0000000..d658324 --- /dev/null +++ b/modules/windows/oodialog/winsystem/usewmgr.rex @@ -0,0 +1,431 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: usewmgr.rex + * Type: Example ooRexx program + * + * Description: Demonstrates the use of the WindowsManager, the WindowObject, + * and the WindowsClipboard classes. Has some examples of + * ooDialog usage. + * + * This example uses some of the public functions provided by + * the windowsSystem.frm package. That framework contains + * functions shared with other example programs shipped with + * ooRexx that use winsystm.cls. + * + * Note: Because of language dependencies this example will not run + * correctly on all language versions of Windows. It assumes + * the window titles are in English. To run on a different + * language version, change the window titles for the Calculator + * and Notepad applications to the correct title for + * the specific language version of Windows. + */ + +-- First, give the user a clue as to what is happening. +msg = "This ooRexx example program demonstrates controlling a" || .endOfLine || - + "Windows application using the winsystm.cls classes." || .endOfLine~copies(2) || - + "Information will be displayed using message boxes like" || .endOfLine || - + "this one. Push the ok button in them to continue the" || .endOfLine || - + "demonstration." || .endOfLine~copies(2) || - + "You will see the Calculator and Notepad programs appear" || .endOfLine || - + "on your screen, one at a time. There are some short" || .endOfLine || - + "pauses between actions. Be patient during them." || .endOfLine~copies(2) || - + "On the other hand, if the pauses are too short for you," || .endOfLine || - + "you can increase the pauses by editing the code. This" || .endOfLine || - + "will provide a good excuse to explore the code, which" || .endOfLine || - + "is an excellent way to learn. Simply search for 'call" || .endOfLine || - + "SysSleep' in the code and increase the sleep amount for" || .endOfLine || - + "any pause that is is too short." || .endOfLine~copies(2) || - + "In particular watch the Calculator program to see the" || .endOfLine || - + "changes as it is remotely controlled. The applications" || .endOfLine || - + "will be closed automatically" + +j = infoDialog(msg) + +-- A simple demonstration of the Windows Manager. Get an instance of the +-- WindowsManager class. Then, display the title and coordinates of the current +-- foreground window. +winMgr = .WindowsManager~new + +fg = winMgr~ForegroundWindow +if fg \= .nil then do + msg = "Current foreground window" || '0d0a0d0a'x || - + " Window title: " fg~Title || '0d0a'x || - + " Window location:" fg~Coordinates + j = infoDialog(msg) +end +else do + msg = "The WindowsManager object failed to find the foreground window." + j = errorDialog(msg) +end + +-- A more involved demonstration using the Windows Calculator application. The +-- real work is done in the workWithCalc() routine. +calcPrg = getPathToSystemExe("calc.exe") +if calcPrg \== .nil then do + ret = workWithCalc(calcPrg) +end +else do + msg = "Faild to locate a definitive path to the Windows" || '0d0a'x || - + "Calculator application. Going to skip this part" || '0d0a'x || - + "of the demonstration." + j = errorDialog(msg) +end + +-- An example similar to the Windows Calculator, but using Windows Notepad. +notepad = getPathToSystemExe("notepad.exe") +if notepad \== .nil then do + ret = workWithNotepad(notepad) +end +else do + msg = "Faild to locate a definitive path to the Windows" || '0d0a'x || - + "Notepad application. Going to skip this part of" || '0d0a'x || - + "the demonstration." + j = errorDialog(msg) +end + +return 0 + + +/* windowsSystem.frm contains public helper routines and also requires + * winsystm.cls and oodplain.cls. Requiring windowsSystem.frm gives us access + * to the class definitions for WindowsManager, WindowsClipboard, and + * WindowObject. oodplain.cls has the class definitions for the message dialogs. + */ +::requires "windowsSystem.frm" + +::routine workWithCalc + use strict arg calcPrg + + -- Start the Calculator program. + "start" calcPrg + + -- Find the Calculator Window, if we don't find it, then end this portion of + -- the demonstration. + calc = findTheWindow("Calculator") + if calc == .nil then return windowFailure("Calculator") + + -- Make the calculator the top-most window. + calc~ToForeground + call SysSleep 2 + + -- Switch to the scientific view. + calc~ProcessMenuCommand("&View","&Scientific") + call SysSleep 2 + + /* When the view of the Calculator is changed, it gets a new window handle. + * Because of this, after each view change, the calculator must be found + * again. This is an oddity of the Calculator application. Most applications + * maintain the same window handle through out their execution. + */ + calc = findTheWindow("Calculator") + if calc == .nil then return windowFailure("Calculator") + calc~ToForeground + + /* Each button in a dialog has a resource ID. When the button is pushed or + * clicked, the button sends a command (WM_COMMAND) notification to its + * parent window. The command notification contains the resource ID of the + * button that was pushed. This is how the dialog knows what button(s) the + * user pushes or clicks. + * + * We can simulate a user pushing buttons by sending commands to the dialog + * using the resource ID of the button we want pushed. Here we define + * variables with the IDs of some of the buttons in the calculator + * application. This makes the code easier to read. You can verify that + * these are the correct ID numbers by using the displayWindowTree.rex program + * included with this distribution of ooRexx. + */ + + divide = 90 + multi = 91 + plus = 92 + minus = 93 + point = 85 + equals = 112 + one = 125 + three = 127 + five = 129 + seven = 131 + + /* Create a clipboard object */ + cb = .WindowsClipboard~new + + /* Switch between Scientific and Standard view using the calculator's menu */ + calc = findTheWindow("Calculator") + if calc == .nil then return windowFailure("Calculator") + + calc~ProcessMenuCommand("&View","S&tandard") + call SysSleep 2 + + calc = findTheWindow("Calculator") + if calc == .nil then return windowFailure("Calculator") + + calc~ProcessMenuCommand("&View","&Scientific") + call SysSleep 2 + + calc = findTheWindow("Calculator") + if calc == .nil then return windowFailure("Calculator") + + calc~Title = "Calculator - Open Object Rexx is in charge!" + + -- Do a few calculations and retrieve the results via the clipboard + calc~sendCommand(seven) + calc~sendCommand(plus) + calc~sendCommand(five) + calc~sendCommand(equals) + + -- Empty clipboard so that we can wait until data is available + cb~empty + + /* Copy result to clipboard, wait until the data is available from the + * clipboard and then use paste to display the result. + */ + calc~processMenuCommand("&Edit", "&Copy") + do while cb~IsDataAvailable = 0; nop; end + msg = "Calculator says: 7+5="cb~Paste + j = infoDialog(msg) + + call SysSleep 2 + calc~sendCommand(divide) + calc~sendCommand(one) + calc~sendCommand(Point) + calc~sendCommand(five) + calc~sendCommand(equals) + cb~Empty + + calc~processMenuCommand("&Edit", "&Copy") + do while cb~IsDataAvailable = 0; nop; end + msg = "Calculator says: 7+5/1.5="cb~Paste + j = infoDialog(msg) + + calc~sendCommand(multi) + calc~sendCommand(three) + calc~sendCommand(equals) + cb~Empty + + calc~processMenuCommand("&Edit","&Copy") + do while cb~IsDataAvailable = 0; nop; end + msg = "Calculator says: 7+5/1.5*3="cb~Paste + j = infoDialog(msg) + + call SysSleep 2 + + -- Switch to hexadecimal mode. + calc~pushButton("Hex") + cb~empty + calc~processMenuCommand("&Edit","&Copy") + do while cb~isDataAvailable = 0; nop; end + msg = "Calculator says: 7+5/1.5="cb~Paste " (HEX)" + j = infoDialog(msg) + + call SysSleep 2 + + -- Switch back to decimal mode. + calc~pushButton("Dec") + + -- Copy a number to the clipboard and from there to the calculator to + -- demonstrate another way to enter numbers. + cb~copy("123456789") + calc~processMenuCommand("&Edit", "&Paste") + call SysSleep 2 + + -- Simulate a left mouse button click on the "Grads" radio button. + gradsRB = findDescendent(calc, "Grads") + if gradsRB \== .nil then do + gradsRB~sendMouseClick("LEFT", "DOWN", 2, 2) + gradsRB~sendMouseClick("LEFT", "UP", 2, 2) + end + + call SysSleep 2 + + -- Close the Calculator application by pressing Close in the system menu. + calc~sendSysCommand("Close") + +return 0 + +::routine workWithNotepad + use strict arg notePrg + + -- Start the Notepad program. + "start" notePrg + + np = findTheWindow("Untitled - Notepad") + if np == .nil then return windowFailure("Notepad") + + -- Move Notepad to foreground. + np~toForeground + + -- The edit window is the first (and perhaps only) child window of Notepad. + npe = np~firstChild + + -- The sendText() method sets the text of a window. + npe~sendText("Hello,") + + -- The sendKey() method sends a key press to a window. This can be used to + -- send virtual key pressess to the window. + npe~sendKey("RETURN") + + -- Because we are sending messages to an application running in a separate + -- process, on today's fast, multi-threaded, multi-cored, systems, it is + -- possible for the messages to arrive in the Notepad application in a + -- different order than they are being sent here. This was probably not + -- possible on Windows 3.0 when this example was first developed. + -- + -- To avoid this out of order messaging, we use a helper function from the + -- windowsSystem.frm framework. + j = sendTextWithPause(npe, "This is a sample that mainly demonstrates the use") + j = sendKeyWithPause(npe, "RETURN") + j = sendTextWithPause(npe, "of the WindowsManager class.") + j = sendKeyWithPause(npe, "RETURN") + j = sendKeyWithPause(npe, "RETURN") + + j = sendTextWithPause(npe, "It also introduces the WindowObject, the MenuObject,") + j = sendKeyWithPause(npe, "RETURN") + j = sendTextWithPause(npe, "and the WindowsClipboard classes.") + j = sendKeyWithPause(npe, "RETURN") + j = sendKeyWithPause(npe, "RETURN") + + npe~sendText("In 1 second intervals I'm going to minimize, maximize, restore,") + j = sendKeyWithPause(npe, "RETURN") + npe~sendText("disable, and reenable Notepad.") + j = sendKeyWithPause(npe, "RETURN") + + call SysSleep 3 + np~minimize + call SysSleep 1 + np~maximize + call SysSleep 1 + np~restore + call SysSleep 1 + + -- Change the size of the Notepad window. + np~resize(650, 280) + + -- Make the main window (including the menu) inaccessible. + np~disable + + j = sendKeyWithPause(npe, "RETURN") + j = sendKeyWithPause(npe, "RETURN") + j = sendTextWithPause(npe, "Select a menu item. It won't be possible.") + call SysSleep 5 + + -- Re-enable the main window. + np~enable + + j = sendKeyWithPause(npe, "RETURN") + j = sendTextWithPause(npe, "Now the menu is enabled again.") + call SysSleep 1 + + j = sendKeyWithPause(npe, "RETURN") + j = sendTextWithPause(npe, "You can do the same with the editor window.") + + -- We disable the edit window so it gets grayed. + npe~disable + call SysSleep 4 + + npe~enable + j = sendKeyWithPause(npe, "RETURN") + npe~sendText("Now let's hide the editor window.") + call SysSleep 2 + + -- Let's hide the edit window (not the main window) for a moment.e */ + npe~hide + np~restore + call SysSleep 2 + + npe~restore + npe~sendKey("RETURN") + npe~sendKey("RETURN") + call SysSleep 3 + npe~sendKey("RETURN") + npe~sendKey("RETURN") + npe~sendText("The show is over. Good bye in 3 seconds!") + + -- Get a WindowsManager object, we'll use it below to cancel the Save dialog. + winMgr = .WindowsManager~new + + -- On Vista, the interface to Notepad is slightly changed. + if isVistaOrLater() then buttonName = "Do&n't Save" + else buttonName = "&No" + call SysSleep 2 + + -- Close Notepad by pressing the Close menu item in the system menu. + np~sendSysCommand("Close") + + -- Wait a second for the dialog that asks whether to save the changes. + call SysSleep 1 + fg = winMgr~foregroundWindow + if fg \== .nil, fg~title = "Notepad" then do + call SysSleep .1 + + -- Get the No or Don't Save button. Then set the focus to the button and + -- send the space key to it. This simulates a user pushing the button and + -- has the effect of closing Notepad automatically. + button = findDescendent(fg, buttonName) + if button \== .nil then do + fg~focusItem(button) + button~SendKey("SPACE") + end + else do + msg = 'Could not locate the' buttonName~changestr('&', "") 'button used to ' || '0d0a'x || - + 'discard the text changes. findDescendent() failed' || '0d0a0d0a'x || - + 'You will have to close the Notepad windows manually.' + j = errorDialog(msg) + end + end + else do + msg = 'Failed to connect with the Save Dialog for Notepad' || '0d0a0d0a'x || - + 'You may have to close the Notepad windows manually.' + j = errorDialog(msg) + end + +return 0 + +/** windowFailure() + * A simple helper function to put up an error message box. + */ +::routine windowFailure + use strict arg name + + msg = "Failed to locate the" name "application window." || '0d0a0d0a'x || - + "Ending the" name "demonstration prematurely." + j = errorDialog(msg) + +return .false + diff --git a/modules/windows/oodialog/winsystem/winSystemDlgs.h b/modules/windows/oodialog/winsystem/winSystemDlgs.h new file mode 100644 index 0000000..dfd27a7 --- /dev/null +++ b/modules/windows/oodialog/winsystem/winSystemDlgs.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#define IDD_WINDOW_TREE 100 +#define IDC_TREE_WINDOWS 1003 + +#define IDD_MENU_TREE 110 +#define IDC_TREE_MENUS 1103 + +#define IDD_USER_PROMPT 120 +#define IDC_EDIT_NAME 1203 + +#define IDD_WINDOW_LIST 130 +#define IDC_STATIC_DESCRIPTION 1302 +#define IDC_PB_SHOW 1303 +#define IDC_PB_QUIT 1304 +#define IDC_LV_WINDOWS 1306 +#define IDC_PB_REFRESH 1301 diff --git a/modules/windows/oodialog/winsystem/winSystemDlgs.rc b/modules/windows/oodialog/winsystem/winSystemDlgs.rc new file mode 100644 index 0000000..ec413dc --- /dev/null +++ b/modules/windows/oodialog/winsystem/winSystemDlgs.rc @@ -0,0 +1,87 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#include "winSystemDlgs.h" +#include +#include + + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_WINDOW_TREE DIALOGEX 0, 0, 289, 330 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Window Hierarchy" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 229, 306, 50, 14 + CONTROL "", IDC_TREE_WINDOWS, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_INFOTIP | TVS_FULLROWSELECT, 10, 10, 269, 291 +END + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT +IDD_MENU_TREE DIALOGEX 0, 0, 289, 330 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Menu Hierarchy" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +BEGIN + DEFPUSHBUTTON "OK", IDOK, 229, 306, 50, 14 + CONTROL "", IDC_TREE_MENUS, WC_TREEVIEW, WS_TABSTOP | WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_INFOTIP | TVS_FULLROWSELECT, 10, 10, 269, 291 +END + +IDD_USER_PROMPT DIALOG 0, 0, 186, 89 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_FIXEDSYS | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Select Top Level Window" +FONT 8, "Ms Shell Dlg 2" +BEGIN + LTEXT "Enter the window title of the window whose menu you want to display. You need to use the full and exact title of the window.", IDC_STATIC, 15, 14, 154, 32 + GROUPBOX "", IDC_STATIC, 5, 5, 176, 41 + EDITTEXT IDC_EDIT_NAME, 5, 53, 176, 12, ES_AUTOHSCROLL + DEFPUSHBUTTON "OK", IDOK, 76, 72, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 131, 72, 50, 14 +END + +IDD_WINDOW_LIST DIALOGEX 0, 0, 286, 212 +STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_VISIBLE | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU +CAPTION "Top-level Windows" +FONT 8, "Ms Shell Dlg 2", 400, 0, 1 +BEGIN + CTEXT "Select a top-level window in the list and push the Show button. The selected window and its children will be graphically displayed. Use the Refresh button to re-populate the list.", IDC_STATIC_DESCRIPTION, 10, 10, 266, 35 + GROUPBOX "Window List", IDC_STATIC, 10, 50, 266, 133 + CONTROL "", IDC_LV_WINDOWS, WC_LISTVIEW, WS_TABSTOP | WS_BORDER | LVS_ALIGNLEFT | LVS_SINGLESEL | LVS_REPORT | LVS_SHOWSELALWAYS, 17, 68, 252, 104 + DEFPUSHBUTTON "Refresh", IDC_PB_REFRESH, 10, 188, 50, 14 + DEFPUSHBUTTON "Show", IDC_PB_SHOW, 171, 188, 50, 14 + PUSHBUTTON "Quit", IDC_PB_QUIT, 226, 188, 50, 14 +END + diff --git a/modules/windows/oodialog/winsystem/windowsSystem.frm b/modules/windows/oodialog/winsystem/windowsSystem.frm new file mode 100644 index 0000000..dd61e1a --- /dev/null +++ b/modules/windows/oodialog/winsystem/windowsSystem.frm @@ -0,0 +1,917 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: windowsSystem.frm + * Type: Framework + * + * Description: A collection of public routines and classes to help work with + * the winsystm.cls package. + * + * This is an example of how to extract common function into a + * package, and the use the package to help in writting similar + * programs. A number of the sample programs that use + * winsystm.cls make use of this framework. + */ + +::requires 'winsystm.cls' +::requires "ooDialog.cls" + +/** findTheWindow() + * Uses the WindowsManager to create a WindowObject representing a top-level + * window currently running on the system. + * + * When an application is started up, it takes some finite amount of time before + * the window for the application is created by the operating system. The + * WindowsManager can not 'find' the aplication window until it has been + * created. This function loops a number of times trying to find the window, + * then eventually gives up + * + * How long to wait for to find the window before giving up can be adjusted by + * the caller. + * + * @param title The title of the window being sought. + * @param loops Optional. The number of loops to perform looking for the + * window. The default is 20. + * @param pause Optional. The time to sleep during each loop. The default + * is .2 of a second. + * + * @return A WindowObject object representing the desired window on + * success. If the function fails, .nil is returned. + * + * @note To find a window, you must use its exact title. + */ +::routine findTheWindow public + use strict arg title, loops = 20, pause = .2 + + windowMgr = .WindowsManager~new + + do loops + j = SysSleep(pause) + wnd = windowMgr~find(title) + if wnd~class == .WindowObject then leave + end + +return wnd + +/** sendTextWithPause() + * Sends text to a window and pauses slightly before returning. + * + * @param wnd A window object that represents the window to send the text to. + * @param text The text to send. + * + * @return The return from SysSleep() + * + * @note Not to go into too much detail about the underlying implmentation of + * winsystm.cls, but a brief explantion. When sending text or a key + * press to a window, a Windows API function is used that returns + * immediately, before the text or key press actually makes it to + * the OS window. In a fast dual-core / multi-core / multi-processor + * system this can result in the window receiving the key presses or text + * in a different order than they are sent by ooRexx. + * + * This function and the sendKeyWithPause() function prevent that out of + * ordering by pausing very slightly after doing the send. This actually + * mimics more closely a user entering the data on a keyboard. Anyone + * familiar with Expect, probably knows that Expect provides a similiar + * function. + */ +::routine sendTextWithPause public + use strict arg wnd, text + wnd~sendText(text) +return SysSleep(.01) + +/** sendKeyWithPause() + * Sends a key press to a window and pauses slightly before returning. + * + * @param wnd A window object that represents the window to send the key + * press to. + * @param key The key press to send. + * + * @return The return from SysSleep() + * + * @see sendTextWithPause() + */ +::routine sendKeyWithPause public + use strict arg wnd, key + wnd~sendKey(key) +return SysSleep(.01) + +/** printChildren() + * Given a window object, enumerates all descendent windows of that window and + * prints the results to the screen. + * + * @param wnd The parent window object. + * @param indent When printing to the console, the amount of indentation. + * + * @return True if this function recursed, otherwise false. + */ +::routine printChildren public + use strict arg wnd, indent + + line = indent || wnd~hwnd ":" wnd~id ":" wnd~wclass ":" wnd~title~left(15) ":" wnd~coordinates + + childs. = wnd~enumerateChildren + + select + when childs.0 == 0 then do + line = line "no children" + say line + return .false + end + + when childs.0 == 1 then do + line = line "1 child" + end + + otherwise do + line = line childs.0 "children" + end + end + -- End select + + say line + + indent = indent || " " + + do i = 1 to childs.0 + childWnd = .WindowObject~new(childs.i.!Handle) + ret = printChildren(childWnd, indent) + end + +return .true + +/** findDescendent() + * Finds a descendent window with the window title specified, if any. + * + * @param wnd The parent window whose descendents are searched. + * @param title The title (label) of the window being searched for. + * + * @return A .WindowObject representing the window if found. If not found then + * .nil is returned. + * + * @note This function is very similar to .WindowObject~findChild(), except + * that this function will search recursively through the window + * hierarchy for any descendent window with the specified label. The + * WindowObject's findChild() on the other hand only looks at the + * immediate children. + */ +::routine findDescendent public + use strict arg wnd, title + + descendent = wnd~findChild(title) + if descendent \== .nil then return descendent + + children. = wnd~enumerateChildren + + do i = 1 to children.0 + childWnd = .WindowObject~new(children.i.!Handle) + + descendent = findDescendent(childWnd, title) + if descendent \== .nil then return descendent + end + +return .nil + +/** isVistaOrLater() + * Simple convenience function to determine if the operating system is at least + * Windows Vista. + * + * @return True if the current OS is Vista or a later version of Windows, + * otherwise false. + */ +::routine isVistaOrLater public + parse value SysVersion() with name ver + return (ver >= 6) + + +/** getPathToSystemExe() + * Gets the complete path to an executable that is a standard application + * shipped with a Windows system. In a Windows distributions, these + * applications are in the system directory. Getting the complete path ensures + * that the correct application is started. + * + * For instance, there are a surprisingly large number of applications named + * 'calc.' If a user has set up her system with a 'calc' program in a directory + * ahead of the system directory in the path, then that calc program can end up + * being started rather than the expected Windows calculator application. + * + * @param prgName The program whose path is being sought. The .exe is + * expected. + * + * @return The fully qualified path name of the program, if it exists in the + * system directory. If not found, then .nil is returned. + */ +::routine getPathToSystemExe public + use strict arg prgName + + shell = .oleObject~new('Shell.Application') + + -- 0x25 is the CSIDL_SYSTEM constant. The CSIDL_XXX constants are used to + -- identify well known directories on Windows. Like the My Documents + -- directory, the All Users Start Menu, etc. We use this constant to get the + -- Windows System folder object, and from that the path to the directory. + csidl_system = '25' + + folderObj = shell~nameSpace(csidl_system~x2d) + sysFolderPath = folderObj~self~path + if sysFolderPath~right(1) \== '\' then sysFolderPath = sysFolderPath'\' + + prgPathName = sysFolderPath || prgName + if \ SysIsFile(prgPathName) then prgPathName = .nil + +return prgPathName + +/** getWindowTree() + * Constructs a data structure that represents the entire window hierarchy of + * a window. + * + * Each node in the structure represents a window. The node is a .directory + * object whose items contain the important attributes of the window. This + * directory object has an item: children, that is an array of nodes + * representing the children windows of the node. + * + * Each node has these indexes: + * + * node~handle + * node~title + * node~windowClass + * node~state + * node~id + * node~coordinates + * node~children + * node~hasChildren + * node~childrenCount + * + * @param wnd The window object to construct a node for. + * + * @return A tree of window nodes representing the window specified and all its + * children. + * + * @note This is a recursive function. + */ +::routine getWindowTree public + use strict arg wnd + + tree = buildWindowDetails(wnd) + child = wnd~firstChild + if child == .nil then return tree + + tree~children = .array~new + tree~hasChildren = .true + do while child \== .nil + tree~children~append(getWindowTree(child)) + tree~childrenCount += 1 + child = child~next + end + +return tree + +/** buildWindowDetails() + * Private helper function for getWindowTree(). + * + * @param wnd The .WindowObject whose details are desired. + * + * @return A directory object whose items reflect a number of attributes of + * a window. + */ +::routine buildWindowDetails + use strict arg wnd + + d = .directory~new + d~handle = wnd~handle + d~text = wnd~title + d~windowClass = wnd~wClass + d~state = wnd~state + d~id = wnd~id + d~coordinates = wnd~coordinates + d~children = .nil + d~hasChildren = .false + d~childrenCount = 0 + +return d + +/** printWindowTree + * Given a tree of window nodes, prints out the tree to the console. + * + * @param tree The tree of window nodes to print. + * @param indent The current indentation. Note that this is a recursive + * function and the indent is increased with each recursion. + * + * @return True if the function has recursed, othewise false. + * + * @see getWindowTree() + * @see printChildren() + * + * @note The function produces the exact same output as printChildren(). Its + * main purpose was to debug getWindowTree(). However, it could serve + * as a useful template if one wanted to change how the information or + * what information is printed to the console. + */ +::routine printWindowTree public + use strict arg tree, indent + + -- A little defensive programming. + if \ tree~isA(.directory) then return .false + + line = indent || tree~handle ":" tree~id ":" tree~windowClass ":" tree~text~left(15) ":" tree~coordinates + + select + when tree~childrenCount == 0 then do + line = line "no children" + say line + return .false + end + + when tree~childrenCount == 1 then do + line = line "1 child" + end + + otherwise do + line = line tree~childrenCount "children" + end + end + -- End select + + say line + + indent = indent || " " + + do child over tree~children + ret = printWindowTree(child, indent) + end + +return .true + +/** showWindowTree() + * Puts up an ooDialog dialog that displays the window hierarchy of a window in + * a tree view control. + * + * @param tree A tree node data structure produced by the getWindowTree() + * function. + * + * @return True if the dialog was shown, false if it was not. + * + * @see getWindowTree() + * + * @note We use the locate() function to get the directory this source code is + * located in. And then, use that value to create a complete path name + * to our resource files. This ensures the .rc and .h files will always + * be found + */ +::routine showWindowTree public + use strict arg tree + + sd = locate() + dlg = .WindowTreeDlg~new(sd"winSystemDlgs.rc", IDD_WINDOW_TREE, , sd"winSystemDlgs.h") + if dlg~initCode == 0 then do + dlg~useTree(tree) + dlg~execute("SHOWTOP") + return .true + end + +return .false + +/** class: WindowTreeDlg + * + * A simple ooDialog dialog class to display the window hierarchy, parent and + * descendent windows, of any window. + * + * The only caveat is that the class requires a window tree structure created by + * the getWindowTree() public routine in this framework. + * + * This is a subclass of RcDialog, meaning the dialog template is defined in a + * resource script file. The dialog template was created by a GUI dialog + * editor. The dialog template is stored in the winSystemDlgs.rc file and has + * a symbolic resource ID of IDD_WINDOW_TREE. The symbolic resource IDs are + * defined in the winSystemDlgs.h file. + * + * @note For an example of how to use this class see the showWindowTree() + * public routine in this framework. + */ +::class 'WindowTreeDlg' public subclass RcDialog + +/** useTree() + * Sets the window tree structure for this dialog. The structure must be set + * prior to executing the dialog, otherwise the dialog will display an empty + * tree view control. + * + * @param windowTree A tree node structure in the same format as that produced + * by the getWindowTree() function. + @ + @ @see getWindowTree() + */ +::method useTree + expose windowTree + use arg windowTree + +/** initDialog() + * Initializes the dialog controls for this dialog. The only control is the + * Tree control. + * + * The ooDialog framework automatically inovkes this method for every dialog + * immediately after the underlying Windows dialog has been created. Since most + * of the initialization of dialog controls requires that the underlying control + * has been created, this makes initDialog() the proper place to do all the + * control initialization. + */ +::method initDialog + expose windowTree + + if windowTree~isA(.directory), windowTree~hasIndex("WINDOWCLASS") then self~doInit(windowTree) + +/** doInit() + * A private method that does the actuall work of initializing the tree control. + * + * @param windowTree The window tree node structure for this dialog. + */ +::method doInit private + use strict arg windowTree + + -- Get the tree-view control object and then invoke the addNode() recursive + -- method to add all the items to the control. + tree = self~newTreeView(IDC_TREE_WINDOWS) + rootNode = self~addNode(tree, "Root", windowTree) + + -- Set the title of this dialog, which will contain the window handle for the + -- window we represent. + title = "The" windowTree~text "(" || windowTree~handle || ") Window Hierarchy" + self~setTitle(title) + + -- Expand the root item in the tree-view control. + tree~expand(rootNode) + +/** addNode() + * A private recursive function that adds each node to the tree control. Each + * node represents a single window in the hiearchy. + * + * @param tree The tree-view control object. + * + * @param root A reference to the current item in the tree-view control we + * are working with. Note that this can also be the keyword: root + * which will signal that this is to be the initial item in the + * tree-view control. Otherwise, it is a reference to an already + * created item in the tree-view control. + * + * @param node The current node in the window tree structure we are working + * with. + */ +::method addNode private + use strict arg tree, root, node + + -- The text displayed for this item. + text = node~handle || ":" node~text + + -- Insert (create) a new item in the tree-view control. Insert it after the + -- 'LAST' sub-item under the item referenced by root in the tree-view control. + -- This item is the window item. + newRoot = tree~insert(root, "LAST", text, , , , node~childrenCount) + + -- Insert sub-items. Each of these sub-items is an attribute of the window + tree~insert(newRoot, , "Text:" node~text) + tree~insert(newRoot, , "Handle:" node~handle) + tree~insert(newRoot, , "Class:" node~windowClass) + tree~insert(newRoot, , "ID:" node~id) + tree~insert(newRoot, , "Coordinates:" node~coordinates) + tree~insert(newRoot, , "State:" node~state) + + -- Now, if the window has children windows, recursively add them to the + -- tree-view control. + if node~hasChildren then do n over node~children + self~addNode(tree, newRoot, n) + end + +return newRoot + +/** class: MenuDetailer + * + * A class to parse and display the details of a menu bar. + * + * In Windows, a menu bar is similar to a top level window in that they both + * have a hierarchy of contained objects. A top-level window can contain other + * windows, which themselves can contain other windows. A menu bar can contain + * submenus, which can contain submenus. + * + * This hierarchy is easily displayed in a tree-like structure, for both windows + * and menus. The function of displaying a menu hierachy is therefore very + * similar to the set of functions used to display a window hierarchy provided + * in this framework. + * + * However, the MenuDetailer is a more object-orientated approach than that used + * for displaying a window hierarchy. The data and the means to manipulate the + * data are all contained within a single object, the MenuDetailer object. + * + * Note that this is a subclass of ooDialog's RcDialog, but the class can be + * used / useful without ever creating an underlying Windows dialog. The + * ooDialog part is only used in the display() method which produces a graphical + * dislpay of the menu tree. + */ +::class 'MenuDetailer' public subclass RcDialog + +::method init + use strict arg wnd + self~newWindow(wnd) + + +/** newWindow() + * This method is called to create a menu tree node structure that represents + * the menu of the specified window. It is used when a new MenuDetailer object + * is created and when / if the user of the class sets a new window. + * + * @param wnd A window object whose menu is to be 'detailed.; + */ +::method newWindow private + expose menubar maxTextLength textFormat mainWindow + use strict arg wnd + + -- Ensure wnd is a WindowObject. + if \ wnd~isA(.WindowObject) then raise syntax 93.948 array ("1 'wnd'", "WindowObject") + + -- Set / reset some state variables. + maxTextLength = 0 + textFormat = .nil + menubar = .nil + mainWindow = wnd + + -- Create the menu tree node structure. + self~createMenubar + +/** createMenubar() + * Creates a menu tree node structure that represents the menu of the main + * window. + * + * Conceptually, a menu consists of a container with some number of menu items, + * where each menu item can, possibly, be a submenu. Typically in Windows, the + * top-level container is called a menubar. A tree is a natural data + * structure to represent this. + * + * The menu tree node structure consists of a directory that represents the + * menubar and has this structure: + * + * menubar~ownerHwnd + * menubar~ownerTitle + * menubar~itemCount + * menubar~menuItems an array of menu items where each menu item is a + * directory. + * + * menuitem~pos + * menuitem~id + * menuitem~text + * menuitem~isSubmenu + * menuitem~isSeparator + * menuitem~isTextItem + * menuitem~isChecked + * menuitem~itemCount + * menuitem~menuItems an array of menu items + * + */ +::method createMenubar private + expose menubar mainWindow + + menubar = .directory~new + menubar~ownerTitle = mainWindow~title + menubar~ownerHwnd = mainWindow~hwnd + + menu = mainWindow~menu + if menu == .nil then do + menubar~itemCount = -1 + menubar~menuItems = .nil + end + else do + menubar~itemCount = menu~items + menubar~menuItems = self~populate(menu) + end + +/** populate() + * A recursive function to create and return an array of menu items. + * + * @param A MenuObject object whose menuitems will be used to create and + * populate an array. + * + * @return The populated array. + * + * @see createMenubar() + */ +::method populate private + expose maxTextLength + use strict arg menu + + maxTextLength = 0 + count = menu~items + + a = .array~new(count) + do i = 0 to count - 1 + d = .directory~new + d~pos = i + d~id = menu~idOf(i) + d~text = menu~textOf(i) + d~isSubmenu = menu~isSubmenu(i) + d~isSeparator = menu~isSeparator(i) + d~isTextItem = \(d~isSeparator | d~isSubmenu) + d~isChecked = menu~isChecked(i) + + if d~text~length > maxTextLength then maxTextLength = d~text~length + + if d~isSubmenu then do + submenu = menu~submenu(i) + d~itemCount = submenu~items + d~menuItems = self~populate(submenu) + end + else do + d~itemCount = 0 + d~menuItems = .nil + end + + a[i + 1] = d + end + +return a + +/** print() + * Outputs a text representation of the menu to the console. + */ +::method print + expose textFormat + + -- If not already created, construct an array of text lines that represents + -- the menu. Then output the lines to the console. + if textFormat == .nil then self~toArray + do l over textFormat + say l + end + +/** getOutline() + * Return the array of text lines representing the menu to the caller. The + * caller can then use the array as they see fit. + */ +::method getOutline + expose textFormat + + -- Return a copy of the array to the caller so that an outsider can not + -- unintentionally or intentionally change our internal data. + if textFormat == .nil then self~toArray + return textFormat~copy + +/** getMenubar() + * Return the menu tree node structure to the caller. The caller can then + * format and / or use the data as desired. + */ +::method getMenubar + expose menubar + + -- Recreate the menubar if needed. + if menubar == .nil then self~createMenubar + + -- Since ooRexx does not have a deep copy, we save a reference to the menuBar + -- object, set our internal reference to the menubar to .nil, and return the + -- saved reference. This allows the caller to change the menubar without + -- changing our internal representation. If we need the menubar structure + -- again, we will re-create it. + populatedMenubar = menubar + menubar = .nil + +return populatedMenubar + +/** setWindow() + * Changes the main window to a new one. + */ +::method setWindow + use strict arg wnd + self~newWindow(wnd) + +/** toArray() + * Transforms the menu tree node structure that represents our menu into an + * array of text lines that represents the menu. + */ +::method toArray private + expose menubar textFormat + + -- Check if we need to recreated the menubar. + if menubar == .nil then self~createMenubar + + textFormat = .array~new + + -- The first line will show data about the main window. It is possible that + -- the window will were initialized with does not have a menu. In addition, + -- many applications now create their menus dynamically. Those types of menus + -- may not contain any menu items until the user actually selects a menu item. + -- For these two cases we return immediately. + + line = menubar~ownerTitle "(" || menubar~ownerHwnd || ")" + if menubar~itemCount == -1 then do + textFormat[1] = line "does not have a menu" + return textFormat + end + else if menubar~itemCount == 0 then do + textFormat[1] = line "menu is not populated" + return textFormat + end + + -- Add the first line, then recursively add a line for every menu item. + textFormat[1] = line + do item over menubar~menuItems + self~addArrayItem(item, " ") + end + +/** addArrayItem() + * A recursive method that adds a line of text for every menu item to an array + * of lines. + * + * @param item A node in the menu tree node structure representing a menu + * item. + * + * @param indent A string of spaces, the length of which shows the depth of + * the menu item within the overall menu. + */ +::method addArrayItem private + expose maxTextLength textFormat + use strict arg item, indent + + -- Build up a line of text for the menu item + line = indent + sep = '-'~copies(maxTextLength) + pos = item~pos~right(2) || ':' + id = '[id:' item~id~right(3) || ']' + + select + when item~isSubmenu then do + line = line || pos id 'popup menu' item~text~left(maxTextLength) + end + when item~isSeparator then do + line = line || pos id 'separator ' sep + end + otherwise do + line = line || pos id 'menu item ' item~text~left(maxTextLength) + if item~isChecked then line = line '[checked]' + end + end + -- End select + + -- Add the line to our array of lines. + textFormat~append(line) + + -- If item is itself a menu, recursively add its menu items to the array. + if item~isSubmenu then do + -- Increase our indent by 2 spaces. + indent = indent || " " + do menuItem over item~menuItems + self~addArrayItem(menuItem, indent) + end + end + +/** display() + * Displays our menu in a graphical format using a tree control in a dialog. + */ +::method display + + -- Initialize our ooDialog superclass. The dialog template is stored in the + -- resource script file: winSystemDlgs.rec with a symbolic ID of IDD_MENU_TREE + -- and the symbolic IDs for the dialog are defined in winSystemDlgs.h + -- + -- Note: We use the locate() function to get the directory this source code + -- is located in. And then, use that value to create a complete path name to + -- our resource files. This ensures the .rc and .h files will always be + -- found. + sd = locate() + self~init:super(sd"winSystemDlgs.rc", IDD_MENU_TREE, , sd"winSystemDlgs.h") + self~execute("SHOWTOP") + +/** initDialog() + * Initializes the dialog controls for this dialog. The only control is the + * Tree control. + * + * The ooDialog framework automatically inovkes this method for every dialog + * immediately after the underlying Windows dialog has been created. Since most + * of the initialization of dialog controls requires that the underlying control + * has been created, this makes initDialog() the proper place to do all the + * control initialization. + * + * @see WindowTreeDlg::initDialog() + */ +::method initDialog + expose menubar + + -- Check if we need to recreate the menubar. + if menubar == .nil then self~createMenubar + + -- Set the dialog title to a subset of what will be the text for the first + -- item in the tree-view control. + rootText = menubar~ownerTitle "(" || menubar~ownerHwnd || ")" + self~setTitle(rootText "Menu Hierarchy") + + -- The tree-view control is populated in a similar manner as was the tree-view + -- control in the WindowTreeDlg class in this framework. See that class for + -- comment if needed. + + -- Get the tree-view object, set the first item, expand it. + tree = self~newTreeView(IDC_TREE_MENUS) + + if menubar~itemCount == -1 then do + rootText = rootText "[window does not have a menu]" + end + else if menubar~itemCount == 0 then do + rootText = rootText "[menu is not populated]" + end + + rootNode = tree~add(rootText, , , "EXPANDED") + + -- If the menubar has menu items, recursively add then to the tree-view + -- control. + if menubar~itemCount > 0 then do item over menubar~menuItems + self~addNode(tree, rootNode, item) + end + +/** addNode() + * Recursively add tree-view items for each menu item in our menu. + * + * @param tree The tree-view control object. + * + * @param root A reference to the current item in the tree-view control we + * are working with. + * + * @param menuItem The current node in the menu tree structure we are working + * with. + * + * @see WindowTreeDlg::initDialog() + */ +::method addNode private + expose maxTextLength + use strict arg tree, root, menuItem + + text = menuItem~pos~right(2) || ':' + + if menuItem~isSeparator then text = text '-'~copies(maxTextLength) + else text = text menuItem~text + + if menuItem~isSubmenu then count = menuItem~itemCount + else count = 0 + + newRoot = tree~insert(root, "LAST", text, , , , count) + + tree~insert(newRoot, , "Text:" menuItem~text) + tree~insert(newRoot, , "ID:" menuItem~id) + tree~insert(newRoot, , "Submenu?" self~logicalToString(menuItem~isSubmenu)) + tree~insert(newRoot, , "Text Item?" self~logicalToString(menuItem~isTextItem)) + tree~insert(newRoot, , "Separator?" self~logicalToString(menuItem~isSeparator)) + tree~insert(newRoot, , "Checked?" self~logicalToString(menuItem~isChecked)) + + if menuItem~isSubmenu then do mi over menuItem~menuItems + self~addNode(tree, newRoot, mi) + end + +return newRoot + +/** logicalToString() + * Simple helper method to convert an ooRexx logical value to a string + * representation. + * + * @param logical The value to convert. + * + * @return The string "true" if logical is strictly true, otherwise the string + * "false" + */ +::method logicalToString private + use strict arg logical + + -- Work with anything sent to us. This uses the short-cut AND operator. Once + -- a test fails, the rest of the tests are not evaluated. If logical is a + -- string object, and the data type of the string object is lOgical, and + -- logical is true then return "true" Othewise return "false" + + if logical~isA(.String), logical~datatype('O'), logical then return 'true' + else return 'false' + diff --git a/modules/windows/oodialog/winsystem/writeWithNotepad.rex b/modules/windows/oodialog/winsystem/writeWithNotepad.rex new file mode 100755 index 0000000..a20dbcb --- /dev/null +++ b/modules/windows/oodialog/winsystem/writeWithNotepad.rex @@ -0,0 +1,186 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2008-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * Name: writeWithNotepad.rex + * Type: Example ooRexx program + * + * Description: An example of using the winsystm.cls classes to control the + * Notepad application. It is a subset of the usewmgr.rex + * example, intended to be simplier and maybe easier to see what + * is happening. + * + * This example uses some of the public functions provided by + * the windowsSystem.frm package. That framework contains + * functions shared with other example programs shipped with + * ooRexx that use winsystm.cls. + * + * External function Source + * --------------------------------------------------- + * getPathToSystemExe() windowsSystem.frm + * errorDialog() ooDialog + * findTheWindow() windowsSystem.frm + * sendTextWithPause() windowsSystem.frm + * sendKeyWithPause() windowsSystem.frm + * isVistaOrLater() windowsSystem.frm + * getWindowTree() windowsSystem.frm + * showWindowTree() windowsSystem.frm + * findDescendent() windowsSystem.frm + * + * The external functions used by this program allow you to read through the + * code here and get the over-all picture of how the program works. To + * understand the finer details, you will need to look at the implementation + * of the external functions contained in windowsSystem.frm. + */ + +-- Get the full path to notepad to be sure we start the right application. +notepadExe = getPathToSystemExe("notepad.exe") + +-- Quit if we can't get the path. Let the user know why we are quitting. +if notepadExe == .nil then do + msg = "Faild to locate a definitive path to the Windows" || '0d0a'x || - + "Notepad application. This sample can not execute." + return errorDialog(msg) +end + +-- This will start notepad as a separate process. +"start" notepadExe + +-- When Notepad is started without a file name as an argument, its title will be +-- 'Untitled - Notepad' We try to find that window, quitting if we can not. +-- Note that findTheWindow() tries several times to locate the window, but will +-- eventually time out. Again, we let the user know why we are quitting if we +-- do. + +np = findTheWindow("Untitled - Notepad") +if np == .nil then do + msg = "Could not find the Notepad application window." || '0d0a0d0a'x || - + "This sample will have to abort." + return errorDialog(msg) +end + +-- Make sure the size of the Notepad window is wide enough for our text. +np~resize(650, 500) + +-- Move Notepad to the foreground. +np~ToForeground + +-- Get the edit window, which is the first (and perhaps only) child window of +-- the Notepad window. +editWnd = np~FirstChild + +-- Put some text into Notepad, if the user reads it, she will have a clue as to +-- what is going to happen. +j = SysSleep(.01) +j = sendTextWithPause(editWnd, "Hello,") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendTextWithPause(editWnd, "When the Notepad Save dialog window opens, wait a second or two. ") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendTextWithPause(editWnd, "Then a dialog window will open that will allow you to explore the") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendTextWithPause(editWnd, "window hierarchy of the Save dialog. When you close that dialog, ") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendTextWithPause(editWnd, "Notepad will close automatically. (If things work correctly.)") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendKeyWithPause(editWnd, "RETURN") +j = sendTextWithPause(editWnd, "The show is over. Good bye in several seconds.") +j = sendKeyWithPause(editWnd, "RETURN") + +-- Get a WindowsManager object, we'll use it below to cancel the Save dialog. +winMgr = .WindowsManager~new + +-- The Notepad interface is much changed in Vista. +if isVistaOrLater() then buttonName = "Do&n't Save" +else buttonName = "&No" + +-- Pause a little bit to allow the user to read the text. +j = SysSleep(5) + +-- Close Notepad by using the Close item in the system menu of the application. +np~SendSysCommand("Close") + +/* When Notepad closes, it will put up a dialog asking if we want to save the + * changes we just wrote to a file. We will wait a second for the dialog and + * then use the No button (Don't Save button in Vista) to discard our text. + * + * Vista has made this rather interesting. With the Vista Notepad Save dialog, + * the buttons are not immediate children of the dialog. Rather the buttons are + * several layers deep in the window hierarchy. Therefore we need to use the + * findDescendent() function to locate the proper button. + * + * Initially, functions like getWindowTree() and showWindowTree() or + * printWindowTree() were very useful in discovering the interface changes in + * Notepad on Vista. + */ + +-- Wait a second and then grab the foreground window. If we get a window and +-- the window has the title of Notepad, we will assume it is the Save dialog. +-- If we encounter errors, inform the user as to what they were. +j = SysSleep(1) +fg = winMgr~ForegroundWindow +if fg \== .nil, fg~title = "Notepad" then do + j = SysSleep(.1) + + -- Display the window hierarchy of the Save dialog. + tree = getWindowTree(fg) + success = showWindowTree(tree) + + -- Get the No or Don't Save button. Then set the focus to the button and + -- send the space key to it. This simulates a user pushing the button and + -- has the effect of closing Notepad automatically. + button = findDescendent(fg, buttonName) + if button \== .nil then do + fg~focusItem(button) + button~SendKey("SPACE") + end + else do + msg = 'Could not locate the' buttonName~changestr('&', "") 'button used to ' || '0d0a'x || - + 'discard the text changes. findDescendent() failed' || '0d0a0d0a'x || - + 'You will have to close the Notepad windows manually.' + j = errorDialog(msg) + end +end +else do + msg = 'Failed to connect with the Save Dialog for Notepad' || '0d0a0d0a'x || - + 'You may have to close the Notepad windows manually.' + j = errorDialog(msg) +end + +return 0 + +::requires "windowsSystem.frm" diff --git a/modules/windows/rexutils/drives.rex b/modules/windows/rexutils/drives.rex new file mode 100755 index 0000000..854a078 --- /dev/null +++ b/modules/windows/rexutils/drives.rex @@ -0,0 +1,253 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2014 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* https://www.oorexx.org/license.html */ +/* */ +/* 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. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* 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 */ +/* OWNER 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. */ +/* */ +/*----------------------------------------------------------------------------*/ +/*****************************************************************************/ +/* Name: DRIVES.REX */ +/* Type: Open Object Rexx Script */ +/* */ +/* Description: Sample program to display information about drives using the */ +/* Open Object Rexx utility functions SysDriveMap, SysDriveInfo,*/ +/* SysFileSystemType, SysBootDrive */ +/* */ +/*****************************************************************************/ + + +/*****************************************************************************/ +/* Main Programm */ +/*****************************************************************************/ +parse arg InputDrives -- get the input -- + -- +Drives. = "" -- initialize Drives stem -- + -- +call CheckInput -- check input -- + -- +call InfoParsing -- get and parse the drive data -- +call InfoDisplay "BOX" -- display data with box characters -- +--call InfoDisplay "LINE" -- display data without box characters -- + +exit + +/*****************************************************************************/ +/* Procedure : InfoParsing */ +/* */ +/* Description : Get the informations of each drive using the Object REXX */ +/* utility functions. */ +/* */ +/* Parameters : EXPOSE: Drives. - stem to hold all drives informations */ +/* */ +/*****************************************************************************/ +InfoParsing: PROCEDURE EXPOSE Drives. + +UsedDrives = SysDriveMap() -- get all used drives -- + -- +RemoteDrives = SysDriveMap(, 'REMOTE') -- get all remote drives -- + -- +do i = 1 to Drives.0 -- loop over all drives -- + DriveInfo = SysDriveInfo(Drives.i.InputLetter) -- get drive information -- + -- + parse var DriveInfo, -- parse ... -- + Drives.i.OutputLetter, -- drive letter -- + Drives.i.Free, -- free space -- + Drives.i.Total, -- total space -- + Drives.i.Label -- label -- + -- + Drives.i.Label = strip(Drives.i.Label) -- eliminate spaces -- + Drives.i.Free = BeautifyNumber(Drives.i.Free) -- enhance readability of -- + Drives.i.Total = BeautifyNumber(Drives.i.Total) -- the numbers -- + + if Drives.i.OutputLetter = "" & pos(Drives.i.InputLetter, UsedDrives) >0 then do + -- This is a CD-ROM drive, set the label and the drive letter + Drives.i.Label = "CD-ROM" + Drives.i.OutputLetter = Drives.i.InputLetter + end + else do + -- if no available drive set all information data to unknown + if pos(Drives.i.InputLetter, UsedDrives) = 0 then do + Drives.i.OutputLetter = Drives.i.InputLetter + Drives.i.Label = "Unknown-Drive" + Drives.i.Free = "???" + Drives.i.Total = "???" + Drives.i.Location = "???" + Drives.i.Filesys = "???" + end + else do + -- check for remote or local drive + if pos(Drives.i.OutputLetter, RemoteDrives) > 0 then + Drives.i.Location = "remote" + else + Drives.i.Location = "local" + -- get the file system + Drives.i.Filesys = SysFileSystemType(Drives.i.OutputLetter) + end + end +end + +return + + +/*****************************************************************************/ +/* */ +/* Procedure : CheckInput */ +/* */ +/* Description : if no input specified, get all available drives */ +/* parse the input string and ignore all characters which are */ +/* not alphanumeric */ +/* save all alphanumeric characters to "Drives" stem */ +/* */ +/* Parameters : EXPOSE : InputDrives - string from the input */ +/* Drives. - stem for dirves information */ +/* */ +/*****************************************************************************/ + +CheckInput: PROCEDURE EXPOSE InputDrives Drives. + + +if InputDrives = "" then + InputDrives = SysDriveMap() + +InputDrives = translate(InputDrives,' ', ':') +j = 1 +do i = 1 to length(InputDrives) + Drive = substr(InputDrives,i,1) + if datatype(Drive,'A') = 1 then + if datatype(Drive,'N') = 0 then do + Drives.j.InputLetter = translate(Drive) || ":" + Drives.0 = j + j = j + 1 + end +end + +return + + +/*****************************************************************************/ +/* */ +/* Procedure : BeautifyNumber */ +/* */ +/* Description : Insert dots to the numer for better readability like : */ +/* 2.000.000 instead of 2000000 */ +/* */ +/* Parameters : in : Number - number to be beautified */ +/* return : beautified number */ +/* */ +/*****************************************************************************/ +BeautifyNumber: PROCEDURE + +use arg Number + +do i = (length(Number)-3) to 1 by -3 + Number = insert('.', Number, i) +end + +return Number + + +/*****************************************************************************/ +/* */ +/* Procedure : InfoDisplay */ +/* */ +/* Description : Display all drive information in a well formatted form */ +/* */ +/* Parameters : EXPOSE : Drives. - stem which hold all drive information */ +/* in : DisplayType : "BOX" - use box characters */ +/* "" - use box characters */ +/* "LINE" - use '-' */ +/* and '|' */ +/* */ +/*****************************************************************************/ +InfoDisplay: PROCEDURE EXPOSE Drives. + +use arg DisplayType + +-- set the lines for drawing in dependency of the dislay type +if DisplayType = "BOX" | type = "" then do + -- use box characters to display vertical and horizontal lines + DisplayType = "BOX" + HorizontalLine = "ÚÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄ¿" + MidleLine = "ÃÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄ´" + EndLine = "ÀÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÙ" + Vb = "³" -- verical bar character +end +else do + -- use '-' and '|' characters to draw vertical and horizontal lines + HorizontalLine = copies("-", 76) + Vb = "|" +end + +-- display and format the drive information +say HorizontalLine + +say Vb || CENTER('Drive' ,5) ||, + Vb || CENTER('Free' ,16) ||, + Vb || CENTER('Total',16) ||, + Vb || CENTER('Label',14) ||, + Vb || CENTER('Location',8) ||, + Vb || CENTER('Filesystem',10)||, + Vb + +if DisplayType = "BOX" then HorizontalLine = MidleLine + +say HorizontalLine + +do i=1 to Drives.0 + say Vb || CENTER(Drives.i.OutputLetter,5)||, + Vb || right(Drives.i.Free,15) , + Vb || RIGHT(Drives.i.Total,15) , + Vb LEFT(Drives.i.Label,13) ||, + Vb LEFT(Drives.i.Location,7) ||, + Vb LEFT(Drives.i.Filesys,9) ||, + Vb +end + +if DisplayType = "BOX" then HorizontalLine = EndLine + +say HorizontalLine + +-- display additional information +RamDrives = SysDriveMap(,'RAMDISK') +if RamDrives = "" then RamDrives = "No RAM Drives" + +say "" +say "Operating System Version : "SysVersion() +say "Bootdrive : "SysBootDrive() +say "Used drives : "SysDriveMap(,'USED') +say "Local drives : "SysDriveMap(,'LOCAL') +say "RAM drives : "RamDrives +say "Remote drives : "SysDriveMap(,'REMOTE') +say "Drive letters not used : "SysDriveMap(,'FREE') + +return diff --git a/projects/mvs/dasducb.rex b/projects/mvs/dasducb.rex new file mode 100644 index 0000000..66b2b02 --- /dev/null +++ b/projects/mvs/dasducb.rex @@ -0,0 +1,15 @@ +/* testing dasducb */ + +ADDRESS TSO 'RX SYS2.EXEC(DASDUCB)'; /* retrieve dasd information */ + +'EXECIO * DISKR STEMTMP (STEM cuu.' + +DO ix=1 BY 1 TO cuu.0 + PARSE VAR cuu.ix WITH cuu_addr'~'cuu_volser'~'cuu_type'~'cuu_class'~'; + SAY 'CUU: ' cuu_addr , + 'Volume:' cuu_volser , + 'Type: ' cuu_type , + 'Class: ' cuu_class; +END; +ADDRESS TSO 'RX SYS2.EXEC(DSTEMTMP)' +EXIT; diff --git a/projects/mvs/who.rex b/projects/mvs/who.rex new file mode 100644 index 0000000..982cbd4 --- /dev/null +++ b/projects/mvs/who.rex @@ -0,0 +1,16 @@ +/*REXX*/ + +sysuid = sysvar("sysuid") +syspref = sysvar("syspref") +sysproc = sysvar("sysproc") +if syspref = "" then syspref="**NOPREFIX**" +say " userid="sysuid", syspref="syspref", proc="sysproc +terminal = gettrid() +say " VTAM Terminal ID="terminal + +/* LOCATION -- TELLS USER WHERE LOGGEDON ON */ +/* SYSUID -- USER'S IDENTIFICATION */ +/* SYSPREF -- DATA SET NAME PREFIX WHICH THE USER SETS */ +/* USING THE PROFILE COMMAND */ +/* SYSPROC -- LOGON PROCEDURE NAME */ +/* TERMINAL-- VTAM TERMINAL ID AS FOUND BY GETTRID */ \ No newline at end of file diff --git a/projects/oorexx/1plus1.rex b/projects/oorexx/1plus1.rex new file mode 100644 index 0000000..345f008 --- /dev/null +++ b/projects/oorexx/1plus1.rex @@ -0,0 +1,2 @@ +Say '1'+'1' +Say "2" * 2 diff --git a/projects/oorexx/address-test.rex b/projects/oorexx/address-test.rex new file mode 100644 index 0000000..56ce945 --- /dev/null +++ b/projects/oorexx/address-test.rex @@ -0,0 +1,7 @@ +/* Rexx */ + +Address "zsh" "ls -lA" With output stem dir. + +Do i = 1 to dir.0 + say dir.i +end diff --git a/projects/oorexx/contacts.rdbx b/projects/oorexx/contacts.rdbx new file mode 100644 index 0000000..e69de29 diff --git a/projects/oorexx/dist.rex b/projects/oorexx/dist.rex new file mode 100644 index 0000000..b630fd3 --- /dev/null +++ b/projects/oorexx/dist.rex @@ -0,0 +1,56 @@ +/* ---------------------------------------------------------------- */ +/* Calculates the distance between (possibly a series) of */ +/* 2 latitude/longitude pairs. May be used in a pipe. */ +/* ---------------------------------------------------------------- */ +Call RxFuncAdd "MathLoadFuncs","rxmath","MathLoadFuncs" +Call MathLoadFuncs + +/* ---------------------------------------------------------------- */ +/* The following formula's can be used to calculate the distance */ +/* between two points on earth: */ +/* */ +/* d=R*acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2)) */ +/* */ +/* or */ +/* */ +/* d=R*2*asin(sqrt((sin((lat1-lat2)/2))^2 + cos(lat1)*cos(lat2)* */ +/* (sin((lon1-lon2)/2)^2)) */ +/* */ +/* where */ +/* */ +/* R -- the radius of the earth, commonly taken to be: 6378,137 km */ +/* lat1/lat2 -- latitude in degrees (NOT degrees minutes seconds) */ +/* lon1/lon2 -- longitude in degrees (NOT degrees minutes seconds */ +/* */ +/* The first formula is more subject to possible rounding errors */ +/* for short distances and since the route description produced by */ +/* Google Earth/Maps often has points within a couple of meters */ +/* this code uses the second formula. */ +/* */ +/* ---------------------------------------------------------------- */ + +/* -oldradius = 6366710 */ +googleradius = 6378137 /* -- Equatorial earth radius used by Google */ + +Say "Enter 4 values. (FROM) latitude longitude (TO) latitude longitude:" +Parse Value Linein() With flat flon tlat tlon +If (tlat<>'' & tlon<>'') Then Say Distance(flat,flon,tlat,tlon) +Do While Lines()>0 + Parse Value Linein() With tlat tlon . + Say Distance(flat,flon,tlat,tlon) + flat = tlat + flon = tlon +End +Exit + +Distance: Procedure Expose googleradius + Parse Arg flat, flon, tlat, tlon + sinlat = RxCalcSin((flat-tlat)/2) + cosplat = RxCalcCos(flat) + coslati = RxCalcCos(tlat) + sinlon = RxCalcSin((flon-tlon)/2) + sinlatp = (sinlat)**2 + sinlonp = (sinlon)**2 + radians = 2*RxCalcArcSin(RxCalcSqrt(sinlatp + cosplat*coslati*sinlonp),,'R') + distance = (radians*googleradius)~format(,0)/1000 'km' +Return distance /* -- returns distance in thousands of a Km */ diff --git a/projects/oorexx/drawbox.rex b/projects/oorexx/drawbox.rex new file mode 100755 index 0000000..c613faf --- /dev/null +++ b/projects/oorexx/drawbox.rex @@ -0,0 +1,23 @@ +#!/usr/bin/env rexx +/* drawbox.rex - Draw an ncurses box using ooRexx nCurses library */ + +do + /* call ORXCURINITSCR / Initialize ncurses / + call OrxCurNoecho / Disable echoing / + call OrxCurCbreak / Enable immediate input / + */ + /* Create a window: height, width, start_y, start_x */ + win = OrxCurNewwin(10, 20, 5, 10) + call OrxCurBox win, 0, 0 /* Draw box with default ACS characters */ + call OrxCurWrefresh win /* Display the window */ + + call OrxCurGetch /* Wait for keypress */ + call OrxCurEndwin /* Clean up */ +end + +catch error + say "Error:" error~message + call OrxCurEndwin /* Ensure cleanup on error */ +exit + +::requires "ncurses.cls" \ No newline at end of file diff --git a/projects/oorexx/experiment.rex b/projects/oorexx/experiment.rex new file mode 100755 index 0000000..5d66b44 --- /dev/null +++ b/projects/oorexx/experiment.rex @@ -0,0 +1,17 @@ +#!/usr/bin/env rexx +/*************************************************************************/ + + call RxFuncAdd "OrxCurInitscr", "orxncurses", "OrxCurInitscr" + call RxFuncAdd "OrxCurEndwin", "orxncurses", "OrxCurEndwin" + +scr = .Window~new() +scr~clear() +scr~beep() +scr~addstr('I said ATTENTION!') +scr~flash() + + +exit + +/***************** REQUIRES **********************************************/ +::requires "orxncurses" LIBRARY; \ No newline at end of file diff --git a/projects/oorexx/hello.rex b/projects/oorexx/hello.rex new file mode 100644 index 0000000..d55d776 --- /dev/null +++ b/projects/oorexx/hello.rex @@ -0,0 +1,41 @@ +/* Rexx +call RxFuncAdd 'SysGetPid', 'rxunixsys', 'SysGetPid' +call RxFuncAdd 'SysGethostname', 'rxunixsys', 'SysGethostname' +call RxFuncAdd 'SysUname', 'rxunixsys', 'SysUname' +*/ +If RxFuncQuery("SockDropFuncs") then + do + rc = RxFuncAdd("SockLoadFuncs","rxsock","SockLoadFuncs") + rc = SockLoadFuncs() + end + +Say 'Hello, World!' +Say "This PID : " || SysGetPid() +Say "Parent PID : " || SysGetppid() +Say "Hostname : " || SysGethostname() +Say "Platform : " || SysUname() || "." || SysUname("m") +Say "Kernel : " || SysUname("r") +Say "RxSock : " || SockVersion() +Say "OrxNcurses : " || .window~orxncurses_version +say .ooSQLite~version('F') + +Say "The Square Root of 194 is: " || RxCalcSqrt(194,2) + +srcConn = .ooSQLiteConnection~new("contacts.rdbx") +srcConn~busyTimeout(3000) +bu = .ooSQLiteBackup~new(srcConn, ":memory:", .true) +if bu~initCode <> bu~OK then + do + say 'Error opening backup object:' bu~lastErrCode bu~lastErrMsg + srcConn~close + return 99 + end + +exit + +/*** import ***/ +::requires 'ooSQLite.cls' +::requires 'ncurses.cls' +::requires 'rxmath' LIBRARY +::requires "rxunixsys" LIBRARY + diff --git a/projects/oorexx/minimal_ncurses.rex b/projects/oorexx/minimal_ncurses.rex new file mode 100755 index 0000000..bb5b2bb --- /dev/null +++ b/projects/oorexx/minimal_ncurses.rex @@ -0,0 +1,16 @@ +#!/usr/bin/env rexx +/* minimal_ncurses.rex - Draw a box using raw ncurses functions */ + +do + call initscr + call noecho + call cbreak + win = newwin(10, 20, 5, 10) + call box win, 0, 0 + call wrefresh win + call getch + call endwin +end +Exit + +::requires "ncurses.cls" diff --git a/projects/oorexx/mouse_thing.rex b/projects/oorexx/mouse_thing.rex new file mode 100755 index 0000000..5c4dc64 --- /dev/null +++ b/projects/oorexx/mouse_thing.rex @@ -0,0 +1,22 @@ +#!/usr/bin/env rexx + +scr = .window~new() +scr~noecho() +scr~keypad(.true) + +mmask = scr~mousemask(scr~ALL_MOUSE_EVENTS) + +do forever + ch = scr~getch() + if ch = scr~KEY_MOUSE then do + mort = scr~getmouse() + scr~move(1, 1) + scr~clrtoeol() + scr~addstr(mort~y || '/' || mort~x) + scr~refresh() + end + if ch = lf then leave +end +Exit + +::requires 'ncurses.cls' diff --git a/projects/oorexx/move_demo.rex b/projects/oorexx/move_demo.rex new file mode 100755 index 0000000..3b2f53c --- /dev/null +++ b/projects/oorexx/move_demo.rex @@ -0,0 +1,16 @@ +#!/usr/bin/env rexx + +scr = .window~new() +maxyx = scr~getmaxyx() +parse var maxyx maxy maxx . +scr~scrollok(.true) + +do y = 1 to maxy + scr~mvaddstr(y, 1, "This is boring text written to line" y) +end + +scr~getch() + +exit + +::requires 'ncurses.cls' diff --git a/projects/oorexx/ncurses_test.rex b/projects/oorexx/ncurses_test.rex new file mode 100755 index 0000000..af3d1f1 --- /dev/null +++ b/projects/oorexx/ncurses_test.rex @@ -0,0 +1,22 @@ +#!/usr/bin/env rexx +/* test_50cls.rex */ + +scr = .window~new() +scr~start_color() +scr~init_pair(1, scr~COLOR_WHITE, scr~COLOR_BLUE) +msg = " OrxNcurses Version: "||.window~orxncurses_version() +scr~cbreak +scr~noecho +scr~box('|'~c2d(), '-'~c2d()) +scr~beep() +win = scr~subwin(10, 40, 5, 10) +win~box(0, 0) +win~refresh +win~move(2,2) +win~insstr(msg) +/* win~insch(msg)*/ +/* win~addstr(msg)*/ +scr~getch +scr~endwin +exit +::requires "ncurses.cls" diff --git a/projects/oorexx/probe_orxncurses.rex b/projects/oorexx/probe_orxncurses.rex new file mode 100755 index 0000000..0149caf --- /dev/null +++ b/projects/oorexx/probe_orxncurses.rex @@ -0,0 +1,19 @@ +#!/usr/bin/env rexx +/* probe_orxncurses.rex - Test the orxncurses library API */ + +/* Main program */ +do + /* Try version check from docs */ + msg = "Orxncurses version: " || .window~orxncurses_version() + + /* Test basic initialization */ + scr = .window~new() + scr~addstr(msg) + scr~refresh() + scr~getch() + scr~endwin() +end + +exit + +::requires "ncurses.cls" diff --git a/projects/oorexx/rexxcurl.rexx b/projects/oorexx/rexxcurl.rexx new file mode 100644 index 0000000..009f76f --- /dev/null +++ b/projects/oorexx/rexxcurl.rexx @@ -0,0 +1,13 @@ +/* + * This is a demo program for Rexx/CURL + */ +Call RxFuncAdd 'CurlLoadFuncs', 'rexxcurl', 'CurlLoadFuncs' +Call CurlLoadFuncs + +Say 'This is Rexx/CURL:' CurlVariable('VERSION') + +Call CurlQueryFunction 'out.','A' +Say 'Available functions:' +Do i = 1 To out.0 + Say ' 'out.i +End diff --git a/projects/oorexx/stuff.rex b/projects/oorexx/stuff.rex new file mode 100644 index 0000000..3acae26 --- /dev/null +++ b/projects/oorexx/stuff.rex @@ -0,0 +1,21 @@ +/* Rexx */ +Call RxFuncAdd 'SysCrypt', 'rxunixsys','SysCrypt' + +my_msg = "This is a test message I would like to encrypt" +my_salt = get_salt(16) /* the width of the salt. E.g. 16 is for SHA-512 */ +enc_msg = SysCrypt(my_msg, my_salt) + +Say "My Message: " || my_msg +Say "Salt: " || salt +Say "Encrypted: " || enc_msg + +exit + +get_salt: + parse arg width + salt = "" + Loop x = 1 to width + chr = d2c(random(65,90)) /* Alpha Chars A...Z */ + salt = salt || chr + End /* loop */ +return salt diff --git a/projects/oorexx/test.rex b/projects/oorexx/test.rex new file mode 100755 index 0000000..151f9c0 --- /dev/null +++ b/projects/oorexx/test.rex @@ -0,0 +1,4 @@ +say SysGetpwnam('gmgauthier','r') +say "Test complete" +exit +::requires "rxunixsys" LIBRARY diff --git a/projects/oorexx/test_getrexxpackage.rex b/projects/oorexx/test_getrexxpackage.rex new file mode 100755 index 0000000..25f244b --- /dev/null +++ b/projects/oorexx/test_getrexxpackage.rex @@ -0,0 +1,14 @@ +#!/usr/bin/env rexx +/* test_rexxgetpackage.rex */ +do + pkg = RexxGetPackage("orxncurses") + if pkg \= .nil then say "Package: " pkg + else say "No package returned" + call OrxCurInitscr + call OrxCurEndwin +end +catch error + say "Error:" error~message +exit + +::requires "orxncurses" LIBRARY diff --git a/projects/oorexx/test_init.rex b/projects/oorexx/test_init.rex new file mode 100755 index 0000000..d77ef17 --- /dev/null +++ b/projects/oorexx/test_init.rex @@ -0,0 +1,23 @@ +#!/usr/bin/env rexx +/* test_init.rex - Test library initialization */ + +do + /* Register a simple function */ + call RxFuncAdd "OrxCurVersion", "orxncurses", "OrxCurVersion" + + /* Test it */ + version = OrxCurVersion() + say "Version: " version + + /* Try initializing ncurses */ + call RxFuncAdd "OrxCurInitscr", "orxncurses", "OrxCurInitscr" + call RxFuncAdd "OrxCurEndwin", "orxncurses", "OrxCurEndwin" + call OrxCurInitscr + say "Initscr worked!" + call OrxCurEndwin +end + +catch error + say "Error:" error~message + call OrxCurEndwin +exit diff --git a/projects/oorexx/test_orxncurses.rex b/projects/oorexx/test_orxncurses.rex new file mode 100755 index 0000000..11a94b6 --- /dev/null +++ b/projects/oorexx/test_orxncurses.rex @@ -0,0 +1,26 @@ +#!/usr/bin/env rexx +/* test_orxncurses.rex - Test library initialization and basic function */ + +/* Call RxFuncAdd "OrxNcurses","orxncurses","OrxNcurses" */ + +do + /* Try to register the package */ + pkg = RexxGetPackage("orxncurses") + if pkg \= .nil then say "Package registered: " pkg + else say "Package registration failed" + + /* Test a simple function */ + version = OrxCurVersion() + say "Orxncurses version: " version + + /* Try initializing ncurses */ + call OrxCurInitscr + say "Initscr succeeded!" + call OrxCurEndwin +end + +catch error + say "Error:" error~message +exit + +/* ::requires "orxncurses" LIBRARY */ \ No newline at end of file diff --git a/projects/oorexx/test_rxfuncadd.rex b/projects/oorexx/test_rxfuncadd.rex new file mode 100755 index 0000000..8823430 --- /dev/null +++ b/projects/oorexx/test_rxfuncadd.rex @@ -0,0 +1,18 @@ +#!/usr/bin/env rexx +/* test_rxfuncadd.rex - Test RxFuncAdd with new orxncurses */ + +do + /* Register functions */ + call RxFuncAdd "OrxCurInitscr", "orxncurses", "OrxCurInitscr" + call RxFuncAdd "OrxCurEndwin", "orxncurses", "OrxCurEndwin" + + /* Test initialization */ + call OrxCurInitscr + say "Initscr worked!" + call OrxCurEndwin +end + +catch error + say "Error:" error~message + call OrxCurEndwin +exit diff --git a/projects/oorexx/text-attrs.rex b/projects/oorexx/text-attrs.rex new file mode 100755 index 0000000..16e86bc --- /dev/null +++ b/projects/oorexx/text-attrs.rex @@ -0,0 +1,26 @@ +#!/usr/bin/env rexx + +::requires "ncurses.cls" + +lf = .window~ASCII_LF~d2c() +bs = .window~ASCII_BS~d2c() + +text = .array~of('Do', 'you', 'find', 'this', 'silly?') + +scr = .window~new() +do a = 1 to text~items() + do b = 1 to text~items() + if b = a then scr~attrset(scr~A_BOLD + scr~A_UNDERLINE) + scr~addstr(text[b]) + if b = a then scr~attroff(scr~A_BOLD + scr~A_UNDERLINE) + scr~addch(' ') + end + scr~addstr(bs || lf) +end + +/* Forces a pause to wait for input. Poor man's wait. */ +scr~getch +scr~endwin + +Exit + diff --git a/projects/text/jabberwocky.txt b/projects/text/jabberwocky.txt new file mode 100644 index 0000000..fd03221 --- /dev/null +++ b/projects/text/jabberwocky.txt @@ -0,0 +1,38 @@ +Jabberwocky + +'Twas brillig, and the slithy toves +Did gyre and gimble in the wabe: +All mimsy were the borogoves, +And the mome raths outgrabe. + +'Beware the Jabberwock, my son! +The jaws that bite, the claws that catch! +Beware the Jubjub bird, and shun +The frumious Bandersnatch!' + +He took his vorpal sword in hand: +Long time the manxome foe he sought -- +So rested he by the Tumtum tree, +And stood a while in thought. + +And, as in uffish thought he stood, +The Jabberwock, with eyes of flame, +Came whiffling through the tulgey wood, +And burbled as it came! + +One two! One two! And through and through +The vorpal blade went snicker-snack! +He left it dead, and with its head +He went galumphing back. + +'And hast thou slain the Jabberwock? +Come to my arms, my beamish boy! +Oh frabjous day! Callooh! Callay!' +He chortled in his joy. + +'Twas brillig, and the slithy toves +Did gyre and gimble in the wabe: +All mimsy were the borogoves, +And the mome raths outgrabe. + +Lewis Carroll diff --git a/samples/mvs/addcmds.rex b/samples/mvs/addcmds.rex new file mode 100644 index 0000000..c325672 --- /dev/null +++ b/samples/mvs/addcmds.rex @@ -0,0 +1,161 @@ +/* REXX ADDCMDS Add one command table to the currently-resident + copy of ISPCMDS. The user's personal command + table may thus be dynamically spliced to ISPCMDS. + Changes to the user's personal command table may + be implemented at any time by re-running this. + + Written by Frank Clarke in the Dark Ages + + Impact Analysis +. SYSPROC TRAPOUT + + Modification History + 19981027 fxc REXXSKEL at last, v.19980225; + 19991117 fxc upgrade from v.19980225 to v.19991109; + +*/ arg argline +address ISPEXEC /* REXXSKEL ver.19991109 */ +arg parms "((" opts + +signal on syntax +signal on novalue + +call TOOLKIT_INIT /* conventional start-up -*/ +rc = trace(tv) +info = parms /* to enable parsing */ + +"CONTROL ERRORS RETURN" /* I'll handle my own errors */ +call A_INIT /* -*/ +call B_TABLE_OPS /* -*/ + +exit /*@ ADDCMDS */ +/* +. ----------------------------------------------------------------- */ +A_INIT: /*@ */ + if branch then call BRANCH + address ISPEXEC + + parse value "0 0" with, + adds dels del_list + parse value info exec_name with, + tblname . + if tblname = "ADDCMDS" then tblname = "TMPCMDS" + if Length(tblname) < 5 then tblname = tblname"CMDS" + if monitor then say, + "Using" tblname + +return /*@ A_INIT */ +/* +. ----------------------------------------------------------------- */ +B_TABLE_OPS: /*@ */ + if branch then call BRANCH + address ISPEXEC + + "TBQUERY" tblname /* tell me about this table */ + if rc > 12 then do /* doesn't exist, maybe ? */ + zerrsm = "TBQUERY error" + if Symbol("zerrlm") = "LIT" then, + zerrlm = "No additional diagnostics produced." + zerrlm = exec_name "("BRANCH("ID")")", + zerrlm + address ISPEXEC "SETMSG MSG(ISRZ002)" + sw.0error_found = "1"; return + drop zerrlm /* make it a LIT again */ + end + + if rc = 12 then "TBOPEN" tblname "NOWRITE" /* 12 = 'not open' */ + + "TBSORT" tblname "FIELDS(ZCTVERB,C,D)" + do forever /* for every row in the table */ + "TBSKIP" tblname /* get next row */ + if rc > 0 then leave + if monitor then say, + " Working" zctverb + do forever /* found a match on ISPCMDS */ + "TBSCAN ISPCMDS NOREAD ARGLIST(ZCTVERB) CONDLIST(EQ)" + if rc > 0 then leave + if monitor then say, + " Delete from ISPCMDS" + "TBDELETE ISPCMDS" /* get rid of it */ + del_list = del_list zctverb /* make note of it */ + dels = dels + 1 /* count a deleted row */ + end /* forever (inner) */ + "TBADD ISPCMDS" /* ... add a new line */ + adds = adds + 1 /* count an added row */ + "TBTOP ISPCMDS" /* reposition to row 0 */ + end /* forever (outer) */ + + "TBEND " tblname /* close and end */ + + if sw.0show then do /* user asked for a list */ + "TBTOP ISPCMDS" /* reset to top */ + do forever + "TBSKIP ISPCMDS" /* get another row */ + if rc > 0 then leave /* end of table */ + say Left(zctverb,8) Right(zcttrunc,2) Left(zctact,66) + say " " Left(zctdesc,72) + end /* forever */ + end /* SHOW */ + + ZERRSM = "A="adds "D="dels /* short message */ + ZERRLM = adds "lines were added;" dels "lines deleted." + if dels <> 0 & ABS(adds-dels) > 1 then do + ZERRSM = ZERRSM "(!)" + ZERRLM = ZERRLM "Deleted verbs:" del_list + ZERRALRM = "YES" + end + else ZERRALRM = "NO" + address ISPEXEC "SETMSG MSG(ISRZ002)" + +return /*@ B_TABLE_OPS */ +/* +. ----------------------------------------------------------------- */ +LOCAL_PREINIT: /*@ customize opts */ + address TSO + + sw.0show = SWITCH("SHOW") /* user asked for a list ? */ + +return /*@ LOCAL_PREINIT */ +/* +. ----------------------------------------------------------------- */ +HELP: /*@ */ +address TSO;"CLEAR" +if helpmsg <> "" then do ; say helpmsg; say ""; end +ex_nam = Left(exec_name,8) /* predictable size */ +say " "ex_nam" adds a user-command-table to the in-storage copy " +say " of ISPCMDS. Any existing command-table entries " +say " with matching names are deleted before the new " +say " commands are added. " +say " " +say " Syntax: "ex_nam" [cmd-tbl-name] (Defaults)" +say " (( [SHOW] " +say " " +say " " +say " If cmd-tbl-name is not specified, the name defaults " +say " to 'TMPCMDS' for execname=ADDCMDS, and to the name of" +say " the routine for any aliases. " +pull +"CLEAR" +say " Debugging tools provided include:" +say " " +say " MONITOR: displays key information throughout processing." +say " Displays most paragraph names upon entry." +say " " +say " NOUPDT: by-pass all update logic." +say " " +say " BRANCH: show all paragraph entries." +say " " +say " TRACE tv: will use value following TRACE to place" +say " the execution in REXX TRACE Mode." +say " " +say " " +say " Debugging tools can be accessed in the following manner:" +say " " +say " TSO" exec_name" parameters (( debug-options" +say " " +say " For example:" +say " " +say " TSO" exec_name " (( MONITOR TRACE ?R" +address ISPEXEC "CONTROL DISPLAY REFRESH" +exit /*@ HELP */ +/****** REXXSKEL back-end removed to save space. *******/ \ No newline at end of file diff --git a/samples/mvs/alist.rex b/samples/mvs/alist.rex new file mode 100644 index 0000000..9a2da3f --- /dev/null +++ b/samples/mvs/alist.rex @@ -0,0 +1,389 @@ +/* REXX ALIST Display the user's current allocations + + Written by Frank Clarke, Oldsmar, FL + |**-***-***-***-***-***-***-***-***-***-***-***-***-***-***-***-**| + | | + | WARNING: EMBEDDED COMPONENTS. | + | | + |**-***-***-***-***-***-***-***-***-***-***-***-***-***-***-***-**| +*/ +address TSO /* default address */ +tv = "" +signal on syntax +parse source sys_id how_invokt exec_name DD_nm DS_nm as_invokt cmd_env, + addr_spc usr_tokn +if ds_nm <> "?" then do /* explicit invocation */ + say exec_name "cannot be invoked explicitly." + say " " + say " It must be part of your SYSPROC or SYSEXEC allocation," + say " and invoked implicitly because it requires ISPF facilities" + say " and these are incompatible with a command library which is" + say " not part of your defined environment." + say " " + exit + end +if Sysvar("sysispf") = "NOT ACTIVE" then do + arg line + line = line "(( RESTARTED" /* tell the next invocation */ + "ISPSTART CMD("exec_name line")" /* Invoke ISPF if nec. */ + exit /* ...and restart it */ + end + +arg target "((" opts +opts = Strip( opts , "T" , ")" ) /* clip trailing paren */ +if Word(target,1) = "?" then call HELP /* ...and don't come back */ + +parse var opts "TRACE" tv . +parse value tv "O" with tv . +rc = Trace(tv) +address ISPEXEC /* default address for ISPF */ +"CONTROL ERRORS RETURN" + +call A_INIT /* -*/ +call B_GET_ALLOCATIONS /* -*/ +call C_LOAD_TABLE /* -*/ +call D_TABLE_OPS /* -*/ +call E_REDO_ALLOC /* -*/ + +exit /*@ ALIST */ +/* +. ----------------------------------------------------------------- */ +A_INIT: /*@ */ + address TSO + + restarted = WordPos("RESTARTED",opts)>0/* called from READY-mode ? */ + parse value "0 ISR00000 YES" with, + got_one zerrhm zerralrm zerrsm zerrlm + t_nam = "T"Right(Time(s),5,0) /* T32855 maybe #*/ + + parse value "?" with, + ddname dsnames. disp. tk_globalvars , + ddlist , + . + +return /*@ A_INIT */ +/* +. ----------------------------------------------------------------- */ +B_GET_ALLOCATIONS: /*@ */ + address TSO + + tgt_list = "" + + do ii = 1 to Words(target) /* for every target spec */ + this_tgt = Word(target,ii) + if this_tgt = "ISPF" then, /* expand ISPF */ + tgt_list = tgt_list "ISPPLIB ISPMLIB ISPSLIB ISPTLIB", + "ISPTABL ISPLLIB ISPPROF" + else, + if this_tgt = "CMDS" |, /* expand CMDS */ + this_tgt = "COMMANDS" then, + call BA_Q_ALTLIB /* -*/ +/* tgt_list = tgt_list "SYSPROC SYSEXEC" */ + else, /* just add to the list */ + tgt_list = tgt_list this_tgt + end /* ii */ + + ln. = "" /* setup array */ + rc = Outtrap("ln.") /* open trap */ + "LISTA ST" + rc = Outtrap("off") /* close trap */ + call BB_GET_STACKS /* -*/ + + dds_to_realloc = "" + ds_stack. = "" + redo_alloc = "0" + +return /*@ B_GET_ALLOCATIONS */ +/* +. ----------------------------------------------------------------- */ +BA_Q_ALTLIB: /*@ */ + address TSO + + $x = Outtrap("alt.") /* set up outtrap */ + "ALTLIB DISPLAY" /* get ddname-list */ + $x = Outtrap("OFF") /* release trap */ + + do bax = 1 to alt.0 + parse var alt.bax "DDNAME=" baxddn . + tgt_list = tgt_list baxddn + end /* bax */ + +return /*@ BA_Q_ALTLIB */ +/* + Build lists of DSNames by DDName and store in a stem array indexed + by DDName. +. ----------------------------------------------------------------- */ +BB_GET_STACKS: /*@ */ + address TSO + /* Build DDName stack */ + do bbx = 1 to ln.0, /* for each trapped line */ + until Substr(ln.bbx,1,1) <> "-" /* ...skip the header */ + end /* bbx */ + + start = bbx + do bbx = start to ln.0 /* for each trapped line */ + if Left(ln.bbx,1) = ' ' then do /* it's a DDname */ + if Substr(ln.bbx,3,1) <> " " then do /* new DDName */ + parse var ln.bbx ddname disp . + ddlist = ddlist ddname + end /* DDName */ + dsnames.ddname = dsnames.ddname dsname + disp.ddname = disp + end /* DDname */ + else dsname = Word(ln.bbx,1) /* it's a DSName */ + end /* bbx */ + +return /*@ BB_GET_STACKS */ +/* +. ----------------------------------------------------------------- */ +C_LOAD_TABLE: /*@ */ + address ISPEXEC + + if tgt_list = "" then tgt_list = ddlist + + "TBCREATE " t_nam " NAMES(DDNAME DSNAME DISP) NOWRITE" + disp = "?" + + do Words(tgt_list) /* every DDName */ + parse var tgt_list ddname tgt_list + ds_stack.ddname = dsnames.ddname + disp = disp.ddname + do Words(dsnames.ddname) + parse var dsnames.ddname dsname dsnames.ddname + "TBADD" t_nam /* add to table #*/ + got_one = "1" + end /* dsnames */ + end /* Words(tgt_list) */ + +return /*@ C_LOAD_TABLE */ +/* +. ----------------------------------------------------------------- */ +D_TABLE_OPS: /*@ */ + address ISPEXEC + + if got_one then do + call DEIMBED /* expose the panel -*/ + $ddn = $ddn.PLIB + "LIBDEF ISPPLIB LIBRARY ID("$ddn") STACK" + + "TBTOP" t_nam /* */ + "CONTROL DISPLAY SAVE" /* In case of re-invocation */ + do forever + "TBDISPL" t_nam "PANEL(FCALLOC) CURSOR(ACTION) AUTOSEL(NO)" + if rc > 4 then leave + do ztdsels + curact = Translate(action) + "CONTROL DISPLAY SAVE" + select + when curact = "E" then do /* Edit */ + "EDIT DATASET('"dsname"')" + save_rc = rc + end /* Edit */ + when curact = "V" then do /* View */ + "VIEW DATASET('"dsname"') CONFIRM(NO)" + save_rc = rc + end /* View */ + when curact = "B" then do /* Browse */ + "BROWSE DATASET('"dsname"')" + save_rc = rc + end /* Browse */ + when curact = "D" then do /* DUP */ + address TSO "DUP '"dsname"' ID" + save_rc = rc + if rc <> 0 then do + ZERRSM = "RC ="rc + ZERRLM = "DUP ended abnormally" + end + end /* CLONE */ + when curact = "F" then do /* Free */ + redo_alloc = "1" + if WordPos(ddname,dds_to_realloc) = 0 then,/* new DDName */ + dds_to_realloc = dds_to_realloc ddname + dsid = WordPos(dsname,ds_stack.ddname) /* in the list ? */ + if dsid > 0 then, + ds_stack.ddname = DelWord(ds_stack.ddname,dsid,1) + end /* Free */ + when curact = "X" then do /* UnDisplay */ + "TBDELETE" t_nam /* drop this row */ + end /* UnDisplay */ + otherwise nop + end /* Select */ + "CONTROL DISPLAY RESTORE" + if save_rc <> 0 then, + "SETMSG MSG(ISRZ002)" + save_rc = 0 + if ztdsels = 1 then, /* never do the last one */ + ztdsels = 0 + else "TBDISPL" t_nam /* next row #*/ + end /* ztdsels */ + action = "" /* clear for re-display */ + end /* forever */ + "CONTROL DISPLAY RESTORE" /* In case of re-invocation */ + + "LIBDEF ISPPLIB" + "TBCLOSE" t_nam + address TSO "FREE FI("$ddn")" + end /* got_one */ + else do + "TBEND" t_nam /* #*/ + ZERRSM = "No datasets" /* short message */ + ZERRLM = "No datasets were allocated as specified/implied." + "SETMSG MSG(ISRZ002)" + end + +return /*@ D_TABLE_OPS */ +/* +. ----------------------------------------------------------------- */ +E_REDO_ALLOC: /*@ */ + address TSO /* ready for some TSO work */ + + if redo_alloc then do + do fidx = 1 to Words(dds_to_realloc)/* for each DDName */ + ddname = Word(dds_to_realloc,fidx) /* grab it */ + alloc_list = "" /* initialize */ + + if Words(ds_stack.ddname) > 0 then, + do didx = 1 to Words(ds_stack.ddname) /* for each DSName */ + alloc_list = alloc_list "'"Word(ds_stack.ddname,didx)"'" + end + + if alloc_list <> "" then, /* re-ALLOC */ + "ALLOC FI("ddname") DA("alloc_list") SHR REU" + else "FREE FI("ddname")" + end /* fidx */ + end /* redo_alloc */ + +return /*@ E_REDO_ALLOC */ +/* +. ----------------------------------------------------------------- */ +HELP: /*@ */ +address TSO "CLEAR" +say " " +say " ALIST displays a scrollable list of allocated datasets." +say " The list may be limited to specific DDNames or " +say " specific sets of DDNames. " +say " " +say " Syntax: ALIST [ddname-list] [CMDS] [ISPF] " +say " [ ? ] " +say " " +say " [ddname-list] is a blank-delimited list of filenames " +say " to be displayed. " +say " [CMDS] is equivalent to 'SYSPROC SYSEXEC' " +say " [ISPF] is equivalent to 'ISPPLIB ISPMLIB ISPSLIB " +say " ISPTLIB ISPLLIB ISPPROF ISPTABL' " +say " " +say " ALIST may be invoked from READY-mode. " +say " " +exit /*@ HELP */ + +/* ----------------------------------------------------------------- */ +SYNTAX: /*@ */ + errormsg = "REXX error" rc "in line" sigl":" errortext(rc) + say errormsg + say sourceline(sigl) + trace "?r" + nop +exit /*@ SYNTAX */ +/* + Parse out the embedded components at the back of the source code. +. ----------------------------------------------------------------- */ +DEIMBED: Procedure expose, /*@ */ + (tk_globalvars) ddnlist $ddn. daid. + + address TSO + + fb80po.0 = "NEW UNIT(VIO) SPACE(5 5) TRACKS DIR(40)", + "RECFM(F B) LRECL(80) BLKSIZE(0)" + parse value "" with ddnlist $ddn. daid. + + lastln = sourceline() + currln = lastln /* */ + if Left(sourceline(currln),2) <> "*/" then return + + currln = currln - 1 /* previous line */ + "NEWSTACK" + do while sourceline(currln) <> "/*" + text = sourceline(currln) /* save with a short name ! */ + if Left(text,3) = ")))" then do /* package the queue */ + parse var text ")))" ddn mbr . /* PLIB PANL001 maybe */ + if Pos(ddn,ddnlist) = 0 then do /* doesn't exist */ + ddnlist = ddnlist ddn /* keep track */ + $ddn = ddn || Random(999) + $ddn.ddn = $ddn + "ALLOC FI("$ddn")" fb80po.0 + address ISPEXEC "LMINIT DATAID(DAID) DDNAME("$ddn")" + daid.ddn = daid + end + daid = daid.ddn + address ISPEXEC "LMOPEN DATAID("daid") OPTION(OUTPUT)" + do queued() + parse pull line + address ISPEXEC "LMPUT DATAID("daid") MODE(INVAR)", + "DATALOC(LINE) DATALEN(80)" + end + address ISPEXEC "LMMADD DATAID("daid") MEMBER("mbr")" + address ISPEXEC "LMCLOSE DATAID("daid")" + end /* package the queue */ + else push text /* onto the top of the stack */ + currln = currln - 1 /* previous line */ + end /* while */ + "DELSTACK" + +return /*@ DEIMBED */ +/* +)))PLIB FCALLOC +)ATTR + % TYPE(TEXT) INTENS(HIGH) SKIP(ON) + + TYPE(TEXT) INTENS(LOW) SKIP(ON) + _ TYPE(INPUT) INTENS(HIGH) + ! TYPE(OUTPUT) INTENS(HIGH) SKIP(ON) +)BODY EXPAND(||) +%|-| Current Allocations |-| +%COMMAND ===>_ZCMD + %SCROLL ===>_AMT + ++ ++ DDName DSName Disp +)MODEL +_Z+ !DDNAME + !DSNAME + !DISP + +)INIT + .ZVARS = '(ACTION)' + .HELP = FCALLOCH +)REINIT + IF (&MSG = ' ') + &ACTION = ' ' + REFRESH (&ACTION) +)END +)))PLIB FCALLOCH +)ATTR + % TYPE(TEXT) INTENS(HIGH) SKIP(ON) + + TYPE(TEXT) INTENS(LOW) SKIP(ON) + _ TYPE(INPUT) INTENS(HIGH) + ! TYPE(OUTPUT) INTENS(HIGH) SKIP(ON) + @ TYPE(OUTPUT) INTENS(LOW) SKIP(ON) +)BODY EXPAND(��) +%TUTORIAL �-� Current Allocations �-� TUTORIAL +%Next Selection ===>_ZCMD + ++ + Panel FCALLOC shows the current allocations for the DDNames you specified + (or ALL DDNames). + + For each shown dataset you may select among several actions: + + %B+-%BROWSE +Browse the selected dataset. + + %E+-%EDIT +Edit the selected dataset. + + %V+-%VIEW +View the selected dataset. + + %D+-%DUP +You may make a copy (either filled or empty) of the + selected dataset. Subroutine DUP will be called to + perform this function. + + %F+-%FREE +This is effective only for DDNames which are not under + the control of ISPF since those files are necessarily + OPEN while ISPF is active. + +)PROC +)END +*/ diff --git a/samples/mvs/blox.rex b/samples/mvs/blox.rex new file mode 100644 index 0000000..ac0e817 --- /dev/null +++ b/samples/mvs/blox.rex @@ -0,0 +1,214 @@ +/* REXX BLOX create block letters from an input string. + for each of eight lines + for each letter in string + get pattern for letter + get sub-pattern for this line + build slug + attach to line + write the line + + Written by Frank Clarke, Oldsmar, FL + +*/ +address TSO +signal on syntax + +tv="" ; odsn="" /* ensure values */ +sav = "" +parse upper arg instr "((" parms /* get parameters */ +if instr="" & parms="" then call HELP /* no parms at all */ +parms = Strip(parms,T,")") /* clip trailing paren */ + +parse value KEYWD("TRACE") "O" with tv . +odsn = KEYWD("OUTPUT") /* output to file ? */ +if Pos("(",odsn) > 0 then, /* has a left banana */ +if Pos(")",odsn) = 0 then, /* but no right banana */ + odsn = Space(odsn")",0) /* add one */ + +prompt = \SWITCH("NOPROMPT") +diagnose = SWITCH("DIAGNOSE") +instr = Strip(instr) /* clean the input */ +rc = Trace(tv) + +if odsn <> "" then do /* was a value */ + "ALLOC FI(BLOXDD) DA("odsn") SHR REU" + if rc > 0 then do /* doesn't exist ? */ + "ALLOC FI(BLOXDD) DA("odsn") NEW REU SPACE(1) TRACKS", + " RECFM(V B) LRECL(121) BLKSIZE(1210) UNIT(SYSDA)" + if rc > 0 then do /* ...and couldn't create it! */ + say "Allocation failed for "odsn"." + exit + end /* alloc NEW */ + end /* alloc SHR */ + end /* alloc dataset */ +else "ALLOC FI(BLOXDD) DA(*) SHR REU" /* to the terminal */ + +call SET_PATN /* -*/ +if tv = "O" then "CLEAR" /* clear screen */ + +if instr = "" then do /* no input ? */ + say ":" /* initial prompt */ + "NEWSTACK" + pull instr + "DELSTACK" + end + +do forever + do while instr <> "" + if length(instr) > 8 then do /* too long */ + parse var instr instr 9 sav /* save the excess */ + end + + do i = 1 to 7 /* for 7 lines */ + outline="" /* clear it */ + do j = 1 to Length(instr) /* for each letter */ + ltr = Substr(instr,j,1) /* isolate it */ + ltrpos = Pos(ltr,choices) /* where in the array ? */ + if ltrpos = 0 then ltrpos = 47 /* set to blank */ + byte = Substr(patn.ltrpos,i*2-1,2) + if diagnose then say ltr byte X2B(byte) + slug = X2B(byte) /* character-to-binary */ + slug = Translate(slug," ","0") /* off -> blank */ + slug = Translate(slug,ltr,"1") /* on -> letter */ + outline = outline slug /* splice to the line */ + end /* j for length(instr) */ + queue outline /* into the queue */ + end /* i for 7 lines */ + instr = "" + queue " " /* blank line */ + queue " " /* blank line */ + + rc = Trace("O") + rc = Trace(tv) + if sav <> "" then do /* was there excess ? */ + instr = sav /* restore it */ + sav = "" /* indicate "no excess" */ + end + end /* while instr filled */ + + if prompt then, + if instr = "" then do /* no more input ? */ + say ":" /* prompt for more */ + "NEWSTACK" + pull instr + "DELSTACK" + end + if instr = "" then leave /* prompt was refused */ +end /* forever */ + +rc = Trace("O") ; rc = Trace(tv) +"EXECIO" queued() "DISKW BLOXDD (FINIS" /* flush to output */ +"FREE FI(BLOXDD)" + +exit +/* +. ----------------------------------------------------------------- */ +SET_PATN: /*@ */ + patn.="" /* storage for patterns */ + patn.1 = "081422417F4141" /* A */ + patn.2 = "7E41417E41417E" /* B */ + patn.3 = "3E41404040413E" /* C */ + patn.4 = "7C42414141427C" /* D */ + patn.5 = "7F40407C40407F" /* E */ + patn.6 = "7F40407C404040" /* F */ + patn.7 = "7E41404047417E" /* G */ + patn.8 = "4141417F414141" /* H */ + patn.9 = "1C08080808081C" /* I */ + patn.10 = "7F02020202423C" /* J */ + patn.11 = "41424478444241" /* K */ + patn.12 = "4040404040407F" /* L */ + patn.13 = "41635549414141" /* M */ + patn.14 = "41615149454341" /* N */ + patn.15 = "3E41414141413E" /* O */ + patn.16 = "7E41417E404040" /* P */ + patn.17 = "3E41414145423D" /* Q */ + patn.18 = "7E41417E444241" /* R */ + patn.19 = "3E41403E01413E" /* S */ + patn.20 = "7F080808080808" /* T */ + patn.21 = "4141414141413E" /* U */ + patn.22 = "41414141221408" /* V */ + patn.23 = "41414141494936" /* W */ + patn.24 = "41221408142241" /* X */ + patn.25 = "41221408080808" /* Y */ + patn.26 = "7F02040810207F" /* Z */ + patn.27 = "3E43454951613E" /* 0 */ + patn.28 = "0818080808083E" /* 1 */ + patn.29 = "3E41020408103E" /* 2 */ + patn.30 = "7F020C0201413E" /* 3 */ + patn.31 = "2040487F080808" /* 4 */ + patn.32 = "7F40407E01017E" /* 5 */ + patn.33 = "0408103E41413E" /* 6 */ + patn.34 = "7F020408080808" /* 7 */ + patn.35 = "3E41413E41413E" /* 8 */ + patn.36 = "3E41413E040810" /* 9 */ + patn.37 = "22227F227F2222" /* # */ + patn.38 = "143E403E013E14" /* $ */ + patn.39 = "21522408122542" /* % */ + patn.40 = "0018241825423D" /* & */ + patn.41 = "0022143E142200" /* * */ + patn.42 = "04081010100804" /* ( */ + patn.43 = "10080404040810" /* ) */ + patn.44 = "0000003E000000" /* - */ + patn.45 = "00181800181800" /* : */ + patn.46 = "00000000000000" /*blank */ + patn.47 = "00181800181808" /* ; */ + patn.48 = "3E410104080008" /* ? */ + choices ="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$%&*()-: ;?" +return /*@ SET_PATN */ +/* +. ----------------------------------------------------------------- */ +HELP: /*@ */ +"CLEAR" /* clear screen */ +say " " +say " BLOX is a REXX routine which will build 8x7 block letters " +say " from text you specify. " +say " " +say " BLOX can handle strings to length=8 and will write either to " +say " the screen-face or to a file you name. Syntax for BLOX is: " +say " BLOX " +say " " +say " : OUTPUT output-dsname " +say " " +exit /*@ HELP */ + +/*-------------------------------------------------------------------*/ +KEYWD: Procedure expose, /*@ */ + kw parms +arg kw . +if Wordpos(kw,parms) = 0 then, + kw_val = "" +else, +if Wordpos(kw,parms) = 1 then, + kwa = kw" " +else kwa = " "kw" " +parse var parms . value(kwa) kw_val . +if kw_val <> "" then parms = Delword(parms,Wordpos(value(kw),parms),2) +return kw_val /*@ KEYWD */ + +/*-------------------------------------------------------------------*/ +SWITCH: /*@ */ +arg kw . +sw_val = Wordpos(value(kw),parms) > 0 +if sw_val then parms = Delword(parms,Wordpos(value(kw),parms),1) +return sw_val /*@ SWITCH */ + +/*-------------------------------------------------------------------*/ +SYNTAX: /*@ */ + errormsg = "REXX error" rc "in line" sigl":" errortext(rc) + say errormsg + say sourceline(sigl) + Trace "?R" + nop +exit /*@ SYNTAX */ + +/* Work area for creating new patterns: */ + +/* ....... */ +/* ....... */ +/* ....... */ +/* ....... */ +/* ....... */ +/* ....... */ +/* ....... */ +/* ....... */ +/* ....... */ \ No newline at end of file diff --git a/samples/mvs/cmds.rex b/samples/mvs/cmds.rex new file mode 100644 index 0000000..cf95efa --- /dev/null +++ b/samples/mvs/cmds.rex @@ -0,0 +1,194 @@ +/* REXX COMMANDS Show the contents of xxxCMDS and allow + selection and parameter entry. + |**-***-***-***-***-***-***-***-***-***-***-***-***-***-***-***-**| + | | + | WARNING: EMBEDDED COMPONENTS. | + | | + |**-***-***-***-***-***-***-***-***-***-***-***-***-***-***-***-**| +*/ +address TSO +arg line +exec_name = Sysvar(Sysicmd) +if Sysvar(sysispf) = "NOT ACTIVE" then do + line = line "(( RESTARTED" /* tell the next invocation */ + "ISPSTART CMD("exec_name line")" /* Invoke ISPF if nec. */ + exit /* ...and restart it */ + end +restarted = WordPos("RESTARTED",opts)>0/* called from READY-mode ? */ +tv = "" +arg parms "((" opts +opts = Strip(opts,"T",")") /* lop trailing banana */ + +parse var opts "TRACE" tv . +parse value tv "O" with tv . /* guarantee a value */ +rc = Trace(tv) + +if parms = "?" then call HELP +parse value parms "ISP" with cmdtblID . +$tn$ = cmdtblID"CMDS" /* ISPCMDS by default */ + +address ISPEXEC +"CONTROL ERRORS RETURN" +call DEIMBED /* extract panel FCCMDSP -*/ +$ddn = $ddn.PLIB +"LIBDEF ISPPLIB LIBRARY ID("$ddn") STACK" +"TBTOP" $tn$ +do forever + "TBDISPL" $tn$ "PANEL(FCCMDSP) CURSOR(ACTION) AUTOSEL(NO)" + if rc > 4 then leave + do ztdsels + select + when action = "S" then + do /* Select */ + "CONTROL DISPLAY SAVE" /* in case we display s'thing */ + (zctact) + "CONTROL DISPLAY RESTORE" /* return from display */ + end + when WordPos(action,"D") > 0 then "TBDELETE" $tn$ + when WordPos(action,"E B") > 0 then call F_FIXTBL /* -*/ + otherwise nop + end /* Select */ + if ztdsels = 1 then ztdsels = 0 + else "TBDISPL" $tn$ /* next row */ + end /* ztdsels */ + action = "" /* clear for re-display */ +end /* forever */ +"LIBDEF ISPPLIB" + +if restarted then do + @@ = OutTrap("ll.") + exit 4 + end +exit /*@ COMMANDS */ +/* +. ----------------------------------------------------------------- */ +F_FIXTBL: /*@ */ + address ISPEXEC + + save. = "" + parse value zctverb zcttrunc zctact with , + save.vb save.tr save.act + save.desc = zctdesc + do forever + "DISPLAY PANEL(FCCMDFIX)" + if rc > 0 then leave + end + if save.vb = zctverb then, + if save.tr = zcttrunc then, + if save.act = zctact then, + if save.desc = zctdesc then return + "TBMOD" $tn$ + +return /*@ F_FIXTBL */ +/* +. ----------------------------------------------------------------- */ +HELP: /*@ */ +say "HELP for" Sysvar(Sysicmd) "not available" +exit /*@ HELP */ +/* + Parse out the embedded components at the back of the source code. + + The components are enclosed in a comment whose start and end are on + individual lines for easier recognition. + + Each component is identified by a triple-close-paren ")))" in + column 1 followed by a DDName and a membername. The text of the + component begins on the next line. + + There are no restrictions on the DDName, but it is probably a good + idea to pick a name which relates to its use so that mainline + processing can, for example, determine what sort of LIBDEF to do. + Note also that a 3-digit random number will be generated for each + DDName to guard against the possibility that processing may be + interleaved or recursive. It is up to the programmer to add the + code to properly LIBDEF each component type. +. ----------------------------------------------------------------- */ +DEIMBED: Procedure expose, /*@ */ + ddnlist $ddn. daid. + + address TSO + + fb80po.0 = "NEW UNIT(VIO) SPACE(5 5) TRACKS DIR(40)", + "RECFM(F B) LRECL(80) BLKSIZE(0)" + parse value "" with ddnlist $ddn. daid. + + lastln = sourceline() + currln = lastln /* */ + if Left(sourceline(currln),2) <> "*/" then return + + currln = currln - 1 /* previous line */ + "NEWSTACK" + address ISPEXEC + do while sourceline(currln) <> "/*" + text = sourceline(currln) /* save with a short name ! */ + if Left(text,3) = ")))" then do /* package the queue */ + parse var text ")))" ddn mbr . /* PLIB PANL001 maybe */ + if Pos(ddn,ddnlist) = 0 then do /* doesn't exist */ + ddnlist = ddnlist ddn /* keep track */ + $ddn = ddn || Random(999) + $ddn.ddn = $ddn + address TSO "ALLOC FI("$ddn")" fb80po.0 + "LMINIT DATAID(DAID) DDNAME("$ddn")" + daid.ddn = daid + end + daid = daid.ddn + "LMOPEN DATAID("daid") OPTION(OUTPUT)" + do queued() + parse pull line + "LMPUT DATAID("daid") MODE(INVAR) DATALOC(LINE) DATALEN(80)" + end + "LMMADD DATAID("daid") MEMBER("mbr")" + "LMCLOSE DATAID("daid")" + end /* package the queue */ + else push text /* onto the top of the stack */ + currln = currln - 1 /* previous line */ + end /* while */ + address TSO "DELSTACK" + +return /*@ DEIMBED */ +/* +)))PLIB FCCMDSP +)ATTR + % TYPE(TEXT) INTENS(HIGH) SKIP(ON) + + TYPE(TEXT) INTENS(LOW) SKIP(ON) + _ TYPE(INPUT) INTENS(HIGH) CAPS(ON) + ! TYPE(OUTPUT) INTENS(HIGH) SKIP(ON) +)BODY EXPAND(ºº) +%º-º Current Command Table Contents º-º +%COMMAND ===>_ZCMD %SCROLL ===>_AMT + ++ ++ CmdName CmdDescription +)MODEL +_Z+ !ZCTVERB + !ZCTDESC +)INIT + .ZVARS = '(ACTION)' +)REINIT + IF (&MSG = ' ') + &ACTION = ' ' + REFRESH (&ACTION) +)END +)))PLIB FCCMDFIX +)ATTR + % TYPE(TEXT) INTENS(HIGH) SKIP(ON) + + TYPE(TEXT) INTENS(LOW) SKIP(ON) + _ TYPE(INPUT) INTENS(HIGH) CAPS(ON) + } TYPE(INPUT) INTENS(HIGH) CAPS(OFF) + ! TYPE(OUTPUT) INTENS(HIGH) SKIP(ON) +)BODY EXPAND(ºº) +%º-º Current Command Table Line Contents º-º +%COMMAND ===>_ZCMD + %SCROLL ===>_AMT + ++ ++ Verb ===>_zctverb + + ++ Truncation ===>_z+ + ++ Action ===>_zctact + ++ Description ===>}zctdesc + +)INIT + .ZVARS = '(ZCTTRUNC)' +)PROC +)END +*/ \ No newline at end of file diff --git a/samples/mvs/cpuid.rex b/samples/mvs/cpuid.rex new file mode 100644 index 0000000..e7b52e6 --- /dev/null +++ b/samples/mvs/cpuid.rex @@ -0,0 +1,129 @@ +/* CPUID -- Display CPU information from REXX */ +/* article in TSO TIMES, Fall 1993, by John Andrisan */ +/* of IBM ISSC subdivision in Long Beach California */ +/*********************************************************************/ +/* A TSO REXX Exec to get information aobut CPUs from the MVS */ +/* control blocks: DVT, SMCA, CSD, PCCAVT, and PCCA; then show CPU */ +/* number, id serial number, type, SMF id letter, and anything else */ +/* that looks interesting. */ +/* */ +/* The control block chain that I want to follow: */ +/* location 10x --> CVT */ +/* CVT+C4x --> SMCA */ +/* SMCA+16 contains the SMF id */ +/* CVT+294x --> CSD */ +/* CSD+4, +8 and + 10 contain */ +/* some interesting cpu counts */ +/* CVT+2FCx --> PCCAVT */ +/* PCCAVT+0 --> PCCA for CPU 0 */ +/* PCCAVT+4 --> PCCA for CPU 1 */ +/* ... etc. */ +/* PCCAVT+60 --> PCCA for CPU 15 */ +/* PCCA+4 contains the cpu id, serial#, type */ +/* PCCA+24 --> virtual PSA */ +/* PCCA+28 --> real PSA */ +/*********************************************************************/ +/* ---------begin available "The REXX Macros Toolbox" only portion*/ + "CLS" /* clear screen*/ + say '----- information obtained via WHICH CPU ------' + "WHICH CPU" + say ' ' + say '----- information from CPUID -- Display CPU information' +/* ------------ end available "The REXX Macros Toolbox" only portion*/ +arg what . +if what='?' then do /* offer the user some help */ + say ' use: COMMAND ===> CPUID' + say ' No parms are required' + say ' You will be shown the SMF id letter defining this system,' + say ' the CPU id, serial number, and CPU type of each CPU,' + say ' This exec (CPUID) only works on TSO.' +end +if address() /='TSO' then do + say 'This exec only works in MVS/TSO.' + exit 4 +end +call init /* set up some constants */ +CVT=storage('10',4) +CVT=bitand(CVT,'7FFFFFFF'x) /* zero high bit */ +SMCA=storage(d2x(c2d(CVT)+x2d('C4')),4) /* get to SMCA */ +SMCA=bitand(SMCA,'7FFFFFFF'x) +SMCASID=storage(d2x(c2d(SMCA)+16),4) +say 'SMF id=' SMCASID +CSD=storage(d2x(c2d(CVT)+x2d('294')),4) /* get to CSD */ +CSD=bitand(CSD,'7FFFFFFF'x) /* zero high bit */ + /* the counts shown next may change whil you run*/ +nr_cpus=c2d(storage(d2x(c2d(CSD)+10),2)) /* get nr cur alive */ +say 'nr cpus currently alive:' nr_cpus /* whatever that is */ +job_avail_cpus=x2b(c2x(storage(d2x(c2d(csd)+4),2))) +say count_bits(job_avail_cpus) 'available for jobs' +srb_avail_cpus=x2b(c2x(storage(d2x(c2d(csd)+8),2))) +say count_bits(srb_avail_cpus) 'available for srbs' +cur_alive_cpus=x2b(c2x(storage(d2x(c2d(CSD)+10),2))) +say count_bits(cur_alive_cpus) 'currently alive' +say ' ' +PCCAAVT=storage(d2x(c2d(CVt)+x2d('2FC')),4) /* get to PCCAVT */ +PCCAAVT=bitand(PCCAAVT,'7FFFFFFF'x) /* zero high bit*/ + +say '-----CPU-------------- PSA PSA ' +say '# ver id serial type vaddr raddr status:' +do i=0 to 60 by 4 + PCCA=storage(d2x(c2d(PCCAAVT)+i),4) /* get the i-th PCCA */ + PCCA=bitand(PCCA,'7FFFFFFF'x) /* zero high bit */ + if PCCA=='00000000'x then iterate i /* avoid empty entry */ + info=storage(c2x(PCCA),32) + if substr(job_avail_cpus,i%4+1,1)='1' then jobs='jobs' + else jobs='no-jobs' + if substr(srb_avail_cpus,i%4+1,1)='1' then srbs='srbs' + else jobs='no-srbs' + if substr(cur_alive_cpus,i%4+1,1)='1' then alive='alive' + else alive='no-alive' + /* as run "The REXX Macros Toolbox" 1993/12/16 + SMF id= H901 + nr cpus currently alive: 5 + 5 available for jobs + 5 available for srbs + 2 currently alive + + -----CPU-------------- PSA PSA + # ver id serial type vaddr raddr status: + 00 52 0 12495 3090 8000F6F0 00157240 jobs srbs no-alive + 01 52 1 12495 3090 7800F9F0 00134030 jobs srbs no-alive + 02 52 2 12495 3090 0000F980 0002F040 jobs srbs no-alive + 03 52 3 12495 3090 0000F960 00068040 jobs srbs no-alive + 04 52 4 12495 3090 1000F7F0 000A2040 jobs srbs no-alive + 05 a: 9 & 00070C30 0080007B no-srbs srbs no-alive + */ + say , + /*cpu number:*/ right(i%4,2,'0')' ', + /*cpu ver : */ substr(info,5,2)' ', + /*cpuid: */ substr(info,7,1), + /*cpu serial:*/ substr(info,8,5)' ', + /*cpu type: */ substr(info,13,4)' ', + /*PSA vaddr:*/ c2x(substr(info,24,4))' ', + /*PSA raddr:*/ c2x(substr(info,28,4))' ', + /* the status shown next may change while you run*/, + /*status:*/ jobs srbs alive +end +exit 0 +/* ------------------- subroutines ---------------------- */ +count_bits: + arg bit_string . + bit_sum = 0 + do bit=1 to length(bit_string) + if substr(bit_string,bit,1)='1' then bit_sum=bit_sum + 1 + end + return(bit_sum) + X2B: /* X2B is a function for hex to binary string conversion*/ + arg arg . + bitout='' + do i=1 to length(arg) + t=substr(arg,i,1) + bitout=bitout||hex.t + end + return bitout + init: /* constants needed in x2b */ + hex.0='0000'; hex.1='0001'; hex.2='0010'; hex.3='0011'; + hex.4='0100'; hex.5='0101'; hex.6='0110'; hex.7='0111'; + hex.8='1000'; hex.9='1001'; hex.A='1010'; hex.B='1011'; + hex.C='1100'; hex.D='1101'; hex.E='1110'; hex.F='1111'; + return \ No newline at end of file diff --git a/samples/mvs/free.clist b/samples/mvs/free.clist new file mode 100644 index 0000000..decc032 --- /dev/null +++ b/samples/mvs/free.clist @@ -0,0 +1,10 @@ + PROC 1 FREE$DS CONTROL LIST + /*CONLIST SYMLIST + /* PURPOSE: "FREE" DATASET AND "WHOGOT" DATASET + /* CONTRIBUTED: F. DAVID MCRITCHIE 1985/02/04 + IF &SUBSTR(1:1,&FREE$DS.) = &STR(') THEN DO + SET L = &LENGTH(&FREE$DS.) + SET FREE$DS = &SUBSTR(2:&EVAL(&L - 1),&FREE$DS) + END + FREE DS('&FREE$DS') + WHOGOT &FREE$DS diff --git a/samples/mvs/gettrid.rex b/samples/mvs/gettrid.rex new file mode 100644 index 0000000..2325c0d --- /dev/null +++ b/samples/mvs/gettrid.rex @@ -0,0 +1,60 @@ +/* REXX - + statistics 0122-92148-93314-0817-00056-00087-00000-REXX + sys6.cbt.file078(rexx) + returns the name of the terminal -- e.g. + terminal = gettrid(); say terminal + +------------------------------------------------------------------+ + | Name: GETTRID | + | Type: REXX exec | + | Purpose: Extract the ACEETRID from the RACF ACEE. | + | Release: MVS/ESA v4.2.2 and TSO/E v2.4 | + | Programmer: John Kalinich | + | Date: 3/10/93 | + | Abstract: A sub-function to extract the VTAM terminal id from | + | the RACF Accessor Environment Element. The ACEE is | + | not fetch protected. This function works in ACF2 | + | systems. | + | | + | Call Format: GETTRID() | + | | + | Logic: Extracts address of ASCB (PSAAOLD at x'224') | + | Extracts address of ASXB (ASCB+x'6C') | + | Extracts address of ACEE (ASXB+x'C8') | + | Extracts ACEETRID | + +------------------------------------------------------------------+ */ +trace + +ascb_ptr = get_ptr(224,0) +asxb_ptr = get_ptr(ascb_ptr,'6c') +acee_ptr = get_ptr(asxb_ptr,'c8') +aceetrid = get_data(acee_ptr,'40',8) +exit aceetrid + +/* +-----------------------------------------+ + | Procedures and functions defined below. | + +-----------------------------------------+ */ + +get_ptr: procedure + /* +-----------------------------------------+ + | returns a 4 byte pointer as hexadecimal | + | string at address addr+offset. | + | ADDR and OFFSET must be HEX strings. | + +-----------------------------------------+ */ + arg addr, offset + temp = d2x(x2d(addr) + x2d(offset)) + return c2x(storage(temp,4)) + exit + +get_data: procedure + /* +-----------------------------------------+ + | returns LENGTH bytes at ADDR+OFFSET as | + | an EBCDIC string. | + | ADDR and OFFSET must be HEX strings. | + | LENGTH must be a decimal string. | + +-----------------------------------------+ */ + arg addr, offset, length + temp = d2x(x2d(addr) + x2d(offset)) + return storage(temp,length) + exit +/* J. KALINICH, X4521 */ +/* EXEC TO GET THE RACF ACEE TERMINAL ID */ \ No newline at end of file diff --git a/samples/mvs/gotdsn.clist b/samples/mvs/gotdsn.clist new file mode 100644 index 0000000..0252643 --- /dev/null +++ b/samples/mvs/gotdsn.clist @@ -0,0 +1,29 @@ +PROC 1 DSN INFORM +/* GOTDSN: DETERMINE IF THE PERSON TESTING HAS THE DSNAME ALLOCATED +/* NO PROVISION MADE FOR MEMBERNAME +/* CONTRIBUTED: DAVID MCRITCHIE, "THE REXX MACROS TOOLBOX", 1989/09/04 +SET INFORM = &SYSCAPS(&INFORM.) +SET SYSOUTTRAP = 400 +LISTALC STA +SET N = &SYSOUTLINE +SET SYSOUTTRAP = 0 +SET I = 1 +SET LP = &STR(( +DO WHILE &I <= &N + SET DX = &STR(&&SYSOUTLINE&I..) + SET DX = &STR(&DX.) + SET IX = &SYSINDEX(&STR(&LP.),&STR(&DX.)) + IF &IX ^= 0 THEN SET DX = &SUBSTR(1:&EVAL(&IX. - 1),&STR(&DX.)) + /* WRITE &IX. _ &DX. _ &DSN. _ &LP. + IF X&SUBSTR(1:1,&STR(&DX.)) = X&STR( ) THEN GOTO NIX + IF X&STR(&DX.). = X&STR(&DSN.). THEN DO + IF INFORM = &INFORM THEN - + WRITE GOTDSN -- YES YOU ARE ALLOCATED TO &DSN. <---<< + EXIT CODE(0) + END +NIX: - + SET I = &I. + 1 +END +IF INFORM = &INFORM THEN - + WRITE GOTDSN -- YOU ARE NOT ALLOCATED TO &DSN. +EXIT CODE(4) \ No newline at end of file diff --git a/samples/mvs/iplinfo.rex b/samples/mvs/iplinfo.rex new file mode 100644 index 0000000..0f55092 --- /dev/null +++ b/samples/mvs/iplinfo.rex @@ -0,0 +1,3586 @@ +/* REXX */ +/* */ +/* AUTHOR: Mark Zelden */ +/* */ +/* Trace ?r */ +/* */ +/*********************************************************************/ +/* */ +/* D I S C L A I M E R */ +/* ------------------- */ +/* */ +/* This program is FREEWARE. Use at your own risk. Neither Mark */ +/* Zelden, nor other contributing organizations or individuals */ +/* accept any liability of any kind howsoever arising out of the use */ +/* of this program. You are free to use and modify this program as */ +/* you desire, however, the author does ask that you leave his name */ +/* in the source and give credit to him as the original programmer. */ +/* */ +/*********************************************************************/ +/* IPLINFO: DISPLAY SYSTEM INFORMATION ON TERMINAL */ +/*********************************************************************/ +/* */ +/* IPLINFO can be called as an interactive exec / ISPF edit macro */ +/* or in batch to display various system information. The result */ +/* will be displayed in an ISPF browse data set if ISPF is active. */ +/* */ +/* IPLINFO can also be called as a REXX function to return from 1 */ +/* to 20 variables used in the exec at their final value. If more */ +/* than one variable is requested the variables are returned with */ +/* a blank or user defined delimiter between each variable so they */ +/* may be parsed if desired. */ +/* */ +/* See below for the sytax of each method. */ +/* */ +/*********************************************************************/ +/* */ +/* EXECUTION SYNTAX: */ +/* */ +/* TSO %IPLINFO MVS Information */ +/* Virtual Storage Map */ +/* Static System Symbols */ +/* Subsystem Information */ +/* APF Library List */ +/* */ +/*********************************************************************/ +/* */ +/* FUNCTION SYNTAX: */ +/* */ +/* IPLINFO(VAR,var1_name) */ +/* IPLINFO(VAR,var1_name,var2_name,var3_name, ... var20_name) */ +/* */ +/* Examples: */ +/* sysname = IPLINFO(VAR,GRSNAME) */ +/* pvtsize = IPLINFO(VAR,GDAPVTSZ) */ +/* */ +/* */ +/* /* REXX one line IPL information using IPLINFO rexx function */ */ +/* IPL_SUM = IPLINFO(VAR,ipldate,ipltime,iplvol,ipladdr,iplparm) */ +/* Parse var IPL_SUM ipldate ipltime iplvol ipladdr iplparm */ +/* Say 'Date:'ipldate ' Time:'ipltime ' Vol:'iplvol , */ +/* ' Load addr:'ipladdr ' LOADPARM:'iplparm */ +/* */ +/* */ +/* NOTE: The default delimeter between returned variables is a */ +/* blank. However, this can be problematic when the returned */ +/* value contains a blank or is null. You can optionally */ +/* change the delimiter from a blank to one of your choice */ +/* by using "VAR2" instead of "VAR" in the function call and */ +/* specifying the delimiter character(s) as the next operand */ +/* prior to the list of variables you want returned. */ +/* */ +/* */ +/* FUNCTION SYNTAX - "VAR2" / USER DEFINED DELIMITER: */ +/* */ +/* IPLINFO(VAR2,'dlm',var1_name) */ +/* IPLINFO(VAR2,'dlm',var1_name,var2_name,var3_name, ... var20_name) */ +/* */ +/* Example: */ +/* /* REXX one line IPL information using IPLINFO rexx function */ */ +/* IPL_SUM = IPLINFO(VAR2,'@@',ipldate,ipltime,iplvol, , */ +/* ipladdr,iplparm) */ +/* Parse var IPL_SUM ipldate '@@' ipltime '@@' iplvol '@@' , */ +/* ipladdr '@@' iplparm */ +/* Say 'Date:'ipldate ' Time:'ipltime ' Vol:'iplvol , */ +/* ' Load addr:'ipladdr ' LOADPARM:'iplparm */ +/* */ +/*********************************************************************/ +/* */ +/* NOTE: The dynamic APF and dynamic LNKLST code in this exec */ +/* use undocumented IBM control blocks and may break at */ +/* any time! */ +/* ... tested on MVS ESA V4.3 up through z/OS 2.3. */ +/* */ +/* NOTE: The LNKLST SET displayed is the LNKLST SET of the address */ +/* space running this exec, not necessarily the most */ +/* current one. For the current LNKLST SET either: */ +/* 1) Run this exec in batch. */ +/* 2) Log off and on TSO before executing this exec. */ +/* 3) Issue SETPROG LNKLST,UPDATE,JOB=userid (B4 execution) */ +/* */ +/* NOTE: The APF flag in the LNKLST display is the status if the */ +/* data set is accessed VIA LNKLST. Therefore, if IEASYSxx */ +/* specifies LNKAUTH=LNKLST, all entires are marked as APF=Y. */ +/* */ +/*********************************************************************/ +LASTUPD = '09/24/2020' /* date of last update */ +/*********************************************************************/ +/* */ +/* B E G I N C U S T O M I Z A T I O N S E C T I O N */ +/* */ +/* You may changes the variables below to your preference. */ +/* You may only choose the options that are commented out. */ +/* */ +/* DATEFMT - Controls date format: ISO ; USA ; EUR */ +/* VMAP - Controls VMAP order: HIGHFIRST ; LOWFIRST */ +/* */ +/*********************************************************************/ +DATEFMT = 'ISO' /* ISO 8601 format YYYY-MM-DD (new default) */ +/* DATEFMT = 'USA' */ /* USA format MM/DD/YYYY (original format) */ +/* DATEFMT = 'EUR' */ /* EUR format DD/MM/YYYY */ +/*********************************************************************/ +VMAP = 'HIGHFIRST' /* new default - show VMAP from top down */ +/* VMAP = 'LOWFIRST' */ /* the old way - show from bottom up */ +/* Please let me know if you "need" the old way (LOWFIRST) as I */ +/* will probably remove the duplicate code in the future. */ +/*********************************************************************/ +/* */ +/* E N D C U S T O M I Z A T I O N S E C T I O N */ +/* */ +/*********************************************************************/ +Signal On Syntax name SIG_ALL /* trap syntax errors */ +Signal On Novalue name SIG_ALL /* trap uninitialized variables */ +Arg OPTION,VAR.1,VAR.2,VAR.3,VAR.4,VAR.5,VAR.6,VAR.7,VAR.8,VAR.9, , + VAR.10,VAR.11,VAR.12,VAR.13,VAR.14,VAR.15,VAR.16,VAR.17,VAR.18, , + VAR.19,VAR.20,VAR.21 +Parse source . EXEC_TYPE . . . . . ENV . . +MML = Substr(LASTUPD,1,2) /* MM from MM/DD/YYYY */ +DDL = Substr(LASTUPD,4,2) /* DD from MM/DD/YYYY */ +YYYYL = Substr(LASTUPD,7,4) /* YYYY from MM/DD/YYYY */ +If DATEFMT = 'USA' then , /* USA format date? */ + LASTUPD = LASTUPD /* date as MM/DD/YYYY */ +If DATEFMT = 'EUR' then , /* EUR format date? */ + LASTUPD = DDL'/'MML'/'YYYYL /* date as DD/MM/YYYY */ +If DATEFMT = 'ISO' then , /* ISO format date? */ + LASTUPD = YYYYL'-'MML'-'DDL /* date as YYYY-MM-DD */ +SYSISPF = 'NOT ACTIVE' /* set SYSISPF=NOT ACTIVE */ +FUNCDLM = ' ' /* Delimiter default for function call */ +If ENV <> 'OMVS' then /* are we under unix ? */ + If Sysvar('SYSISPF')='ACTIVE' then do /* no, is ISPF active? */ + If Pos('NOB',OPTION) = 0 then , /* NOBrowse not used? */ + Address ISREDIT "MACRO (OPTION)" /* YES,allow use as macro */ + OPTION = Translate(OPTION) /* ensure upper case for edit macro */ + Address ISPEXEC "VGET ZENVIR" /* ispf version */ + SYSISPF = 'ACTIVE' /* set SYSISPF = ACTIVE */ + End +/*********************************************************************/ +/* Process options */ +/*********************************************************************/ +BROWSEOP = 'YES' /* default is to browse OP under ISPF */ +EDITOP = 'NO' /* output is not in edit mode */ +/*********************************************************************/ +If SYSISPF = 'NOT ACTIVE' & Pos('EDI',OPTION) <> 0 then /* EDIT is */ + call INVALID_OPTION /* not valid if ISPF isn't active */ +If OPTION = '' then OPTION = 'ALL' /* Default option. Change to IPL */ + /* or something else - may want to change help panel if changed */ +If Abbrev('NOBROWSE',OPTION,3) = 1 then , /* NOBROWSE only opt? */ + OPTION = 'ALL NOBROWSE' /* yes, use all option */ +If Abbrev('EDIT',OPTION,3) = 1 then , /* EDITonly opt? */ + OPTION = 'ALL EDIT' /* yes, use all option */ +If Abbrev('NOBROWSE',Word(OPTION,2),3) = 1 then do /* NOBROWSE USED? */ + OPTION = Word(OPTION,1) /* separate out option */ + BROWSEOP = 'NO' /* set BROWSEOP flag to NO */ +End +If Abbrev('EDIT',Word(OPTION,2),3) = 1 then do /* EDIT USED? */ + OPTION = Word(OPTION,1) /* separate out option */ + EDITOP = 'YES' /* set EDITOP flag to YES */ +End +/*********************************************************************/ +If OPTION <> 'IPL' & , /* check for IPL option */ + Abbrev('VERSION',OPTION,3) <> 1 & , /* check for VERsion option */ + Abbrev('STORAGE',OPTION,3) <> 1 & , /* check for STOrage option */ + Abbrev('STORE',OPTION,3) <> 1 & , /* check for STOre option */ + Abbrev('MEMORY',OPTION,3) <> 1 & , /* check for MEMory option */ + OPTION <> 'CPU' & , /* check for CPU option */ + OPTION <> 'IPA' & , /* check for IPA option */ + Abbrev('SYMBOLS',OPTION,3) <> 1 & , /* check for SYMbols option */ + Abbrev('VMAP',OPTION,3) <> 1 & , /* check for VMAp option */ + Abbrev('PAGE',OPTION,3) <> 1 & , /* check for PAGe option */ + Abbrev('ASM',OPTION,3) <> 1 & , /* check for ASM option */ + Abbrev('AUX',OPTION,3) <> 1 & , /* check for ASM option */ + OPTION <> 'SMF' & , /* check for SMF option */ + OPTION <> 'SSI' & , /* check for SSI option */ + OPTION <> 'SSN' & , /* check for SSN option */ + OPTION <> 'SUB' & , /* check for SUB option */ + Abbrev('SUBSYSTEMS',OPTION,3) <> 1 & , /* check for SUB option */ + Abbrev('ASID',OPTION,3) <> 1 & , /* check for ASId option */ + Abbrev('ASVT',OPTION,3) <> 1 & , /* check for ASVt option */ + OPTION <> 'LPA' & , /* check for LPA option */ + Abbrev('LNKLST',OPTION,3) <> 1 & , /* check for LNKlst option */ + Abbrev('LINKLIST',OPTION,3) <> 1 & , /* check for LINklist option*/ + OPTION <> 'APF' & , /* check for APF option */ + OPTION <> 'SVC' & , /* check for SVC option */ + OPTION <> 'ALL' & , /* check for ALL option */ + Substr(OPTION,1,3) <> 'VAR' , /* check for VAR option */ + then call INVALID_OPTION /* no valid option... */ +Numeric digits 20 /* dflt of 9 not enough */ + /* 20 can handle 64-bit */ +Call COMMON /* control blocks needed by multiple routines */ +Call HEADING /* Heading sub-routine */ +Select + When OPTION = 'ALL' | Substr(OPTION,1,3) = 'VAR' then do + Call IPL /* IPL information */ + Call VERSION /* Version information */ + Call STOR /* Storage information */ + Call CPU /* CPU information */ + Call IPA /* Initialization info. */ + Call SYMBOLS /* Symbols information */ + Call VMAP /* Virt. Storage Map */ + Call PAGE /* Page DSN information */ + Call SMF /* SMF DSN information */ + Call SUB /* Subsystem information */ + Call ASID /* ASID usage information*/ + Call LPA /* LPA List information */ + Call LNKLST /* LNKLST information */ + Call APF /* APF List information */ + Call SVC /* SVC information */ + End /* when OPTION = 'ALL' */ + When Abbrev('VERSION',OPTION,3) = 1 then call VERSION + When Abbrev('STORAGE',OPTION,3) = 1 then call STOR + When Abbrev('STORE',OPTION,3) = 1 then call STOR + When Abbrev('MEMORY',OPTION,3) = 1 then call STOR + When Abbrev('SYMBOLS',OPTION,3) = 1 then call SYMBOLS + When Abbrev('VMAP',OPTION,3) = 1 then call VMAP + When Abbrev('ASM',OPTION,3) = 1 then call PAGE + When Abbrev('AUX',OPTION,3) = 1 then call PAGE + When Abbrev('SSI',OPTION,3) = 1 then call SUB + When Abbrev('SSN',OPTION,3) = 1 then call SUB + When Abbrev('SUBSYSTEMS',OPTION,3) = 1 then call SUB + When Abbrev('PAGE',OPTION,3) = 1 then call PAGE + When Abbrev('ASID',OPTION,3) = 1 then call ASID + When Abbrev('ASVT',OPTION,3) = 1 then call ASID + When Abbrev('LNKLST',OPTION,3) = 1 then call LNKLST + When Abbrev('LINKLIST',OPTION,3) = 1 then call LNKLST + Otherwise interpret "Call" OPTION +End /* select */ +/*********************************************************************/ +/* Done looking at all control blocks */ +/*********************************************************************/ +/*********************************************************************/ +/* IPLINFO called as a function with an alternate delimiter. */ +/* Return variable names and exit */ +/*********************************************************************/ +If Substr(OPTION,1,4) = 'VAR2' & EXEC_TYPE='FUNCTION' then do + "DROPBUF" /* remove data stack */ + FUNCDLM = VAR.1 /* function delimiter */ + ALL_VARS = Value(VAR.2) /* at least one var */ + Do V = 3 to 21 /* check for others */ + If VAR.V = '' then leave /* done, leave loop */ + Else ALL_VARS = ALL_VARS || , /* concat additional */ + FUNCDLM || Value(VAR.V) /* var + dlm at end */ + End /* end Do V */ + Return ALL_VARS /* return vars */ +End +/*********************************************************************/ +/* IPLINFO called as a function. Return variable names and exit */ +/*********************************************************************/ +If Substr(OPTION,1,3) = 'VAR' & EXEC_TYPE='FUNCTION' then do + "DROPBUF" /* remove data stack */ + ALL_VARS = Value(VAR.1) /* at least one var */ + Do V = 2 to 20 /* check for others */ + If VAR.V = '' then leave /* done, leave loop */ + Else ALL_VARS = ALL_VARS || , /* concat additional */ + FUNCDLM || Value(VAR.V) /* var + dlm at end */ + End /* end Do V */ + Return ALL_VARS /* return vars */ +End +/*********************************************************************/ +/* If ISPF is active and the BROWSEOP option is set (default) then */ +/* browse the output - otherwise write to the terminal */ +/*********************************************************************/ +If SYSISPF = 'ACTIVE' & BROWSEOP = 'YES' , /* ISPF active and */ + then call BROWSE_ISPF /* BROWSEOP option set? */ +Else do queued() /* ISPF is not active */ + Parse pull line /* pull queued lines */ + Say line /* say lines */ +End /* else do */ +Exit 0 /* End IPLINFO - RC 0 */ +/*********************************************************************/ +/* End of main IPLINFO code */ +/*********************************************************************/ +/*********************************************************************/ +/* Start of sub-routines */ +/*********************************************************************/ +INVALID_OPTION: /* Invalid option sub-routine */ +If SYSISPF = 'ACTIVE' then do + Queue ' ' + Queue ' ******************************************************' + If OPTION <> '?' then, + Queue ' * Invalid IPLINFO option. *' + Queue ' * Please hit PF1/HELP two times for valid options. *' + Queue ' ******************************************************' + Queue ' ' + OPTION = 'Invalid' + Call BROWSE_ISPF + Exit 16 + End +Else do + Call CKWEB /* call CKWEB sub-routine */ + Say Copies('*',79) + Say " " + If OPTION <> '?' then, + Say "Invalid IPLINFO option." + Say " " + Say "EXECUTION SYNTAX: %IPLINFO

'
+       Leave                               /* exit loop              */
+     End /* if pos */
+  End /* do CKWEB */
+End
+Return
+
+COMMON:              /* Control blocks needed by multiple routines   */
+CVT      = C2d(Storage(10,4))                /* point to CVT         */
+CVTFLAG2 = Storage(D2x(CVT+377),1)           /* CVT flag byte 2      */
+CVTEXT2  = C2d(Storage(D2x(CVT + 328),4))    /* point to CVTEXT2     */
+PRODNAME = Storage(D2x(CVT - 40),7)          /* point to mvs version */
+If Substr(PRODNAME,3,1) >= 3 then do         /* HBB3310 ESA V3 & >   */
+  CVTOSLV0   = Storage(D2x(CVT + 1264),1)    /* Byte 0 of CVTOSLVL   */
+  CVTOSLV1   = Storage(D2x(CVT + 1265),1)    /* Byte 1 of CVTOSLVL   */
+  CVTOSLV2   = Storage(D2x(CVT + 1266),1)    /* Byte 2 of CVTOSLVL   */
+  CVTOSLV3   = Storage(D2x(CVT + 1267),1)    /* Byte 3 of CVTOSLVL   */
+  CVTOSLV4   = Storage(D2x(CVT + 1268),1)    /* Byte 4 of CVTOSLVL   */
+  CVTOSLV5   = Storage(D2x(CVT + 1269),1)    /* Byte 5 of CVTOSLVL   */
+  CVTOSLV6   = Storage(D2x(CVT + 1270),1)    /* Byte 6 of CVTOSLVL   */
+  CVTOSLV7   = Storage(D2x(CVT + 1271),1)    /* Byte 7 of CVTOSLVL   */
+  CVTOSLV8   = Storage(D2x(CVT + 1272),1)    /* Byte 8 of CVTOSLVL   */
+  CVTOSLV9   = Storage(D2x(CVT + 1273),1)    /* Byte 9 of CVTOSLVL   */
+End
+If Bitand(CVTOSLV0,'08'x) = '08'x then ,     /* HBB4410 ESA V4 & >   */
+  ECVT     = C2d(Storage(D2x(CVT + 140),4))  /* point to CVTECVT     */
+FMIDNUM  = Storage(D2x(CVT - 32),7)          /* point to fmid        */
+JESCT    = C2d(Storage(D2x(CVT + 296),4))    /* point to JESCT       */
+JESCTEXT = C2d(Storage(D2x(JESCT +100),4))   /* point to JESPEXT     */
+JESPJESN = Storage(D2x(JESCT + 28),4)        /* name of primary JES  */
+CVTSNAME = Storage(D2x(CVT + 340),8)         /* point to system name */
+GRSNAME  = Strip(CVTSNAME,'T')               /* del trailing blanks  */
+CSD      = C2d(Storage(D2x(CVT + 660),4))    /* point to CSD         */
+SMCA     = Storage(D2x(CVT + 196),4)         /* point to SMCA        */
+SMCA     = Bitand(SMCA,'7FFFFFFF'x)          /* zero high order bit  */
+SMCA     = C2d(SMCA)                         /* convert to decimal   */
+ASMVT    = C2d(Storage(D2x(CVT + 704),4))    /* point to ASMVT       */
+CVTSCPIN = D2x(CVT+832)                      /* point to SCPINFO     */
+If Bitand(CVTOSLV5,'08'x) = '08'x then do    /* z/OS 1.10 and above  */
+  ECVTSCPIN = D2x(ECVT+876)                  /* point to cur SCPINFO */
+  SCCB      = C2d(Storage(ECVTSCPIN,4))      /* Service Call Cntl Blk*/
+End
+Else SCCB   = C2d(Storage(CVTSCPIN,4))       /* Service Call Cntl Blk*/
+RCE      = C2d(Storage(D2x(CVT + 1168),4))   /* point to RCE         */
+MODEL    = C2d(Storage(D2x(CVT - 6),2))      /* point to cpu model   */
+/*********************************************************************/
+/*  The CPU model is stored in packed decimal format with no sign,   */
+/*  so to make the model printable, it needs to be converted back    */
+/*  to hex.                                                          */
+/*********************************************************************/
+MODEL    = D2x(MODEL)                        /* convert back to hex  */
+PCCAVT    = C2d(Storage(D2x(CVT + 764),4))   /* point to PCCA vect tb*/
+If Bitand(CVTOSLV1,'01'x) = '01'x then do    /* OS/390 R2 and above  */
+  ECVTIPA  = C2d(Storage(D2x(ECVT + 392),4)) /* point to IPA         */
+  IPASCAT  = Storage(D2x(ECVTIPA + 224),63)  /* SYSCAT  card image   */
+End
+zARCH = 1                                    /* default ARCHLVL      */
+If Bitand(CVTOSLV2,'01'x) = '01'x then do    /* OS/390 R10 and above */
+  FLCARCH  = Storage('A3',1)                 /* FLCARCH in PSA       */
+  If C2d(FLCARCH) <> 0 then zARCH=2          /* non-zero is z/Arch.  */
+End
+Return
+
+IPL:                 /* IPL information sub-routine                  */
+Queue ' '
+/*********************************************************************/
+/*  The IPL date is stored in packed decimal format - so to make     */
+/*  the date printable, it needs to be converted back to hex and     */
+/*  the packed sign needs to be removed.                             */
+/*********************************************************************/
+/*  Converting binary fields to time of day format is described      */
+/*  in the MVS SMF manual.                                           */
+/*********************************************************************/
+IPLTIME  = C2d(Storage(D2x(SMCA + 336),4))   /* IPL Time - binary    */
+IPLDATE  = C2d(Storage(D2x(SMCA + 340),4))   /* IPL Date - 0CYYDDDF  */
+If IPLDATE  >= 16777231 then do              /*          is C = 1 ?  */
+  IPLDATE  = D2x(IPLDATE)                    /* convert back to hex  */
+  IPLDATE  = Substr(IPLDATE,2,5)             /* keep YYDDD           */
+  IPLDATE  = '20'IPLDATE                     /* use 21st century date*/
+End
+Else do
+  IPLDATE  = D2x(IPLDATE)                    /* convert back to hex  */
+  IPLDATE  = Left(IPLDATE,5)                 /* keep YYDDD           */
+  IPLDATE  = '19'IPLDATE                     /* use 20th century date*/
+End
+IPLYYYY  = Substr(IPLDATE,1,4)               /* YYYY portion of date */
+IPLDDD   = Substr(IPLDATE,5,3)               /* DDD  portion of date */
+Call RDATE IPLYYYY IPLDDD                    /* call RDATE subroutine*/
+IPLDAY   = Word(RESULT,3)                    /* weekday from RDATE   */
+MMI      = Substr(RESULT,1,2)                /* MM from MM/DD/YYYY   */
+DDI      = Substr(RESULT,4,2)                /* DD from MM/DD/YYYY   */
+YYYYI    = Substr(RESULT,7,4)                /* YYYY from MM/DD/YYYY */
+If DATEFMT = 'USA' then ,                    /* USA format date?     */
+  IPLDATE  = Substr(RESULT,1,10)             /* date as MM/DD/YYYY   */
+If DATEFMT = 'EUR' then ,                    /* EUR format date?     */
+  IPLDATE  = DDI'/'MMI'/'YYYYI               /* date as DD/MM/YYYY   */
+If DATEFMT = 'ISO' then ,                    /* ISO format date?     */
+  IPLDATE  = YYYYI'-'MMI'-'DDI               /* date as YYYY-MM-DD   */
+IPLJUL   = Substr(RESULT,7,8)                /* date as YYYY.DDD     */
+IPLNNNNN = Substr(RESULT,16,5)               /* date as NNNNN        */
+IPLHH    = Right(IPLTIME%100%3600,2,'0')     /* IPL hour             */
+IPLMM    = Right(IPLTIME%100//3600%60,2,'0') /* IPL minute           */
+IPLSS    = Right(IPLTIME%100//60,2,'0')      /* IPL seconds          */
+IPLTIME  = IPLHH':'IPLMM':'IPLSS             /* time in HH:MM:SS     */
+/*                                                                   */
+ASMFLAG2 = Storage(D2x(ASMVT + 1),1)         /* point to ASMFLAG2    */
+If Bitand(ASMFLAG2,'08'x) = '08'x then ,     /* Check ASMQUICK bit   */
+  IPLCLPA    = 'without CLPA'                /* bit on  - no CLPA    */
+Else IPLCLPA = 'with CLPA'                   /* bit off - CLPA       */
+RESUCB   = C2d(Storage(D2x(JESCT + 4),4))    /* point to SYSRES UCB  */
+IPLVOL   = Storage(D2x(RESUCB + 28),6)       /* point to IPL volume  */
+If Bitand(CVTOSLV1,'20'x) <> '20'x then ,    /* Below HBB5510 ESA V5 */
+  IPLADDR  = Storage(D2x(RESUCB + 13),3)     /* point to IPL address */
+Else do
+  CVTSYSAD = C2d(Storage(D2x(CVT + 48),4))   /* point to UCB address */
+  IPLADDR  = Storage(D2x(CVTSYSAD + 4),2)    /* point to IPL UCB     */
+  IPLADDR  = C2x(IPLADDR)                    /* convert to EBCDIC    */
+End
+SMFNAME  = Storage(D2x(SMCA + 16),4)         /* point to SMF name    */
+SMFNAME  = Strip(SMFNAME,'T')                /* del trailing blanks  */
+AMCBS    = C2d(Storage(D2x(CVT + 256),4))    /* point to AMCBS       */
+If Bitand(CVTOSLV2,'80'x) <> '80'x then do   /*Use CAXWA B4 OS/390 R4*/
+  ACB      = C2d(Storage(D2x(AMCBS + 8),4))  /* point to ACB         */
+  CAXWA    = C2d(Storage(D2x(ACB + 64),4))   /* point to CAXWA       */
+  MCATDSN  = Storage(D2x(CAXWA + 52),44)     /* master catalog dsn   */
+  MCATDSN  = Strip(MCATDSN,'T')              /* remove trailing blnks*/
+  MCATUCB  = C2d(Storage(D2x(CAXWA + 28),4)) /* point to mcat UCB    */
+  MCATVOL  = Storage(D2x(MCATUCB + 28),6)    /* master catalog VOLSER*/
+End
+Else do                                      /* OS/390 R4 and above  */
+  MCATDSN  = Strip(Substr(IPASCAT,11,44))    /* master catalog dsn   */
+  MCATVOL  = Substr(IPASCAT,1,6)             /* master catalog VOLSER*/
+  IPASCANL = Storage(d2x(ECVTIPA+231),1)     /* mcat alias level     */
+  IPASCTYP = Storage(d2x(ECVTIPA+230),1)     /* mcat catalog type    */
+  AMCBSFLG = Storage(D2x(AMCBS + 96),1)      /* AMCBS flags          */
+  AMCBSALV = C2d(Storage(D2x(AMCBS + 155),1)) /* AMCBS - alias level */
+  If IPASCANL = ' ' then IPASCANL = 1  /* SYSCAT col 17 blank / dflt */
+  If IPASCTYP = ' ' then IPASCTYP = 1  /* SYSCAT col 16 blank / dflt */
+  CTYP.0   = 'VSAM'
+  CTYP.1   = 'ICF. SYS%-SYS1 conversion was not active at IPL time'
+  CTYP.2   = 'ICF. SYS%-SYS1 conversion was active at IPL time'
+End
+Queue 'The last IPL was 'IPLDAY IPLDATE '('IPLJUL')' ,
+      'at 'IPLTIME' ('CURNNNNN - IPLNNNNN' days ago).'
+Queue 'The IPL was done 'IPLCLPA'.'
+Queue 'The system IPL address was 'IPLADDR' ('IPLVOL').'
+If Bitand(CVTOSLV0,'08'x) = '08'x then do    /* HBB4410 ESA V4 1 & > */
+  ECVTSPLX = Storage(D2x(ECVT+8),8)          /* point to SYSPLEX name*/
+  ECVTLOAD = Storage(D2x(ECVT+160),8)        /* point to LOAD PARM   */
+  IPLPARM  = Strip(ECVTLOAD,'T')             /* del trailing blanks  */
+  SEPPARM  = Substr(IPLPARM,1,4) Substr(IPLPARM,5,2),
+             Substr(IPLPARM,7,1) Substr(IPLPARM,8,1)
+  SEPPARM  = Strip(SEPPARM,'T')              /* del trailing blanks  */
+  Queue 'The IPL LOAD PARM used was 'IPLPARM' ('SEPPARM').'
+  If Bitand(CVTOSLV1,'20'x) = '20'x then do  /* HBB5510 ESA V5 & >   */
+    CVTIXAVL = C2d(Storage(D2x(CVT+124),4))      /* point to IOCM    */
+    IOCIOVTP = C2d(Storage(D2x(CVTIXAVL+208),4)) /* IOS Vector Table */
+    CDA      = C2d(Storage(D2x(IOCIOVTP+24),4))  /* point to CDA     */
+  End
+  CVTTZ      = Storage(D2x(CVT + 304),4)     /* point to cvttz       */
+  CKTZBYTE   = Storage(D2x(CVT + 304),1)     /* need to chk 1st byte */
+  If bitand(CKTZBYTE,'80'x) = '80'x then ,   /* chk for negative     */
+    CVTTZ    = C2d(CVTTZ,4)                  /* negative offset C2d  */
+  Else CVTTZ = C2d(CVTTZ)                    /* postitive offset C2d */
+  CVTTZ      = CVTTZ * 1.048576 / 3600       /* convert to hours     */
+  If Format(CVTTZ,3,1) = Format(CVTTZ,3,0) , /* don't use decimal if */
+   then CVTTZ = Strip(Format(CVTTZ,3,0))     /* not needed           */
+  Else  CVTTZ = Strip(Format(CVTTZ,3,1))     /* display 1 decimal    */
+  Queue 'The local time offset from GMT time is' CVTTZ 'hours.'
+  If Bitand(CVTOSLV1,'10'x) = '10'x then do  /* HBB5520 ESA V5.2 & > */
+    ECVTHDNM = Storage(D2x(ECVT+336),8)      /* point to hardware nam*/
+    ECVTLPNM = Storage(D2x(ECVT+344),8)      /* point to LPAR name   */
+    If Bitand(CVTOSLV2,'01'x) = '01'x then do  /* OS/390 R10 & above */
+      MIFID    = C2d(Storage(D2X(CDA+252),1))  /* MIF ID in decimal  */
+      MIFID    = D2x(MIFID)                    /* MIF ID in hex      */
+      If Bitand(CVTOSLV3,'04'x) = '04'x then do /* z/OS 1.4 and above*/
+        IOCCSSID = C2d(Storage(d2x(CVTIXAVL+275),1))
+        IOCCSSID = D2x(IOCCSSID)                /* CSS ID in hex     */
+      End
+      If zARCH = 2 then ,                    /* z/Architechture      */
+        Queue 'The system is running in z/Architecture mode' ,
+               '(ARCHLVL = 2).'
+      Else ,                                 /* ESA/390 mode         */
+        Queue 'The system is running in ESA/390 mode (ARCHLVL = 1).'
+    End /* If Bitand(CVTOSLV2,'01'x) = '01'x */
+    If ECVTHDNM <> ' ' & ECVTLPNM <> ' ' then do
+      CSDPLPN  = C2d(Storage(D2x(CSD + 252),1))    /* point to LPAR #*/
+   /* CSDPLPN not valid for z990 (T-REX) or z890 for LPAR number     */
+      CPOFF = 0  /* init offset to next PCCA entry                   */
+      PCCA  = 0  /* init PCCA to 0                                   */
+      Do until PCCA <> 0   /* do until we find a valid PCCA          */
+        PCCA = C2d(Storage(D2x(PCCAVT + CPOFF),4)) /* point to PCCA  */
+        If PCCA <> 0 then do
+          LPAR_#  = X2d(Storage(D2x(PCCA + 6),2))  /* LPAR # in hex  */
+          LPAR_#  = D2x(LPAR_#)                    /* display as hex */
+        End /* if PCCA <> 0 */
+        Else CPOFF = CPOFF + 4  /* bump up offset for next PCCA      */
+      End /* do until PCCA <> 0 */
+      If Bitand(CVTOSLV2,'01'x) = '01'x then do    /* OS/390 R10 & > */
+        Queue 'The Processor name is' Strip(ECVTHDNM)'.' ,
+               'The LPAR name is' Strip(ECVTLPNM)'.'
+        If Bitand(CVTOSLV3,'04'x) = '04'x then  /* z/OS 1.4 and above*/
+          Queue ' ' Strip(ECVTLPNM) 'is (HMC defined) LPAR ID =' ,
+                LPAR_#', MIF ID =' mifid 'and CSS ID = 'IOCCSSID'.'
+        Else ,
+          Queue ' ' Strip(ECVTLPNM) 'is (HMC defined) LPAR ID =' ,
+                LPAR_# 'and MIF ID =' mifid'.'
+        Queue ' ' Strip(ECVTLPNM) 'is PR/SM partition number' ,
+                   CSDPLPN' (internal value from the CSD).'
+      End /* If Bitand(CVTOSLV2,'01'x) = '01'x */
+      Else ,
+        Queue 'The Processor name is' Strip(ECVTHDNM)'.' ,
+               'The LPAR name is' Strip(ECVTLPNM)' (LPAR #'CSDPLPN').'
+    End  /* If ECVTHDNM <> ' ' & ECVTLPNM <> ' '   */
+    Else if ECVTHDNM <> ' ' then ,
+      Queue 'The Processor name is' Strip(ECVTHDNM)'.'
+    If Bitand(CVTOSLV1,'20'x) = '20'x ,   /* HBB5510 ESA V5 & above  */
+       & ECVTSPLX <> 'LOCAL' then do      /* and not a local sysplex */
+      JESDSNID = X2d(Storage(D2x(JESCTEXT+120),2)) /*ID for temp dsns*/
+      Queue 'The sysplex name is' Strip(ECVTSPLX)'. This was system' ,
+            'number' Format(JESDSNID) 'added to the sysplex.'
+    End /* If Bitand(CVTOSLV1,'20'x) = '20'x */
+    Else queue 'The sysplex name is' Strip(ECVTSPLX)'.'
+  End  /* If Bitand(CVTOSLV1,'10'x) = '10'x */
+End
+Queue 'The GRS system id (SYSNAME) is 'GRSNAME'.'
+If Bitand(CVTOSLV1,'10'x) = '10'x then do  /* HBB5520 ESA V5.2 & > */
+  ECVTGMOD   = C2d(Storage(D2x(ECVT + 266),1)) /* GRS mode         */
+  GMOD.0     = "NONE"  /* Stem for GRS mode: ECVTGNON EQU 0        */
+  GMOD.1     = "RING"  /* Stem for GRS mode: ECVTGRNG EQU 1        */
+  GMOD.2     = "STAR"  /* Stem for GRS mode: ECVTGSTA EQU 2        */
+  Queue '  The GRS mode is' GMOD.ECVTGMOD' (NONE, RING or STAR).'
+End
+Queue 'The SMF system id (SID) is 'SMFNAME'.'
+If Bitand(CVTOSLV1,'20'x) <> '20'x then do   /* Below HBB5510 ESA V5 */
+  IOCON    = Storage(D2x(CVTEXT2 + 6),2)       /* HCD IODFxx or MVSCP*/
+                                               /* IOCONFIG ID=xx     */
+  Queue 'The currently active IOCONFIG or HCD IODF is 'IOCON'.'
+End
+Else do
+  IODF     = Storage(D2X(CDA+32),44)           /* point to IODF name */
+  IODF     = Strip(IODF,'T')                   /* del trailing blanks*/
+  CONFIGID = Storage(D2X(CDA+92),8)            /* point to CONFIG    */
+  EDT      = Storage(D2X(CDA+104),2)           /* point to EDT       */
+  IOPROC   = Storage(D2X(CDA+124),8)           /* point to IODF Proc */
+  IODATE   = Storage(D2X(CDA+156),8)           /* point to IODF date */
+  IOTIME   = Storage(D2X(CDA+164),8)           /* point to IODF time */
+  IODESC   = Storage(D2X(CDA+172),16)          /* point to IODF desc */
+  Queue 'The currently active IODF data set is 'IODF'.'
+  Queue '  Configuration ID =' CONFIGID ' EDT ID =' EDT
+  If Substr(IOPROC,1,1) <> '00'x  & ,
+     Substr(IOPROC,1,1) <> '40'x then do       /* is token there?    */
+    Queue '  TOKEN: Processor  Date      Time      Description'
+    Queue '         'IOPROC'   'IODATE'  'IOTIME'  'IODESC
+  End
+End
+Queue 'The Master Catalog is 'MCATDSN' on 'MCATVOL'.'
+If Bitand(CVTOSLV2,'80'x) = '80'x then do    /* OS/390 R4 and above  */
+ Queue '  The catalog alias level was 'IPASCANL' at IPL time.'
+ Queue '    The catalog alias level is currently' AMCBSALV'.'
+ Queue '  The catalog type is 'CTYP.IPASCTYP'.'
+ If Bitand(AMCBSFLG,'40'x) = '40'x then ,
+   Queue '    SYS%-SYS1 conversion is currently active.'
+ Else ,
+   Queue '    SYS%-SYS1 conversion is not currently active.'
+End
+/*If OPTION = 'IPL' then interpret call 'VERSION' */ /* incl version*/
+Return
+
+VERSION:             /* Version information sub-routine              */
+Queue ' '
+Call SUB 'FINDJES'   /* call SUB routine with FINDJES option         */
+If JESPJESN = 'JES3' then do                 /* Is this JES3?        */
+  If ENV = 'OMVS' then do  /* running under Unix System Services     */
+    JES3FMID = Storage(D2x(JESSSVT+644),8)      /* JES3 FMID         */
+    Select  /* determine JES3 version from FMID  */
+      When JES3FMID = 'HJS5521' then JESLEV = 'SP 5.2.1'
+      When JES3FMID = 'HJS6601' then JESLEV = 'OS 1.1.0'
+      When JES3FMID = 'HJS6604' then JESLEV = 'OS 2.4.0'
+      When JES3FMID = 'HJS6606' then JESLEV = 'OS 2.6.0'
+      When JES3FMID = 'HJS6608' then JESLEV = 'OS 2.8.0'
+      When JES3FMID = 'HJS6609' then JESLEV = 'OS 2.9.0'
+      When JES3FMID = 'HJS7703' then JESLEV = 'OS 2.10.0'
+      When JES3FMID = 'HJS7705' then JESLEV = 'z 1.2.0'
+      When JES3FMID = 'HJS7707' then JESLEV = 'z 1.4.0'
+      When JES3FMID = 'HJS7708' then JESLEV = 'z 1.5.0'
+      When JES3FMID = 'HJS7720' then JESLEV = 'z 1.7.0'
+      When JES3FMID = 'HJS7730' then JESLEV = 'z 1.8.0'
+      When JES3FMID = 'HJS7740' then JESLEV = 'z 1.9.0'
+      When JES3FMID = 'HJS7750' then JESLEV = 'z 1.10.0'
+      When JES3FMID = 'HJS7760' then JESLEV = 'z 1.11.0'
+      When JES3FMID = 'HJS7770' then JESLEV = 'z 1.12.0'
+      When JES3FMID = 'HJS7780' then JESLEV = 'z 1.13.0'
+      When JES3FMID = 'HJS7790' then JESLEV = 'z 2.1.0'
+      When JES3FMID = 'HJS77A0' then JESLEV = 'z 2.2.0'
+      When JES3FMID = 'HJS77B0' then JESLEV = 'z 2.3.0'
+      When JES3FMID = 'HJS77C0' then JESLEV = 'z 2.4.0'
+      Otherwise JESLEV = JES3FMID /* if not in tbl, use FMID as ver  */
+    End /* select */
+    JESNODE  = '*not_avail*'                 /* can't do under USS   */
+  End /* if env = 'omvs' */
+  Else do /* if not running under Unix System Services, use TSO VARs */
+    JESLEV   = SYSVAR('SYSJES')              /* TSO/E VAR for JESLVL */
+    JESNODE  = SYSVAR('SYSNODE')             /* TSO/E VAR for JESNODE*/
+  End
+End
+Else do  /* JES2 */
+  JESLEV   = Strip(Storage(D2x(JESSUSE),8))  /* JES2 Version         */
+  /* offset in $HCCT - CCTNDENM */
+  Select
+    When Substr(JESLEV,1,8) == 'z/OS 2.4' then, /* z/OS 2.4          */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+696),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,8) == 'z/OS 2.3' | ,   /* z/OS 2.3          */
+      Substr(JESLEV,1,8) == 'z/OS 2.2'  then,   /* z/OS 2.2          */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+664),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,8) == 'z/OS 2.1' | ,   /* z/OS 2.1          */
+      Substr(JESLEV,1,8) == 'z/OS1.13'    | ,   /* z/OS 1.13         */
+      Substr(JESLEV,1,8) == 'z/OS1.12'    | ,   /* z/OS 1.12         */
+      Substr(JESLEV,1,8) == 'z/OS1.11'  then,   /* z/OS 1.11         */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+656),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,8) == 'z/OS1.10' | ,  /* z/OS 1.10          */
+      Substr(JESLEV,1,8) == 'z/OS 1.9' then,    /* z/OS 1.9          */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+708),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,8) == 'z/OS 1.8' then, /* z/OS 1.8          */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+620),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,8) == 'z/OS 1.7' then, /* z/OS 1.7          */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+616),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,8) == 'z/OS 1.5' | , /* z/OS 1.5 & 1.6      */
+      Substr(JESLEV,1,8) == 'z/OS 1.4' then   /* z/OS 1.4            */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+532),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,7) == 'OS 2.10' | ,  /* OS/390 2.10 and     */
+      Substr(JESLEV,1,8) == 'z/OS 1.2' then,  /* z/OS 1.2            */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+452),8)) /* JES2 NODE     */
+    When Substr(JESLEV,1,6) == 'OS 1.1' | , /* OS/390 1.1  or        */
+      Substr(JESLEV,1,4) == 'SP 5' then ,    /* ESA V5 JES2          */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+336),8)) /*   JES2 NODE   */
+    When Substr(JESLEV,1,5) == 'OS 1.' | ,   /* OS/390 1.2           */
+      Substr(JESLEV,1,5) == 'OS 2.' then,    /*  through OS/390 2.9  */
+      JESNODE  = Strip(Storage(D2x(JESSUS2+372),8)) /* JES2 NODE     */
+    Otherwise ,                              /* Lower than ESA V5    */
+      If ENV = 'OMVS' then JESNODE = '*not_avail*'
+      else JESNODE  = SYSVAR('SYSNODE')      /* TSO/E VAR for JESNODE*/
+  End  /* select */
+End /* else do */
+/*                                                                   */
+CVTVERID = Storage(D2x(CVT - 24),16)         /* "user" software vers.*/
+CVTRAC   = C2d(Storage(D2x(CVT + 992),4))    /* point to RACF CVT    */
+RCVT     = CVTRAC                            /* use RCVT name        */
+RCVTID   = Storage(D2x(RCVT),4)              /* point to RCVTID      */
+                                             /* RCVT, ACF2, or RTSS  */
+SECNAM = RCVTID                              /* ACF2 SECNAME = RCVTID*/
+If RCVTID = 'RCVT' then SECNAM = 'RACF'      /* RCVT is RACF         */
+If RCVTID = 'RTSS' then SECNAM = 'Top Secret'  /* RTSS is Top Secret */
+RACFVRM  = Storage(D2x(RCVT + 616),4)        /* RACF Ver/Rel/Mod     */
+RACFVER  = Substr(RACFVRM,1,1)               /* RACF Version         */
+RACFREL  = Substr(RACFVRM,2,2)               /* RACF Release         */
+If Bitand(CVTOSLV2,'01'x) <> '01'x then ,    /* below OS/390 R10     */
+  RACFREL  = Format(RACFREL)                 /* Remove leading 0     */
+RACFMOD  = Substr(RACFVRM,4,1)               /* RACF MOD level       */
+RACFLEV  = RACFVER || '.' || RACFREL || '.' || RACFMOD
+If RCVTID = 'RCVT' | RCVTID = 'RTSS' then ,
+ RCVTDSN = Strip(Storage(D2x(RCVT + 56),44))    /* RACF prim dsn or  */
+                                                /* TSS Security File */
+If SECNAM = 'ACF2' then do
+  SSCVT    = C2d(Storage(D2x(JESCT+24),4))   /* point to SSCVT       */
+  Do while SSCVT <> 0
+    SSCTSNAM = Storage(D2x(SSCVT+8),4)       /* subsystem name       */
+    If SSCTSNAM = 'ACF2' then do
+      ACCVT    = C2d(Storage(D2x(SSCVT + 20),4)) /* ACF2 CVT         */
+      ACCPFXP  = C2d(Storage(D2x(ACCVT - 4),4))  /* ACCVT prefix     */
+      ACCPIDL  = C2d(Storage(D2x(ACCPFXP + 8),2))  /* Len ident area */
+      LEN_ID   = ACCPIDL-4 /* don't count ACCPIDL and ACCPIDO in len */
+      ACCPIDS  = Strip(Storage(D2x(ACCPFXP + 12),LEN_ID)) /*sys ident*/
+      ACF2DSNS = C2d(Storage(D2x(ACCVT + 252) ,4)) /* ACF2 DSNs      */
+      ACF2DNUM = C2d(Storage(D2x(ACF2DSNS + 16),2)) /* # OF DSNs     */
+      Leave
+    End
+  SSCVT    = C2d(Storage(D2x(SSCVT+4),4))    /* next sscvt or zero   */
+  End  /*  Do while SSCVT <> 0 */
+End
+/*                                                                   */
+CVTDFA   = C2d(Storage(D2x(CVT + 1216),4))   /* point to DFP ID table*/
+DFAPROD  = C2d(Storage(D2x(CVTDFA +16),1))   /* point to product byte*/
+If DFAPROD = 0 then do                       /* DFP not DF/SMS       */
+  DFAREL   = C2x(Storage(D2x(CVTDFA+2),2))   /* point to DFP release */
+  DFPVER   = Substr(DFAREL,1,1)              /* DFP Version          */
+  DFPREL   = Substr(DFAREL,2,1)              /* DFP Release          */
+  DFPMOD   = Substr(DFAREL,3,1)              /* DFP Mod Lvl          */
+  DFPRD    = 'DFP'                           /* product is DFP       */
+  DFLEV    = DFPVER || '.' || DFPREL || '.' || DFPMOD
+End
+Else do                                      /* DFSMS not DFP        */
+  DFARELS  = C2x(Storage(D2x(CVTDFA+16),4))  /* point to DF/SMS rel  */
+  DFAVER   = X2d(Substr(DFARELS,3,2))        /* DF/SMS Version       */
+  DFAREL   = X2d(Substr(DFARELS,5,2))        /* DF/SMS Release       */
+  DFAMOD   = X2d(Substr(DFARELS,7,2))        /* DF/SMS Mod Lvl       */
+  DFPRD    = 'DFSMS'                         /* product is DF/SMS    */
+  DFLEV    = DFAVER || '.' || DFAREL || '.' || DFAMOD
+  If DFAPROD = 2 then DFLEV = 'OS/390' DFLEV
+  If DFAPROD = 3 then do
+    DFLEV    = 'z/OS' DFLEV
+    /* Next section of code doesn't work because CRT is in key 5 */
+       /*
+    CVTCBSP  = C2d(Storage(D2x(CVT + 256),4))      /* point to AMCBS */
+    CRT      = C2d(Storage(D2x(CVTCBSP + 124),4))  /* point to CRT   */
+    CRTFMID  = Storage(D2x(CRT + 472),7)           /* DFSMS FMID     */
+       */
+  End /* if DFAPROD = 3 */
+  JESSMSIB = C2d(Storage(D2x(JESCTEXT+84),4)) /* point to SMS SSIB   */
+  IGDSSIVT = C2d(Storage(D2x(JESSMSIB+32),4))  /* SMS vector table   */
+  IGDSMS   = Storage(D2x(IGDSSIVT+132),2)      /* IGDSMSxx suffix    */
+  SMSACDS  = Strip(Storage(D2x(IGDSSIVT+44),44))   /* ACDS           */
+  SMSCMDS  = Strip(Storage(D2x(IGDSSIVT+88),44))   /* COMMDS         */
+End
+/*                                                                   */
+CVTTVT   = C2d(Storage(D2x(CVT + 156),4))    /* point to TSO vect tbl*/
+TSVTLVER = Storage(D2x(CVTTVT+100),1)        /* point to TSO Version */
+TSVTLREL = Storage(D2x(CVTTVT+101),2)        /* point to TSO Release */
+TSVTLREL = Format(TSVTLREL)                  /* Remove leading 0     */
+TSVTLMOD = Storage(D2x(CVTTVT+103),1)        /* point to TSO Mod Lvl */
+TSOLEV   = TSVTLVER || '.' || TSVTLREL || '.' || TSVTLMOD
+/*                                                                   */
+CHKVTACT = Storage(D2x(CVTEXT2+64),1)        /* VTAM active flag     */
+If bitand(CHKVTACT,'80'x) = '80'x then do      /* vtam is active     */
+  CVTATCVT = C2d(Storage(D2x(CVTEXT2 + 65),3)) /* point to VTAM AVT  */
+  ISTATCVT = C2d(Storage(D2x(CVTATCVT + 0),4)) /* point to VTAM CVT  */
+  ATCVTLVL = Storage(D2x(ISTATCVT + 0),8)      /* VTAM Rel Lvl VOVRP */
+  VTAMVER  = Substr(ATCVTLVL,3,1)              /* VTAM Version   V   */
+  VTAMREL  = Substr(ATCVTLVL,4,1)              /* VTAM Release    R  */
+  VTAMMOD  = Substr(ATCVTLVL,5,1)              /* VTAM Mod Lvl     P */
+  If VTAMMOD = ' ' then VTAMLEV =  VTAMVER || '.' || VTAMREL
+    else VTAMLEV =  VTAMVER || '.' || VTAMREL || '.' || VTAMMOD
+/*                                                                   */
+  ATCNETID = Strip(Storage(D2x(ISTATCVT + 2080),8))  /* VTAM NETID   */
+  ATCNQNAM = Strip(Storage(D2x(ISTATCVT + 2412),17)) /* VTAM SSCPNAME*/
+  VTAM_ACTIVE = 'YES'
+End /* if bitand (vtam is active) */
+Else VTAM_ACTIVE = 'NO'
+If Bitand(CVTOSLV1,'80'x) = '80'x then do    /* HBB4430 ESA V4.3 & > */
+  ECVTTCP     = D2x(ECVT + 176)              /* TCPIP                */
+  TSAB        = C2d(Storage(ECVTTCP,4))      /* point to TSAB        */
+  TSABLEN     = C2d(Storage(D2x(TSAB+4),2))  /* Length of TSAB       */
+  TSEBNUM     = (TSABLEN - 64) / 128         /* Number of TSEBs      */
+  TCPANUM     = 0                            /* counter of act TSEBs */
+  TCP_ACTIVE  = 'NO'                         /* Init active flag     */
+  Do SCNTSEBS = 1 to TSEBNUM                 /* Scan TSEB loop       */
+    TSEB = TSAB + 64 + (SCNTSEBS-1)*128
+    TCPASID = C2x(Storage(D2x(TSEB + 56),2)) /* asid or zero         */
+    If TCPASID <> 0 then do                  /* active asid          */
+      TCP_ACTIVE = 'YES'
+      TCPANUM = TCPANUM + 1                /* add 1 to active count  */
+      TCPSTATUS           =     Storage(D2x(TSEB +  8),1)
+      TCPNAME.TCPANUM     =     Storage(D2x(TSEB + 16),8)
+      TCPNUM.TCPANUM      = C2x(Storage(D2x(TSEB + 24),1))
+      TCPVER.TCPANUM      = C2x(Storage(D2x(TSEB + 26),2))
+      TCPASID.TCPANUM     = TCPASID '('Right(X2d(TCPASID),4)')'
+      Select
+        When Bitand(TCPSTATUS,'80'x) = '80'x then TCPST = 'Active'
+        When Bitand(TCPSTATUS,'40'x) = '40'x then TCPST = 'Terminating'
+        When Bitand(TCPSTATUS,'20'x) = '20'x then TCPST = 'Down'
+        When Bitand(TCPSTATUS,'10'x) = '10'x then TCPST = 'Stopped'
+        Otherwise say 'Bad TCPSTATUS! Contact Mark Zelden' TCPSTATUS
+      End /*  select  */
+      TCPST.TCPANUM     = TCPST
+    End /* If TCPASID <> 0 */
+  End /* Do SCNTSEBS = 1 to TSEBNUM */
+End /* If Bitand(CVTOSLV1,'80'x) = '80'x */
+If Bitand(CVTOSLV1,'02'x) <> '02'x then ,    /* Below OS/390 R1      */
+  Queue 'The MVS version is 'PRODNAME' - FMID 'FMIDNUM'.'
+Else do
+  PRODNAM2 = Storage(D2x(ECVT+496),16)       /* point to product name*/
+  PRODNAM2 = Strip(PRODNAM2,'T')             /* del trailing blanks  */
+  VER      = Storage(D2x(ECVT+512),2)        /* point to version     */
+  REL      = Storage(D2x(ECVT+514),2)        /* point to release     */
+  MOD      = Storage(D2x(ECVT+516),2)        /* point to mod level   */
+  VRM      = VER'.'REL'.'MOD
+  Queue 'The OS version is 'PRODNAM2 VRM' - FMID' ,
+         FMIDNUM' ('PRODNAME').'
+End
+If CVTVERID <> ' ' then ,
+  Queue 'The "user" system software version is' Strip(CVTVERID,'T')'.'
+Queue 'The primary job entry subsystem is 'JESPJESN'.'
+Queue 'The 'JESPJESN 'level is 'JESLEV'.' ,
+      'The 'JESPJESN 'node name is 'JESNODE'.'
+If SECNAM <> 'RACF' | RACFVRM < '2608' then do
+  Queue 'The security software is 'SECNAM'.'
+  If SECNAM = 'ACF2' then do
+    Queue 'The ACF2 level is' ACCPIDS'.'
+    Queue '  There are 'ACF2DNUM' ACF2 data sets in use:'
+    Do ADSNS = 1 to ACF2DNUM
+      ADSOFF   = ACF2DSNS + 24 + (ADSNS-1)*64
+      ACF2TYPE = Storage(D2x(ADSOFF) , 8)
+      ACF2DSN  = Storage(D2x(ADSOFF + 16),44)
+      Queue '   ' ACF2TYPE '-' ACF2DSN
+    End
+  End /* if secname = 'ACF2' */
+  If Bitand(CVTOSLV6,'40'x) = '40'x then nop /* z/OS 2.2 and above */
+    Else Queue '  The RACF level is 'RACFLEV'.' /*dont show racflev*/
+  If SECNAM = 'Top Secret' then ,
+   Queue '  The TSS Security File data set is' RCVTDSN'.'
+  If SECNAM = 'RACF' then ,
+   Queue '  The RACF primary data set is' RCVTDSN'.'
+End
+Else do
+  /* RACF system */
+  RCVTDSDT  = C2d(Storage(D2x(RCVT + 224),4))  /* point to RACFDSDT*/
+  DSDTNUM   = C2d(Storage(D2x(RCVTDSDT+4),4))  /* num RACF dsns    */
+  DSDTPRIM  = Storage(D2x(RCVTDSDT+177),44)    /* point to prim ds */
+  DSDTPRIM  = Strip(DSDTPRIM,'T')              /* del trail blanks */
+  DSDTBACK  = Storage(D2x(RCVTDSDT+353),44)    /* point to back ds */
+  DSDTBACK  = Strip(DSDTBACK,'T')              /* del trail blanks */
+  If Bitand(CVTOSLV6,'40'x) = '40'x then do /* z/OS 2.2 and above  */
+    Queue 'The security software is' Word(PRODNAM2,1) ,
+          'Security Server (RACF).'
+    Queue 'The RACF level is' PRODNAM2 VRM || '.'
+  End
+  Else do
+    Queue 'The security software is' Word(PRODNAM2,1) ,
+          'Security Server (RACF).' ,
+          'The FMID is HRF' || RACFVRM || '.'
+  End
+  If DSDTNUM = 1 then do
+    Queue '  The RACF primary data set is' DSDTPRIM'.'
+    Queue '  The RACF backup  data set is' DSDTBACK'.'
+  End
+  Else do
+    Queue '  RACF is using a split database. There are' DSDTNUM ,
+          'pairs of RACF data sets:'
+    RDTOFF = 0                            /* init cur offset to 0 */
+    DSDTENTY_SIZE = 352                   /* dsdtenty size        */
+    Do RDSNS = 1 to DSDTNUM
+      DSDTPRIM  = Storage(D2x(RCVTDSDT+177+RDTOFF),44) /* prim dsn */
+      DSDTPRIM  = Strip(DSDTPRIM,'T')                  /* del blnks*/
+      DSDTBACK  = Storage(D2x(RCVTDSDT+353+RDTOFF),44) /* bkup dsn */
+      DSDTBACK  = Strip(DSDTBACK,'T')                  /* del blnks*/
+      RDTOFF = RDTOFF + DSDTENTY_SIZE            /* next tbl entry */
+      Queue '    Primary #'RDSNS' - ' DSDTPRIM
+      Queue '    Backup  #'RDSNS' - ' DSDTBACK
+    End  /* do RDSNS = 1 to DSDTNUM */
+  End
+End /* else do */
+Queue 'The' DFPRD 'level is' DFLEV'.'
+If DFPRD = 'DFSMS' then do
+  Queue '  The SMS parmlib member is IGDSMS'igdsms'.'
+  Queue '  The SMS ACDS data set name is' SMSACDS'.'
+  Queue '  The SMS COMMDS data set name is' SMSCMDS'.'
+End
+Queue 'The TSO level is 'TSOLEV'.'
+If SYSISPF = 'ACTIVE' then do                /* is ISPF active?      */
+  Address ISPEXEC "VGET ZISPFOS"             /* yes, is it OS?390?   */
+  If RC = 0 then do                          /* yes, get OS/390 var  */
+    ISPFLEV = Strip(Substr(ZISPFOS,10,15))   /* only need version    */
+    Address ISPEXEC "VGET ZENVIR"            /* ispf internal rel var*/
+    ISPFLEVI = Substr(ZENVIR,1,8)            /* internal ISPF release*/
+    Queue 'The ISPF level is 'ISPFLEV' ('ISPFLEVI').'
+  End  /* if RC */
+  Else do                          /* not OS/390 - use old variables */
+    Address ISPEXEC "VGET ZPDFREL"           /* get pdf release info */
+    ISPFLEV  = Substr(ZENVIR,6,3)            /* ISPF level           */
+    PDFLEV   = Substr(ZPDFREL,5,3)           /* PDF  level           */
+    Queue 'The ISPF level is 'ISPFLEV'. The PDF level is' PDFLEV'.'
+  End /* else do */
+End  /* if SYSISPF */
+If VTAM_ACTIVE = 'YES' then do
+  Queue 'The VTAM level is 'VTAMLEV'.'
+  Queue '  The NETID is' ATCNETID'. The SSCPNAME is' ATCNQNAM'.'
+End /* if VTAM_ACTIVE = YES */
+Else Queue 'The VTAM level is not available - VTAM is not active.'
+If Bitand(CVTOSLV1,'80'x) = '80'x then do    /* HBB4430 ESA V4.3 & > */
+  If TCP_ACTIVE = 'YES' then do
+    Queue 'The TCP/IP stack is active. ',
+          'There are 'TCPANUM' active TSEBs out of 'TSEBNUM'.'
+    Queue '  SI Proc       Vers   ASID ( dec)   Status'
+    Queue '  -- --------   ----   ---- ------   ------'
+    Do LSI = 1 to TCPANUM
+      Queue '  'Right(TCPNUM.LSI,2)' 'TCPNAME.LSI'   'TCPVER.LSI'  ',
+            TCPASID.LSI'   'TCPST.LSI
+    End
+  End /* if TCP_ACTIVE = YES */
+  Else Queue 'The TCP level is not available - TCP is not active.'
+End /*  If Bitand(CVTOSLV1,'80'x) = '80'x   */
+Return
+
+STOR:                /* Storage information sub-routine              */
+Queue ' '
+CVTRLSTG = C2d(Storage(D2x(CVT + 856),4))    /* point to store at IPL*/
+CVTRLSTG = CVTRLSTG/1024                     /* convert to Megabytes */
+If zARCH <> 2 then do                        /* not valid in 64-bit  */
+  CVTEORM  = C2d(Storage(D2x(CVT + 312),4))  /* potential real high  */
+  CVTEORM  = (CVTEORM+1)/1024/1024           /* convert to Megabytes */
+  ESTOR    = C2d(Storage(D2x(RCE + 160),4))  /* point to ESTOR frames*/
+  ESTOR    = ESTOR*4/1024                    /* convert to Megabytes */
+End
+  /**********************************************************/
+  /* At z/OS 2.1 CVTRLSTG was not always correct. The code  */
+  /* below gets the value from the RSM Internal Table       */
+  /* field 'RITTOTALONLINESTORAGEATIPL'.                    */
+  /* The RIT is documented in the MVS Data Areas manual     */
+  /*  - This was a bug fixed by APAR OA48094                */
+  /**********************************************************/
+ /*
+If Bitand(CVTOSLV6,'80'x) = '80'x then do    /* z/OS 2.1  and above  */
+CVTPVTP  = C2d(Storage(D2x(CVT+356),4))      /* point page vect tbl  */
+PVTRIT   = C2x(Storage(D2x(CVTPVTP+4),4))    /* RSM internal tbl OCO */
+RITOLSTG = X2d(C2x(Storage(D2x(X2d(PVTRIT)+X2d(128)),8)))
+RITOLSTG = RITOLSTG/1024/1024                /* convert to Megabytes */
+CVTRLSTG = RITOLSTG            /* change the name for code below     */
+End
+  */
+If Bitand(CVTOSLV0,'08'x) = '08'x then do    /* HBB4410 ESA V4 & >   */
+  ECVTEORM  = C2d(Storage(d2x(ECVT+600),8))  /* potential real high  */
+  RECONFIG  = (ECVTEORM-CVTRLSTG*1024*1024+1)/(1024*1024) /* amt of  */
+                                             /* reconfigurable stor  */
+End
+If Bitand(CVTOSLV5,'40'x) = '40'x then do    /* z/OS 1.7 and above   */
+  RCECADSUsed = C2d(Storage(D2x(RCE + 572),2)) /* CADS current use   */
+  RCECADSHW   = C2d(Storage(D2x(RCE + 574),2)) /* CADS high water    */
+End
+Call STORAGE_GDA_LDA
+If Bitand(CVTOSLV2,'01'x) = '01'x then do    /* OS/390 R10 and above */
+  SCCBSAI  = C2d(Storage(D2x(SCCB + 10),1))  /* real stor incr. in M */
+  If SCCBSAI =  0 then do                    /* If 0, use SCCBSAIX   */
+    SCCBSAIX = C2d(Storage(D2x(SCCB + 100),4)) /* real stor incr in M*/
+    SCCBSAI  = SCCBSAIX                      /* using SCCBSAI later  */
+  End
+  SCCBSAR  = C2d(Storage(D2x(SCCB + 8),2))   /* # of. incr installed */
+End
+If zARCH <> 2 then do       /* not valid in 64-bit */
+  Queue 'The real storage size at IPL time was 'Format(CVTRLSTG,,0)'M.'
+  Queue 'The potential real storage size is' ,
+         Format(CVTEORM,,0)'M.'
+  If ESTOR > 0 then
+    Queue 'The expanded storage size is 'ESTOR'M.'
+  Else
+    Queue 'The system has no expanded storage.'
+End /* If zARCH <> 2 */
+Else Queue 'The real storage online at IPL time' ,
+           'was 'Format(CVTRLSTG,,0)'M.'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+  If SCCBSAI <> 0 then ,
+    Queue 'The real storage increment size is 'SCCBSAI'M with' ,
+           SCCBSAR 'increments installed.'
+If Bitand(CVTOSLV0,'08'x) = '08'x then do    /* HBB4410 ESA V4 & >   */
+  Queue 'The potential real storage size is' ,
+         (ECVTEORM+1)/(1024*1024)'M.'
+  Queue 'The reconfigurable storage size is 'reconfig'MB.'
+End
+Queue 'The private area size <16M is 'GDAPVTSZ'K.'
+Queue 'The private area size >16M is 'GDAEPVTS'M.'
+Queue 'The CSA size <16M is 'GDACSASZ'K.'
+Queue 'The CSA size >16M is 'GDAECSAS'K.'
+Queue 'The SQA size <16M is 'GDASQASZ'K.'
+Queue 'The SQA size >16M is 'GDAESQAS'K.'
+Queue 'The maximum V=R region size is 'GDAVRSZ'K.'
+Queue 'The default V=R region size is 'GDAVREGS'K.'
+Queue 'The maximum V=V region size is 'LDASIZEA'K.'
+If Bitand(CVTOSLV5,'40'x) = '40'x then do    /* z/OS 1.7 and above   */
+  Queue 'The current number of CADS (MAXCADs)' ,
+        'in use is 'RCECADSUsed'.'
+  Queue 'The maximum number of CADS (MAXCADs)' ,
+        'used since IPL is 'RCECADSHW'.'
+End
+Return
+
+CPU:                 /* CPU information sub-routine                  */
+Queue ' '
+If Bitand(CVTOSLV3,'01'x) = '01'x then ,  /* z/OS 1.6 & above >16 CPs*/
+  NUMCPU   = C2d(Storage(D2x(CSD + 212),4))  /* point to # of CPUS   */
+Else,
+  NUMCPU   = C2d(Storage(D2x(CSD + 10),2))   /* point to # of CPUS   */
+SCCBNCPS = C2d(Storage(d2x(SCCB + 16),2))    /* Max No. of CPUs      */
+/*                                                                   */
+Queue 'The CPU model number is 'MODEL'.'
+Queue 'The number of online CPUs is 'NUMCPU'.' ,
+      'The maximum number of CPUs is 'SCCBNCPS'.'
+If Bitand(CVTOSLV3,'20'x) = '20'x & ,        /* z/OS 1.1 and above   */
+   Bitand(CVTOSLV3,'01'x) <> '01'x then do   /* but below z/OS 1.6   */
+  CSDICPUS = C2d(Storage(D2x(CSD+161),1))    /* CPUs online @ IPL    */
+  Queue '  The number of CPUs online at IPL time was 'CSDICPUS'.'
+End
+If Bitand(CVTOSLV3,'01'x) = '01'x then do    /* z/OS 1.6 and above   */
+  CSDICPUS = C2d(Storage(D2x(CSD+161),1))    /* CPUs online @ IPL    */
+  CSDIIFAS = C2d(Storage(D2x(CSD+162),1))    /* zAAPs online @ IPL   */
+  Queue '  The number of GPs online at IPL time was 'CSDICPUS'.'
+  If CSDIIFAS <> 0 then ,
+  Queue '  The number of zAAPs online at IPL time was 'CSDIIFAS'.'
+  If Bitand(CVTOSLV4,'02'x) = '02'x then do /* zIIP (SUP) support    */
+    CSDISUPS = C2d(Storage(D2x(CSD+163),1))  /* zIIPs online @ IPL   */
+    If CSDISUPS <> 0 then ,
+    Queue '  The number of zIIPs online at IPL time was 'CSDISUPS'.'
+  End
+End
+/*                                                                   */
+CPNUM     = 0
+FOUNDCPUS = 0
+FOUNDZAPS = 0
+FOUNDZIPS = 0
+Do until FOUNDCPUS = NUMCPU
+PCCA = C2d(Storage(D2x(PCCAVT + CPNUM*4),4)) /* point to PCCA        */
+  If PCCA <> 0 then do
+    CPUVER   = Storage(D2x(PCCA + 4),2)      /* point to VERSION     */
+    CPUID    = Storage(D2x(PCCA + 6),10)     /* point to CPUID       */
+    IDSHORT  = Substr(CPUID,2,5)
+    PCCAATTR = Storage(D2x(PCCA + 376),1)    /* attribute byte       */
+    PCCARCFF = Storage(D2x(PCCA + 379),1)    /* reconfig flag        */
+    CP_TYP   = ''                            /* init to null for now */
+    If Bitand(PCCAATTR,'01'x) = '01'x then do  /* check PCCAIFA      */
+       CP_TYP = '(zAAP)'                       /* zAAP / IFA CP      */
+       FOUNDZAPS = FOUNDZAPS + 1
+    End
+    If Bitand(PCCAATTR,'04'x) = '04'x then do  /* check PCCAzIIP     */
+       CP_TYP = '(zIIP)'                       /* zIIP processor     */
+       FOUNDZIPS = FOUNDZIPS + 1
+    End
+    If Bitand(PCCARCFF,'80'x) = '80'x then ,   /* check PCCACWLM     */
+       CP_TYP = '(WLM)'                        /* WLM controlled CP  */
+    CPNUM_M = D2x(CPNUM)                       /* display in hex     */
+    If Bitand(CVTOSLV3,'01'x) = '01'x then ,   /* z/OS 1.6 & above   */
+      CPNUM_M = Right(CPNUM_M,2,'0')           /* display as 2 digits*/
+    Queue 'The CPU serial number for CPU 'CPNUM_M' is ' || ,
+     CPUID' ('IDSHORT'), version code' CPUVER'.' CP_TYP
+    FOUNDCPUS = FOUNDCPUS + 1
+  End
+CPNUM = CPNUM + 1
+End  /* do until  */
+/**************************************************/
+/* SUs/SEC and MIPS calculations                  */
+/* SYS1.NUCLEUS(IEAVNP10) CSECT IRARMCPU          */
+/**************************************************/
+RMCT     = C2d(Storage(D2x(CVT+604),4))      /* point to RMCT        */
+SU       = C2d(Storage(D2x(RMCT+64),4))      /* CPU Rate Adjustment  */
+SUSEC    = Format((16000000/SU),7,2)         /* SUs per second       */
+MIPSCP   = NUMCPU-FOUNDZAPS-FOUNDZIPS        /* Don't include special*/
+                                             /* processors for MIPs  */
+MIPS     = Format((SUSEC/48.5) * MIPSCP,6,2) /* SRM MIPS calculation */
+                                             /* (48.5) borrowed from */
+                                             /* Thierry Falissard    */
+Queue 'The service units per second per online CPU is' Strip(SUSEC)'.'
+Queue 'The approximate total MIPS (SUs/SEC / 48.5 * # general CPUs)' ,
+      'is' Strip(MIPS)'.'
+  /*
+RMCTCCT  = C2d(Storage(D2x(RMCT+4),4))       /* cpu mgmt control tbl */
+CCVUTILP = C2d(Storage(D2x(RMCTCCT+102),2))  /* CPU Utilization      */
+Queue 'The approximate CPU utilization is' CCVUTILP'%.'
+       */
+If Bitand(CVTOSLV3,'20'x) = '20'x then do    /* z/OS 1.1 and above   */
+                                             /* w/APAR OW55509       */
+  RCT      = C2d(Storage(D2x(RMCT+228),4))   /* Resource Control Tbl */
+  RCTLACS  = C2d(Storage(D2x(RCT+196),4))    /* 4 hr MSU average     */
+  RCTIMGWU = C2d(Storage(D2x(RCT+28),4))     /* Image defined MSUs   */
+  RCTCECWU = C2d(Storage(D2x(RCT+32),4))     /* CEC MSU Capacity     */
+  If RCTCECWU <> 0 then do
+    Queue 'The MSU capacity for this CEC is' RCTCECWU'.'
+    Queue 'The defined MSU capacity for this LPAR is' RCTIMGWU'.'
+  End
+  If RCTLACS <> 0 then do
+    Queue 'The 4 hour MSU average usage is' RCTLACS'.'
+    If RCTLACS >= RCTIMGWU & RCTIMGWU <> RCTCECWU then ,
+      Queue ' ** This LPAR is currently being "soft capped". **'
+  End
+End
+/*                                                                   */
+If Bitand(CVTOSLV5,'20'x) = '20'x then do    /* z/OS 1.8 and above   */
+  IEAVESVT = C2d(Storage(D2x(CVT + 868),4))  /* supv. vect tbl IHASVT*/
+  SVTAFFB  = Storage(D2x(IEAVESVT + 12),1)   /* aff-dispatch byte    */
+  If Bitand(SVTAFFB,'80'x) = '80'x then ,
+    Queue 'The HiperDispatch feature is active on this LPAR.'
+  Else Queue 'The HiperDispatch feature is not active on this LPAR.'
+  CPCRPERC = C2d(Storage(D2x(IEAVESVT+1008),4)) /* CPCR Percent      */
+  If CPCRPERC <> 0 then
+    Queue 'The CP Credits feature is active on this CPC/LPAR' ,
+          'at' CPCRPERC'%.'
+End
+/**************************************************/
+/* Central Processing Complex Node Descriptor     */
+/**************************************************/
+If Bitand(CVTOSLV1,'20'x) = '20'x then do      /* HBB5510 ESA V5 & > */
+  CVTHID   = C2d(Storage(D2x(CVT + 1068),4))   /* point to SHID      */
+  CPCND_FLAGS = Storage(D2x(CVTHID+22),1)      /* pnt to CPCND FLAGS */
+  If CPCND_FLAGS <> 0 then do                  /* Is there a CPC?    */
+    CPCND_VALID = Bitand(CPCND_FLAGS,'E0'x)    /* Valid flags        */
+    CPCND_INVALID = Bitand('40'x)              /* Invalid flag       */
+    If CPCND_VALID <> CPCND_INVALID then do    /* Is it valid?       */
+      CPCND_TYPE  = Storage(D2x(CVTHID+26),6)  /* Type               */
+      CPCND_MODEL = Storage(D2x(CVTHID+32),3)  /* Model              */
+      CPCND_MAN   = Storage(D2x(CVTHID+35),3)  /* Manufacturer       */
+      CPCND_PLANT = Storage(D2x(CVTHID+38),2)  /* Plant of manufact. */
+      CPCND_SEQNO = Storage(D2x(CVTHID+40),12) /* Sequence number    */
+      CPC_ID      = C2x(Storage(D2x(CVTHID+55),1))  /* CPC ID        */
+      Queue ' '
+   /* Queue 'Central Processing Complex (CPC) Node Descriptor:' */
+      Queue 'Central Processing Complex (CPC) Information:'
+      Queue '  CPC ND =',
+       CPCND_TYPE'.'CPCND_MODEL'.'CPCND_MAN'.'CPCND_PLANT'.'CPCND_SEQNO
+      If Bitand(CVTOSLV3,'10'x) = '10'x then do    /*z/OS 1.2 & above*/
+        Call GET_CPCSI /* Get CPC SI (STSI) information sub-routine  */
+        Queue '  CPC SI ='  CPCSI_TYPE'.'CPCSI_MODEL'.'  || ,
+               CPCSI_MAN'.'CPCSI_PLANT'.'CPCSI_CPUID
+        Queue '           Model:' CPCSI_MODELID
+      End /* If Bitand(CVTOSLV3,'10'x) = '10'x */
+      Queue '  CPC ID =' CPC_ID
+      Queue '  Type('CPCND_TYPE') Model('CPCND_MODEL')',
+            'Manufacturer('CPCND_MAN') Plant('CPCND_PLANT')',
+            'Seq Num('CPCND_SEQNO')'
+      If Bitand(CVTOSLV3,'20'x) = '20'x then do    /*z/OS 1.1 & above*/
+        RMCTX1M  = Storage(D2x(RMCT+500),4)        /* Microcode addr */
+                                                   /*   in RMCTX1    */
+        If RMCTX1M  <> '7FFFF000'x then do         /* skip VM/FLEX/ES*/
+          RMCTX1M  = C2d(RMCTX1M)                  /* change to dec. */
+          MCL      = Storage(D2x(RMCTX1M + 40),8)  /* Microcode lvl  */
+          MCLDRV   = Substr(MCL,1,4)               /* Driver only..  */
+          If Datatype(MCLDRV,'Number') = 1 then ,  /* if all numeric */
+             MCLDRV = Format(MCLDRV)               /* rmv leading 0s */
+          Queue '  The Microcode level of this CPC is' MCL || ,
+                ' (Driver' MCLDRV').'
+        End /* If RMCTX1M  <> '7FFFF000'x */
+      End /* If Bitand(CVTOSLV3,'20'x) = '20'x */
+    End /* if CPCND_VALID <> CPCND_INVALID */
+    Else do
+      If Bitand(CVTOSLV3,'10'x) = '10'x then do    /*z/OS 1.2 & above*/
+        Call GET_CPCSI /* Get CPC SI (STSI) information sub-routine  */
+        Queue ' '
+        Queue 'Central Processing Complex (CPC) Information:'
+        Queue '  CPC SI ='  CPCSI_TYPE'.'CPCSI_MODEL'.'  || ,
+               CPCSI_MAN'.'CPCSI_PLANT'.'CPCSI_CPUID
+        Queue '           Model:' CPCSI_MODELID
+      End /* if Bitand(CVTOSLV3,'10'x) = '10'x */
+    End /* else do */
+  End  /* if CPCND_FLAGS <>0  */
+End
+Return
+
+IPA:                 /* IPA information sub-routine                  */
+Queue ' '
+/*********************************************************************/
+/* IPL parms from the IPA                                            */
+/*********************************************************************/
+If Bitand(CVTOSLV1,'01'x) = '01'x then do    /* OS/390 R2 and above  */
+  IPAICTOD = Storage(D2x(ECVTIPA + 8),8)     /* point to IPL TOD     */
+  IPALPARM = Storage(D2x(ECVTIPA + 16),8)    /* point to LOAD PARM   */
+  IPALPDSN = Storage(D2x(ECVTIPA + 48),44)   /* load parm dsn name   */
+  IPALPDDV = Storage(D2x(ECVTIPA + 92),4)    /* load parm dev number */
+  IPAHWNAM = Storage(D2x(ECVTIPA + 24),8)    /* point to HWNAME      */
+  IPAHWNAM = Strip(IPAHWNAM,'T')             /* del trailing blanks  */
+  IPALPNAM = Storage(D2x(ECVTIPA + 32),8)    /* point to LPARNAME    */
+  IPALPNAM = Strip(IPALPNAM,'T')             /* del trailing blanks  */
+  IPAVMNAM = Storage(D2x(ECVTIPA + 40),8)    /* point to VMUSERID    */
+  /**************************/
+  /* PARMS in LOADxx        */
+  /**************************/
+  IPANUCID = Storage(D2x(ECVTIPA + 23),1)    /* NUCLEUS ID           */
+  IPAIODF  = Storage(D2x(ECVTIPA + 96),63)   /* IODF    card image   */
+  IPASPARM = Storage(D2x(ECVTIPA + 160),63)  /* SYSPARM card image   */
+  /*IPASCAT= Storage(D2x(ECVTIPA + 224),63)*//* SYSCAT  card image   */
+  IPASYM   = Storage(D2x(ECVTIPA + 288),63)  /* IEASYM  card image   */
+  IPAPLEX  = Storage(D2x(ECVTIPA + 352),63)  /* SYSPLEX card image   */
+  If Bitand(CVTOSLV2,'01'x) = '01'x then do  /* OS/390 R10 and above */
+    IPAPLNUMX = Storage(D2x(ECVTIPA + 2134),2) /* number of parmlibs */
+    IPAPLNUM  = IPAPLNUMX
+  End
+  Else ,                                     /* OS/390 R10 and above */
+    IPAPLNUM = Storage(D2x(ECVTIPA + 2148),2) /* number of parmlibs  */
+  IPAPLNUM = C2d(IPAPLNUM)                   /* convert to decimal   */
+  POFF = 0
+  Do P = 1 to IPAPLNUM
+    IPAPLIB.P = Storage(D2x(ECVTIPA+416+POFF),63) /* PARMLIB cards   */
+    IPAPLFLG.P = Storage(D2x(ECVTIPA+479+POFF),1)  /* flag bits      */
+    If Bitand(IPAPLFLG.P,'20'x) = '20'x then ,   /* volser from cat? */
+      IPAPLIB.P = Overlay('      ',IPAPLIB.P,46) /* no, clear it     */
+    POFF = POFF + 64
+  End
+  IPANLID  = Storage(D2x(ECVTIPA + 2144),2)  /* NUCLSTxx member used */
+  IPANUCW  = Storage(D2x(ECVTIPA + 2146),1)  /* load wait state char */
+  IPAICTOD = C2x(IPAICTOD)   /* make "readable" for REXXTOD call     */
+  Call REXXTOD IPAICTOD      /* convert TOD to YYYY.DDD HH:MM:SS.ttt */
+  TOD_RESY = Substr(RESULT,1,4)      /* year portion from REXXTOD    */
+  TOD_RESD = Substr(RESULT,6,3)      /* day  portion from REXXTOD    */
+  TOD_REST = Substr(RESULT,10,8)     /* time portion from REXXTOD    */
+  Call RDATE TOD_RESY TOD_RESD /* call RDATE- format for ISO/USA/EUR */
+  MMIPA    = Substr(RESULT,1,2)              /* MM from MM/DD/YYYY   */
+  DDIPA    = Substr(RESULT,4,2)              /* DD from MM/DD/YYYY   */
+  YYYYIPA  = Substr(RESULT,7,4)              /* YYYY from MM/DD/YYYY */
+  If DATEFMT = 'USA' then ,                  /* USA format date?     */
+    IPAIDATE = Substr(RESULT,1,10)           /* date as MM/DD/YYYY   */
+  If DATEFMT = 'EUR' then ,                  /* EUR format date?     */
+    IPAIDATE = DDIPA'/'MMIPA'/'YYYYIPA       /* date as DD/MM/YYYY   */
+  If DATEFMT = 'ISO' then ,                  /* ISO format date?     */
+    IPAIDATE = YYYYIPA'-'MMIPA'-'DDIPA       /* date as YYYY-MM-DD   */
+  Queue 'Initialization information from the IPA:'
+  Queue '  IPL TIME (GMT):' IPAIDATE ,
+           '('TOD_RESY'.'TOD_RESD') at' TOD_REST
+  Queue '  IPLPARM =' IPALPARM   '(merged)'
+  Queue '  IPL load parameter data set name: 'IPALPDSN
+  Queue '  IPL load parameter data set device address: 'IPALPDDV
+  Queue '  HWNAME='IPAHWNAM '  LPARNAME='IPALPNAM ,
+        '  VMUSERID='IPAVMNAM
+  Queue '  '                    /* add blank line for readability   */
+  Queue '  LOADxx parameters from the IPA' ,
+        '(LOAD' || Substr(IPALPARM,5,2) || '):'
+  Queue '    *---+----1----+----2----+----3----+----4' || ,
+            '----+----5----+----6----+----7--'
+  If Bitand(CVTOSLV2,'01'x) = '01'x then do    /* OS/390 R10 & above */
+    IPAARCHL = Storage(D2x(ECVTIPA + 2143),1)  /* ARCHLVL (1 or 2)   */
+    Queue '    ARCHLVL  'IPAARCHL
+  End
+  If IPASYM   <> '' then queue '    IEASYM   'IPASYM
+  If IPAIODF  <> '' then queue '    IODF     'IPAIODF
+  If IPANUCID <> '' then queue '    NUCLEUS  'IPANUCID
+  If IPANLID  <> '' then queue '    NUCLST   'IPANLID' 'IPANUCW
+  Do P = 1 to IPAPLNUM
+    Queue '    PARMLIB  'IPAPLIB.P
+  End
+  If IPASCAT  <> '' then queue '    SYSCAT   'IPASCAT
+  If IPASPARM <> '' then queue '    SYSPARM  'IPASPARM
+  If IPAPLEX  <> '' then queue '    SYSPLEX  'IPAPLEX
+  /**************************/
+  /* PARMS in IEASYSxx      */
+  /**************************/
+  Queue '  '                    /* add blank line for readability   */
+  Queue '  IEASYSxx parameters from the IPA:          ',
+        '                     (Source)'
+  Call BUILD_IPAPDETB    /* Build table for init parms               */
+  TOTPRMS = 0            /* tot num of specified or defaulted parms  */
+  Do I = 1 to IPAPDETB.0
+    Call EXTRACT_SYSPARMS IPAPDETB.I   /* extract parms from the IPA */
+  End
+ /********************************************************************/
+ /* Uncommment a sample below to test IPA PAGE parm "split" code:    */
+ /*  PRMLINE.32 = 'SWAP SWAP=(SYS1.SWAP.TEST) IEASYSXX'              */
+ /*  PRMLINE.32 = 'NONVIO NONVIO=(SYS1.PAGE.TEST) IEASYSXX'          */
+ /*  PRMLINE.32 = 'NONVIO NONVIO=(SYS1.PAGE1,SYS1.PAGE2) IEASYSXX'   */
+ /*  PRMLINE.32 = 'NONVIO ' || ,                                     */
+ /*  'NONVIO=(SYS1.PAGE1,SYS1.PAGE2,SYS1.PAGE3,SYS1.PAGE4) IEASYSXX' */
+ /********************************************************************/
+  Call SORT_IPA                       /* sort IPA parms              */
+  Call SPLIT_IPA_PAGE                 /* split page/swap dsn parms   */
+  Do I = 1 to TOT_IPALINES            /* add ipa parms               */
+    If I = TOT_IPALINES then ,        /*   to stack and              */
+      IPALINE.I = Translate(IPALINE.I,' ',',') /* remove comma       */
+    Queue IPALINE.I                   /*           from last parm    */
+  End
+End
+Return
+
+SYMBOLS:             /* System Symbols information sub-routine       */
+Queue ' '
+/*********************************************************************/
+/* Find System Symbols  - ASASYMBP MACRO                             */
+/*  ECVT+X'128' = ECVTSYMT                                           */
+/*  2nd half word = # of symbols , after that each entry is 4 words  */
+/*  1st word = offset to symbol name                                 */
+/*  2nd word = length of symbol name                                 */
+/*  3rd word = offset to symbol value                                */
+/*  4th word = length of symbol value                                */
+/*********************************************************************/
+If Bitand(CVTOSLV1,'10'x) = '10'x then do    /* HBB5520 ESA V5.2 & > */
+  ECVTSYMT = C2d(Storage(D2x(ECVT + 296),4)) /* point to ECVTSYMT    */
+  NUMSYMBS = C2d(Storage(D2x(ECVTSYMT + 2),2))  /* number of symbols */
+  Queue 'Static System Symbol Values:'
+  Do I = 1 to NUMSYMBS
+    SOFF = I*16-16
+    NAMOFF  = C2d(Storage(D2x(ECVTSYMT+4+SOFF),4))  /*offset to name */
+    NAMLEN  = C2d(Storage(D2x(ECVTSYMT+8+SOFF),4))  /*length of name */
+    VALOFF  = C2d(Storage(D2x(ECVTSYMT+12+SOFF),4)) /*offset to value*/
+    VALLEN  = C2d(Storage(D2x(ECVTSYMT+16+SOFF),4)) /*length of value*/
+    SYMNAME = Storage(D2x(ECVTSYMT+4+NAMOFF),NAMLEN) /*symbol name   */
+    If VALLEN = 0 then VALNAME = ''                 /* null value    */
+    Else ,
+    VALNAME = Storage(D2x(ECVTSYMT+4+VALOFF),VALLEN) /* symbol value */
+      If Bitand(CVTOSLV6,'40'x) = '40'x then ,   /* z/OS 2.2 and >   */
+      Queue ' ' Left(SYMNAME,18,' ') '=' VALNAME /* max 16 + & + .   */
+      Else ,
+      Queue ' ' Left(SYMNAME,10,' ') '=' VALNAME /* max 8 + & + .    */
+  End  /* do NUMSYMBS */
+End
+Return
+
+VMAP:                /* Virtual Storage Map sub-routine              */
+Arg VMAPOPT
+If option <> 'ALL' then,
+  Call STORAGE_GDA_LDA                       /* GDA/LDA stor routine */
+SYSEND  = X2d(LDASTRTS) + (LDASIZS*1024) - 1 /* end of system area   */
+SYSEND  = D2x(SYSEND)                        /* display in hex       */
+If GDAVRSZ = 0 then do                       /* no v=r               */
+  VRSTRT = 'N/A     '
+  VREND  = 'N/A     '
+  VVSTRT = LDASTRTA                          /* start of v=v         */
+  VVEND  =  X2d(LDASTRTA) + (LDASIZEA*1024) - 1 /* end of v=v        */
+  VVEND  =  D2x(VVEND)                       /* display in hex       */
+End
+Else do
+  VRSTRT =  LDASTRTA                         /* start of v=r         */
+  VREND  =  X2d(LDASTRTA) + (GDAVRSZ*1024) - 1 /* end of v=r         */
+  VREND  =  D2X(VREND)                       /* display in hex       */
+  VVSTRT =  LDASTRTA                         /* start of v=v         */
+  VVEND  =  X2d(LDASTRTA) + (LDASIZEA*1024) - 1 /* end of v=v        */
+  VVEND  =  D2x(VVEND)                       /* display in hex       */
+End
+GDACSA   = C2d(Storage(D2x(CVTGDA + 108),4)) /* start of CSA addr    */
+GDACSAH  = D2x(GDACSA)                       /* display in hex       */
+CSAEND   = (GDACSASZ*1024) + GDACSA - 1      /* end of CSA           */
+CSAEND   = D2x(CSAEND)                       /* display in hex       */
+CVTSMEXT = C2d(Storage(D2x(CVT +1196),4))    /* point to stg map ext.*/
+CVTMLPAS = C2d(Storage(D2x(CVTSMEXT+ 8),4))  /* start of MLPA addr   */
+CVTMLPAS = D2x(CVTMLPAS)                     /* display in hex       */
+If CVTMLPAS <> 0 then do
+  CVTMLPAE = C2d(Storage(D2x(CVTSMEXT+12),4))  /* end of MLPA addr   */
+  CVTMLPAE = D2x(CVTMLPAE)                     /* display in hex     */
+  MLPASZ   = X2d(CVTMLPAE) - X2d(CVTMLPAS) + 1 /* size of MLPA       */
+  MLPASZ   = MLPASZ/1024                       /* convert to Kbytes  */
+End
+Else do /* no MLPA */
+  CVTMLPAS = 'N/A     '
+  CVTMLPAE = 'N/A     '
+  MLPASZ   = 0
+End
+CVTFLPAS = C2d(Storage(D2x(CVTSMEXT+16),4))  /* start of FLPA addr   */
+CVTFLPAS = D2x(CVTFLPAS)                     /* display in hex       */
+If CVTFLPAS <> 0 then do
+  CVTFLPAE = C2d(Storage(D2x(CVTSMEXT+20),4))  /* end of FLPA addr   */
+  CVTFLPAE = D2x(CVTFLPAE)                     /* display in hex     */
+  FLPASZ   = X2d(CVTFLPAE) - X2d(CVTFLPAS) + 1 /* size of FLPA       */
+  FLPASZ   = FLPASZ/1024                       /* convert to Kbytes  */
+End
+Else do /* no FLPA */
+  CVTFLPAS = 'N/A     '
+  CVTFLPAE = 'N/A     '
+  FLPASZ   = 0
+End
+CVTPLPAS = C2d(Storage(D2x(CVTSMEXT+24),4))  /* start of PLPA addr   */
+CVTPLPAS = D2x(CVTPLPAS)                     /* display in hex       */
+CVTPLPAE = C2d(Storage(D2x(CVTSMEXT+28),4))  /* end of PLPA addr     */
+CVTPLPAE = D2x(CVTPLPAE)                     /* display in hex       */
+PLPASZ   = X2d(CVTPLPAE) - X2d(CVTPLPAS) + 1 /* size of PLPA         */
+PLPASZ   = PLPASZ/1024                       /* convert to Kbytes    */
+GDASQA   = C2d(Storage(D2x(CVTGDA + 144),4)) /* start of SQA addr    */
+GDASQAH  = D2x(GDASQA)                       /* display in hex       */
+SQAEND   = (GDASQASZ*1024) + GDASQA - 1      /* end of SQA           */
+SQAEND   = D2x(SQAEND)                       /* display in hex       */
+CVTRWNS  = C2d(Storage(D2x(CVTSMEXT+32),4))  /* start of R/W nucleus */
+CVTRWNS  = D2x(CVTRWNS)                      /* display in hex       */
+CVTRWNE  = C2d(Storage(D2x(CVTSMEXT+36),4))  /* end of R/W nucleus   */
+CVTRWNE  = D2x(CVTRWNE)                      /* display in hex       */
+RWNUCSZ  = X2d(CVTRWNE)  - X2d(CVTRWNS)  + 1 /* size of R/W nucleus  */
+RWNUCSZ  = Format(RWNUCSZ/1024,,0)           /* convert to Kbytes    */
+CVTRONS  = C2d(Storage(D2x(CVTSMEXT+40),4))  /* start of R/O nucleus */
+CVTRONS  = D2x(CVTRONS)                      /* display in hex       */
+CVTRONE  = C2d(Storage(D2x(CVTSMEXT+44),4))  /* end of R/O nucleus   */
+CVTRONE  = D2x(CVTRONE)                      /* display in hex       */
+RONUCSZ  = X2d(CVTRONE)  - X2d(CVTRONS)  + 1 /* size of R/O nucleus  */
+RONUCSZ  = Format(RONUCSZ/1024,,0)           /* convert to Kbytes    */
+RONUCSZB = X2d('FFFFFF') - X2d(CVTRONS) + 1  /* size of R/O nuc <16M */
+RONUCSZB = Format(RONUCSZB/1024,,0)          /* convert to Kbytes    */
+RONUCSZA = X2d(CVTRONE) - X2d('1000000') + 1 /* size of R/O nuc >16M */
+RONUCSZA = Format(RONUCSZA/1024,,0)          /* convert to Kbytes    */
+CVTERWNS = C2d(Storage(D2x(CVTSMEXT+48),4))  /* start of E-R/W nuc   */
+CVTERWNS = D2x(CVTERWNS)                     /* display in hex       */
+CVTERWNE = C2d(Storage(D2x(CVTSMEXT+52),4))  /* end of E-R/W nuc     */
+CVTERWNE = D2x(CVTERWNE)                     /* display in hex       */
+ERWNUCSZ = X2d(CVTERWNE) - X2d(CVTERWNS) + 1 /* size of E-R/W nuc    */
+ERWNUCSZ = ERWNUCSZ/1024                     /* convert to Kbytes    */
+GDAESQA  = C2d(Storage(D2x(CVTGDA + 152),4)) /* start of ESQA addr   */
+GDAESQAH = D2x(GDAESQA)                      /* display in hex       */
+ESQAEND  = (GDAESQAS*1024) + GDAESQA - 1     /* end of ESQA          */
+ESQAEND  = D2x(ESQAEND)                      /* display in hex       */
+CVTEPLPS = C2d(Storage(D2x(CVTSMEXT+56),4))  /* start of EPLPA addr  */
+CVTEPLPS = D2x(CVTEPLPS)                     /* display in hex       */
+CVTEPLPE = C2d(Storage(D2x(CVTSMEXT+60),4))  /* end of EPLPA addr    */
+CVTEPLPE = D2x(CVTEPLPE)                     /* display in hex       */
+EPLPASZ  = X2d(CVTEPLPE) - X2d(CVTEPLPS) + 1 /* size of EPLPA        */
+EPLPASZ  = EPLPASZ/1024                      /* convert to Kbytes    */
+CVTEFLPS = C2d(Storage(D2x(CVTSMEXT+64),4))  /* start of EFLPA addr  */
+CVTEFLPS = D2x(CVTEFLPS)                     /* display in hex       */
+If CVTEFLPS <> 0 then do
+  CVTEFLPE = C2d(Storage(D2x(CVTSMEXT+68),4))  /* end of EFLPA addr  */
+  CVTEFLPE = D2x(CVTEFLPE)                     /* display in hex     */
+  EFLPASZ  = X2d(CVTEFLPE) - X2d(CVTEFLPS) + 1 /* size of EFLPA      */
+  EFLPASZ  = EFLPASZ/1024                      /* convert to Kbytes  */
+End
+Else do /* no EFLPA */
+  CVTEFLPS = 'N/A     '
+  CVTEFLPE = 'N/A     '
+  EFLPASZ  = 0
+End
+CVTEMLPS = C2d(Storage(D2x(CVTSMEXT+72),4))  /* start of EMLPA addr  */
+CVTEMLPS = D2x(CVTEMLPS)                     /* display in hex       */
+If CVTEMLPS <> 0 then do
+  CVTEMLPE = C2d(Storage(D2x(CVTSMEXT+76),4))  /* end of EMLPA addr  */
+  CVTEMLPE = D2x(CVTEMLPE)                     /* display in hex     */
+  EMLPASZ  = X2d(CVTEMLPE) - X2d(CVTEMLPS) + 1 /* size of EMLPA      */
+  EMLPASZ  = EMLPASZ/1024                      /* convert to Kbytes  */
+End
+Else do /* no EMLPA */
+  CVTEMLPS = 'N/A     '
+  CVTEMLPE = 'N/A     '
+  EMLPASZ  = 0
+End
+GDAECSA  = C2d(Storage(D2x(CVTGDA + 124),4)) /* start of ECSA addr   */
+GDAECSAH = D2x(GDAECSA)                      /* display in hex       */
+ECSAEND  = (GDAECSAS*1024) + GDAECSA - 1     /* end of ECSA          */
+ECSAEND  = D2x(ECSAEND)                      /* display in hex       */
+GDAEPVT  = C2d(Storage(D2x(CVTGDA + 168),4)) /* start of EPVT addr   */
+GDAEPVTH = D2x(GDAEPVT)                      /* display in hex       */
+EPVTEND  = (GDAEPVTS*1024*1024) + GDAEPVT - 1 /* end of EPVT         */
+EPVTEND  = D2x(EPVTEND)                      /* display in hex       */
+If VMAPOPT <> 'NODISP' then do         /* no display of vmap desired */
+Queue ' '
+Queue 'Virtual Storage Map:'
+Queue '          '
+If VMAP = 'HIGHFIRST' then do
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+ Queue '     Storage Area     Start      End           Size' ,
+       '     Used     Conv      HWM'
+Else ,
+ Queue '     Storage Area     Start      End           Size' ,
+       '     Used     Conv'
+Queue '          '
+Queue '     Ext. Private    '     Right(GDAEPVTH,8,'0') ' ' ,
+   Right(EPVTEND,8,'0')           Right(GDAEPVTS,8,' ')'M'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '         Ext. CSA    '     Right(GDAECSAH,8,'0') ' ' ,
+   Right(ECSAEND,8,'0')           Right(GDAECSAS,8,' ')'K' ,
+   Right(GDA_ECSA_ALLOC,8,' ')'K         ' ,
+   Right(GDAECSAHWM,7,' ')'K'
+Else ,
+Queue '         Ext. CSA    '     Right(GDAECSAH,8,'0') ' ' ,
+   Right(ECSAEND,8,'0')           Right(GDAECSAS,8,' ')'K' ,
+   Right(GDA_ECSA_ALLOC,8,' ')'K'
+Queue '        Ext. MLPA    '     Right(CVTEMLPS,8,'0') ' ' ,
+   Right(CVTEMLPE,8,'0')          Right(EMLPASZ,8,' ')'K'
+Queue '        Ext. FLPA    '     Right(CVTEFLPS,8,'0') ' ' ,
+   Right(CVTEFLPE,8,'0')          Right(EFLPASZ,8,' ')'K'
+Queue '        Ext. PLPA    '     Right(CVTEPLPS,8,'0') ' ' ,
+   Right(CVTEPLPE,8,'0')          Right(EPLPASZ,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '         Ext. SQA    '     Right(GDAESQAH,8,'0') ' ' ,
+   Right(ESQAEND,8,'0')           Right(GDAESQAS,8,' ')'K' ,
+   Right(GDA_ESQA_ALLOC,8,' ')'K' Right(GDA_ECSA_CONV,7,' ')'K',
+   Right(GDAESQAHWM,7,' ')'K'
+Else ,
+Queue '         Ext. SQA    '     Right(GDAESQAH,8,'0') ' ' ,
+   Right(ESQAEND,8,'0')           Right(GDAESQAS,8,' ')'K' ,
+   Right(GDA_ESQA_ALLOC,8,' ')'K' Right(GDA_ECSA_CONV,7,' ')'K'
+Queue ' Ext. R/W Nucleus    '     Right(CVTERWNS,8,'0') ' ' ,
+   Right(CVTERWNE,8,'0')          Right(ERWNUCSZ,8,' ')'K'
+Queue ' Ext. R/O Nucleus    '     Right('1000000',8,'0') ' ' ,
+   Right(CVTRONE,8,'0')           Right(RONUCSZA,8,' ')'K' ,
+   '(Total' RONUCSZ'K)'
+Queue '             16M line -----------------------------'
+Queue '      R/O Nucleus    '     Right(CVTRONS,8,'0') ' ' ,
+   Right('FFFFFF',8,'0')          Right(RONUCSZB,8,' ')'K',
+   '(Spans 16M line)'
+Queue '      R/W Nucleus    '     Right(CVTRWNS,8,'0') ' ' ,
+   Right(CVTRWNE,8,'0')           Right(RWNUCSZ,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '              SQA    '     Right(GDASQAH,8,'0') ' ' ,
+   Right(SQAEND,8,'0')            Right(GDASQASZ,8,' ')'K' ,
+   Right(GDA_SQA_ALLOC,8,' ')'K'  Right(GDA_CSA_CONV,7,' ')'K' ,
+   Right(GDASQAHWM,7,' ')'K'
+Else ,
+Queue '              SQA    '     Right(GDASQAH,8,'0') ' ' ,
+   Right(SQAEND,8,'0')            Right(GDASQASZ,8,' ')'K' ,
+   Right(GDA_SQA_ALLOC,8,' ')'K'  Right(GDA_CSA_CONV,7,' ')'K'
+Queue '             PLPA    '     Right(CVTPLPAS,8,'0') ' ' ,
+   Right(CVTPLPAE,8,'0')          Right(PLPASZ,8,' ')'K'
+Queue '             FLPA    '     Right(CVTFLPAS,8,'0') ' ' ,
+   Right(CVTFLPAE,8,'0')          Right(FLPASZ,8,' ')'K'
+Queue '             MLPA    '     Right(CVTMLPAS,8,'0') ' ' ,
+   Right(CVTMLPAE,8,'0')          Right(MLPASZ,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '              CSA    '     Right(GDACSAH,8,'0') ' ' ,
+   Right(CSAEND,8,'0')            Right(GDACSASZ,8,' ')'K' ,
+   Right(GDA_CSA_ALLOC,8,' ')'K         ' ,
+   Right(GDACSAHWM,7,' ')'K'
+Else ,
+Queue '              CSA    '     Right(GDACSAH,8,'0') ' ' ,
+   Right(CSAEND,8,'0')            Right(GDACSASZ,8,' ')'K' ,
+   Right(GDA_CSA_ALLOC,8,' ')'K'
+Queue '      Private V=V    '     Right(VVSTRT,8,'0') ' ' ,
+   Right(VVEND,8,'0')             Right(LDASIZEA,8,' ')'K'
+Queue '      Private V=R    '     Right(VRSTRT,8,'0') ' ' ,
+   Right(VREND,8,'0')             Right(GDAVRSZ,8,' ')'K'
+Queue '           System    '     Right(LDASTRTS,8,'0') ' ' ,
+   Right(SYSEND,8,'0')            Right(LDASIZS,8,' ')'K'
+If zARCH = 2 then ,
+  Queue '              PSA     00000000   00001FFF        8K'
+Else ,
+  Queue '              PSA     00000000   00000FFF        4K'
+End  /* if VMAP = 'HIGHFIRST'  */
+Else do  /* VMAP <> 'HIGHFIRST'  */
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+ Queue '     Storage Area     Start      End           Size' ,
+       '     Used     Conv      HWM'
+Else ,
+ Queue '     Storage Area     Start      End           Size' ,
+       '     Used     Conv'
+Queue '          '
+If zARCH = 2 then ,
+  Queue '              PSA     00000000   00001FFF        8K'
+Else ,
+  Queue '              PSA     00000000   00000FFF        4K'
+Queue '           System    '     Right(LDASTRTS,8,'0') ' ' ,
+   Right(SYSEND,8,'0')            Right(LDASIZS,8,' ')'K'
+Queue '      Private V=R    '     Right(VRSTRT,8,'0') ' ' ,
+   Right(VREND,8,'0')             Right(GDAVRSZ,8,' ')'K'
+Queue '      Private V=V    '     Right(VVSTRT,8,'0') ' ' ,
+   Right(VVEND,8,'0')             Right(LDASIZEA,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '              CSA    '     Right(GDACSAH,8,'0') ' ' ,
+   Right(CSAEND,8,'0')            Right(GDACSASZ,8,' ')'K' ,
+   Right(GDA_CSA_ALLOC,8,' ')'K         ' ,
+   Right(GDACSAHWM,7,' ')'K'
+Else ,
+Queue '              CSA    '     Right(GDACSAH,8,'0') ' ' ,
+   Right(CSAEND,8,'0')            Right(GDACSASZ,8,' ')'K' ,
+   Right(GDA_CSA_ALLOC,8,' ')'K'
+Queue '             MLPA    '     Right(CVTMLPAS,8,'0') ' ' ,
+   Right(CVTMLPAE,8,'0')          Right(MLPASZ,8,' ')'K'
+Queue '             FLPA    '     Right(CVTFLPAS,8,'0') ' ' ,
+   Right(CVTFLPAE,8,'0')          Right(FLPASZ,8,' ')'K'
+Queue '             PLPA    '     Right(CVTPLPAS,8,'0') ' ' ,
+   Right(CVTPLPAE,8,'0')          Right(PLPASZ,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '              SQA    '     Right(GDASQAH,8,'0') ' ' ,
+   Right(SQAEND,8,'0')            Right(GDASQASZ,8,' ')'K' ,
+   Right(GDA_SQA_ALLOC,8,' ')'K'  Right(GDA_CSA_CONV,7,' ')'K' ,
+   Right(GDASQAHWM,7,' ')'K'
+Else ,
+Queue '              SQA    '     Right(GDASQAH,8,'0') ' ' ,
+   Right(SQAEND,8,'0')            Right(GDASQASZ,8,' ')'K' ,
+   Right(GDA_SQA_ALLOC,8,' ')'K'  Right(GDA_CSA_CONV,7,' ')'K'
+Queue '      R/W Nucleus    '     Right(CVTRWNS,8,'0') ' ' ,
+   Right(CVTRWNE,8,'0')           Right(RWNUCSZ,8,' ')'K'
+Queue '      R/O Nucleus    '     Right(CVTRONS,8,'0') ' ' ,
+   Right('FFFFFF',8,'0')          Right(RONUCSZB,8,' ')'K',
+   '(Spans 16M line)'
+Queue '             16M line -----------------------------'
+Queue ' Ext. R/O Nucleus    '     Right('1000000',8,'0') ' ' ,
+   Right(CVTRONE,8,'0')           Right(RONUCSZA,8,' ')'K' ,
+   '(Total' RONUCSZ'K)'
+Queue ' Ext. R/W Nucleus    '     Right(CVTERWNS,8,'0') ' ' ,
+   Right(CVTERWNE,8,'0')          Right(ERWNUCSZ,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '         Ext. SQA    '     Right(GDAESQAH,8,'0') ' ' ,
+   Right(ESQAEND,8,'0')           Right(GDAESQAS,8,' ')'K' ,
+   Right(GDA_ESQA_ALLOC,8,' ')'K' Right(GDA_ECSA_CONV,7,' ')'K',
+   Right(GDAESQAHWM,7,' ')'K'
+Else ,
+Queue '         Ext. SQA    '     Right(GDAESQAH,8,'0') ' ' ,
+   Right(ESQAEND,8,'0')           Right(GDAESQAS,8,' ')'K' ,
+   Right(GDA_ESQA_ALLOC,8,' ')'K' Right(GDA_ECSA_CONV,7,' ')'K'
+Queue '        Ext. PLPA    '     Right(CVTEPLPS,8,'0') ' ' ,
+   Right(CVTEPLPE,8,'0')          Right(EPLPASZ,8,' ')'K'
+Queue '        Ext. FLPA    '     Right(CVTEFLPS,8,'0') ' ' ,
+   Right(CVTEFLPE,8,'0')          Right(EFLPASZ,8,' ')'K'
+Queue '        Ext. MLPA    '     Right(CVTEMLPS,8,'0') ' ' ,
+   Right(CVTEMLPE,8,'0')          Right(EMLPASZ,8,' ')'K'
+If Bitand(CVTOSLV2,'01'x) = '01'x then ,     /* OS/390 R10 and above */
+Queue '         Ext. CSA    '     Right(GDAECSAH,8,'0') ' ' ,
+   Right(ECSAEND,8,'0')           Right(GDAECSAS,8,' ')'K' ,
+   Right(GDA_ECSA_ALLOC,8,' ')'K         ' ,
+   Right(GDAECSAHWM,7,' ')'K'
+Else ,
+Queue '         Ext. CSA    '     Right(GDAECSAH,8,'0') ' ' ,
+   Right(ECSAEND,8,'0')           Right(GDAECSAS,8,' ')'K' ,
+   Right(GDA_ECSA_ALLOC,8,' ')'K'
+Queue '     Ext. Private    '     Right(GDAEPVTH,8,'0') ' ' ,
+   Right(EPVTEND,8,'0')           Right(GDAEPVTS,8,' ')'M'
+End  /* else do (VMAP <> 'HIGHFIRST')  */
+
+If bitand(CVTOSLV3,'02'x) = '02'x then do   /* z/OS 1.5 and above?   */
+                            /* Yes, get HVSHARE info from the RCE    */
+  RCELVSHRSTRT   = C2d(Storage(D2x(RCE + 544),8))  /* low virt addr  */
+                                                   /* for 64-bit shr */
+  RCELVSHRSTRT_D = C2x(Storage(D2x(RCE + 544),8))  /* make readable  */
+  VSHRSTRT_D     = Substr(RCELVSHRSTRT_D,1,8) ,    /*  address range */
+                   Substr(RCELVSHRSTRT_D,9,8)      /*   display      */
+  RCELVHPRSTRT   = C2d(Storage(D2x(RCE + 552),8))  /* low virt addr  */
+                                                   /* for 64-bit prv */
+  RCELVHPRSTRT_D = C2d(Storage(D2x(RCE + 552),8)) -1 /*make readable */
+  RCELVHPRSTRT_D = Right(D2x(RCELVHPRSTRT_D),16,'0') /* address      */
+  VHPRSTRT_D     = Substr(RCELVHPRSTRT_D,1,8) ,    /*   range        */
+                   Substr(RCELVHPRSTRT_D,9,8)      /*   display      */
+  TOTAL_VHSHR    = RCELVHPRSTRT - RCELVSHRSTRT     /* total shared   */
+  TOTAL_VHSHR    = TOTAL_VHSHR/1024/1024           /* change to MB   */
+  TOTAL_VHSHR    = FORMAT_MEMSIZE(TOTAL_VHSHR)     /* format size    */
+
+  RCELVSHRSTRT   = RCELVSHRSTRT/1024/1024          /* change to MB   */
+  RCELVSHRSTRT   = FORMAT_MEMSIZE(RCELVSHRSTRT)    /* format size    */
+
+  RCELVHPRSTRT   = RCELVHPRSTRT/1024/1024          /* change to MB   */
+  RCELVHPRSTRT   = FORMAT_MEMSIZE(RCELVHPRSTRT)    /* format size    */
+
+  RCELVSHRPAGES  = C2d(Storage(D2x(RCE + 584),8))  /* shr pages      */
+  RCELVSHRPAGES  = (RCELVSHRPAGES*4)/1024          /* change to MB   */
+  RCELVSHRPAGES  = FORMAT_MEMSIZE(RCELVSHRPAGES)   /* format size    */
+
+  RCELVSHRGBYTES = C2d(Storage(D2x(RCE + 592),8))  /* shr bytes HWM  */
+  RCELVSHRGBYTES = RCELVSHRGBYTES/1024/1024        /* change to MB   */
+  RCELVSHRGBYTES = FORMAT_MEMSIZE(RCELVSHRGBYTES)  /* format size    */
+
+  Queue '   '
+  Queue '  64-Bit Shared Virtual Storage (HVSHARE):'
+  Queue '   '
+  Queue '    Shared storage total:' TOTAL_VHSHR
+  Queue '    Shared storage range:' RCELVSHRSTRT'-'RCELVHPRSTRT ,
+        '('VSHRSTRT_D' - 'VHPRSTRT_D')'
+  Queue '    Shared storage allocated:' RCELVSHRPAGES
+  Queue '    Shared storage allocated HWM:' RCELVSHRGBYTES
+
+End /* If bitand(CVTOSLV3,'02'x) = '02'x  */
+
+If bitand(CVTOSLV5,'08'x) = '08'x then do   /* z/OS 1.10 and above   */
+                            /* Yes, get HVCOMMON info from the RCE   */
+  RCEHVCommonStrt = C2d(Storage(D2x(RCE + 872),8)) /*low virt addr */
+                                                   /*for 64-bit cmn*/
+  CommonStrt_D   = C2x(Storage(D2x(RCE + 872),8))  /*make readable */
+  CommonStrt_D   = Substr(CommonStrt_D,1,8) ,      /* address range*/
+                   Substr(CommonStrt_D,9,8)        /*  display     */
+
+  RCEHVCommonEnd = C2d(Storage(D2x(RCE + 880),8))  /*high virt addr*/
+                                                   /*for 64-bit cmn*/
+  RCEHVCommonEnd = RCEHVCommonEnd + 1              /* Add 1 to addr*/
+  CommonEnd_D    = C2x(Storage(D2x(RCE + 880),8))  /*make readable */
+  CommonEnd_D    = Substr(CommonEnd_D,1,8) ,       /* address range*/
+                   Substr(CommonEnd_D,9,8)         /*  display     */
+
+  TOTAL_VHCOMN   = RCEHVCommonEnd-RCEHVCommonStrt  /* total common */
+  TOTAL_VHCOMN   = TOTAL_VHCOMN/1024/1024          /* change to MB */
+  TOTAL_VHCOMN   = FORMAT_MEMSIZE(TOTAL_VHCOMN)    /* format size  */
+
+  RCEHVCommonStrt = RCEHVCommonStrt/1024/1024      /* chg to MB    */
+  RCEHVCommonStrt = FORMAT_MEMSIZE(RCEHVCommonStrt) /* format size */
+
+  RCEHVCommonEnd = RCEHVCommonEnd/1024/1024        /* chg to MB    */
+  RCEHVCommonEnd = FORMAT_MEMSIZE(RCEHVCommonEnd)  /* format  size */
+
+  RCEHVCommonPAGES = C2d(Storage(D2x(RCE + 888),8)) /* comn pages  */
+  RCEHVCommonPAGES = (RCEHVCommonPAGES*4)/1024      /* chg to MB   */
+  RCEHVCommonPAGES = FORMAT_MEMSIZE(RCEHVCommonPAGES) /*format size*/
+
+  RCEHVCommonHWMBytes = C2d(Storage(D2x(RCE + 896),8)) /* comn HWM */
+  RCEHVCommonHWMBytes = RCEHVCommonHWMBytes/1024/1024  /*chg to MB */
+  RCEHVCommonHWMBytes = FORMAT_MEMSIZE(RCEHVCommonHWMBytes) /* fmt */
+
+  Queue '   '
+  Queue '  64-Bit Common Virtual Storage (HVCOMMON):'
+  Queue '   '
+  Queue '    Common storage total:' TOTAL_VHCOMN
+  Queue '    Common storage range:' RCEHVCommonStrt'-'RCEHVCommonEnd ,
+        '('CommonStrt_D' - 'CommonEnd_D')'
+  Queue '    Common storage allocated:' RCEHVCommonPAGES
+  Queue '    Common storage allocated HWM:' RCEHVCommonHWMBytes
+End /* If bitand(CVTOSLV5,'08'x) = '08'x  */
+If Bitand(CVTOSLV5,'10'x) = '10'x &     ,   /* z/OS 1.9 and above &  */
+   Bitand(CVTFLAG2,'01'x) = '01'x then do   /*  CVTEDAT on (z10 >)?  */
+  LARGEMEM = 1                              /* set LARGEMEM avail flg*/
+  RCEReconLFASize  = C2d(Storage(D2x(RCE + 760),8)) /* recon lfarea  */
+  RCENonReconLFASize = C2d(Storage(D2x(RCE + 768),8)) /*  LFAREA     */
+ /* Comment out or delete the next 2 lines of code if you want the   */
+ /* large memory displays even if you specified or defaulted to      */
+ /* LFAREA=0M (z/OS 1.9 & above) and have the hardware support.      */
+  If RCEReconLFASize = 0 & RCENonReconLFASize = 0 then ,  /* both 0? */
+   LARGEMEM = 0
+  If Bitand(CVTOSLV6,'80'x) = '80'x then do /* z/OS 2.1 and above    */
+    PL = 1                                  /* pageable1m + 2.1 & >  */
+    /*****************/
+    /* 2G frame code */
+    /*****************/
+    RCE2GMemoryObjects          = ,
+     C2d(Storage(D2x(RCE + 1256),8))    /* Number of 2G objects      */
+    RCE2GNonReconLFASize        = ,
+     C2d(Storage(D2x(RCE + 1272),8))    /* 2G frame area in 2G units */
+    RCE2GNonReconLFAUsed        = ,
+     C2d(Storage(D2x(RCE + 1280),8))    /* used 2G frames            */
+    RCE2GHWM                    = ,
+     C2d(Storage(D2x(RCE + 1288),4))    /* 2G used frames HWM        */
+    If RCE2GNonReconLFASize <> 0 then LARGEMEM = 1  /* lfarea used   */
+  End
+    Else PL = 0                             /* no pageable1m         */
+End /* If Bitand(CVTOSLV5,'10'x) */
+   Else LARGEMEM = 0                        /* < z/OS 1.9/no hw supt */
+If LARGEMEM = 1 then do                      /* z/OS 1.10 & above  */
+  RCELargeMemoryObjects = ,
+   C2d(Storage(D2x(RCE + 744),8))             /*tot large mem objs */
+  RCELargePagesBackedinReal = ,
+   C2d(Storage(D2x(RCE + 752),8))             /* tot lrg obj pages */
+  RCELFAvailGroups          = ,
+   C2d(Storage(D2x(RCE + 796),4))             /* avial lrg frames  */
+  RCEReconLFAUsed             = ,
+   C2d(Storage(D2x(RCE + 776),8))    /* # recon 1M frames alloc    */
+  RCENonReconLFAUsed          = ,
+   C2d(Storage(D2x(RCE + 784),8))    /* # nonrecon 1M frames alloc */
+
+  LFASize = RCEReconLFASize + RCENonReconLFASize     /* LFAREA size*/
+  LFA_Used    = RCEReconLFAUsed + RCENonReconLFAUsed /* used LFAREA*/
+  LFA_Alloc1M = RCELargePagesBackedinReal            /* 1M alloc   */
+  LFA_Alloc4K = LFA_Used - LFA_Alloc1M               /* 4K alloc   */
+
+  If PL = 1 then do            /* z/OS 2.1 / pageable1m support    */
+    RCELargeUsed4K              = ,
+     C2d(Storage(D2x(RCE + 1032),4))      /* 4K used for 1M req    */
+    LFA_Alloc4K = RCELargeUsed4K     /* chg var name for old code  */
+    RceLargeAllocatedPL         = ,
+     C2d(Storage(D2x(RCE + 1244),4))      /* # used pageable1m     */
+    RceLargeUsedPLHWM           = ,
+     C2d(Storage(D2x(RCE + 1252),4))      /* pageable1m HWM        */
+  End
+
+  LFASize     = FORMAT_MEMSIZE(LFASize)          /* format size    */
+  LFA_Avail   = FORMAT_MEMSIZE(RCELFAvailGroups) /* format size    */
+  LFA_Alloc1M = FORMAT_MEMSIZE(LFA_Alloc1M)      /* format size    */
+  LFA_Alloc4K = FORMAT_MEMSIZE(LFA_Alloc4K)      /* format size    */
+
+  If PL = 1 then do            /* z/OS 2.1 + pageable1m support    */
+    RceLargeAllocatedPL = FORMAT_MEMSIZE(RceLargeAllocatedPL)
+    RceLargeUsedPLHWM   = FORMAT_MEMSIZE(RceLargeUsedPLHWM)
+    /*****************/
+    /* 2G frame code */
+    /*****************/
+    LFA2G_Size  = FORMAT_MEMSIZE(RCE2GNonReconLFASize*2048)
+    LFA2G_Used  = FORMAT_MEMSIZE(RCE2GNonReconLFAUsed*2048)
+    LFA2G_avail = ((RCE2GNonReconLFASize-RCE2GNonReconLFAUsed)*2048)
+    LFA2G_avail = FORMAT_MEMSIZE(LFA2G_avail)
+    LFA2G_Max   = RCE2GHWM*2048
+    LFA2G_Max   = FORMAT_MEMSIZE(LFA2G_Max)
+  End
+
+  If Bitand(CVTOSLV5,'04'x) = '04'x then do /* z/OS 1.12 and above */
+    RceLargeUsed1MHWM           = ,
+     C2d(Storage(D2x(RCE + 804),4)) /*large pg HWM alloc behalf 1M */
+    RceLargeUsed4KHWM           = ,
+     C2d(Storage(D2x(RCE + 808),4)) /*large pg HWM alloc behalf 4K */
+    LFA_Max1M = FORMAT_MEMSIZE(RceLargeUsed1MHWM)  /* format size  */
+    LFA_Max4K = FORMAT_MEMSIZE(RceLargeUsed4KHWM)  /* format size  */
+  End
+
+  Queue '   '
+  Queue '  64-Bit Large Memory Virtual Storage (LFAREA):'
+  Queue '   '
+  If PL = 1 then do            /* z/OS 2.1 / pageable1m support    */
+    Queue '    Large memory area (LFAREA)    :' LFASize ',' LFA2G_Size
+    Queue '    Large memory storage available:' LFA_Avail ',' ,
+               LFA2G_avail
+  End
+  Else do
+    Queue '    Large memory area (LFAREA)    :' LFASize
+    Queue '    Large memory storage available:' LFA_Avail
+  End
+  Queue '    Large memory storage allocated (1M):' LFA_Alloc1M
+  Queue '    Large memory storage allocated (4K):' LFA_Alloc4K
+  If Bitand(CVTOSLV5,'04'x) = '04'x then do /* z/OS 1.12 and above */
+    Queue '    Large memory storage allocated HWM (1M):' LFA_Max1M
+    Queue '    Large memory storage allocated HWM (4K):' LFA_Max4K
+  End
+  If PL = 1 then do            /* z/OS 2.1 / pageable1m support    */
+    Queue '    Large memory storage allocated (PAGEABLE1M):' ,
+     RceLargeAllocatedPL
+    Queue '    Large memory storage allocated HWM (PAGEABLE1M):' ,
+     RceLargeUsedPLHWM
+    Queue '    Large memory storage allocated (2G):' LFA2G_Used ,
+          '/' RCE2GNonReconLFAUsed 'pages'
+    Queue '    Large memory storage allocated HWM (2G):' LFA2G_Max ,
+          '/' RCE2GHWM 'pages'
+  End
+  Queue '    Large memory objects allocated:' RCELargeMemoryObjects
+  If PL = 1 then ,             /* z/OS 2.1 / pageable1m support    */
+    Queue '    Large memory objects allocated (2G):' RCE2GMemoryObjects
+End
+End  /* If VMAPOPT <> 'NODISP' */
+Return
+
+PAGE:                /* Page Data Sets information sub-routine       */
+Queue ' '
+Queue 'Page Data Set Usage:'
+Queue '  Type     Full     Slots  Dev   Volser  Data Set Name'
+ASMPART  = C2d(Storage(D2x(ASMVT + 8),4))  /* Pnt to Pag Act Ref Tbl */
+PARTSIZE = C2d(Storage(D2x(ASMPART+4),4))  /* Tot number of entries  */
+PARTDSNL = C2d(Storage(D2x(ASMPART+24),4)) /* Point to 1st pg dsn    */
+PARTENTS = ASMPART+80                      /* Point to 1st parte     */
+Do I = 1 to PARTSIZE
+  If I > 1 then do
+    PARTENTS = PARTENTS + 96
+    PARTDSNL = PARTDSNL + 44
+  End
+  CHKINUSE = Storage(D2x(PARTENTS+9),1)    /* in use flag            */
+  If Bitand(CHKINUSE,'80'x) = '80'x then iterate /* not in use       */
+  PGDSN    = Storage(D2x(PARTDSNL),44)     /* page data set name     */
+  PGDSN    = Strip(PGDSN,'T')              /* remove trailing blanks */
+  PARETYPE = Storage(D2x(PARTENTS+8),1)    /* type flag              */
+  Select
+    When Bitand(PARETYPE,'80'x) = '80'x then PGTYPE = ' PLPA    '
+    When Bitand(PARETYPE,'40'x) = '40'x then PGTYPE = ' COMMON  '
+    When Bitand(PARETYPE,'20'x) = '20'x then PGTYPE = ' DUPLEX  '
+    When Bitand(PARETYPE,'10'x) = '10'x then PGTYPE = ' LOCAL   '
+    Otherwise PGTYPE = '??????'
+  End  /* Select */
+  If PGTYPE = ' LOCAL   ' then do
+    PAREFLG1  = Storage(D2x(PARTENTS+9),1)    /* PARTE flags         */
+    If Bitand(PAREFLG1,'10'x) = '10'x then PGTYPE = ' LOCAL NV'
+  End
+  PAREUCBP = C2d(Storage(D2x(PARTENTS+44),4)) /* point to UCB        */
+  PGUCB    = C2x(Storage(D2x(PAREUCBP+4),2))  /* UCB address         */
+  PGVOL    = Storage(D2x(PAREUCBP+28),6)      /* UCB volser          */
+  PARESZSL = C2d(Storage(D2x(PARTENTS+16),4)) /* total slots         */
+  PARESZSL = Right(PARESZSL,9,' ')            /* ensure 9 digits     */
+  PARESLTA = C2d(Storage(D2x(PARTENTS+20),4)) /* avail. slots        */
+  PGFULL   = ((PARESZSL-PARESLTA) / PARESZSL) * 100 /* percent full  */
+  PGFULL   = Format(PGFULL,3,2)               /* force 2 decimals    */
+  PGFULL   = Left(PGFULL,3)                   /* keep intiger only   */
+  Queue  ' 'PGTYPE' 'PGFULL'% 'PARESZSL'  'PGUCB' ' ,
+         PGVOL'  'PGDSN
+End  /* do I=1 to partsize */
+/*********************************************************************/
+/* SCM - Storage Class Memory                                        */
+/* ASMVX - SYS1.MODGEN(ILRASMVX) pointed to in SYS1.MODGEN(ILRASMVT) */
+/*********************************************************************/
+ /*If Bitand(CVTOSLV5,'01'x) = '01'x then do */ /* z/OS 1.13 and > */
+If Bitand(CVTOSLV6,'80'x) = '80'x then do    /* z/OS 2.1  and above  */
+  SCMSTATUS = 'NOT-USED'                     /* set dflt to not used */
+  ASMVX = C2d(Storage(D2x(ASMVT + 1236),4))  /* point to ASM tbl ext */
+  SCMBLKSAVAIL = C2d(Storage(D2x(ASMVX + 8),8))   /* SCM blks avail  */
+  SCMNVBC      = C2d(Storage(D2x(ASMVX + 16),8))  /* SCM blks used   */
+  SCMERRS      = C2d(Storage(D2x(ASMVX + 24),8))  /* bad SCM blks    */
+  If (SCMBLKSAVAIL > 0) then do              /* SCM is used          */
+    SCMSTATUS = 'IN-USE  '                   /* status is IN-USE     */
+    SCMPCTUSED = Trunc(SCMNVBC*100/SCMBLKSAVAIL)  /* percent used    */
+    SCMPCTUSED = Format(SCMPCTUSED,3,2)      /* format for display   */
+    SCMPCTUSED = Left(SCMPCTUSED,3)          /* format for display   */
+    Call FORMAT_COMMAS SCMBLKSAVAIL          /* format with commas   */
+    SCMBLKSAVAIL = FORMATTED_WHOLENUM        /* save number          */
+    Call FORMAT_COMMAS SCMNVBC               /* format with commas   */
+    SCMNVBC      = FORMATTED_WHOLENUM        /* save number          */
+    Call FORMAT_COMMAS SCMERRS               /* format with commas   */
+    SCMERRS      = FORMATTED_WHOLENUM        /* save number          */
+    SCMBLKSAVAIL = Right(SCMBLKSAVAIL,16)    /* format for display   */
+    SCMNVBC      = Right(SCMNVBC,16)         /* format for display   */
+    SCMERRS      = Right(SCMERRS,16)         /* format for display   */
+  End
+  Queue ' '
+  Queue 'Storage Class Memory:'
+  Queue '  STATUS      FULL               SIZE             USED' ,
+        '        IN-ERROR'
+  If SCMSTATUS = 'NOT-USED' then Queue ' ' SCMSTATUS
+  Else do
+    Queue ' ' SCMSTATUS '  ' SCMPCTUSED || '%  '  ,
+          SCMBLKSAVAIL SCMNVBC SCMERRS
+  End
+End
+Return
+
+SMF:                 /* SMF Data Set information sub-routine         */
+Queue ' '
+Queue 'SMF Data Set Usage:'
+Queue '  Name                      Volser   Size(Blks)  %Full  Status'
+SMCAMISC = Storage(D2x(SMCA + 1),1)          /* misc. indicators     */
+If bitand(SMCAMISC,'80'x) <> '80'x then do   /* smf active ??        */
+  Queue '  *** SMF recording not being used ***'
+  Return
+End
+SMCAFRDS = C2d(Storage(D2x(SMCA + 244),4))   /* point to first RDS   */
+SMCALRDS = C2d(Storage(D2x(SMCA + 248),4))   /* point to last RDS    */
+SMCASMCX = C2d(Storage(D2x(SMCA + 376),4))   /* point to SMCX        */
+SMCXLSBT = Storage(D2x(SMCASMCX + 88),1)     /* logstream bits       */
+If Bitand(SMCXLSBT,'80'x) = '80'x then do    /* logstream recording? */
+  If SMCAFRDS = SMCALRDS then do
+    Queue '  ***       SMF LOGSTREAM recording is active       ***'
+    Queue '  *** LOGSTREAM information not available via REXX  ***'
+  Return
+  End
+  Else do
+    Queue '  ***       SMF LOGSTREAM recording is active       ***'
+    Queue '  *** LOGSTREAM information not available via REXX  ***'
+    Queue '  ***     SMF data sets listed below not in use     ***'
+  End
+End /* If Bitand(SMCXLSBT,'80'x) */
+If SMCAFRDS = SMCALRDS then do
+  Queue '  ***    No SMF data sets available     ***'
+  Return
+End
+Do until SMCAFRDS = SMCALRDS    /* end loop when next rds ptr = last */
+  RDSNAME  =  Strip(Storage(D2x(SMCAFRDS + 16),44))  /* smf dsn      */
+  RDSVOLID = Storage(D2x(SMCAFRDS + 60),6)           /* smf volser   */
+  RDSCAPTY = C2d(Storage(D2x(SMCAFRDS + 76),4))      /* size in blks */
+  RDSNXTBL = C2d(Storage(D2x(SMCAFRDS + 80),4))      /* next avl blk */
+  /* RDSPCT  = (RDSNXTBL / RDSCAPTY) * 100 */ /* not how mvs does it */
+  RDSPCT   = Trunc((RDSNXTBL / RDSCAPTY) * 100) /* same as mvs disp. */
+  RDSFLG1  = Storage(D2x(SMCAFRDS + 12),1)     /* staus flags        */
+  Select
+    When Bitand(RDSFLG1,'10'x) = '10'x then RDSSTAT = 'FREE REQUIRED'
+    When Bitand(RDSFLG1,'08'x) = '08'x then RDSSTAT = 'DUMP REQUIRED'
+    When Bitand(RDSFLG1,'04'x) = '04'x then RDSSTAT = 'ALTERNATE'
+    When Bitand(RDSFLG1,'02'x) = '02'x then RDSSTAT = 'CLOSE PENDING'
+    When Bitand(RDSFLG1,'01'x) = '01'x then RDSSTAT = 'OPEN REQUIRED'
+    When Bitand(RDSFLG1,'00'x) = '00'x then RDSSTAT = 'ACTIVE'
+    Otherwise RDSSTAT = '??????'
+  End  /* Select */
+  If (RDSSTAT = 'ACTIVE' | RDSSTAT = 'DUMP REQUIRED') , /* display   */
+    & RDSPCT = 0 then RDSPCT = 1    /* %full the same way mvs does   */
+  SMCAFRDS = C2d(Storage(D2x(SMCAFRDS + 4),4)) /* point to next RDS  */
+  If Length(RDSNAME) < 26 then do
+    Queue ' ' Left(RDSNAME,25,' ') RDSVOLID  Right(RDSCAPTY,11,' ') ,
+              ' 'Format(RDSPCT,5,0) ' ' RDSSTAT
+  End
+  Else do
+    Queue ' ' RDSNAME
+    Queue copies(' ',27) RDSVOLID  Right(RDSCAPTY,11,' ') ,
+              ' 'Format(RDSPCT,5,0) ' ' RDSSTAT
+  End
+End
+Return
+
+SUB:                 /* Subsystem information sub-routine            */
+Arg SUBOPT
+SSCVT    = C2d(Storage(D2x(JESCT+24),4))     /* point to SSCVT       */
+SSCVT2   = SSCVT           /* save address for second loop           */
+If SUBOPT <> 'FINDJES' then do
+  Queue ' '
+  Queue 'Subsystem Communications Vector Table:'
+  Queue '  Name   Hex        SSCTADDR   SSCTSSVT' ,
+        '  SSCTSUSE   SSCTSUS2   Status'
+End /* if subopt */
+Do until SSCVT = 0
+  SSCTSNAM = Storage(D2x(SSCVT+8),4)         /* subsystem name       */
+  SSCTSSVT = C2d(Storage(D2x(SSCVT+16),4))   /* subsys vect tbl ptr  */
+  SSCTSUSE = C2d(Storage(D2x(SSCVT+20),4))   /* SSCTSUSE pointer     */
+  SSCTSUS2 = C2d(Storage(D2x(SSCVT+28),4))   /* SSCTSUS2 pointer     */
+  If SUBOPT = 'FINDJES' & SSCTSNAM = JESPJESN then do
+     JESSSVT  = SSCTSSVT   /* save SSVTSSVT for "version" section    */
+                           /* this points to JES3 Subsystem Vector   */
+                           /* Table, mapped by IATYSVT               */
+     JESSUSE  = SSCTSUSE   /* save SSCTSUSE for "version" section    */
+                           /* this points to version for JES2        */
+     JESSUS2  = SSCTSUS2   /* save SSCTSUS2 for "version" section    */
+                           /* this points to $HCCT for JES2          */
+     Leave  /* found JES info for version section, exit loop */
+  End /* if subopt */
+  SSCTSNAX = C2x(SSCTSNAM)    /* chg to EBCDIC for non-display chars */
+  Call XLATE_NONDISP SSCTSNAM /* translate non display chars         */
+  SSCTSNAM = RESULT           /* result from XLATE_NONDISP           */
+  If SSCTSSVT = 0 then SSCT_STAT = 'Inactive'
+    Else SSCT_STAT = 'Active'
+  If SUBOPT <> 'FINDJES' then do
+    Queue ' ' SSCTSNAM ' ' SSCTSNAX  ,
+          ' ' Right(D2x(SSCVT),8,0)    ' ' Right(D2x(SSCTSSVT),8,0) ,
+          ' ' Right(D2x(SSCTSUSE),8,0) ' ' Right(D2x(SSCTSUS2),8,0) ,
+          ' ' SSCT_STAT ' '
+  End /* if SUBOPT */
+ /*SSCTSSID = C2d(Storage(D2x(SSCVT+13),1)) */ /* subsys identifier  */
+ /*If bitand(SSCTSSID,'02'x) = '02'x then JESPJESN = 'JES2' */
+ /*If bitand(SSCTSSID,'03'x) = '03'x then JESPJESN = 'JES3'*/
+  SSCVT    = C2d(Storage(D2x(SSCVT+4),4))    /* next sscvt or zero   */
+End /* do until sscvt = 0 */
+If SUBOPT <> 'FINDJES' then do
+  Queue ' '
+  Queue 'Supported Subsystem Function Codes:'
+  Do until SSCVT2 = 0 /* 2nd loop for function codes                 */
+    SSCTSNAM = Storage(D2x(SSCVT2+8),4)        /* subsystem name     */
+    SSCTSSVT = C2d(Storage(D2x(SSCVT2+16),4)) /* subsys vect tbl ptr */
+    SSCTSNAX = C2x(SSCTSNAM)  /* chg to EBCDIC for non-display chars */
+    Call XLATE_NONDISP SSCTSNAM /* translate non display chars       */
+    SSCTSNAM = RESULT           /* result from XLATE_NONDISP         */
+    Queue ' ' SSCTSNAM '(X''' || SSCTSNAX || ''')'
+    If SSCTSSVT <> 0 then do
+      SSVTFCOD = SSCTSSVT + 4                  /* pt to funct. matrix*/
+      SSFUNCTB = Storage(D2X(SSVTFCOD),255)    /* function matrix    */
+      TOTFUNC = 0       /* counter for total functions per subsystem */
+      Drop FUNC.        /* init stem to null for saved functions     */
+      Do SUPFUNC = 1 TO 255
+        If Substr(SSFUNCTB,SUPFUNC,1) <> '00'x then do /* supported? */
+          TOTFUNC = TOTFUNC + 1 /* tot functions for this subsystem  */
+          FUNC.TOTFUNC = SUPFUNC  /* save function in stem           */
+        End
+      End /* do supfunc */
+      /***************************************************************/
+      /* The following code is used to list the supported function   */
+      /* codes by ranges. For example: 1-10,13,18-30,35,70,143-145   */
+      /***************************************************************/
+      If TOTFUNC >= 1 then do   /* begin loop to list function codes */
+        ALLCODES = ''                   /* init var to nulls         */
+        NEWRANGE = 'YES'                /* init newrange flag to YES */
+        FIRSTRNG = 'YES'                /* init firstrng flag to YES */
+        Do FCODES = 1 to TOTFUNC        /* loop though codes         */
+          JUNK = TOTFUNC + 1            /* prevent NOVALUE cond.     */
+          FUNC.JUNK = ''                /*  in func.chknext at end   */
+          CHKNEXT = FCODES + 1          /* stem var to chk next code */
+          If FUNC.FCODES + 1 = FUNC.CHKNEXT then do  /* next matches */
+            If NEWRANGE = 'YES' & FIRSTRNG = 'YES' then do /* first  */
+              ALLCODES =  ALLCODES || FUNC.FCODES || '-'   /* in new */
+              NEWRANGE = 'NO'                    /* range - seperate */
+              FIRSTRNG = 'NO'                    /* with a dash      */
+              Iterate                            /* get next code    */
+            End /* if newrange = 'yes' & firstrng = 'yes'            */
+            If NEWRANGE = 'YES' & FIRSTRNG = 'NO' then do /* next    */
+              ALLCODES =  ALLCODES || FUNC.FCODES  /* matches, but   */
+              NEWRANGE = 'NO'   /* is not the first, don't add dash  */
+              Iterate                            /* get next code    */
+            End /* if newrange = 'yes' & firstrng = 'no'             */
+            Else iterate  /* same range + not first - get next code  */
+          End /* func.fcodes + 1 */
+          If FCODES = TOTFUNC then , /* next doesn't match and this  */
+            ALLCODES =  ALLCODES || FUNC.FCODES  /* is the last code */
+          Else do /* next code doesn't match - seperate with comma   */
+            ALLCODES =  ALLCODES || FUNC.FCODES || ','
+            NEWRANGE = 'YES'         /* re-init newrange flag to YES */
+            FIRSTRNG = 'YES'         /* re-init firstrng flag to YES */
+          End
+        End /* do fcodes = 1 to totfunc */
+        /*************************************************************/
+        /* The code below splits up the ranges to multiple lines if  */
+        /* they won't all fit on a single line due to IPLINFO lrecl. */
+        /*************************************************************/
+        FUN_MAXL = 68      /* max length b4 need to split out codes  */
+        If Length(ALLCODES) <= FUN_MAXL then ,  /* fits on one line  */
+          Queue '    Codes:' ALLCODES
+        Else do                            /* need to split up       */
+          FUNSPLT = Pos(',',ALLCODES,FUN_MAXL-6)   /* split at comma */
+          ALLCODES_1 = Substr(ALLCODES,1,FUNSPLT)  /* 1st part       */
+          ALLCODES_2 = Strip(Substr(ALLCODES,FUNSPLT+1,FUN_MAXL))
+          Queue '    Codes:' ALLCODES_1
+          Queue '          ' ALLCODES_2
+        End /* else do */
+      End /* if totfunc >= 1 */
+    End
+    Else queue '    *Inactive*'
+    SSCVT2   = C2d(Storage(D2x(SSCVT2+4),4))   /* next sscvt or zero */
+  End /* do until sscvt2 = 0 */
+End /* if subopt <> 'findjes' */
+Return
+
+ASID:                /* ASVT Usage sub-routine                       */
+Queue ' '
+CVTASVT  = C2d(Storage(D2x(CVT+556),4))     /* point to ASVT         */
+ASVTMAXU = C2d(Storage(D2x(CVTASVT+516),4)) /* max number of entries */
+ASVTMAXI = C2d(Storage(D2x(CVTASVT+500),4)) /* MAXUSERS from ASVT    */
+ASVTAAVT = C2d(Storage(D2x(CVTASVT+480),4)) /* free slots in ASVT    */
+ASVTSTRT = C2d(Storage(D2x(CVTASVT+492),4)) /* RSVTSTRT from ASVT    */
+ASVTAST  = C2d(Storage(D2x(CVTASVT+484),4)) /* free START/SASI       */
+ASVTNONR = C2d(Storage(D2x(CVTASVT+496),4)) /* RSVNONR  from ASVT    */
+ASVTANR  = C2d(Storage(D2x(CVTASVT+488),4)) /* free non-reusable     */
+Queue 'ASID Usage Summary from the ASVT:'
+Queue '  Maximum number of ASIDs:' Right(ASVTMAXU,5,' ')
+Queue '                          '
+Queue '    MAXUSER from IEASYSxx:' Right(ASVTMAXI,5,' ')
+Queue '             In use ASIDs:' Right(ASVTMAXI-ASVTAAVT,5,' ')
+Queue '          Available ASIDs:' Right(ASVTAAVT,5,' ')
+Queue '                          '
+Queue '    RSVSTRT from IEASYSxx:' Right(ASVTSTRT,5,' ')
+Queue '           RSVSTRT in use:' Right(ASVTSTRT-ASVTAST,5,' ')
+Queue '        RSVSTRT available:' Right(ASVTAST,5,' ')
+Queue '                          '
+Queue '    RSVNONR from IEASYSxx:' Right(ASVTNONR,5,' ')
+Queue '           RSVNONR in use:' Right(ASVTNONR-ASVTANR,5,' ')
+Queue '        RSVNONR available:' Right(ASVTANR,5,' ')
+Return
+
+LPA:                 /* LPA List sub-routine                         */
+CVTSMEXT = C2d(Storage(D2x(CVT + 1196),4))   /* point to stg map ext.*/
+CVTEPLPS = C2d(Storage(D2x(CVTSMEXT+56),4))  /* start vaddr of ELPA  */
+NUMLPA   = C2d(Storage(D2x(CVTEPLPS+4),4))   /* # LPA libs in table  */
+LPAOFF   = 8                                 /* first ent in LPA tbl */
+Queue '     '
+Queue 'LPA Library List  ('NUMLPA' libraries):'
+Queue '  POSITION    DSNAME'
+Do I = 1 to NUMLPA
+  LEN   = C2d(Storage(D2x(CVTEPLPS+LPAOFF),1)) /* length of entry    */
+  LPDSN = Storage(D2x(CVTEPLPS+LPAOFF+1),LEN)  /* DSN of LPA library */
+  LPAOFF = LPAOFF + 44 + 1                     /* next entry in table*/
+  LPAPOS = Right(I,3)                        /* position in LPA list */
+  RELLPPOS = Right('(+'I-1')',6)        /* relative position in list */
+  Queue LPAPOS  RELLPPOS '  ' LPDSN
+End
+Return
+
+LNKLST:              /* LNKLST sub-routine                           */
+If Bitand(CVTOSLV1,'01'x) <> '01'x then do    /* below OS/390 R2     */
+  CVTLLTA  = C2d(Storage(D2x(CVT + 1244),4))  /* point to lnklst tbl */
+  NUMLNK   = C2d(Storage(D2x(CVTLLTA+4),4))   /* # LNK libs in table */
+  LLTAPFTB = CVTLLTA + 8 + (NUMLNK*45)        /* start of LLTAPFTB   */
+  LNKOFF   = 8                                /*first ent in LBK tbl */
+  LKAPFOFF = 0                                /*first ent in LLTAPFTB*/
+  Queue '     '
+  Queue 'LNKLST Library List  ('NUMLNK' Libraries):'
+  Queue '  POSITION    APF    DSNAME'
+  Do I = 1 to NUMLNK
+    LEN = C2d(Storage(D2x(CVTLLTA+LNKOFF),1))     /* length of entry */
+    LKDSN = Storage(D2x(CVTLLTA+LNKOFF+1),LEN)    /* DSN of LNK lib  */
+    CHKAPF = Storage(D2x(LLTAPFTB+LKAPFOFF),1)    /* APF flag        */
+    If  bitand(CHKAPF,'80'x) = '80'x then LKAPF = 'Y'  /* flag on    */
+      else LKAPF = ' '                            /* APF flag off    */
+    LNKOFF = LNKOFF + 44 + 1                      /*next entry in tbl*/
+    LKAPFOFF = LKAPFOFF + 1               /* next entry in LLTAPFTB  */
+    LNKPOS = Right(I,3)                           /*position in list */
+    RELLKPOS = Right('(+'I-1')',6)      /* relative position in list */
+    Queue LNKPOS  RELLKPOS '   ' LKAPF '   ' LKDSN
+  End
+End
+Else do  /* OS/390 1.2 and above - PROGxx capable LNKLST             */
+  ASCB     = C2d(Storage(224,4))               /* point to ASCB      */
+  ASSB     = C2d(Storage(D2x(ASCB+336),4))     /* point to ASSB      */
+  DLCB     = C2d(Storage(D2x(ASSB+236),4))     /* point to CSVDLCB   */
+  DLCBFLGS = Storage(d2x(DLCB + 32),1)         /* DLCB flag bits     */
+  SETNAME  = Storage(D2x(DLCB + 36),16)        /* LNKLST set name    */
+  SETNAME  = Strip(SETNAME,'T')                /* del trailing blanks*/
+  CVTLLTA  = C2d(Storage(D2x(DLCB + 16),4))    /* point to lnklst tbl*/
+  LLTX     = C2d(Storage(D2x(DLCB + 20),4))    /* point to LLTX      */
+  NUMLNK   = C2d(Storage(D2x(CVTLLTA+4),4))    /* # LNK libs in table*/
+  LLTAPFTB = CVTLLTA + 8 + (NUMLNK*45)         /* start of LLTAPFTB  */
+  LNKOFF   = 8                                 /*first ent in LLT tbl*/
+  VOLOFF   = 8                                 /*first ent in LLTX   */
+  LKAPFOFF = 0                                /*first ent in LLTAPFTB*/
+  If Bitand(DLCBFLGS,'10'x) = '10'x then ,     /* bit for LNKAUTH    */
+       LAUTH = 'LNKLST'                        /* LNKAUTH=LNKLST     */
+  Else LAUTH = 'APFTAB'                        /* LNKAUTH=APFTAB     */
+  Queue '     '
+  Queue 'LNKLST Library List - Set:' SETNAME ,
+        ' LNKAUTH='LAUTH '('NUMLNK' Libraries):'
+  If LAUTH = 'LNKLST' then ,
+    Queue '     (All LNKLST data sets marked APF=Y due to' ,
+          'LNKAUTH=LNKLST)'
+  Queue '  POSITION    APF   VOLUME    DSNAME'
+  Do I = 1 to NUMLNK
+    LEN = C2d(Storage(D2x(CVTLLTA+LNKOFF),1))     /* length of entry */
+    LKDSN = Storage(D2x(CVTLLTA+LNKOFF+1),LEN)    /* DSN of LNK lib  */
+    LNKVOL = Storage(D2x(LLTX+VOLOFF),6)          /* VOL of LNK lib  */
+    CHKAPF = Storage(D2x(LLTAPFTB+LKAPFOFF),1)    /* APF flag        */
+    If  bitand(CHKAPF,'80'x) = '80'x then LKAPF = 'Y'    /* flag on  */
+      else LKAPF = ' '                            /* APF flag off    */
+    LNKOFF   = LNKOFF + 44 + 1                    /*next entry in LLT*/
+    VOLOFF   = VOLOFF + 8                         /*next vol in LLTX */
+    LKAPFOFF = LKAPFOFF + 1               /* next entry in LLTAPFTB  */
+    LNKPOS   = Right(I,3)                         /*position in list */
+    RELLKPOS = Right('(+'I-1')',6)      /* relative position in list */
+    Queue LNKPOS  RELLKPOS '   ' LKAPF '  ' LNKVOL '  ' LKDSN
+  End
+End
+Return
+
+APF:                 /* APF List sub-routine                         */
+CVTAUTHL = C2d(Storage(D2x(CVT + 484),4))    /* point to auth lib tbl*/
+If CVTAUTHL <> C2d('7FFFF001'x) then do      /* dynamic list ?       */
+  NUMAPF   = C2d(Storage(D2x(CVTAUTHL),2))   /* # APF libs in table  */
+  APFOFF   = 2                               /* first ent in APF tbl */
+  Queue '     '
+  Queue 'APF Library List  ('NUMAPF' libraries):'
+  Queue '  ENTRY   VOLUME    DSNAME'
+  Do I = 1 to NUMAPF
+    LEN = C2d(Storage(D2x(CVTAUTHL+APFOFF),1)) /* length of entry    */
+    VOL = Storage(D2x(CVTAUTHL+APFOFF+1),6)    /* VOLSER of APF LIB  */
+    DSN = Storage(D2x(CVTAUTHL+APFOFF+1+6),LEN-6)  /* DSN of apflib  */
+    APFOFF = APFOFF + LEN +1
+    APFPOS   = Right(I,4)                      /*position in APF list*/
+    Queue '  'APFPOS '  ' VOL '  ' DSN
+  End
+End
+Else Do
+  ECVT     = C2d(Storage(D2x(CVT + 140),4))    /* point to CVTECVT   */
+  ECVTCSVT = C2d(Storage(D2x(ECVT + 228),4))   /* point to CSV table */
+  APFA = C2d(Storage(D2x(ECVTCSVT + 12),4))    /* APFA               */
+  AFIRST = C2d(Storage(D2x(APFA + 8),4))       /* First entry        */
+  ALAST  = C2d(Storage(D2x(APFA + 12),4))      /* Last  entry        */
+  LASTONE = 0   /* flag for end of list     */
+  NUMAPF = 1    /* tot # of entries in list */
+  Do forever
+    DSN.NUMAPF = Storage(D2x(AFIRST+24),44)    /* DSN of APF library */
+    DSN.NUMAPF = Strip(DSN.NUMAPF,'T')         /* remove blanks      */
+    CKSMS = Storage(D2x(AFIRST+4),1)           /* DSN of APF library */
+    if  bitand(CKSMS,'80'x)  = '80'x           /*  SMS data set?     */
+      then VOL.NUMAPF = '*SMS* '               /* SMS control dsn    */
+    else VOL.NUMAPF = Storage(D2x(AFIRST+68),6)    /* VOL of APF lib */
+    If Substr(DSN.NUMAPF,1,1) <> X2c('00')     /* check for deleted  */
+      then NUMAPF = NUMAPF + 1                 /*   APF entry        */
+    AFIRST = C2d(Storage(D2x(AFIRST + 8),4))   /* next  entry        */
+    if LASTONE = 1 then leave
+    If  AFIRST = ALAST then LASTONE = 1
+  End
+  Queue '     '
+  Queue 'APF Library List  - Dynamic ('NUMAPF - 1' libraries):'
+  Queue '  ENTRY   VOLUME    DSNAME'
+  Do I = 1 to NUMAPF-1
+    APFPOS   = Right(I,4)                      /*position in APF list*/
+    Queue '  'APFPOS '  ' VOL.I '  ' DSN.I
+  End
+End
+Return
+
+SVC:                 /* SVC information sub-routine                  */
+/*********************************************************************/
+/* See SYS1.MODGEN(IHASVC) for descriptions of SVC attributes        */
+/*********************************************************************/
+CVTABEND  = C2d(Storage(D2x(CVT+200),4))     /* point to CVTABEND    */
+SCVT      = CVTABEND        /* this is the SCVT -  mapped by IHASCVT */
+SCVTSVCT  = C2d(Storage(D2x(SCVT+132),4))    /* point to SVCTABLE    */
+SCVTSVCR  = C2d(Storage(D2x(SCVT+136),4))    /* point to SVC UPD TBL */
+Call FIND_NUC 'IGCERROR'     /* Find addr of IGCERROR in NUC MAP     */
+IGCERROR_ADDR = RESULT       /* Save address of IGCERROR             */
+Call FIND_NUC 'IGCRETRN'     /* Find addr of IGCRETRN in NUC MAP     */
+IGCRETRN_ADDR = RESULT       /* Save address of IGCRETRN             */
+Call FIND_NUC 'IGXERROR'     /* Find addr of IGXERROR in NUC MAP     */
+IGXERROR_ADDR = RESULT       /* Save address of IGXERROR             */
+Call VMAP 'NODISP'      /* call virt. stor map routine, "no display" */
+/*********************************************************************/
+/* The following code is needed to prevent errors in FIND_SVC_LOC    */
+/* routine "Select" because the VMAP sub-routine sets the address    */
+/* variables to "N/A" when MLPA/E-MLPA/FLPA/E-FLPA do not exist.     */
+/*********************************************************************/
+If CVTMLPAS = 'N/A' then CVTMLPAS = 0  /* MLPA   strt does not exist */
+If CVTMLPAE = 'N/A' then CVTMLPAE = 0  /* MLPA   end  does not exist */
+If CVTFLPAS = 'N/A' then CVTFLPAS = 0  /* FLPA   strt does not exist */
+If CVTFLPAE = 'N/A' then CVTFLPAE = 0  /* FLPA   end  does not exist */
+If CVTEFLPS = 'N/A' then CVTEFLPS = 0  /* E-FLPA strt does not exist */
+If CVTEFLPE = 'N/A' then CVTEFLPE = 0  /* E-FLPA end  does not exist */
+If CVTEMLPS = 'N/A' then CVTEMLPS = 0  /* E-MLPA strt does not exist */
+If CVTEMLPE = 'N/A' then CVTEMLPE = 0  /* E-MLPA end  does not exist */
+/*********************************************************************/
+/* A little house keeping                                            */
+/*********************************************************************/
+SVCACT_TOT    = 0   /* total number of active std SVCs               */
+SVCUNUSED_TOT = 0   /* total number of unused std SVCs               */
+SVCAPF_TOT    = 0   /* total number of std SVCs requiring APF        */
+SVCESR_T1_TOT = 0   /* total number of active Type 1 ESR SVCs        */
+SVCESR_T2_TOT = 0   /* total number of active Type 2 ESR SVCs        */
+SVCESR_T3_TOT = 0   /* total number of active Type 3/4 ESR SVCs      */
+SVCESR_T6_TOT = 0   /* total number of active Type 6 ESR SVCs        */
+/*********************************************************************/
+/* Standard SVC table display loop                                   */
+/*********************************************************************/
+Queue '     '
+Queue 'SVC Table:'
+Queue '  Num Hex  EP-Addr  Location  AM TYP APF ESR ASF AR NP UP' ,
+      'CNT Old-EPA  LOCKS'
+Do SVCLST = 0 to 255
+  SVCTENT  = Storage(D2x(SCVTSVCT+(SVCLST*8)),8)  /* SVC Table Entry */
+  SVCTENTU = Storage(D2x(SCVTSVCR+(SVCLST*24)),24) /* SVC UP TBL ENT */
+  SVCOLDA  = Substr(SVCTENTU,1,4)            /* OLD EP Address       */
+  SVCOLDAR = C2x(SVCOLDA)                    /* OLD addr readable    */
+  SVCOLDAR = Right(SVCOLDAR,8,'0')           /* ensure leading zeros */
+  SVCURCNT = C2d(Substr(SVCTENTU,21,2))      /* SVC update count     */
+  SVCAMODE = Substr(SVCTENT,1,1)             /* AMODE indicator      */
+  SVCEPA   = Substr(SVCTENT,1,4)             /* Entry point addr     */
+  SVCEPAR  = C2x(SVCEPA)                     /* EPA - readable       */
+  SVCEPAR  = Right(SVCEPAR,8,'0')            /* ensure leading zeros */
+  SVCATTR1 = Substr(SVCTENT,5,1)             /* SVC attributes       */
+  SVCATTR3 = Substr(SVCTENT,6,1)             /* SVC attributes       */
+  SVCLOCKS = Substr(SVCTENT,7,1)             /* Lock attributes      */
+  /**************************/
+  /* Save EPAs of ESR SVCs  */
+  /**************************/
+  If SVCLST = 109 then SVC109AD = SVCEPA
+  If SVCLST = 116 then SVC116AD = SVCEPA
+  If SVCLST = 122 then SVC122AD = SVCEPA
+  If SVCLST = 137 then SVC137AD = SVCEPA
+  /**************************/
+  /*  Check amode           */
+  /**************************/
+  If Bitand(SVCAMODE,'80'x) = '80'x then SVC_AMODE = '31'
+    Else SVC_AMODE = '24'
+  /**************************/
+  /*  Check SVC type flag   */
+  /**************************/
+  Select                                     /* determine SVC type   */
+    When Bitand(SVCATTR1,'C0'x) = 'C0'x then SVCTYPE = '3/4'
+    When Bitand(SVCATTR1,'80'x) = '80'x then SVCTYPE = ' 2 '
+    When Bitand(SVCATTR1,'20'x) = '20'x then SVCTYPE = ' 6 '
+    When Bitand(SVCATTR1,'00'x) = '00'x then SVCTYPE = ' 1 '
+    Otherwise SVCTYPE = '???'
+  End /* select */
+  If SVCLST = 109 then SVCTYPE = ' 3 '  /* 109 is type 3 ESR, not 2  */
+  /**************************/
+  /*  Check other SVC flags */
+  /**************************/
+  SVCAPF = '   ' ; SVCESR = '   ' ; SVCNP = '  '  /* init as blanks  */
+  SVCASF = '   ' ; SVCAR  = '  '  ; SVCUP = '  '  /* init as blanks  */
+  If Bitand(SVCATTR1,'08'x) = '08'x then SVCAPF  = 'APF'
+  If Bitand(SVCATTR1,'04'x) = '04'x then SVCESR  = 'ESR'
+  If Bitand(SVCATTR1,'02'x) = '02'x then SVCNP   = 'NP'
+  If Bitand(SVCATTR1,'01'x) = '01'x then SVCASF  = 'ASF'
+  If Bitand(SVCATTR3,'80'x) = '80'x then SVCAR   = 'AR'
+  If SVCURCNT <> 0 then SVCUP = 'UP'   /* this SVC has been updated  */
+  If SVCURCNT = 0 then do              /* svc never updated          */
+    SVCURCNT = '   '
+    SVCOLDAR = '        '
+  End
+  Else do /* most, if not all UP nums are sngl digit- center display */
+   If SVCURCNT < 10 then SVCURCNT = Right(SVCURCNT,2,' ') || ' '
+     Else SVCURCNT = Right(SVCURCNT,3,' ')
+  End /* else do */
+  /**************************/
+  /*  Check lock flags      */
+  /**************************/
+  SVCLL    = ' '  ; SVCCMS  = ' ' ; SVCOPT = ' '  /* init as blanks  */
+  SVCALLOC = ' '  ; SVCDISP = ' '                 /* init as blanks  */
+  If Bitand(SVCLOCKS,'80'x) = '80'x then SVCLL    = 'L'  /* LOCAL    */
+  If Bitand(SVCLOCKS,'40'x) = '40'x then SVCCMS   = 'C'  /* CMS      */
+  If Bitand(SVCLOCKS,'20'x) = '20'x then SVCOPT   = 'O'  /* OPT      */
+  If Bitand(SVCLOCKS,'10'x) = '10'x then SVCALLOC = 'S'  /* SALLOC   */
+  If Bitand(SVCLOCKS,'08'x) = '08'x then SVCDISP  = 'D'  /* DISP     */
+  /*********************************/
+  /*  location, location, location */
+  /*********************************/
+  SVCLOCA = Bitand(SVCEPA,'7FFFFFFF'x)       /* zero high order bit  */
+  SVCLOCA = C2d(SVCLOCA)                     /* need dec. for compare*/
+  Call FIND_SVC_LOC SVCLOCA                  /* determine SVC loc    */
+  SVCLOC = RESULT                            /* Save Result          */
+
+  If SVCLOCA = IGCERROR_ADDR | ,             /* this SVC             */
+     SVCLOCA = IGCRETRN_ADDR then do         /*          is not used */
+    SVC_AMODE = '  '                         /* blank out amode      */
+    SVCAPF = '*** Not Used ***'              /* replace other        */
+    SVCESR = ''                              /*   fields to line     */
+    SVCASF = ''                              /*     up "locks" due   */
+    SVCAR  = ''                              /*       to "not used"  */
+    SVCNP  = ''                              /*         display      */
+    SVCUP  = ''                              /*                      */
+    SVCURCNT = ''                            /*                      */
+    SVCOLDAR = '          '                  /*                      */
+    SVCUNUSED_TOT = SVCUNUSED_TOT + 1        /* add 1 to unused tot  */
+  End /* If SVCLOCA = IGCERROR_ADDR */
+  Else do /* used SVC */
+    SVCACT_TOT = SVCACT_TOT + 1              /* add 1 to tot active  */
+    If SVCAPF  = 'APF' then ,
+       SVCAPF_TOT = SVCAPF_TOT + 1           /* add 1 to APF total   */
+  End /* Else do */
+
+  Queue ' '  Right(SVCLST,3,' ') '('Right(D2x(SVCLST),2,0)')' ,
+    SVCEPAR SVCLOC SVC_AMODE SVCTYPE SVCAPF SVCESR SVCASF ,
+    SVCAR SVCNP SVCUP SVCURCNT SVCOLDAR ,
+    SVCLL || SVCCMS || SVCOPT || SVCALLOC || SVCDISP
+End /* Do SVCLST = 0 to 255 */
+/*********************************************************************/
+/* ESR SVC tables display loop                                       */
+/*********************************************************************/
+Do SVCESRL = 1 to 4  /* ESR display loop  */
+  If SVCESRL = 1 then do
+    SVCEAD = C2d(SVC116AD)                   /* Type 1 ESR tbl       */
+    SVCEHD = 'Type 1 (SVC 116'              /* Type/SVC for heading */
+  End
+  If SVCESRL = 2 then do
+    SVCEAD = C2d(SVC122AD)                   /* Type 2 ESR tbl       */
+    SVCEHD = 'Type 2 (SVC 122'              /* Type/SVC for heading */
+  End
+  If SVCESRL = 3 then do
+    SVCEAD = C2d(SVC109AD)                   /* Type 3 ESR tbl       */
+    SVCEHD = 'Type 3 (SVC 109'              /* Type/SVC for heading */
+  End
+  If SVCESRL = 4 then do
+    SVCEAD = C2d(SVC137AD)                   /* Type 6 ESR tbl       */
+    SVCEHD = 'Type 6 (SVC 137'              /* Type/SVC for heading */
+  End
+  SVCESRMX = C2d(Storage(D2x(SVCEAD+4),4))   /* Max # ESR entries    */
+  Queue '     '
+  Queue 'SVC Table for ESR' SVCEHD '- Maximum ESR Number Supported' ,
+        'is' SVCESRMX'):'
+  Queue '  Num Hex  EP-Addr  Location  AM TYP APF ASF AR NP' ,
+        'LOCKS'
+  SVCEAD = SVCEAD + 8                        /* bump past ESR hdr    */
+  Do SVCELST = 0 to SVCESRMX
+    SVCETENT  = Storage(D2x(SVCEAD+(SVCELST*8)),8) /* SVC Tbl Entry  */
+    SVCEAMODE = Substr(SVCETENT,1,1)         /* AMODE indicator      */
+    SVCEEPA   = Substr(SVCETENT,1,4)         /* Entry point addr     */
+    SVCEEPAR  = C2x(SVCEEPA)                 /* EPA - readable       */
+    SVCEEPAR  = Right(SVCEEPAR,8,'0')        /* ensure leading zeros */
+    SVCEATTR1 = Substr(SVCETENT,5,1)         /* SVC attributes       */
+    SVCEATTR3 = Substr(SVCETENT,6,1)         /* SVC attributes       */
+    SVCELOCKS = Substr(SVCETENT,7,1)         /* Lock attributes      */
+  /**************************/
+  /*  Check amode           */
+  /**************************/
+  If Bitand(SVCEAMODE,'80'x) = '80'x then SVCE_AMODE = '31'
+    Else SVCE_AMODE = '24'
+  /**************************/
+  /*  Check SVC type flag   */
+  /**************************/
+  Select                                     /* determine SVC type   */
+    When Bitand(SVCEATTR1,'C0'x) = 'C0'x then SVCETYPE = '3/4'
+    When Bitand(SVCEATTR1,'80'x) = '80'x then SVCETYPE = ' 2 '
+    When Bitand(SVCEATTR1,'20'x) = '20'x then SVCETYPE = ' 6 '
+    When Bitand(SVCEATTR1,'00'x) = '00'x then SVCETYPE = ' 1 '
+    Otherwise SVCETYPE = '???'
+  End /* select */
+  /**************************/
+  /*  Check other SVC flags */
+  /**************************/
+  SVCEAPF = '   ' ; SVCENP = '  '  /* init as blanks  */
+  SVCEASF = '   ' ; SVCEAR = '  '  /* init as blanks  */
+  SVCEESR = '   '
+  If Bitand(SVCEATTR1,'08'x) = '08'x then SVCEAPF  = 'APF'
+  If Bitand(SVCEATTR1,'04'x) = '04'x then SVCEESR  = 'ESR'
+  If Bitand(SVCEATTR1,'02'x) = '02'x then SVCENP   = 'NP'
+  If Bitand(SVCEATTR1,'01'x) = '01'x then SVCEASF  = 'ASF'
+  If Bitand(SVCEATTR3,'80'x) = '80'x then SVCEAR   = 'AR'
+  /**************************/
+  /*  Check lock flags      */
+  /**************************/
+  SVCELL    = ' '  ; SVCECMS  = ' ' ; SVCEOPT = ' ' /* init as blanks*/
+  SVCEALLOC = ' '  ; SVCEDISP = ' '                 /* init as blanks*/
+  If Bitand(SVCELOCKS,'80'x) = '80'x then SVCELL    = 'L' /* LOCAL   */
+  If Bitand(SVCELOCKS,'40'x) = '40'x then SVCECMS   = 'C' /* CMS     */
+  If Bitand(SVCELOCKS,'20'x) = '20'x then SVCEOPT   = 'O' /* OPT     */
+  If Bitand(SVCELOCKS,'10'x) = '10'x then SVCEALLOC = 'S' /* SALLOC  */
+  If Bitand(SVCELOCKS,'08'x) = '08'x then SVCEDISP  = 'D' /* DISP    */
+  /*********************************/
+  /*  location, location, location */
+  /*********************************/
+  SVCELOCA = Bitand(SVCEEPA,'7FFFFFFF'x)     /* zero high order bit  */
+  SVCELOCA = C2d(SVCELOCA)                   /* need dec. for compare*/
+  Call FIND_SVC_LOC SVCELOCA                 /* determine SVC loc    */
+  SVCELOC = RESULT                           /* Save Result          */
+
+  If SVCELOCA = IGXERROR_ADDR then do        /* this SVC is not used */
+    SVCE_AMODE = '  '                        /* blank out amode      */
+    SVCEAPF = '* Unused *'                   /* replace other fields */
+    SVCEASF = ''                             /*  to line up "locks"  */
+    SVCEAR  = ''                             /*   due to "unused"    */
+    SVCENP  = ''                             /*    display           */
+  End /* If SVCELOCA = IGXERROR_ADDR */
+  Else do /* used SVC */
+    If SVCESRL = 1 then ,
+       SVCESR_T1_TOT = SVCESR_T1_TOT + 1     /* add 1 to TYPE 1 tot  */
+    If SVCESRL = 2 then ,
+       SVCESR_T2_TOT = SVCESR_T2_TOT + 1     /* add 1 to TYPE 2 tot  */
+    If SVCESRL = 3 then ,
+       SVCESR_T3_TOT = SVCESR_T3_TOT + 1     /* add 1 to TYPE 3/4 tot*/
+    If SVCESRL = 4 then ,
+       SVCESR_T6_TOT = SVCESR_T6_TOT + 1     /* add 1 to TYPE 6 tot  */
+  End /* Else do */
+
+  Queue ' '  Right(SVCELST,3,' ') '('Right(D2x(SVCELST),2,0)')' ,
+    SVCEEPAR SVCELOC SVCE_AMODE SVCETYPE SVCEAPF SVCEASF ,
+    SVCEAR SVCENP ,
+    SVCELL || SVCECMS || SVCEOPT || SVCEALLOC || SVCEDISP
+  End
+
+End /* Do SVCESRL = 1 to 4 */
+Queue '    '
+Queue '  SVC Usage Summary:'
+Queue '    Total number of active standard SVCs (including ESR' ,
+      'slots) =' SVCACT_TOT
+Queue '    Total number of unused standard SVCs =' SVCUNUSED_TOT
+Queue '    Total number of active standard SVCs' ,
+      'requiring APF auth =' SVCAPF_TOT
+Queue '    Total number of active Type 1   ESR SVCs =' SVCESR_T1_TOT
+Queue '    Total number of active Type 2   ESR SVCs =' SVCESR_T2_TOT
+Queue '    Total number of active Type 3/4 ESR SVCs =' SVCESR_T3_TOT
+Queue '    Total number of active Type 6   ESR SVCs =' SVCESR_T6_TOT
+Return
+
+FIND_SVC_LOC:  /* determine virtual storage location of SVC  */
+Arg SVC_LOC
+Select
+  When SVC_LOC >= X2d(VVSTRT)    & SVC_LOC <= X2d(VVEND)     ,
+       then SVCLOC = 'PRIVATE  ' /* never, but coded anyway */
+  When SVC_LOC >= X2d(GDACSAH)   & SVC_LOC <= X2d(CSAEND)    ,
+       then SVCLOC = 'CSA      '
+  When SVC_LOC >= X2d(CVTMLPAS)  & SVC_LOC <= X2d(CVTMLPAE)  ,
+       then SVCLOC = 'MLPA     '
+  When SVC_LOC >= X2d(CVTFLPAS)  & SVC_LOC <= X2d(CVTFLPAE)  ,
+       then SVCLOC = 'FLPA     '
+  When SVC_LOC >= X2d(CVTPLPAS)  & SVC_LOC <= X2d(CVTPLPAE)  ,
+       then SVCLOC = 'PLPA     '
+  When SVC_LOC >= X2d(GDASQAH)   & SVC_LOC <= X2d(SQAEND)    ,
+       then SVCLOC = 'SQA      '
+  When SVC_LOC >= X2d(CVTRWNS)   & SVC_LOC <= X2d(CVTRWNE)   ,
+       then SVCLOC = 'R/W Nuc  '
+  When SVC_LOC >= X2d(RONUCSZB)  & SVC_LOC <= X2d('FFFFFF')  ,
+       then SVCLOC = 'R/O Nuc  '
+  When SVC_LOC >= X2d('1000000') & SVC_LOC <= X2d(CVTRONE)   ,
+       then SVCLOC = 'E-R/O Nuc'
+  When SVC_LOC >= X2d(CVTERWNS)  & SVC_LOC <= X2d(CVTERWNE)  ,
+       then SVCLOC = 'E-R/W Nuc'
+  When SVC_LOC >= X2d(GDAESQAH)  & SVC_LOC <= X2d(ESQAEND)   ,
+       then SVCLOC = 'E-SQA    '
+  When SVC_LOC >= X2d(CVTEPLPS)  & SVC_LOC <= X2d(CVTEPLPE)  ,
+       then SVCLOC = 'E-PLPA   '
+  When SVC_LOC >= X2d(CVTEFLPS)  & SVC_LOC <= X2d(CVTEFLPE)  ,
+       then SVCLOC = 'E-FLPA   '
+  When SVC_LOC >= X2d(CVTEMLPS)  & SVC_LOC <= X2d(CVTEMLPE)  ,
+       then SVCLOC = 'E-MLPA   '
+  When SVC_LOC >= X2d(GDAECSAH)  & SVC_LOC <= X2d(ECSAEND)   ,
+       then SVCLOC = 'E-CSA    '
+  When SVC_LOC >= X2d(GDAEPVTH)  & SVC_LOC <= X2d(EPVTEND)   ,
+       then SVCLOC = 'E-PRIVATE' /* never, but coded anyway */
+  Otherwise SVCLOC = '????     '
+End /* select */
+Return SVCLOC
+
+FIND_NUC: /* Find EP address of "ARG" in NUC MAP  */
+Arg NUC_NAME
+CVTNUCMP  = C2d(Storage(D2x(CVT+1200),4))    /* NUC map address      */
+NUCMAPEND = C2d(Storage(D2x(CVTNUCMP+8),4))  /* End of nucmap        */
+ /* NUCMAPLEN = C2d(Storage(D2x(CVTNUCMP+13),3)) */ /* tbl length    */
+NUC_CURA  = CVTNUCMP+16                      /* Curent tbl entry     */
+Do while  NUC_CURA <  NUCMAPEND              /* go though tbl        */
+  NUC_EP    = Storage(D2x(NUC_CURA),8)       /* Nuc EP name          */
+  If NUC_EP = NUC_NAME then do               /* NUC_NAME found?      */
+    NUC_ADDR = C2d(Storage(D2x(NUC_CURA+8),4)) /* yes, save addr     */
+    Leave                                    /* leave this loop      */
+  End /* If NUC_EP = NUC_NAME */
+  Else NUC_CURA = NUC_CURA + 16              /* bump to next entry   */
+End /* do while */
+Return NUC_ADDR
+
+XLATE_NONDISP:       /* translate non-display characters to a "."    */
+Arg XLATEPRM
+XLATELEN = Length(XLATEPRM) /* length of parm passed to routine      */
+Do I = 1 to XLATELEN                      /* check each byte for     */
+  If (Substr(XLATEPRM,I,1) >= '00'x & ,   /* non-display characters  */
+    Substr(XLATEPRM,I,1) < '40'x ) | ,    /* and replace each        */
+    Substr(XLATEPRM,I,1) = 'FF'x  then ,  /* character that          */
+    XLATEPRM = OVERLAY('.',XLATEPRM,I)    /* is non-displayable      */
+End                                       /* with a period (.)       */
+Return XLATEPRM
+
+STORAGE_GDA_LDA:     /* GDA/LDA Storage values sub-routine           */
+ASCB     = C2d(Storage(224,4))               /* point to cur ASCB    */
+ASCBLDA  = C2d(Storage(D2x(ASCB + 48),4))    /* point to LDA         */
+CVTGDA   = C2d(Storage(D2x(CVT + 560),4))    /* point to GDA         */
+LDASTRTA = Storage(D2x(ASCBLDA + 60),4)      /* point to V=V start   */
+LDASTRTA = C2x(LDASTRTA)                     /* display in hex       */
+LDASIZEA = C2d(Storage(D2x(ASCBLDA + 64),4)) /* point to V=V size    */
+LDASIZEA = LDASIZEA/1024                     /* convert to Kbytes    */
+LDASTRTS = Storage(D2x(ASCBLDA + 92),4)      /* pt. to sysarea start */
+LDASTRTS = C2x(LDASTRTS)                     /* display in hex       */
+LDASIZS  = C2d(Storage(D2x(ASCBLDA + 96),4)) /* pt. to sysarea size  */
+LDASIZS  = LDASIZS/1024                      /* convert to Kbytes    */
+GDAPVTSZ = C2d(Storage(D2x(CVTGDA + 164),4)) /* point to MAX PVT<16M */
+GDAPVTSZ = GDAPVTSZ/1024                     /* convert to Kbytes    */
+GDAEPVTS = C2d(Storage(D2x(CVTGDA + 172),4)) /* point to MAX PVT>16M */
+GDAEPVTS = GDAEPVTS/1024/1024                /* convert to Mbytes    */
+GDACSASZ = C2d(Storage(D2x(CVTGDA + 112),4)) /* point to CSA<16M     */
+GDACSASZ = GDACSASZ/1024                     /* convert to Kbytes    */
+GDAECSAS = C2d(Storage(D2x(CVTGDA + 128),4)) /* point to CSA>16M     */
+GDAECSAS = GDAECSAS/1024                     /* convert to Kbytes    */
+GDASQASZ = C2d(Storage(D2x(CVTGDA + 148),4)) /* point to SQA<16M     */
+GDASQASZ = GDASQASZ/1024                     /* convert to Kbytes    */
+GDAESQAS = C2d(Storage(D2x(CVTGDA + 156),4)) /* point to SQA>16M     */
+GDAESQAS = GDAESQAS/1024                     /* convert to Kbytes    */
+GDAVRSZ  = C2d(Storage(D2x(CVTGDA + 196),4)) /* point to V=R global  */
+GDAVRSZ  = GDAVRSZ/1024                      /* convert to Kbytes    */
+GDAVREGS = C2d(Storage(D2x(CVTGDA + 200),4)) /* point to V=R default */
+GDAVREGS = GDAVREGS/1024                     /* convert to Kbytes    */
+GDA_CSA_ALLOC  = C2d(Storage(D2x(CVTGDA + 432),4)) /* CSA amt alloc  */
+GDA_CSA_ALLOC  = Format(GDA_CSA_ALLOC/1024,,0)     /* conv to Kbytes */
+GDA_ECSA_ALLOC = C2d(Storage(D2x(CVTGDA + 436),4)) /* ECSA amt alloc */
+GDA_ECSA_ALLOC = Format(GDA_ECSA_ALLOC/1024,,0)    /* conv to Kbytes */
+GDA_SQA_ALLOC  = C2d(Storage(D2x(CVTGDA + 440),4)) /* SQA amt alloc  */
+GDA_SQA_ALLOC  = Format(GDA_SQA_ALLOC/1024,,0)     /* conv to Kbytes */
+GDA_ESQA_ALLOC = C2d(Storage(D2x(CVTGDA + 444),4)) /* ESQA amt alloc */
+GDA_ESQA_ALLOC = Format(GDA_ESQA_ALLOC/1024,,0)    /* conv to Kbytes */
+GDA_CSA_CONV   = C2d(Storage(D2x(CVTGDA + 448),4)) /* CSA => SQA amt */
+GDA_CSA_CONV   = Format(GDA_CSA_CONV/1024,,0)      /* conv to Kbytes */
+GDA_ECSA_CONV  = C2d(Storage(D2x(CVTGDA + 452),4)) /* ECSA=>ESQA amt */
+GDA_ECSA_CONV  = Format(GDA_ECSA_CONV/1024,,0)     /* conv to Kbytes */
+/*********************************************************************/
+/* High Water Marks for SQA/ESQA/CSA/ECSA added in OS/390 R10        */
+/*********************************************************************/
+If Bitand(CVTOSLV2,'01'x) = '01'x then do    /* OS/390 R10 and above */
+  GDASQAHWM  = C2d(Storage(D2x(CVTGDA + 536),4))   /* SQA HWM        */
+  GDASQAHWM  = Format(GDASQAHWM/1024,,0)           /* conv to Kbytes */
+  GDAESQAHWM = C2d(Storage(D2x(CVTGDA + 540),4))   /* ESQA HWM       */
+  GDAESQAHWM = Format(GDAESQAHWM/1024,,0)          /* conv to Kbytes */
+  If Bitand(CVTOSLV5,'08'x) = '08'x then do  /* z/OS 1.10 and above  */
+    GDATotalCSAHWM  = C2d(Storage(D2x(CVTGDA+552),4)) /* CSA HWM     */
+    GDATotalCSAHWM  = Format(GDATotalCSAHWM/1024,,0)  /* conv to Kb  */
+    GDATotalECSAHWM = C2d(Storage(D2x(CVTGDA+556),4)) /* ECSA HWM    */
+    GDATotalECSAHWM = Format(GDATotalECSAHWM/1024,,0) /* conv to Kb  */
+    GDACSAHWM       = GDATotalCSAHWM   /* set var used for VMAP disp */
+    GDAECSAHWM      = GDATotalECSAHWM  /* set var used for VMAP disp */
+  End
+  Else do  /* use pre z/OS 1.10 values for CSA/ECSA HWM              */
+    GDACSAHWM  = C2d(Storage(D2x(CVTGDA + 544),4)) /* CSA HWM        */
+    GDACSAHWM  = Format(GDACSAHWM/1024,,0)         /* conv to Kbytes */
+    GDAECSAHWM = C2d(Storage(D2x(CVTGDA + 548),4)) /* ECSA HWM       */
+    GDAECSAHWM = Format(GDAECSAHWM/1024,,0)        /* conv to Kbytes */
+  End
+End
+Return
+
+EXTRACT_SYSPARMS:    /* Extract IEASYSxx values from the IPA         */
+Parse arg IEASPARM
+IEASPARM = Strip(IEASPARM,'T')               /* remove trailing blnks*/
+If IEASPARM = '' then return         /*"blank" parm in IHAIPA*/
+/*********************************************************************/
+/* This next section of code removes IEASYSxx parameters from the    */
+/* IPA output display for parms that are obsolete or undocumented    */
+/* but still have to be accounted for when parsing out the parms     */
+/* and values from the IPA control block.                            */
+/*********************************************************************/
+If Bitand(CVTOSLV3,'08'x) = '08'x then ,     /* z/OS 1.3 and above   */
+  If Substr(IEASPARM,1,3) = 'IPS'then return /* remove IPS parm      */
+If Bitand(CVTOSLV3,'02'x) = '02'x then ,     /* z/OS 1.5 and above   */
+  If Pos('ILM',IEASPARM) <> 0  then return   /* remove ILM parms     */
+If Bitand(CVTOSLV5,'04'x) = '04'x then do    /* z/OS 1.11 and above  */
+  If Pos('IQP',IEASPARM)  <> 0 then return   /* remove IQP parm      */
+  If Pos('CPCR',IEASPARM) <> 0 then return   /* remove CPCR parm     */
+  If Pos('DDM',IEASPARM)  <> 0 then return   /* remove DDM parm      */
+End
+If Bitand(CVTOSLV5,'01'x) = '01'x then do    /* z/OS 1.13 and above  */
+  If Pos('RTLS',IEASPARM) <> 0 then return   /* remove RTLS parm     */
+End
+/*********************************************************************/
+IPAOFF = ((I-1) * 8)                         /* offset to next entry */
+IPASTOR = D2x(ECVTIPA + 2152 + IPAOFF)       /* point to PDE addr    */
+IPAPDE  = C2x(Storage((IPASTOR),8))          /* point to PDE         */
+If IPAPDE = 0 then return   /* parm not specified and has no default */
+TOTPRMS = TOTPRMS + 1    /* tot num of specified or defaulted parms  */
+IPAADDR = Substr(IPAPDE,1,8)                 /* PARM address         */
+IPALEN  = X2d(Substr(IPAPDE,9,4))            /* PARM length          */
+IPAPRM  = Storage((IPAADDR),IPALEN)          /* PARM                 */
+IPASRC  = Substr(IPAPDE,13,4)                /* PARM source          */
+If X2d(IPASRC) = 65535 then PRMSRC = 'Operator'   /* operator parm   */
+Else
+  If X2d(IPASRC) = 0     then PRMSRC = 'Default'  /* default  parm   */
+Else
+  PRMSRC = 'IEASYS' || X2c(IPASRC)           /* IEASYSxx parm        */
+PRMLINE = '    'IEASPARM'='IPAPRM
+  /**************************************************/
+  /* This check just below is for parms that do not */
+  /* have an equal sign in IEASYSxx.                */
+  /**************************************************/
+If IEASPARM = 'PRESCPU' | ,
+   IEASPARM = 'WARNUND' | ,
+   IEASPARM = 'CVIO'    | ,
+   IEASPARM = 'CLPA' then  PRMLINE = '    'IEASPARM
+  Else PRMLINE = '    'IEASPARM'='IPAPRM
+PRMLINE.TOTPRMS = IEASPARM PRMLINE PRMSRC
+PRMLINE.0 = TOTPRMS
+Return
+
+BUILD_IPAPDETB:      /* Build table for lookup for IPA values        */
+NUM=1
+IPAPDETB.NUM = 'ALLOC   ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'APF     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'APG     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'BLDL    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'BLDLF   ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CLOCK   ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CLPA    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CMB     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CMD     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CON     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CONT    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'COUPLE  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CPQE    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CSA     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CSCBLOC ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'CVIO    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'DEVSUP  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'DIAG    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'DUMP    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'DUPLEX  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'EXIT    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'FIX     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'GRS     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'GRSCNF  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'GRSRNL  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'ICS     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'IOS     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'IPS     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'LNK     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'LNKAUTH ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'LOGCLS  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'LOGLMT  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'LOGREC  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'LPA     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'MAXCAD  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'MAXUSER ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'MLPA    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'MSTRJCL ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'NONVIO  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'NSYSLX  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'NUCMAP  ' ; NUM = NUM + 1
+If Bitand(CVTOSLV1,'04'x) = '04'x then do    /* OS/390 R3 and above  */
+   IPAPDETB.NUM = 'OMVS    ' ; NUM = NUM + 1
+End
+Else do
+   IPAPDETB.NUM = 'RESERVED' ; NUM = NUM + 1
+End
+IPAPDETB.NUM = 'OPI     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'OPT     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PAGE-OPR' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PAGE    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PAGNUM  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PAGTOTL ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PAK     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PLEXCFG ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PROD    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PROG    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'PURGE   ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'RDE     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'REAL    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'RER     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'RSU     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'RSVNONR ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'RSVSTRT ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SCH     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SMF     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SMS     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SQA     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SSN     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SVC     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SWAP    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SYSNAME ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'SYSP    ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'VAL     ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'VIODSN  ' ; NUM = NUM + 1
+IPAPDETB.NUM = 'VRREGN  ' ; NUM = NUM + 1
+If Bitand(CVTOSLV2,'80'x) = '80'x then do    /* OS/390 R4 and above  */
+   IPAPDETB.NUM = 'RTLS    ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV2,'04'x) = '04'x then do    /* OS/390 R8 and above  */
+   IPAPDETB.NUM = 'UNI     ' ; NUM = NUM + 1 /* added by APAR OW44581*/
+End
+If Bitand(CVTOSLV3,'20'x) = '20'x then do    /* z/OS 1.1 and above   */
+   IPAPDETB.NUM = 'ILMLIB  ' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'ILMMODE ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV3,'08'x) = '08'x then do    /* z/OS 1.3 and above   */
+   IPAPDETB.NUM = 'IKJTSO  ' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'LICENSE ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV3,'02'x) = '02'x then do    /* z/OS 1.5 and above   */
+   IPAPDETB.NUM = '' ; NUM = NUM + 1 /*"blank" def in IHAIPA */
+   IPAPDETB.NUM = 'HVSHARE ' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'ILM     ' ; NUM = NUM + 1
+ /********************************************************************/
+ /* If you have a z/OS 1.5 or z/OS 1.6 system without OA09649, you   */
+ /* may have to delete the next 3 lines of code.                     */
+ /********************************************************************/
+   IPAPDETB.NUM = '' ; NUM = NUM + 1 /*"blank" def in IHAIPA */
+   IPAPDETB.NUM = '' ; NUM = NUM + 1 /*"blank" def in IHAIPA */
+   IPAPDETB.NUM = 'PRESCPU ' ; NUM = NUM + 1 /* added by OA09649 */
+End
+If Bitand(CVTOSLV5,'40'x) = '40'x then do    /* z/OS 1.7 and above   */
+   NUM = NUM-3
+   IPAPDETB.NUM = 'DRMODE  ' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'CEE     ' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'PRESCPU ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV5,'10'x) = '10'x then do    /* z/OS 1.9 and above   */
+   IPAPDETB.NUM = 'LFAREA  ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV5,'08'x) = '08'x then do    /* z/OS 1.10 and above  */
+   IPAPDETB.NUM = 'CEA     ' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'HVCOMMON' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'AXR     ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV5,'08'x) = '08'x then do    /* z/OS 1.10 and above  */
+ /********************************************************************/
+ /* If you have z/OS 1.10 without OA27495, you may have to delete    */
+ /* the next line of code. If you have z/OS 1.9 with OA27495 and     */
+ /* wish to see the "ZZ" value, change the check above from:         */
+ /*   If Bitand(CVTOSLV5,'08'x) = '08'x then do                      */
+ /* to:                                                              */
+ /*   If Bitand(CVTOSLV5,'10'x) = '10'x then do                      */
+ /********************************************************************/
+   IPAPDETB.NUM = 'ZZ      ' ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV5,'04'x) = '04'x then do    /* z/OS 1.11 and above  */
+   NUM = NUM - 1
+   IPAPDETB.NUM = 'ZAAPZIIP' ; NUM = NUM + 1
+   IPAPDETB.NUM = 'IQP'      ; NUM = NUM + 1
+   IPAPDETB.NUM = 'CPCR'     ; NUM = NUM + 1
+   IPAPDETB.NUM = 'DDM'      ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV5,'02'x) = '02'x then do    /* z/OS 1.12 and above  */
+   IPAPDETB.NUM = 'AUTOR'    ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV5,'01'x) = '01'x then do    /* z/OS 1.13 and above  */
+   IPAPDETB.NUM = 'CATALOG'  ; NUM = NUM + 1
+   IPAPDETB.NUM = 'IXGCNF'   ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV6,'80'x) = '80'x then do    /* z/OS 2.1  and above  */
+   IPAPDETB.NUM = 'PAGESCM'  ; NUM = NUM + 1
+   IPAPDETB.NUM = 'WARNUND'  ; NUM = NUM + 1
+   IPAPDETB.NUM = 'HZS'      ; NUM = NUM + 1
+   IPAPDETB.NUM = 'GTZ'      ; NUM = NUM + 1
+   IPAPDETB.NUM = 'HZSPROC'  ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV6,'40'x) = '40'x then do    /* z/OS 2.2  and above  */
+   IPAPDETB.NUM = 'SMFLIM'   ; NUM = NUM + 1
+   IPAPDETB.NUM = 'IEFOPZ'   ; NUM = NUM + 1
+End
+If Bitand(CVTOSLV6,'10'x) = '10'x then do    /* z/OS 2.3  and above  */
+   IPAPDETB.NUM = 'RACF'     ; NUM = NUM + 1
+   IPAPDETB.NUM = 'FXE'      ; NUM = NUM + 1
+   IPAPDETB.NUM = 'IZU'      ; NUM = NUM + 1
+   IPAPDETB.NUM = 'SMFTBUFF' ; NUM = NUM + 1  /* APAR OA52828 */
+   IPAPDETB.NUM = 'DIAG1'    ; NUM = NUM + 1  /* IBM use only */
+   IPAPDETB.NUM = 'OSPROTECT'; NUM = NUM + 1  /* APAR OA54807 */
+   IPAPDETB.NUM = 'ICSF'     ; NUM = NUM + 1  /* APAR OA55378 */
+   IPAPDETB.NUM = 'ICSFPROC' ; NUM = NUM + 1  /* APAR OA55378 */
+End
+       /* RUCSA and BOOST on z/OS 2.3 with APARs OA56180 and OA57849 */
+If Bitand(CVTOSLV6,'08'x) = '08'x then do    /* z/OS 2.4  and above  */
+   IPAPDETB.NUM = 'RUCSA'    ; NUM = NUM + 1
+   IPAPDETB.NUM = 'BOOST'    ; NUM = NUM + 1
+End
+IPAPDETB.0 = NUM-1
+Return
+
+SPLIT_IPA_PAGE: /* Split up page data set parms to multiple lines */
+TOT_IPALINES = 0
+Do SPLIT = 1 to PRMLINE.0
+   TOT_IPALINES = TOT_IPALINES+1    /* add one total lines    */
+   IPA_PDE = Word(PRMLINE.SPLIT,1)  /* keyword                */
+   IPA_PRM = Word(PRMLINE.SPLIT,2)  /* value                  */
+   IPA_SRC = Word(PRMLINE.SPLIT,3)  /* IEASYSxx, dlft, or OPR */
+   IPA_LEN = Length(IPA_PRM)
+  If IPA_PDE = 'NONVIO' | IPA_PDE = 'PAGE' | ,
+     IPA_PDE = 'PAGE-OPR' | IPA_PDE = 'SWAP' then do
+    MORE  = 'YES' /* init flag for more subparms */
+    FIRST = 'YES' /* init flag for first subparm */
+    SPLITPOS = 1
+    Do until MORE = 'NO'
+      SPLITPOS = Pos(',',IPA_PRM)
+      If SPLITPOS = 0 then do
+        If FIRST = 'YES' then do
+          IPALINE.TOT_IPALINES = '    'IPA_PRM || ','
+          IPALINE.TOT_IPALINES = ,
+            Overlay(IPA_SRC,IPALINE.TOT_IPALINES,68)
+        End
+        Else do
+          MBLNK = ''
+          If IPA_PDE = 'NONVIO' then MBLNK = '  '     /* align   */
+          If IPA_PDE = 'PAGE-OPR' then MBLNK = '    ' /* align   */
+          IPALINE.TOT_IPALINES = MBLNK'          'IPA_PRM || ','
+          IPALINE.TOT_IPALINES = ,
+            Overlay(IPA_SRC,IPALINE.TOT_IPALINES,68)
+        End
+        MORE = 'NO'  /* no more subparms */
+      End /* if SPLITPOS = 0 */
+      Else do
+        IPAPRM_SPLIT = Substr(IPA_PRM,1,SPLITPOS)
+        If FIRST = 'YES' then IPALINE.TOT_IPALINES = '    'IPAPRM_SPLIT
+          Else do
+            MBLNK = ''
+            If IPA_PDE = 'NONVIO' then MBLNK = '  '     /* align   */
+            If IPA_PDE = 'PAGE-OPR' then MBLNK = '    ' /* align   */
+            IPALINE.TOT_IPALINES = MBLNK'          'IPAPRM_SPLIT
+          End
+        IPA_PRM  = Substr(IPA_PRM,SPLITPOS+1,IPA_LEN-SPLITPOS)
+        IPA_LEN =  Length(IPA_PRM)
+        TOT_IPALINES = TOT_IPALINES+1  /* add one total lines */
+        FIRST = 'NO'
+      End
+    End  /* do until more=no */
+  End
+  Else do
+    IPALINE.TOT_IPALINES = '    'IPA_PRM || ','
+    IPALINE.TOT_IPALINES = Overlay(IPA_SRC,IPALINE.TOT_IPALINES,68)
+  End
+End
+Return
+
+SORT_IPA: Procedure expose PRMLINE.
+/* bubble sort the IPA list */
+SORT_DONE = 0
+SORT_RECS = PRMLINE.0
+Do while SORT_DONE = 0
+  SORT_DONE = 1
+  Do I = 1 to SORT_RECS - 1
+    J = I + 1
+    If PRMLINE.I > PRMLINE.J then do
+      SORT_DONE = 0
+      TEMP_SORT = PRMLINE.J
+      PRMLINE.J = PRMLINE.I
+      PRMLINE.I = TEMP_SORT
+    End /* if */
+  End /* do i=1 to sort_recs */
+  SORT_RECS = SORT_RECS - 1
+End /* do while */
+Return
+
+GET_CPCSI:
+SI_OFF=0
+IRALCCT = C2d(Storage(D2x(RMCT+620),4))         /* point to IRALCCT  */
+                                                /*  (undocumented)   */
+If Bitand(CVTOSLV5,'08'x) = '08'x then , /* z/OS 1.10 and above      */
+  SI_OFF = 128      /* additional offset to CPC SI info in IRALCCT   */
+ /****************************************************************/
+ /* If you have z/OS 1.12 or z/OS 1.13 with z13 support          */
+ /* maintenance applied you will have to uncomment either the    */
+ /* first 2 lines or the 2nd 2 lines to fix the CPCSI display.   */
+ /* The 2nd set should work for z/OS 1.12 or z/OS 1.13 systems   */
+ /* that do have the maintenance and also for those systems that */
+ /* do not have the maintenance.                                 */
+ /****************************************************************/
+/*If Bitand(CVTOSLV5,'02'x) = '02'x then , */   /* z/OS 1.12 and >   */
+/*  SI_OFF = 384 */   /* additional offset to CPC SI info in IRALCCT */
+/*If C2x(Storage(D2x(IRALCCT+10),1)) <> '40' then , *//* z13 support */
+/*  SI_OFF = 384 */   /* additional offset to CPC SI info in IRALCCT */
+If Bitand(CVTOSLV6,'80'x) = '80'x then , /* z/OS 2.1  and above      */
+  SI_OFF = 384      /* additional offset to CPC SI info in IRALCCT   */
+ /****************************************************************/
+ /* The check below was added for a reported problem on          */
+ /* z/OS 2.3 at RSU1812 or RSU1903.  I'm not sure what APAR(s)   */
+ /* broke this or if the same APAR could apply to earlier z/OS   */
+ /* versions.                                                    */
+ /*                                                              */
+ /* If the CPU node display doesn't look right, delete the code  */
+ /* that changes the offset to 392 or comment it out.            */
+ /****************************************************************/
+If Bitand(CVTOSLV6,'10'x) = '10'x then       /* z/OS 2.3  and above  */
+  /* (MODEL='3906' | MODEL='3907') | */      /* z/OS 2.3 + z14       */
+  /* (MODEL='2964' | MODEL='2965') then */   /* z/OS 2.3 + z13       */
+  SI_OFF = 392      /* additional offset to CPC SI info in IRALCCT   */
+CPCSI_TYPE  = Storage(D2x(IRALCCT+332+SI_OFF),4)    /* Type          */
+CPCSI_MODEL = Storage(D2x(IRALCCT+336+SI_OFF),4)    /* Model         */
+CPCSI_MODEL = Strip(CPCSI_MODEL)                    /* Remove blanks */
+CPCSI_MAN   = Storage(D2x(IRALCCT+384+SI_OFF),16)   /* Manufacturer  */
+CPCSI_MAN   = Strip(CPCSI_MAN)                      /* Remove blanks */
+CPCSI_PLANT = Storage(D2x(IRALCCT+400+SI_OFF),4)    /* Plant         */
+CPCSI_PLANT = Strip(CPCSI_PLANT)                    /* Remove blanks */
+CPCSI_CPUID = Storage(D2x(IRALCCT+352+SI_OFF),16)   /* CPUID         */
+CPCSI_MODELID = Storage(D2x(IRALCCT+592+SI_OFF),4)  /* Model ID      */
+CPCSI_MODELID = Strip(CPCSI_MODELID)                /* Remove blanks */
+ /*   CPCSI_MODELID may not be valid on emulated    */
+ /*   z/OS systems like FLEX, HERC and z/PDT        */
+Return
+
+FORMAT_MEMSIZE:
+/****************************************************************/
+/* The following code is used to display the storage size in    */
+/* the largest possible unit.  For example, 1023G and 1025G are */
+/* displayed as 1023G and 1025G, but 1024G is displayed as 1T.  */
+/* The size passed to the routine must be in MB.                */
+/****************************************************************/
+Arg SIZE_IN_MB
+Select
+   When SIZE_IN_MB < 1024 then do
+     MUNITS = 'M'
+   End
+   When SIZE_IN_MB >= 1024 & SIZE_IN_MB < 1048576 then do
+     If SIZE_IN_MB/1024 == TRUNC(SIZE_IN_MB/1024) then do
+       SIZE_IN_MB = SIZE_IN_MB/1024
+       MUNITS = 'G'
+     End
+     Else MUNITS = 'M'
+   End
+   When SIZE_IN_MB >= 1048576 & SIZE_IN_MB < 1073741824 then do
+     If SIZE_IN_MB/1048576 == TRUNC(SIZE_IN_MB/1048576) then do
+       SIZE_IN_MB = SIZE_IN_MB/1048576
+       MUNITS = 'T'
+     End
+     Else do
+       If SIZE_IN_MB/1024 == TRUNC(SIZE_IN_MB/1024) then do
+         SIZE_IN_MB = SIZE_IN_MB/1024
+         MUNITS = 'G'
+       End
+       Else MUNITS = 'M'
+     End
+   End
+   When SIZE_IN_MB >= 1073741824 & ,
+        SIZE_IN_MB <= 17591112302592 then do
+     If SIZE_IN_MB/1073741824 == TRUNC(SIZE_IN_MB/1073741824) ,
+        then do
+       SIZE_IN_MB = SIZE_IN_MB/1073741824
+       MUNITS = 'P'
+     End
+     Else do
+       SIZE_IN_MB = SIZE_IN_MB/1048576
+       MUNITS = 'T'
+     End
+   End
+   When SIZE_IN_MB = 17592186040320 then do
+       SIZE_IN_MB = 'NOLIMIT'   /* 16384P */
+       MUNITS = ''
+   End
+   When SIZE_IN_MB > 17592186040320 then do
+       SIZE_IN_MB = '*NOLIMT'   /* >16384P  (16EB) ?? */
+       MUNITS = ''
+   End
+   Otherwise do
+     Queue ' '
+     Queue 'Error in FORMAT_MEMSIZE code. Contact Mark Zelden.'
+     Queue 'SIZE_IN_MB=' SIZE_IN_MB
+     Queue ' '
+     SIZE_IN_MB = '*ERROR*'
+     MUNITS = ''
+   End
+End /* select */
+STOR_SIZE =  SIZE_IN_MB || MUNITS
+Return STOR_SIZE
+
+BROWSE_ISPF:         /* Browse output if ISPF is active              */
+Address ISPEXEC "CONTROL ERRORS RETURN"
+Address TSO
+prefix = sysvar('SYSPREF')        /* tso profile prefix              */
+uid    = sysvar('SYSUID')         /* tso userid                      */
+If prefix = '' then prefix = uid  /* use uid if null prefix          */
+If prefix <> '' & prefix <> uid then /* different prefix than uid    */
+   prefix = prefix || '.' || uid  /* use  prefix.uid                 */
+ddnm1 = 'DDO'||random(1,99999)    /* choose random ddname            */
+ddnm2 = 'DDP'||random(1,99999)    /* choose random ddname            */
+junk = MSG('OFF')
+"ALLOC FILE("||ddnm1||") UNIT(SYSALLDA) NEW TRACKS SPACE(2,1) DELETE",
+      " REUSE LRECL(80) RECFM(F B) BLKSIZE(3120)"
+"ALLOC FILE("||ddnm2||") UNIT(SYSALLDA) NEW TRACKS SPACE(1,1) DELETE",
+      " REUSE LRECL(80) RECFM(F B) BLKSIZE(3120) DIR(1)"
+junk = MSG('ON')
+"Newstack"
+/*************************/
+/* IPLINFOP Panel source */
+/*************************/
+If Substr(ZENVIR,6,1) >= 4 then
+  If EDITOP = 'YES' then ,
+    Queue ")PANEL KEYLIST(ISRSPEC,ISR)"
+  Else ,
+    Queue ")PANEL KEYLIST(ISRSPBC,ISR)"
+Queue ")ATTR"
+Queue "  _ TYPE(INPUT)   INTENS(HIGH) COLOR(TURQ) CAPS(OFF)" ,
+      "FORMAT(&MIXED)"
+If EDITOP = 'YES' then ,
+  Queue "  | AREA(DYNAMIC) EXTEND(ON)   SCROLL(ON) USERMOD('20')"
+Else ,
+  Queue "  | AREA(DYNAMIC) EXTEND(ON)   SCROLL(ON)"
+Queue "  + TYPE(TEXT)    INTENS(LOW)  COLOR(BLUE)"
+Queue "  @ TYPE(TEXT)    INTENS(LOW)  COLOR(TURQ)"
+Queue "  % TYPE(TEXT)    INTENS(HIGH) COLOR(GREEN)"
+Queue "  ! TYPE(OUTPUT)  INTENS(HIGH) COLOR(TURQ) PAD(-)"
+Queue " 01 TYPE(DATAOUT) INTENS(LOW)"
+Queue " 02 TYPE(DATAOUT) INTENS(HIGH)"
+If EDITOP = 'YES' then do
+  Queue " 03 TYPE(DATAOUT) SKIP(ON) /* FOR TEXT ENTER CMD. FIELD */"
+  Queue " 04 TYPE(DATAIN)  INTENS(LOW)  CAPS(OFF) FORMAT(&MIXED)"
+  Queue " 05 TYPE(DATAIN)  INTENS(HIGH) CAPS(OFF) FORMAT(&MIXED)"
+  Queue " 06 TYPE(DATAIN)  INTENS(LOW)  CAPS(IN)  FORMAT(&MIXED)"
+  Queue " 07 TYPE(DATAIN)  INTENS(HIGH) CAPS(IN)  FORMAT(&MIXED)"
+  Queue " 08 TYPE(DATAIN)  INTENS(LOW)  FORMAT(DBCS) OUTLINE(L)"
+  Queue " 09 TYPE(DATAIN)  INTENS(LOW)  FORMAT(EBCDIC) OUTLINE(L)"
+  Queue " 0A TYPE(DATAIN)  INTENS(LOW)  FORMAT(&MIXED) OUTLINE(L)"
+  Queue " 0D TYPE(DATAIN)  INTENS(LOW)  CAPS(IN)  FORMAT(&MIXED)" || ,
+        " COLOR(BLUE)"
+  Queue " 20 TYPE(DATAIN)  INTENS(LOW) CAPS(IN) FORMAT(&MIXED)"
+End
+Else do
+  Queue " 0B TYPE(DATAOUT) INTENS(HIGH) FORMAT(DBCS)"
+  Queue " 0C TYPE(DATAOUT) INTENS(HIGH) FORMAT(EBCDIC)"
+  Queue " 0D TYPE(DATAOUT) INTENS(HIGH) FORMAT(&MIXED)"
+  Queue " 10 TYPE(DATAOUT) INTENS(LOW)  FORMAT(DBCS)"
+  Queue " 11 TYPE(DATAOUT) INTENS(LOW)  FORMAT(EBCDIC)"
+  Queue " 12 TYPE(DATAOUT) INTENS(LOW)  FORMAT(&MIXED)"
+End
+If EDITOP = 'YES' then do
+  Queue ")BODY WIDTH(&ZWIDTH) EXPAND(//)"
+  Queue "@EDIT @&ZTITLE  / /  %Columns!ZCL  !ZCR  +"
+End
+Else do
+  Queue ")BODY EXPAND(//)"
+  Queue "%BROWSE  @&ZTITLE  / /  %Line!ZLINES  %Col!ZCOLUMS+"
+End
+Queue "%Command ===>_ZCMD / /           %Scroll ===>_Z   +"
+Queue "|ZDATA ---------------/ /-------------------------|"
+Queue "|                     / /                         |"
+Queue "| --------------------/-/-------------------------|"
+Queue ")INIT"
+Queue "  .HELP = IPLINFOH"
+If EDITOP = 'YES' then ,
+  Queue "  .ZVARS = 'ZSCED'"
+Else ,
+  Queue "  .ZVARS = 'ZSCBR'"
+Queue "  &ZTITLE = 'Mark''s MVS Utilities - IPLINFO'"
+Queue "  &MIXED = MIX"
+Queue "  IF (&ZPDMIX = N)"
+Queue "   &MIXED = EBCDIC"
+If EDITOP = 'YES' then do
+  Queue "  VGET (ZSCED) PROFILE"
+  Queue "  IF (&ZSCED = ' ')"
+  Queue "   &ZSCED = 'CSR'"
+End
+Else do
+  Queue "  VGET (ZSCBR) PROFILE"
+  Queue "  IF (&ZSCBR = ' ')"
+  Queue "   &ZSCBR = 'CSR'"
+End
+Queue ")REINIT"
+Queue "  .HELP = IPLINFOH"
+If EDITOP = 'YES' then ,
+  Queue "  REFRESH(ZCMD,ZSCED,ZDATA,ZCL,ZCR)"
+Else ,
+  Queue "  REFRESH(ZCMD,ZSCBR,ZDATA,ZLINES,ZCOLUMS)"
+Queue ")PROC"
+Queue "  &ZCURSOR = .CURSOR"
+Queue "  &ZCSROFF = .CSRPOS"
+Queue "  &ZLVLINE = LVLINE(ZDATA)"
+If EDITOP = 'YES' then ,
+  Queue "  VPUT (ZSCED) PROFILE"
+Else ,
+  Queue "  VPUT (ZSCBR) PROFILE"
+Queue ")END"
+/*                                    */
+Address ISPEXEC "LMINIT DATAID(PAN) DDNAME("ddnm2")"
+Address ISPEXEC "LMOPEN DATAID("pan") OPTION(OUTPUT)"
+Do queued()
+   Parse pull panline
+   Address ISPEXEC "LMPUT DATAID("pan") MODE(INVAR)" ,
+           "DATALOC(PANLINE) DATALEN(80)"
+End
+Address ISPEXEC "LMMADD DATAID("pan") MEMBER(IPLINFOP)"
+/* Address ISPEXEC "LMFREE DATAID("pan")" */
+"Delstack"
+"Newstack"
+/*************************/
+/* IPLINFOH Panel source */
+/*************************/
+If Substr(ZENVIR,6,1) >= 4 then
+  Queue ")PANEL KEYLIST(ISRSPBC,ISR)"
+Queue ")ATTR DEFAULT(!+_)"
+Queue "  _ TYPE(INPUT)   INTENS(HIGH) COLOR(TURQ) CAPS(OFF)" ,
+      "FORMAT(&MIXED)"
+Queue "  + TYPE(TEXT)    INTENS(LOW)  COLOR(BLUE)"
+Queue "  @ TYPE(TEXT)    INTENS(LOW)  COLOR(TURQ)"
+Queue "  ! TYPE(TEXT)    INTENS(HIGH) COLOR(GREEN)"
+Queue "  # AREA(SCRL)    EXTEND(ON)"
+Queue ")BODY EXPAND(//)"
+Queue "!HELP    @&ZTITLE  / / "
+Queue "!Command ===>_ZCMD / / "
+Queue "#IPLHSCR                                          "  || ,
+      "                            #"
+Queue ")AREA IPLHSCR"
+Queue "@EXECUTION SYNTAX:!TSO %IPLINFO