Compare commits
No commits in common. "witmaster" and "alpha4.1" have entirely different histories.
102
.appveyor.yml
102
.appveyor.yml
|
@ -2,80 +2,66 @@ version: 'build #{build}'
|
|||
|
||||
environment:
|
||||
matrix:
|
||||
- arch: 386
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.lib
|
||||
- linking: shared
|
||||
compiler: msvc2013
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- arch: 386
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
- linking: static
|
||||
compiler: msvc2013
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.lib
|
||||
compiler: msvc2013
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
compiler: msvc2013
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
|
||||
- arch: 386
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
compiler: mingw
|
||||
- linking: shared
|
||||
compiler: msvc2015
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
- linking: static
|
||||
compiler: msvc2015
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
- linking: shared
|
||||
compiler: msvc2017
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
- linking: static
|
||||
compiler: msvc2017
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
- linking: static
|
||||
compiler: mingw
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
|
||||
platform:
|
||||
- Win32
|
||||
- x64
|
||||
|
||||
# Note: AppVeyor tries to be "helpful" and splits cmd.exe scripts into their constitutent lines to check their error codes. There is no way to switch this off; for true multi-line scripts we have to use PowerShell. But we need to use vcvarsall.bat, so that's out of the question.
|
||||
install:
|
||||
# Set Python Version
|
||||
- set "PYTHON_ROOT=C:\python37-x64"
|
||||
- if %arch%==386 ( set "PYTHON_ROOT=C:\python37" )
|
||||
- set "PATH=%PYTHON_ROOT%;%PYTHON_ROOT%\Scripts;%PATH%"
|
||||
# Install Latest Meson
|
||||
- pip install meson
|
||||
# Install Ninja
|
||||
- powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
|
||||
- mkdir C:\ninja
|
||||
- powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
|
||||
- set "PATH=C:\ninja;%PATH%"
|
||||
# Parameters for the build_script phase, to reduce their noise.
|
||||
- set "mingwPath=C:\msys64\mingw64\bin"
|
||||
- set vcvarsallArch=x86
|
||||
- if %arch%==386 ( set "mingwPath=C:\msys64\mingw32\bin" )
|
||||
- if %arch%==386 ( set vcvarsallArch=amd64 )
|
||||
before_build:
|
||||
- if %compiler%==msvc2013 ( set "CMAKE_GENERATOR=Visual Studio 12 2013" )
|
||||
else if %compiler%==msvc2015 ( set "CMAKE_GENERATOR=Visual Studio 14 2015" )
|
||||
else if %compiler%==msvc2017 ( set "CMAKE_GENERATOR=Visual Studio 15 2017" )
|
||||
else if %compiler%==mingw ( set "CMAKE_GENERATOR=MinGW Makefiles" )
|
||||
- if %compiler%-%platform%==mingw-Win32 ( set "PATH=C:\msys64\mingw32\bin;%PATH%" )
|
||||
else if %compiler%-%platform%==mingw-x64 ( set "PATH=C:\msys64\mingw64\bin;%PATH%" )
|
||||
else if %platform%==x64 ( set "CMAKE_GENERATOR=%CMAKE_GENERATOR% Win64" )
|
||||
- if %linking%==static ( set CMAKE_FLAGS=-DBUILD_SHARED_LIBS=OFF )
|
||||
- if %compiler%==mingw ( set "outdir=build\out" ) else ( set "outdir=build\out\Release" )
|
||||
- ren "C:\Program Files\Git\usr\bin\sh.exe" _sh.exe
|
||||
- set "simultaneous=3"
|
||||
|
||||
build_script:
|
||||
- if %compiler%==mingw ( set "PATH=%mingwPath%;%PATH%" )
|
||||
- if not %compiler%==mingw ( call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %vcvarsallArch% )
|
||||
- meson setup build --buildtype=release --default-library=%libtype%
|
||||
- ninja -C build
|
||||
- md build && cd build
|
||||
- if not %compiler%==mingw ( set "CFLAGS=/MP%simultaneous% %CFLAGS%" )
|
||||
- if not %compiler%==mingw ( set "CPPFLAGS=/MP%simultaneous% %CPPFLAGS%" )
|
||||
- if not %compiler%==mingw ( set "CXXFLAGS=/MP%simultaneous% %CXXFLAGS%" )
|
||||
- cmake -G "%CMAKE_GENERATOR%" %CMAKE_FLAGS% ..
|
||||
- if %compiler%==mingw ( mingw32-make -j%simultaneous% tester examples )
|
||||
else ( msbuild libui.sln /t:Build /p:Configuration=Release /p:Platform=%platform% )
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
|
||||
after_build:
|
||||
- set "version=%APPVEYOR_REPO_BRANCH%"
|
||||
- if %platform%==x64 ( set "arch=amd64" ) else ( set "arch=386" )
|
||||
- if %APPVEYOR_REPO_TAG%==true ( set "version=%APPVEYOR_REPO_TAG_NAME%" )
|
||||
- set "artifact=%version%-windows-%arch%-%compiler%-%libtype%"
|
||||
- cd build\meson-out
|
||||
# TODO msvc only?
|
||||
- if %libtype%==static ( ren libui.a libui.lib )
|
||||
- copy ..\..\ui.h .
|
||||
- copy ..\..\ui_windows.h .
|
||||
# remove unnecessary files
|
||||
# TODO should we do this on Azure too?
|
||||
- del libui.exp
|
||||
- 7z a "%APPVEYOR_BUILD_FOLDER%\libui-%artifact%.zip" %libfiles% ui.h ui_windows.h
|
||||
- 7z a "%APPVEYOR_BUILD_FOLDER%\examples-%artifact%.zip" controlgallery.exe cpp-multithread.exe datetime.exe drawtext.exe histogram.exe tester.exe timer.exe
|
||||
- del ui.h ui_windows.h
|
||||
else ( set "version=%APPVEYOR_REPO_BRANCH%" )
|
||||
- if %linking%==shared ( set "artifact=shared" ) else ( set "artifact=%compiler%-static" )
|
||||
- set "artifact=%version%-windows-%arch%-%artifact%"
|
||||
- del .\%outdir%\libui.exp # remove unnecessary files
|
||||
- 7z a libui-%artifact%.zip .\%outdir%\libui.* ui.h ui_windows.h
|
||||
- 7z l libui-%artifact%.zip
|
||||
- 7z a examples-%artifact%.zip .\%outdir%\*.exe
|
||||
- 7z l examples-%artifact%.zip
|
||||
|
||||
artifacts:
|
||||
- path: libui-*.zip
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
language: c
|
||||
|
||||
include: &toolchain_linux_amd64
|
||||
os: linux
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
update: true
|
||||
packages:
|
||||
- libgtk-3-dev
|
||||
|
||||
include: &toolchain_linux_386
|
||||
os: linux
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gcc-multilib
|
||||
- g++-multilib
|
||||
- libgtk-3-dev:i386
|
||||
# the rest fixes broken dependencies of libgtk:i386
|
||||
- libgirepository-1.0-1:i386
|
||||
- libglib2.0-dev:i386
|
||||
- gir1.2-glib-2.0:i386
|
||||
- gir1.2-atk-1.0:i386
|
||||
- libatk1.0-dev:i386
|
||||
- libfreetype6-dev:i386
|
||||
- libfontconfig1-dev:i386
|
||||
- libcairo2-dev:i386
|
||||
- libgdk-pixbuf2.0-dev:i386
|
||||
- libpango1.0-dev:i386
|
||||
- libxft-dev:i386
|
||||
- libpng12-dev:i386
|
||||
|
||||
include: &toolchain_osx_amd64
|
||||
os: osx
|
||||
osx_image: xcode8
|
||||
|
||||
# Travis CI build matrix.
|
||||
# Each entry below will trigger an extra, parallel build on Travis.
|
||||
matrix:
|
||||
include:
|
||||
- env: linking=shared arch=amd64
|
||||
<<: *toolchain_linux_amd64
|
||||
- env: linking=static arch=amd64
|
||||
<<: *toolchain_linux_amd64
|
||||
- env: linking=shared arch=386
|
||||
<<: *toolchain_linux_386
|
||||
- env: linking=static arch=386
|
||||
<<: *toolchain_linux_386
|
||||
- env: linking=shared arch=amd64
|
||||
<<: *toolchain_osx_amd64
|
||||
- env: linking=static arch=amd64
|
||||
<<: *toolchain_osx_amd64
|
||||
|
||||
install:
|
||||
- if [[ "${arch}" == "386" ]]; then
|
||||
export CFLAGS=-m32;
|
||||
export CXXFLAGS=-m32;
|
||||
export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig;
|
||||
fi
|
||||
- if [[ "${linking}" == "static" ]]; then
|
||||
export CMAKE_FLAGS=-DBUILD_SHARED_LIBS=OFF;
|
||||
fi
|
||||
|
||||
script:
|
||||
- cmake --version
|
||||
- mkdir build
|
||||
- pushd build
|
||||
- cmake -G "Unix Makefiles" ${CMAKE_FLAGS} ..
|
||||
- make tester examples
|
||||
- popd
|
||||
|
||||
after_success:
|
||||
- ls -lR build/out
|
||||
- file build/out/test
|
||||
- export platform="$TRAVIS_OS_NAME"
|
||||
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cp ui.h ui_darwin.h build/out/; export platform=darwin; fi
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cp ui.h ui_unix.h build/out/; fi
|
||||
- if [[ "x${TRAVIS_TAG}" != "x" ]]; then export version=${TRAVIS_TAG}; else export version=${TRAVIS_BRANCH}; fi
|
||||
- export artifact=${version}-${platform}-${arch}-${linking}
|
||||
- echo ${artifact}
|
||||
- pushd build/out
|
||||
- # TODO do not include symlinks in the archive
|
||||
- tar -czvf libui-${artifact}.tgz libui.* *.h
|
||||
- tar -czvf examples-${artifact}.tgz `find . -type f ! -name "*.*"`
|
||||
- popd
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: "fmgC97mlXQY/ASWAL/GyTJfiJIo/hsVFf6bP3Zz8odv259PJUFGgnZ9kNIgJcFQ5961lXDFi7pBMMSetm1GZ2EBZxIXnUfe1kfIhw62ybJHIwB2+g2tc8A4zzfkWJVY4xVYpitOU3iMuu5Z8U2n+68RYWKpcxhbkVw5v8Zu2Rms="
|
||||
file: build/out/*.tgz
|
||||
file_glob: true
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
|
@ -0,0 +1,238 @@
|
|||
# 3 june 2016
|
||||
# see https://cmake.org/gitweb?p=cmake.git;a=commit;h=95cdf132489c79e88a10fdf7a7566fa002c7680b (thanks ngladitz in irc.freenode.net/#cmake)
|
||||
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
||||
|
||||
# TODOs
|
||||
# - silence entering/leaving messages?
|
||||
# - uname -s for more refined OS control
|
||||
# - Haiku for haiku
|
||||
# - debian DESTDIR? https://github.com/andlabs/libui/pull/10
|
||||
# - libui-combined* needs to be deleted so that custom command can run every time
|
||||
# - add notelemetry.obj to *ALL TARGETS* on VS2015 and up - https://www.infoq.com/news/2016/06/visual-cpp-telemetry
|
||||
# - switch to 3.1.0 features
|
||||
|
||||
# the docs say we need to set this up prior to project()
|
||||
# the docs don't say this, but the CACHE part is important; see https://stackoverflow.com/questions/34208360/cmake-seems-to-ignore-cmake-osx-deployment-target
|
||||
# TODO figure out what other variables must be set with CACHE
|
||||
# TODO figure out if FORCE is needed here
|
||||
# TODO figure out whether STRING "" is best or if something else is better; also what FORCE does because I forget and later I say it's needed
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8" CACHE STRING "" FORCE)
|
||||
|
||||
# we want to disable incremental linking
|
||||
# see also:
|
||||
# - https://github.com/bulletphysics/bullet3/blob/master/CMakeLists.txt#L43
|
||||
# - https://cmake.org/pipermail/cmake/2010-February/035174.html
|
||||
# this must also go before project()
|
||||
set(MSVC_INCREMENTAL_DEFAULT ON)
|
||||
|
||||
# default to debug builds
|
||||
# do this before project() just to be safe
|
||||
# either DEBUG or Debug will work; we use DEBUG as that's what cmake does internally (https://cmake.org/pipermail/cmake/2013-June/055177.html)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE DEBUG CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
project(libui)
|
||||
option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
|
||||
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||
set(CMAKE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out")
|
||||
|
||||
if(APPLE)
|
||||
set(_OSNAME darwin)
|
||||
set(_HASVERSION TRUE)
|
||||
set(_VERSION "A")
|
||||
|
||||
# always use our rpath
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
# the / is required by some older versions of OS X
|
||||
set(CMAKE_INSTALL_RPATH "@executable_path/")
|
||||
set(CMAKE_MACOSX_RPATH TRUE)
|
||||
elseif(WIN32)
|
||||
set(_OSNAME windows)
|
||||
|
||||
# and don't include the default libraries with ANY of the builds
|
||||
# note the CACHE FORCE stuff is required here
|
||||
set(CMAKE_C_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES CACHE STRING "" FORCE)
|
||||
else()
|
||||
set(_OSNAME unix)
|
||||
set(_HASVERSION TRUE)
|
||||
set(_VERSION "0")
|
||||
|
||||
# always use our rpath
|
||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH "\$ORIGIN")
|
||||
endif()
|
||||
|
||||
# common flags
|
||||
if(MSVC)
|
||||
# TODO subsystem version
|
||||
|
||||
# TODO /Wall does too much
|
||||
# TODO -Wno-switch equivalent
|
||||
# TODO /sdl turns C4996 into an ERROR
|
||||
# don't use /analyze; that requires us to write annotations everywhere
|
||||
# TODO undecided flags from qo?
|
||||
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
|
||||
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5
|
||||
# /EHsc is to shut the compiler up in some cases
|
||||
# TODO make /EHsc C++-only
|
||||
set(_COMMON_CFLAGS
|
||||
/W4 /wd4100
|
||||
/bigobj /nologo
|
||||
$<$<CONFIG:Debug>:/RTC1 /RTCs /RTCu>
|
||||
/EHsc
|
||||
)
|
||||
|
||||
# note the /MANIFEST:NO (which must be / and uppercase); thanks FraGag (https://github.com/andlabs/libui/issues/93#issuecomment-223183436)
|
||||
# TODO warnings on undefined symbols
|
||||
set(_COMMON_LDFLAGS
|
||||
/LARGEADDRESSAWARE
|
||||
/NOLOGO
|
||||
/INCREMENTAL:NO
|
||||
/MANIFEST:NO
|
||||
)
|
||||
|
||||
# TODO autogenerate a .def file?
|
||||
|
||||
# more incremental linking fixes
|
||||
# TODO actually get rid of incremental linking here
|
||||
else()
|
||||
set(_COMMON_CFLAGS
|
||||
-Wall -Wextra -pedantic
|
||||
-Wno-unused-parameter
|
||||
-Wno-switch
|
||||
-fvisibility=hidden
|
||||
)
|
||||
# don't use C_VERSION or CXX_VERSION because they use GNU standards
|
||||
# TODO we can actually do this; set both C_EXTENSIONS and CXX_EXTENSIONS to OFF
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --std=c99")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
|
||||
|
||||
set(_COMMON_LDFLAGS
|
||||
-fvisibility=hidden
|
||||
)
|
||||
|
||||
# don't require shipping the MinGW-w64 DLLs
|
||||
if(WIN32)
|
||||
list(APPEND _COMMON_LDFLAGS
|
||||
-static
|
||||
-static-libgcc
|
||||
-static-libstdc++
|
||||
)
|
||||
endif()
|
||||
|
||||
# TODO document this
|
||||
if(ADDRESS_SANITIZER)
|
||||
set(_COMMON_CFLAGS ${_COMMON_CFLAGS}
|
||||
-fsanitize=address
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
set(_COMMON_LDFLAGS ${_COMMON_LDFLAGS}
|
||||
-fsanitize=address
|
||||
-fno-omit-frame-pointer
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# problem:
|
||||
# - target_link_libraries() only supports - for flags
|
||||
# - but cmake only doesn't generate the manifest if the flag has a /
|
||||
macro(_target_link_options_private _target)
|
||||
foreach(_opt IN LISTS ${ARGN})
|
||||
set_property(TARGET ${_target} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " ${_opt}")
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
add_subdirectory("common")
|
||||
add_subdirectory("${_OSNAME}")
|
||||
add_library(libui ${_LIBUI_SOURCES})
|
||||
target_include_directories(libui
|
||||
PUBLIC .
|
||||
PRIVATE ${_LIBUI_INCLUEDIRS})
|
||||
target_compile_definitions(libui
|
||||
PRIVATE ${_LIBUI_DEFS})
|
||||
# cmake produces this for us by default but only for shared libraries
|
||||
target_compile_definitions(libui
|
||||
PRIVATE libui_EXPORTS)
|
||||
target_compile_options(libui
|
||||
PUBLIC ${_COMMON_CFLAGS}
|
||||
PRIVATE ${_LIBUI_CFLAGS})
|
||||
# TODO link directories?
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_link_libraries(libui
|
||||
PRIVATE ${_LIBUI_LIBS})
|
||||
endif()
|
||||
# TODO INTERFACE libs don't inherit to grandhcildren?
|
||||
# on Windows the linker for static libraries is different; don't give it the flags
|
||||
if(BUILD_SHARED_LIBS)
|
||||
_target_link_options_private(libui
|
||||
_COMMON_LDFLAGS
|
||||
_LIBUI_LDFLAGS)
|
||||
endif()
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
# TODO figure out a way to tell libui that it's static
|
||||
target_compile_definitions(libui
|
||||
PUBLIC _UI_STATIC)
|
||||
endif()
|
||||
if(NOT MSVC)
|
||||
# on non-MSVC compilers cmake adds an extra lib-
|
||||
# note that we apply this to libui, not to any intermediates
|
||||
set_target_properties(libui PROPERTIES
|
||||
OUTPUT_NAME ui)
|
||||
|
||||
# flags for warning on undefined symbols
|
||||
# TODO figure out why FreeBSD follows linked libraries here
|
||||
# TODO figure out MSVC equivalents
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(NOT (${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD))
|
||||
# on OS X we don't need to do this; Apple's linker warns about undefined symbols in -shared builds!
|
||||
if(NOT APPLE)
|
||||
target_link_libraries(libui
|
||||
PRIVATE -Wl,--no-undefined -Wl,--no-allow-shlib-undefined
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
if(BUILD_SHARED_LIBS)
|
||||
if(_HASVERSION)
|
||||
set_target_properties(libui PROPERTIES
|
||||
SOVERSION "${_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
# TODO why is this not a default?!
|
||||
set_property(TARGET libui PROPERTY
|
||||
POSITION_INDEPENDENT_CODE True)
|
||||
|
||||
macro(_add_exec _name)
|
||||
# TODOTODO re-add WIN32 when merging back
|
||||
add_executable(${_name}
|
||||
EXCLUDE_FROM_ALL
|
||||
${ARGN})
|
||||
target_link_libraries(${_name} libui)
|
||||
_target_link_options_private(${_name}
|
||||
_COMMON_LDFLAGS)
|
||||
# TODO does this propagate?
|
||||
set_property(TARGET ${_name} PROPERTY
|
||||
POSITION_INDEPENDENT_CODE True)
|
||||
# TODO see above about INTERFACE
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
target_link_libraries(${_name}
|
||||
${_LIBUI_LIBS})
|
||||
endif()
|
||||
|
||||
# TODOfor some reason these don't propagate
|
||||
if(NOT WIN32)
|
||||
target_include_directories(${_name}
|
||||
PUBLIC .)
|
||||
target_compile_options(${_name}
|
||||
PUBLIC ${_COMMON_CFLAGS})
|
||||
endif()
|
||||
endmacro()
|
||||
add_subdirectory("test")
|
||||
add_subdirectory("examples")
|
7
Makefile
7
Makefile
|
@ -1,7 +0,0 @@
|
|||
all:
|
||||
|
||||
redomod:
|
||||
rm -f go.*
|
||||
GO111MODULE= go mod init
|
||||
GO111MODULE= go mod tidy
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
// 20 june 2016
|
||||
// kept in a separate file for now
|
||||
|
||||
typedef struct uiImage uiImage;
|
||||
|
||||
// TODO use const void * for const correctness
|
||||
_UI_EXTERN uiImage *uiNewImage(double width, double height);
|
||||
_UI_EXTERN void uiFreeImage(uiImage *i);
|
||||
_UI_EXTERN void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int pixelStride);
|
||||
|
||||
typedef struct uiTableModel uiTableModel;
|
||||
typedef struct uiTableModelHandler uiTableModelHandler;
|
||||
|
||||
// TODO actually validate these
|
||||
_UI_ENUM(uiTableModelColumnType) {
|
||||
uiTableModelColumnString,
|
||||
uiTableModelColumnImage,
|
||||
uiTableModelColumnInt,
|
||||
uiTableModelColumnColor,
|
||||
};
|
||||
|
||||
// TODO validate ranges; validate types on each getter/setter call (? table columns only?)
|
||||
struct uiTableModelHandler {
|
||||
int (*NumColumns)(uiTableModelHandler *, uiTableModel *);
|
||||
uiTableModelColumnType (*ColumnType)(uiTableModelHandler *, uiTableModel *, int);
|
||||
int (*NumRows)(uiTableModelHandler *, uiTableModel *);
|
||||
void *(*CellValue)(uiTableModelHandler *, uiTableModel *, int, int);
|
||||
void (*SetCellValue)(uiTableModelHandler *, uiTableModel *, int, int, const void *);
|
||||
};
|
||||
|
||||
_UI_EXTERN void *uiTableModelStrdup(const char *str);
|
||||
// TODO rename the strdup one to this too
|
||||
_UI_EXTERN void *uiTableModelGiveColor(double r, double g, double b, double a);
|
||||
_UI_EXTERN void *uiTableModelGiveInt(int i);
|
||||
// TODO TakeString
|
||||
// TODO add const
|
||||
_UI_EXTERN int uiTableModelTakeInt(void *v);
|
||||
|
||||
_UI_EXTERN uiTableModel *uiNewTableModel(uiTableModelHandler *mh);
|
||||
_UI_EXTERN void uiFreeTableModel(uiTableModel *m);
|
||||
_UI_EXTERN void uiTableModelRowInserted(uiTableModel *m, int newIndex);
|
||||
_UI_EXTERN void uiTableModelRowChanged(uiTableModel *m, int index);
|
||||
_UI_EXTERN void uiTableModelRowDeleted(uiTableModel *m, int oldIndex);
|
||||
// TODO reordering/moving
|
||||
|
||||
typedef struct uiTableColumn uiTableColumn;
|
||||
|
||||
_UI_EXTERN void uiTableColumnAppendTextPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
// TODO images shouldn't expand...
|
||||
_UI_EXTERN void uiTableColumnAppendImagePart(uiTableColumn *c, int modelColumn, int expand);
|
||||
_UI_EXTERN void uiTableColumnAppendButtonPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
// TODO should these have labels?
|
||||
_UI_EXTERN void uiTableColumnAppendCheckboxPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
_UI_EXTERN void uiTableColumnAppendProgressBarPart(uiTableColumn *c, int modelColumn, int expand);
|
||||
// TODO Editable?
|
||||
_UI_EXTERN void uiTableColumnPartSetEditable(uiTableColumn *c, int part, int editable);
|
||||
_UI_EXTERN void uiTableColumnPartSetTextColor(uiTableColumn *c, int part, int modelColumn);
|
||||
|
||||
typedef struct uiTable uiTable;
|
||||
#define uiTable(this) ((uiTable *) (this))
|
||||
_UI_EXTERN uiTableColumn *uiTableAppendColumn(uiTable *t, const char *name);
|
||||
_UI_EXTERN uiTableColumn *uiTableAppendTextColumn(uiTable *t, const char *name, int modelColumn);
|
||||
// TODO getter?
|
||||
_UI_EXTERN void uiTableSetRowBackgroundColorModelColumn(uiTable *t, int modelColumn);
|
||||
_UI_EXTERN uiTable *uiNewTable(uiTableModel *model);
|
58
README.md
58
README.md
|
@ -1,8 +1,8 @@
|
|||
# libui: a portable GUI library for C
|
||||
|
||||
This README is being written.<br>
|
||||
[](https://dev.azure.com/andlabs/libui/_build/latest?definitionId=1&branchName=master)<br>
|
||||
[](https://ci.appveyor.com/project/andlabs/libui/branch/master)
|
||||
[](https://travis-ci.org/andlabs/libui)<br>
|
||||
[](https://ci.appveyor.com/project/andlabs/libui)
|
||||
|
||||
## Status
|
||||
|
||||
|
@ -30,10 +30,6 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
|
|||
|
||||
*Note that today's entry (Eastern Time) may be updated later today.*
|
||||
|
||||
* **7 April 2019**
|
||||
* **The build system has been switched to Meson.** See below for instructions. This change was made because the previous build system, CMake, caused countless headaches over trivial issues. Meson was chosen due to how unproblematic setting up libui's build just right was, as well as having design goals that are by coincidence closely aligned with what libui wants.
|
||||
* Travis CI has been replaced with Azure Pipelines and much of the AppVeyor CI configuration was integrated into the Azure Pipelines configuration. This shouldn't affect most developers.
|
||||
|
||||
* **1 September 2018**
|
||||
* **Alpha 4.1 is here.** This is an emergency fix to Alpha 4 to fix `uiImageAppend()` not working as documented. It now works properly, with one important difference you'll need to care about: **it now requires image data to be alpha-premultiplied**. In addition, `uiImage` also is implemented slightly more nicely now, and `ui.h` has minor documentation typo fixes.
|
||||
* Alpha 4.1 also tries to make everything properly PIC-enabled.
|
||||
|
@ -86,8 +82,7 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
|
|||
## Build Requirements
|
||||
|
||||
* All platforms:
|
||||
* [Meson](https://mesonbuild.com/) 0.48.0 or newer
|
||||
* Any of Meson's backends; this section assumes you are using [Ninja](https://ninja-build.org/), but there is no reason the other backends shouldn't work.
|
||||
* CMake 3.1.0 or newer
|
||||
* Windows: either
|
||||
* Microsoft Visual Studio 2013 or newer (2013 is needed for `va_copy()`) — you can build either a static or a shared library
|
||||
* MinGW-w64 (other flavors of MinGW may not work) — **you can only build a static library**; shared library support will be re-added once the following features come in:
|
||||
|
@ -97,41 +92,33 @@ But libui is not dead; I am working on it whenever I can, and I hope to get it t
|
|||
|
||||
## Building
|
||||
|
||||
libui uses only [the standard Meson build options](https://mesonbuild.com/Builtin-options.html), so a libui build can be set up just like any other:
|
||||
Out-of-tree builds typical of cmake are preferred:
|
||||
|
||||
```
|
||||
$ # you must be in the top-level libui directory, otherwise this won't work
|
||||
$ meson setup build [options]
|
||||
$ ninja -C build
|
||||
$ mkdir build
|
||||
$ cd build
|
||||
$ cmake ..
|
||||
```
|
||||
|
||||
Once this completes, everything will be under `build/meson-out/`. (Note that unlike the previous build processes, everything is built by default, including tests and examples.)
|
||||
Pass `-DBUILD_SHARED_LIBS=OFF` to `cmake` to build a static library. The standard cmake build configurations are provided; if none is specified, `Debug` is used.
|
||||
|
||||
The most important options are:
|
||||
If you use a makefile generator with cmake, then
|
||||
|
||||
* `--buildtype=(debug|release|...)` controls the type of build made; the default is `debug`. For a full list of valid values, consult [the Meson documentation](https://mesonbuild.com/Running-Meson.html).
|
||||
* `--default-library=(shared|static)` controls whether libui is built as a shared library or a static library; the default is `shared`. You currently cannot specify `both`, as the build process changes depending on the target type (though I am willing to look into changing things if at all possible).
|
||||
* `-Db_sanitize=which` allows enabling the chosen [sanitizer](https://github.com/google/sanitizers) on a system that supports sanitizers. The list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#base-options).
|
||||
* `--backend=backend` allows using the specified `backend` for builds instead of `ninja` (the default). A list of supported values is in [the Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options).
|
||||
```
|
||||
$ make
|
||||
$ make tester # for the test program
|
||||
$ make examples # for examples
|
||||
```
|
||||
|
||||
Most other built-in options will work, though keep in mind there are a handful of options that cannot be overridden because libui depends on them holding a specific value; if you do override these, though, libui will warn you when you run `meson`.
|
||||
and pass `VERBOSE=1` to see build commands. Build targets will be in the `build/out` folder.
|
||||
|
||||
The Meson website and documentation has more in-depth usage instructions.
|
||||
Project file generators should work, but are untested by me.
|
||||
|
||||
For the sake of completeness, I should note that the default value of `--layout` is `flat`, not the usual `mirror`. This is done both to make creating the release archives easier as well as to reduce the chance that shared library builds will fail to start on Windows because the DLL is in another directory. You can always specify this manually if you want.
|
||||
|
||||
Backends other than `ninja` should work, but are untested by me.
|
||||
On Windows, I use the `Unix Makefiles` generator and GNU make (built using the `build_w32.bat` script included in the source and run in the Visual Studio command line). In this state, if MinGW-w64 (either 32-bit or 64-bit) is not in your `%PATH%`, cmake will use MSVC by default; otherwise, cmake will use with whatever MinGW-w64 is in your path. `set PATH=%PATH%;c:\msys2\mingw(32/64)\bin` should be enough to temporarily change to a MinGW-w64 build for the current command line session only if you installed MinGW-w64 through [MSYS2](https://msys2.github.io/); no need to change global environment variables constantly.
|
||||
|
||||
## Installation
|
||||
|
||||
Meson also supports installing from source; if you use Ninja, just do
|
||||
|
||||
```
|
||||
$ ninja -C build install
|
||||
```
|
||||
|
||||
When running `meson`, the `--prefix` option will set the installation prefix. [The Meson documentation](https://mesonbuild.com/Builtin-options.html#universal-options) has more information, and even lists more fine-grained options that you can use to control the installation.
|
||||
|
||||
#### Arch Linux
|
||||
|
||||
Can be built from AUR: https://aur.archlinux.org/packages/libui-git/
|
||||
|
@ -150,24 +137,23 @@ Language | Bindings
|
|||
--- | ---
|
||||
C++ | [libui-cpp](https://github.com/billyquith/libui-cpp), [cpp-libui-qtlike](https://github.com/aoloe/cpp-libui-qtlike)
|
||||
C# / .NET Framework | [LibUI.Binding](https://github.com/NattyNarwhal/LibUI.Binding)
|
||||
C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [TCD.UI](https://github.com/tacdevel/tcdfx)
|
||||
C# / .NET Core | [DevZH.UI](https://github.com/noliar/DevZH.UI), [SharpUI](https://github.com/benpye/sharpui/), [LibUISharp](https://github.com/tom-corwin/LibUISharp)
|
||||
CHICKEN Scheme | [wasamasa/libui](https://github.com/wasamasa/libui)
|
||||
Common Lisp | [jinwoo/cl-ui](https://github.com/jinwoo/cl-ui)
|
||||
Crystal | [libui.cr](https://github.com/Fusion/libui.cr), [hedron](https://github.com/Qwerp-Derp/hedron)
|
||||
D | [DerelictLibui (flat API)](https://github.com/Extrawurst/DerelictLibui), [libuid (object-oriented)](https://github.com/mogud/libuid)
|
||||
Euphoria | [libui-euphoria](https://github.com/ghaberek/libui-euphoria)
|
||||
Harbour | [hbui](https://github.com/rjopek/hbui)
|
||||
Harbour | [HBUI](https://github.com/RJopek/HBUI)
|
||||
Haskell | [haskell-libui](https://github.com/beijaflor-io/haskell-libui)
|
||||
JavaScript/Node.js | [libui-node](https://github.com/parro-it/libui-node), [libui.js (merged into libui-node?)](https://github.com/mavenave/libui.js), [proton-native](https://github.com/kusti8/proton-native), [vuido](https://github.com/mimecorg/vuido)
|
||||
Julia | [Libui.jl](https://github.com/joa-quim/Libui.jl)
|
||||
Kotlin | [kotlin-libui](https://github.com/msink/kotlin-libui)
|
||||
Lua | [libuilua](https://github.com/zevv/libuilua), [libui-lua](https://github.com/mdombroski/libui-lua), [lui](http://tset.de/lui/index.html), [lui](https://github.com/zhaozg/lui)
|
||||
Nim | [ui](https://github.com/nim-lang/ui)
|
||||
Perl6 | [perl6-libui](https://github.com/Garland-g/perl6-libui)
|
||||
PHP | [ui](https://github.com/krakjoe/ui)
|
||||
Python | [pylibui](https://github.com/joaoventura/pylibui)
|
||||
Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby), [libui](https://github.com/kojix2/libui)
|
||||
Rust | [libui-rs](https://github.com/rust-native-ui/libui-rs)
|
||||
Python | [pylibui](https://github.com/joaoventura/pylibui), [pylibui-cffi](https://github.com/Yardanico/pylibui-cffi)
|
||||
Ruby | [libui-ruby](https://github.com/jamescook/libui-ruby)
|
||||
Rust | [libui-rs](https://github.com/pcwalton/libui-rs), [arcturu/libui-rs](https://github.com/arcturu/libui-rs), [LeoTindall/libui-rs](https://github.com/LeoTindall/libui-rs)
|
||||
Scala | [scalaui](https://github.com/lolgab/scalaui)
|
||||
Swift | [libui-swift](https://github.com/sclukey/libui-swift)
|
||||
|
||||
|
|
|
@ -1,907 +0,0 @@
|
|||
// 9 october 2018
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#define STRICT
|
||||
#define STRICT_TYPED_ITEMIDS
|
||||
#define WINVER 0x0600 /* from Microsoft's winnls.h */
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
|
||||
#define _WIN32_IE 0x0700
|
||||
#define NTDDI_VERSION 0x06000000
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <uxtheme.h>
|
||||
#include <vsstyle.h>
|
||||
#include <vssym32.h>
|
||||
#include <windowsx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// cl winbuttonexplorertheme.cpp -MT -link user32.lib kernel32.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib windows.res
|
||||
|
||||
void diele(const char *func)
|
||||
{
|
||||
DWORD le;
|
||||
|
||||
le = GetLastError();
|
||||
fprintf(stderr, "%s: %I32u\n", func, le);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void diehr(const char *func, HRESULT hr)
|
||||
{
|
||||
fprintf(stderr, "%s: 0x%08I32X\n", func, hr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// TODO if we merge this into libui proper, this will need to be deduplicated
|
||||
static inline HRESULT lastErrorToHRESULT(DWORD lastError)
|
||||
{
|
||||
if (lastError == 0)
|
||||
return E_FAIL;
|
||||
return HRESULT_FROM_WIN32(lastError);
|
||||
}
|
||||
|
||||
HINSTANCE hInstance;
|
||||
HWND leftButtons[5];
|
||||
HWND rightButtons[3];
|
||||
|
||||
class commandModuleStyleParams {
|
||||
public:
|
||||
virtual int partID_CMOD_MODULEBACKGROUND(void) const = 0;
|
||||
virtual int partID_CMOD_TASKBUTTON(void) const = 0;
|
||||
virtual int partID_CMOD_SPLITBUTTONLEFT(void) const = 0;
|
||||
virtual int partID_CMOD_SPLITBUTTONRIGHT(void) const = 0;
|
||||
virtual int partID_CMOD_MENUGLYPH(void) const = 0;
|
||||
virtual int partID_CMOD_OVERFLOWGLYPH(void) const = 0;
|
||||
|
||||
virtual int stateID_CMODS_NORMAL(void) const = 0;
|
||||
virtual int stateID_CMODS_HOT(void) const = 0;
|
||||
virtual int stateID_CMODS_PRESSED(void) const = 0;
|
||||
virtual int stateID_CMODS_KEYFOCUSED(void) const = 0;
|
||||
virtual int stateID_CMODS_NEARHOT(void) const = 0;
|
||||
|
||||
virtual HRESULT backgroundGradientColors(HTHEME theme, COLORREF *colors) const = 0;
|
||||
virtual HRESULT buttonTextColor(HTHEME theme, UINT uItemState, COLORREF *color) const = 0;
|
||||
virtual BOOL buttonTextShadowed(UINT uItemState) const = 0;
|
||||
|
||||
virtual int folderBarMarginsLeftDIP(void) const = 0;
|
||||
virtual int folderBarMarginsTopDIP(void) const = 0;
|
||||
virtual int folderBarMarginsRightDIP(void) const = 0;
|
||||
virtual int folderBarMarginsBottomDIP(void) const = 0;
|
||||
|
||||
virtual int buttonMarginsXDIP(void) const = 0;
|
||||
virtual int buttonMarginsYDIP(void) const = 0;
|
||||
virtual int buttonTextArrowSeparationXDIP(void) const = 0;
|
||||
};
|
||||
|
||||
class commandModuleStyleParamsVista : public commandModuleStyleParams {
|
||||
public:
|
||||
virtual int partID_CMOD_MODULEBACKGROUND(void) const { return 1; }
|
||||
virtual int partID_CMOD_TASKBUTTON(void) const { return 2; }
|
||||
virtual int partID_CMOD_SPLITBUTTONLEFT(void) const { return 3; }
|
||||
virtual int partID_CMOD_SPLITBUTTONRIGHT(void) const { return 4; }
|
||||
virtual int partID_CMOD_MENUGLYPH(void) const { return 5; }
|
||||
virtual int partID_CMOD_OVERFLOWGLYPH(void) const { return 6; }
|
||||
|
||||
virtual int stateID_CMODS_NORMAL(void) const { return 1; }
|
||||
virtual int stateID_CMODS_HOT(void) const { return 2; }
|
||||
virtual int stateID_CMODS_PRESSED(void) const { return 3; }
|
||||
virtual int stateID_CMODS_KEYFOCUSED(void) const { return 4; }
|
||||
virtual int stateID_CMODS_NEARHOT(void) const { return 5; }
|
||||
|
||||
virtual HRESULT backgroundGradientColors(HTHEME theme, COLORREF *colors) const
|
||||
{
|
||||
if (colors == NULL)
|
||||
return E_POINTER;
|
||||
#define argb(a, r, g, b) ((((COLORREF) ((BYTE) (a))) << 24) | RGB(r, g, b))
|
||||
colors[0] = argb(255, 4, 80, 130);
|
||||
colors[1] = argb(255, 17, 101, 132);
|
||||
colors[2] = argb(255, 29, 121, 134);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
virtual HRESULT buttonTextColor(HTHEME theme, UINT uItemState, COLORREF *color) const
|
||||
{
|
||||
if (color == NULL)
|
||||
return E_POINTER;
|
||||
*color = GetSysColor(COLOR_WINDOW);
|
||||
if ((uItemState & CDIS_DISABLED) != 0)
|
||||
*color = argb(255, 161, 204, 210);
|
||||
#undef argb
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
virtual BOOL buttonTextShadowed(UINT uItemState) const
|
||||
{
|
||||
return (uItemState & CDIS_DISABLED) == 0;
|
||||
}
|
||||
|
||||
virtual int folderBarMarginsLeftDIP(void) const { return 3; }
|
||||
virtual int folderBarMarginsTopDIP(void) const { return 2; }
|
||||
virtual int folderBarMarginsRightDIP(void) const { return 3; }
|
||||
virtual int folderBarMarginsBottomDIP(void) const { return 3; }
|
||||
|
||||
virtual int buttonMarginsXDIP(void) const { return 6; }
|
||||
virtual int buttonMarginsYDIP(void) const { return 5; }
|
||||
virtual int buttonTextArrowSeparationXDIP(void) const { return 3; }
|
||||
};
|
||||
|
||||
class commandModuleStyleParams7 : public commandModuleStyleParams {
|
||||
virtual int partID_CMOD_MODULEBACKGROUND(void) const { return 1; }
|
||||
virtual int partID_CMOD_TASKBUTTON(void) const { return 3; }
|
||||
virtual int partID_CMOD_SPLITBUTTONLEFT(void) const { return 4; }
|
||||
virtual int partID_CMOD_SPLITBUTTONRIGHT(void) const { return 5; }
|
||||
virtual int partID_CMOD_MENUGLYPH(void) const { return 6; }
|
||||
virtual int partID_CMOD_OVERFLOWGLYPH(void) const { return 7; }
|
||||
|
||||
virtual int stateID_CMODS_NORMAL(void) const { return 1; }
|
||||
virtual int stateID_CMODS_HOT(void) const { return 2; }
|
||||
virtual int stateID_CMODS_PRESSED(void) const { return 3; }
|
||||
virtual int stateID_CMODS_KEYFOCUSED(void) const { return 4; }
|
||||
/*TODO verify this*/virtual int stateID_CMODS_NEARHOT(void) const { return 5; }
|
||||
|
||||
virtual HRESULT backgroundGradientColors(HTHEME theme, COLORREF *colors) const
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (colors == NULL)
|
||||
return E_POINTER;
|
||||
hr = GetThemeColor(theme,
|
||||
2, 0,
|
||||
TMT_GRADIENTCOLOR1, colors + 0);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
hr = GetThemeColor(theme,
|
||||
2, 0,
|
||||
TMT_GRADIENTCOLOR2, colors + 1);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
return GetThemeColor(theme,
|
||||
2, 0,
|
||||
TMT_GRADIENTCOLOR3, colors + 2);
|
||||
}
|
||||
|
||||
virtual HRESULT buttonTextColor(HTHEME theme, UINT uItemState, COLORREF *color) const
|
||||
{
|
||||
int state;
|
||||
|
||||
if (color == NULL)
|
||||
return E_POINTER;
|
||||
state = 1;
|
||||
if ((uItemState & CDIS_DISABLED) != 0)
|
||||
state = 6;
|
||||
// TODO check if 3 is the correct part ID for all button types
|
||||
return GetThemeColor(theme,
|
||||
3, state,
|
||||
TMT_TEXTCOLOR, color);
|
||||
}
|
||||
|
||||
virtual BOOL buttonTextShadowed(UINT uItemState) const
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
virtual int folderBarMarginsLeftDIP(void) const { return 3; }
|
||||
virtual int folderBarMarginsTopDIP(void) const { return 2; }
|
||||
virtual int folderBarMarginsRightDIP(void) const { return 9; }
|
||||
virtual int folderBarMarginsBottomDIP(void) const { return 3; }
|
||||
|
||||
virtual int buttonMarginsXDIP(void) const { return 13; }
|
||||
virtual int buttonMarginsYDIP(void) const { return 5; }
|
||||
virtual int buttonTextArrowSeparationXDIP(void) const { return 1; }
|
||||
};
|
||||
|
||||
// all coordinates are in client space
|
||||
struct buttonMetrics {
|
||||
SIZE fittingSize;
|
||||
int baseX;
|
||||
int baseY;
|
||||
int dpiX;
|
||||
int dpiY;
|
||||
BOOL hasText;
|
||||
SIZE textSize;
|
||||
BOOL hasArrow;
|
||||
SIZE arrowSize;
|
||||
};
|
||||
|
||||
struct buttonRects {
|
||||
RECT clientRect;
|
||||
RECT textRect;
|
||||
RECT arrowRect;
|
||||
};
|
||||
|
||||
class commandModuleStyle {
|
||||
public:
|
||||
virtual HRESULT drawFolderBar(commandModuleStyleParams *p, HDC dc, RECT *rcWindow, RECT *rcPaint) const = 0;
|
||||
virtual HRESULT buttonMetrics(commandModuleStyleParams *p, HWND button, HDC dc, struct buttonMetrics *m) const = 0;
|
||||
virtual HRESULT buttonRects(commandModuleStyleParams *p, HWND button, struct buttonMetrics *m, struct buttonRects *r) const = 0;
|
||||
virtual HRESULT drawButton(commandModuleStyleParams *p, HWND button, HDC dc, UINT uItemState, RECT *rcPaint) const = 0;
|
||||
};
|
||||
|
||||
class commandModuleStyleThemed : public commandModuleStyle {
|
||||
HTHEME theme;
|
||||
HTHEME textstyleTheme;
|
||||
public:
|
||||
commandModuleStyleThemed(HTHEME theme, HTHEME textstyleTheme)
|
||||
{
|
||||
this->theme = theme;
|
||||
this->textstyleTheme = textstyleTheme;
|
||||
}
|
||||
|
||||
virtual HRESULT drawFolderBar(commandModuleStyleParams *p, HDC dc, RECT *rcWindow, RECT *rcPaint) const
|
||||
{
|
||||
COLORREF colors[3];
|
||||
TRIVERTEX vertices[4];
|
||||
static GRADIENT_RECT gr[2] = {
|
||||
{ 0, 1 },
|
||||
{ 2, 3 },
|
||||
};
|
||||
HRESULT hr;
|
||||
|
||||
hr = p->backgroundGradientColors(this->theme, colors);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
|
||||
vertices[0].x = rcWindow->left;
|
||||
vertices[0].y = rcWindow->top;
|
||||
vertices[0].Red = ((COLOR16) GetRValue(colors[0])) << 8;
|
||||
vertices[0].Green = ((COLOR16) GetGValue(colors[0])) << 8;
|
||||
vertices[0].Blue = ((COLOR16) GetBValue(colors[0])) << 8;
|
||||
vertices[0].Alpha = ((COLOR16) LOBYTE(colors[0] >> 24)) << 8;
|
||||
|
||||
vertices[1].x = (rcWindow->right - rcWindow->left) / 2;
|
||||
vertices[1].y = rcWindow->bottom;
|
||||
vertices[1].Red = ((COLOR16) GetRValue(colors[1])) << 8;
|
||||
vertices[1].Green = ((COLOR16) GetGValue(colors[1])) << 8;
|
||||
vertices[1].Blue = ((COLOR16) GetBValue(colors[1])) << 8;
|
||||
vertices[1].Alpha = ((COLOR16) LOBYTE(colors[1] >> 24)) << 8;
|
||||
|
||||
vertices[2] = vertices[1];
|
||||
vertices[2].y = rcWindow->top;
|
||||
|
||||
vertices[3].x = rcWindow->right;
|
||||
vertices[3].y = rcWindow->bottom;
|
||||
vertices[3].Red = ((COLOR16) GetRValue(colors[2])) << 8;
|
||||
vertices[3].Green = ((COLOR16) GetGValue(colors[2])) << 8;
|
||||
vertices[3].Blue = ((COLOR16) GetBValue(colors[2])) << 8;
|
||||
vertices[3].Alpha = ((COLOR16) LOBYTE(colors[2] >> 24)) << 8;
|
||||
|
||||
if (GradientFill(dc, vertices, 4, (PVOID) gr, 2, GRADIENT_FILL_RECT_H) == FALSE)
|
||||
return lastErrorToHRESULT(GetLastError());
|
||||
return DrawThemeBackground(this->theme, dc,
|
||||
p->partID_CMOD_MODULEBACKGROUND(), 0,
|
||||
rcWindow, rcPaint);
|
||||
}
|
||||
|
||||
#define hasNonsplitArrow(button) ((button) == leftButtons[0] || (button) == leftButtons[1] || (button) == leftButtons[2])
|
||||
|
||||
#define dlgUnitsToX(dlg, baseX) MulDiv((dlg), (baseX), 4)
|
||||
#define dlgUnitsToY(dlg, baseY) MulDiv((dlg), (baseY), 8)
|
||||
// TODO verify the parameter order
|
||||
#define dipsToX(dip, dpiX) MulDiv((dip), (dpiX), 96)
|
||||
#define dipsToY(dip, dpiY) MulDiv((dip), (dpiY), 96)
|
||||
|
||||
// TODO for win7: the sizes are correct (according to UI Automation) but they don't visually match?
|
||||
virtual HRESULT buttonMetrics(commandModuleStyleParams *p, HWND button, HDC dc, struct buttonMetrics *m) const
|
||||
{
|
||||
BOOL releaseDC;
|
||||
TEXTMETRICW tm;
|
||||
RECT r;
|
||||
int minStdButtonHeight;
|
||||
HRESULT hr;
|
||||
|
||||
if (m == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
releaseDC = FALSE;
|
||||
if (dc == NULL) {
|
||||
dc = GetDC(button);
|
||||
if (dc == NULL)
|
||||
return lastErrorToHRESULT(GetLastError());
|
||||
releaseDC = TRUE;
|
||||
}
|
||||
|
||||
ZeroMemory(&tm, sizeof (TEXTMETRICW));
|
||||
hr = GetThemeTextMetrics(this->textstyleTheme, dc,
|
||||
TEXT_BODYTEXT, 0,
|
||||
&tm);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
hr = GetThemeTextExtent(this->textstyleTheme, dc,
|
||||
TEXT_BODYTEXT, 0,
|
||||
L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, 0,
|
||||
NULL, &r);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
m->baseX = (int) (((r.right - r.left) / 26 + 1) / 2);
|
||||
m->baseY = (int) tm.tmHeight;
|
||||
m->dpiX = GetDeviceCaps(dc, LOGPIXELSX);
|
||||
m->dpiY = GetDeviceCaps(dc, LOGPIXELSY);
|
||||
|
||||
m->fittingSize.cx = 0;
|
||||
m->fittingSize.cy = 0;
|
||||
|
||||
m->hasText = TRUE;
|
||||
if (m->hasText) {
|
||||
LRESULT n;
|
||||
WCHAR *buf;
|
||||
LOGFONTW lf;
|
||||
|
||||
n = SendMessageW(button, WM_GETTEXTLENGTH, 0, 0);
|
||||
buf = new WCHAR[n + 1];
|
||||
GetWindowTextW(button, buf, n + 1);
|
||||
hr = GetThemeTextExtent(this->textstyleTheme, dc,
|
||||
TEXT_BODYTEXT, 0,
|
||||
buf, n, DT_CENTER,
|
||||
NULL, &r);
|
||||
delete[] buf;
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
m->textSize.cx = r.right - r.left;
|
||||
m->textSize.cy = r.bottom - r.top;
|
||||
m->fittingSize.cx += m->textSize.cx;
|
||||
m->fittingSize.cy += m->textSize.cy;
|
||||
|
||||
// dui70.dll adds this to the width when "overhang" is enabled, and it seems to be enabled for our cases, but I can't tell what conditions it's enabled for...
|
||||
// and yes, it seems to be using the raw lfHeight value here :/
|
||||
// TODO find the right TMT constant
|
||||
hr = GetThemeFont(this->textstyleTheme, dc,
|
||||
4, 0,
|
||||
TMT_FONT, &lf);
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
m->fittingSize.cx += 2 * (abs(lf.lfHeight) / 6);
|
||||
}
|
||||
|
||||
m->hasArrow = hasNonsplitArrow(button);
|
||||
if (m->hasArrow) {
|
||||
// TS_MIN returns 1x1 and TS_DRAW returns 0x0, so...
|
||||
hr = GetThemePartSize(theme, dc,
|
||||
p->partID_CMOD_MENUGLYPH(), 0,
|
||||
NULL, TS_TRUE, &(m->arrowSize));
|
||||
if (hr != S_OK)
|
||||
goto fail;
|
||||
m->fittingSize.cx += m->arrowSize.cx;
|
||||
// TODO I don't think dui70.dll takes this into consideration...
|
||||
if (m->fittingSize.cy < m->arrowSize.cy)
|
||||
m->fittingSize.cy = m->arrowSize.cy;
|
||||
m->fittingSize.cx += dipsToX(p->buttonTextArrowSeparationXDIP(), m->dpiX);
|
||||
}
|
||||
|
||||
m->fittingSize.cx += dipsToX(p->buttonMarginsXDIP(), m->dpiX) * 2;
|
||||
m->fittingSize.cy += dipsToY(p->buttonMarginsYDIP(), m->dpiY) * 2;
|
||||
|
||||
// and dui70.dll seems to do a variant of this but for text buttons only...
|
||||
minStdButtonHeight = dlgUnitsToY(14, m->baseY);
|
||||
if (m->fittingSize.cy < minStdButtonHeight)
|
||||
m->fittingSize.cy = minStdButtonHeight;
|
||||
|
||||
hr = S_OK;
|
||||
fail:
|
||||
if (releaseDC)
|
||||
// TODO when migrating this to libui, this will need to be renamed to indicate we are intentionally ignoring errors
|
||||
ReleaseDC(button, dc);
|
||||
return hr;
|
||||
};
|
||||
|
||||
// TODO check errors
|
||||
virtual HRESULT buttonRects(commandModuleStyleParams *p, HWND button, struct buttonMetrics *m, struct buttonRects *r) const
|
||||
{
|
||||
if (r == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
GetClientRect(button, &(r->clientRect));
|
||||
|
||||
if (m->hasText)
|
||||
r->textRect = r->clientRect;
|
||||
|
||||
if (m->hasArrow) {
|
||||
r->arrowRect = r->clientRect;
|
||||
r->arrowRect.left = r->arrowRect.right;
|
||||
r->arrowRect.left -= dipsToX(p->buttonMarginsXDIP(), m->dpiX);
|
||||
r->arrowRect.right = r->arrowRect.left;
|
||||
r->arrowRect.left -= m->arrowSize.cx;
|
||||
r->arrowRect.top += ((r->arrowRect.bottom - r->arrowRect.top) - m->arrowSize.cy) / 2;
|
||||
r->arrowRect.bottom = r->arrowRect.top + m->arrowSize.cy;
|
||||
|
||||
if (m->hasText) {
|
||||
r->textRect.right = r->arrowRect.left - dipsToX(p->buttonTextArrowSeparationXDIP(), m->dpiX);
|
||||
r->textRect.right += dipsToX(p->buttonMarginsXDIP(), m->dpiX);
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// TODO check errors fully
|
||||
virtual HRESULT drawButton(commandModuleStyleParams *p, HWND button, HDC dc, UINT uItemState, RECT *rcPaint) const
|
||||
{
|
||||
struct buttonMetrics m;
|
||||
struct buttonRects r;
|
||||
int part, state;
|
||||
HRESULT hr;
|
||||
|
||||
hr = this->buttonMetrics(p, button, dc, &m);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
hr = this->buttonRects(p, button, &m, &r);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
|
||||
part = p->partID_CMOD_TASKBUTTON();
|
||||
state = p->stateID_CMODS_NORMAL();
|
||||
if ((uItemState & CDIS_FOCUS) != 0)
|
||||
state = p->stateID_CMODS_KEYFOCUSED();
|
||||
if ((uItemState & CDIS_HOT) != 0)
|
||||
state = p->stateID_CMODS_HOT();
|
||||
if ((uItemState & CDIS_SELECTED) != 0)
|
||||
state = p->stateID_CMODS_PRESSED();
|
||||
hr = DrawThemeParentBackground(button, dc, rcPaint);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
hr = DrawThemeBackground(this->theme, dc,
|
||||
part, state,
|
||||
&(r.clientRect), rcPaint);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
|
||||
if (m.hasText) {
|
||||
int textState;
|
||||
COLORREF textColor;
|
||||
LRESULT n;
|
||||
WCHAR *buf;
|
||||
DTTOPTS dttopts;
|
||||
|
||||
hr = p->buttonTextColor(this->theme, uItemState, &textColor);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
n = SendMessageW(button, WM_GETTEXTLENGTH, 0, 0);
|
||||
buf = new WCHAR[n + 1];
|
||||
GetWindowTextW(button, buf, n + 1);
|
||||
ZeroMemory(&dttopts, sizeof (DTTOPTS));
|
||||
dttopts.dwSize = sizeof (DTTOPTS);
|
||||
dttopts.dwFlags = DTT_TEXTCOLOR;
|
||||
dttopts.crText = textColor;
|
||||
hr = DrawThemeTextEx(this->textstyleTheme, dc,
|
||||
TEXT_BODYTEXT, 0,
|
||||
buf, n, DT_CENTER | DT_VCENTER | DT_SINGLELINE,
|
||||
&(r.textRect), &dttopts);
|
||||
delete[] buf;
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
}
|
||||
|
||||
if (m.hasArrow) {
|
||||
// TODO verify the state ID on all platforms
|
||||
hr = DrawThemeBackground(this->theme, dc,
|
||||
p->partID_CMOD_MENUGLYPH(), 0,
|
||||
&(r.arrowRect), rcPaint);
|
||||
if (hr != S_OK)
|
||||
return hr;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
#if 0
|
||||
// TODO check errors
|
||||
void drawExplorerChevron(HTHEME theme, HDC dc, HWND rebar, WPARAM band, RECT *rcPaint)
|
||||
{
|
||||
REBARBANDINFOW rbi;
|
||||
RECT r;
|
||||
int state;
|
||||
|
||||
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
|
||||
rbi.cbSize = sizeof (REBARBANDINFOW);
|
||||
rbi.fMask = RBBIM_CHILD | RBBIM_CHEVRONLOCATION | RBBIM_CHEVRONSTATE;
|
||||
SendMessageW(rebar, RB_GETBANDINFOW, band, (LPARAM) (&rbi));
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_INVISIBLE) != 0)
|
||||
return;
|
||||
state = 1;
|
||||
// TODO check if this is correct
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_FOCUSED) != 0)
|
||||
state = 4;
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_HOTTRACKED) != 0)
|
||||
state = 2;
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_PRESSED) != 0)
|
||||
state = 3;
|
||||
r = rbi.rcChevronLocation;
|
||||
// TODO commctrl.h says this should be correct for the chevron rect, but it's not?
|
||||
// MapWindowRect(rbi.hwndChild, rebar, &r);
|
||||
DrawThemeBackground(theme, dc,
|
||||
3, state,
|
||||
&r, rcPaint);
|
||||
DrawThemeBackground(theme, dc,
|
||||
7, 1,
|
||||
&r, rcPaint);
|
||||
}
|
||||
#endif
|
||||
|
||||
HICON shieldIcon;
|
||||
HICON applicationIcon;
|
||||
HICON helpIcon;
|
||||
HIMAGELIST rightList;
|
||||
|
||||
HTHEME theme = NULL;
|
||||
HTHEME textstyleTheme = NULL;
|
||||
const char *which = "7";
|
||||
commandModuleStyle *cms = NULL;
|
||||
commandModuleStyleParams *cmsp = NULL;
|
||||
HIMAGELIST dropdownArrowList = NULL;
|
||||
|
||||
static struct {
|
||||
const WCHAR *text;
|
||||
BOOL dropdown;
|
||||
} leftbarButtons[] = {
|
||||
{ L"Organize", TRUE },
|
||||
{ L"Include in library", TRUE },
|
||||
{ L"Share with", TRUE },
|
||||
{ L"Burn", FALSE },
|
||||
{ L"New folder", FALSE },
|
||||
};
|
||||
|
||||
// TODO check errors
|
||||
LRESULT drawExplorerButton(NMCUSTOMDRAW *nm)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
if (nm->dwDrawStage != CDDS_PREPAINT)
|
||||
return CDRF_DODEFAULT;
|
||||
hr = cms->drawButton(cmsp, nm->hdr.hwndFrom,
|
||||
nm->hdc, nm->uItemState, &(nm->rc));
|
||||
if (hr != S_OK)
|
||||
return CDRF_DODEFAULT;
|
||||
return CDRF_SKIPDEFAULT;
|
||||
}
|
||||
|
||||
void onWM_CREATE(HWND hwnd)
|
||||
{
|
||||
int buttonx, buttony;
|
||||
int i;
|
||||
|
||||
buttonx = 5;
|
||||
buttony = 5;
|
||||
for (i = 0; i < 5; i++) {
|
||||
// TODO split buttons don't support arrow navigation?
|
||||
leftButtons[i] = CreateWindowExW(0,
|
||||
L"BUTTON", leftbarButtons[i].text,
|
||||
WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON,
|
||||
buttonx, buttony,
|
||||
150, 30,
|
||||
hwnd, (HMENU) (100 + i), hInstance, NULL);
|
||||
if (leftButtons[i] == NULL)
|
||||
diele("CreateWindowExW(L\"BUTTON\")");
|
||||
buttonx += 150;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO check errors
|
||||
void updateTheme(HWND hwnd)
|
||||
{
|
||||
if (cmsp != NULL) {
|
||||
delete cmsp;
|
||||
cmsp = NULL;
|
||||
}
|
||||
if (cms != NULL) {
|
||||
delete cms;
|
||||
cms = NULL;
|
||||
}
|
||||
if (textstyleTheme != NULL) {
|
||||
CloseThemeData(textstyleTheme);
|
||||
textstyleTheme = NULL;
|
||||
}
|
||||
if (theme != NULL) {
|
||||
CloseThemeData(theme);
|
||||
theme = NULL;
|
||||
}
|
||||
|
||||
theme = OpenThemeData(hwnd, L"CommandModule");
|
||||
textstyleTheme = OpenThemeData(hwnd, L"TEXTSTYLE");
|
||||
cms = new commandModuleStyleThemed(theme, textstyleTheme);
|
||||
if (strcmp(which, "vista") == 0)
|
||||
cmsp = new commandModuleStyleParamsVista;
|
||||
else
|
||||
cmsp = new commandModuleStyleParams7;
|
||||
}
|
||||
|
||||
void repositionButtons(HWND hwnd)
|
||||
{
|
||||
HDWP dwp;
|
||||
int buttonx, buttony;
|
||||
HDC dc;
|
||||
int dpiX;
|
||||
int dpiY;
|
||||
struct buttonMetrics m;
|
||||
int i;
|
||||
|
||||
dc = GetDC(hwnd);
|
||||
if (dc == NULL)
|
||||
diele("GetDC()");
|
||||
dpiX = GetDeviceCaps(dc, LOGPIXELSX);
|
||||
dpiY = GetDeviceCaps(dc, LOGPIXELSY);
|
||||
// TODO check error
|
||||
ReleaseDC(hwnd, dc);
|
||||
|
||||
dwp = BeginDeferWindowPos(5);
|
||||
if (dwp == NULL)
|
||||
diele("BeginDeferWindowPos()");
|
||||
buttonx = dipsToX(cmsp->folderBarMarginsLeftDIP(), dpiX);
|
||||
buttony = dipsToY(cmsp->folderBarMarginsTopDIP(), dpiY);
|
||||
for (i = 0; i < 5; i++) {
|
||||
cms->buttonMetrics(cmsp, leftButtons[i], NULL, &m);
|
||||
dwp = DeferWindowPos(dwp, leftButtons[i], NULL,
|
||||
buttonx, buttony, m.fittingSize.cx, m.fittingSize.cy,
|
||||
SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER);
|
||||
if (dwp == NULL)
|
||||
diele("DeferWindowPos()");
|
||||
buttonx += m.fittingSize.cx;
|
||||
}
|
||||
if (EndDeferWindowPos(dwp) == 0)
|
||||
diele("EndDeferWindowPos()");
|
||||
}
|
||||
|
||||
// TODO check errors
|
||||
void folderBarRect(HWND hwnd, HDC dc, RECT *r)
|
||||
{
|
||||
int dpiX;
|
||||
int dpiY;
|
||||
RECT child;
|
||||
int i;
|
||||
|
||||
dpiX = GetDeviceCaps(dc, LOGPIXELSX);
|
||||
dpiY = GetDeviceCaps(dc, LOGPIXELSY);
|
||||
|
||||
GetClientRect(hwnd, r);
|
||||
r->right -= r->left;
|
||||
r->left = 0;
|
||||
r->top = 0;
|
||||
r->bottom = 0;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
GetWindowRect(leftButtons[i], &child);
|
||||
if (r->bottom < (child.bottom - child.top))
|
||||
r->bottom = (child.bottom - child.top);
|
||||
}
|
||||
|
||||
r->bottom += dipsToY(cmsp->folderBarMarginsTopDIP(), dpiY);
|
||||
r->bottom += dipsToY(cmsp->folderBarMarginsBottomDIP(), dpiY);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// TODO check errors
|
||||
void handleEvents(HWND hwnd, WPARAM wParam)
|
||||
{
|
||||
LRESULT n;
|
||||
const WCHAR *selRebar = NULL, *selToolbar = NULL;
|
||||
WCHAR *bufRebar = NULL, *bufToolbar = NULL;
|
||||
BOOL changeRebar = FALSE, changeToolbar = FALSE;
|
||||
BOOL invalidate = FALSE;
|
||||
WPARAM check;
|
||||
|
||||
switch (wParam) {
|
||||
case MAKEWPARAM(300, CBN_SELCHANGE):
|
||||
n = SendMessageW(rebarCombo, CB_GETCURSEL, 0, 0);
|
||||
selRebar = rebarThemes[n];
|
||||
changeRebar = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(301, CBN_SELCHANGE):
|
||||
n = SendMessageW(toolbarCombo, CB_GETCURSEL, 0, 0);
|
||||
selToolbar = toolbarThemes[n];
|
||||
changeToolbar = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(200, BN_CLICKED):
|
||||
drawmode = 0;
|
||||
n = SendMessageW(rebarCombo, WM_GETTEXTLENGTH, 0, 0);
|
||||
bufRebar = new WCHAR[n + 1];
|
||||
GetWindowTextW(rebarCombo, bufRebar, n + 1);
|
||||
n = SendMessageW(toolbarCombo, WM_GETTEXTLENGTH, 0, 0);
|
||||
bufToolbar = new WCHAR[n + 1];
|
||||
GetWindowTextW(toolbarCombo, bufToolbar, n + 1);
|
||||
selRebar = bufRebar;
|
||||
selToolbar = bufToolbar;
|
||||
changeRebar = TRUE;
|
||||
changeToolbar = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(201, BN_CLICKED):
|
||||
drawmode = 1;
|
||||
invalidate = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(302, BN_CLICKED):
|
||||
ShowWindow(leftbar, SW_HIDE);
|
||||
check = BST_CHECKED;
|
||||
if (SendMessage(toolbarTransparentCheckbox, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
check = BST_UNCHECKED;
|
||||
SendMessage(toolbarTransparentCheckbox, BM_SETCHECK, check, 0);
|
||||
if (check == BST_CHECKED)
|
||||
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST | TBSTYLE_TRANSPARENT);
|
||||
else
|
||||
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST);
|
||||
ShowWindow(leftbar, SW_SHOW);
|
||||
break;
|
||||
case MAKEWPARAM(202, BN_CLICKED):
|
||||
SetFocus(leftbar);
|
||||
break;
|
||||
}
|
||||
if (changeRebar) {
|
||||
if (selRebar != NULL && wcscmp(selRebar, L"NULL") == 0)
|
||||
selRebar = NULL;
|
||||
if (selRebar != NULL && *selRebar != L'\0')
|
||||
SendMessageW(rebar, RB_SETWINDOWTHEME, 0, (LPARAM) selRebar);
|
||||
else
|
||||
SetWindowTheme(rebar, selRebar, selRebar);
|
||||
invalidate = TRUE;
|
||||
}
|
||||
if (changeToolbar) {
|
||||
if (selToolbar != NULL && wcscmp(selToolbar, L"NULL") == 0)
|
||||
selToolbar = NULL;
|
||||
if (selToolbar != NULL && *selToolbar != L'\0') {
|
||||
SendMessageW(leftbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
|
||||
SendMessageW(rightbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
|
||||
} else {
|
||||
SetWindowTheme(leftbar, selToolbar, selToolbar);
|
||||
SetWindowTheme(rightbar, selToolbar, selToolbar);
|
||||
}
|
||||
invalidate = TRUE;
|
||||
}
|
||||
if (invalidate)
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
if (bufRebar != NULL)
|
||||
delete[] bufRebar;
|
||||
if (bufToolbar != NULL)
|
||||
delete[] bufToolbar;
|
||||
}
|
||||
#endif
|
||||
|
||||
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
HDC dc;
|
||||
PAINTSTRUCT ps;
|
||||
NMHDR *nm = (NMHDR *) lParam;
|
||||
int i;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_CREATE:
|
||||
onWM_CREATE(hwnd);
|
||||
updateTheme(hwnd);
|
||||
repositionButtons(hwnd);
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
repositionButtons(hwnd);
|
||||
// TODO check errors
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
break;
|
||||
case WM_THEMECHANGED:
|
||||
updateTheme(hwnd);
|
||||
repositionButtons(hwnd);
|
||||
break;
|
||||
case WM_PAINT:
|
||||
// TODO check errors
|
||||
dc = BeginPaint(hwnd, &ps);
|
||||
{RECT w;
|
||||
folderBarRect(hwnd, dc, &w);
|
||||
cms->drawFolderBar(cmsp, dc, &w, &(ps.rcPaint));}
|
||||
EndPaint(hwnd, &ps);
|
||||
return 0;
|
||||
case WM_PRINTCLIENT:
|
||||
{RECT w, paint;
|
||||
folderBarRect(hwnd, (HDC) wParam, &w);
|
||||
GetClientRect(hwnd,&paint);
|
||||
cms->drawFolderBar(cmsp, (HDC) wParam, &w, &w);}
|
||||
return 0;
|
||||
#if 0
|
||||
case WM_COMMAND:
|
||||
handleEvents(hwnd, wParam);
|
||||
break;
|
||||
#endif
|
||||
case WM_NOTIFY:
|
||||
switch (nm->code) {
|
||||
case NM_CUSTOMDRAW:
|
||||
for (i = 0; i < 5; i++)
|
||||
if (nm->hwndFrom == leftButtons[i])
|
||||
return drawExplorerButton((NMCUSTOMDRAW *) nm);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
STARTUPINFOW si;
|
||||
int nCmdShow;
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
HICON hDefaultIcon;
|
||||
HCURSOR hDefaultCursor;
|
||||
WNDCLASSW wc;
|
||||
HWND mainwin;
|
||||
MSG msg;
|
||||
HRESULT hr;
|
||||
|
||||
if (argc > 1)
|
||||
which = argv[1];
|
||||
|
||||
hInstance = (HINSTANCE) (&__ImageBase);
|
||||
nCmdShow = SW_SHOWDEFAULT;
|
||||
GetStartupInfoW(&si);
|
||||
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
|
||||
nCmdShow = si.wShowWindow;
|
||||
|
||||
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
|
||||
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
|
||||
icc.dwICC = ICC_STANDARD_CLASSES | ICC_BAR_CLASSES | ICC_COOL_CLASSES;
|
||||
if (InitCommonControlsEx(&icc) == 0)
|
||||
diele("InitCommonControlsEx()");
|
||||
|
||||
hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
|
||||
if (hDefaultIcon == NULL)
|
||||
diele("LoadIconW(IDI_APPLICATION)");
|
||||
hDefaultCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||
if (hDefaultCursor == NULL)
|
||||
diele("LoadCursorW(IDC_ARROW)");
|
||||
|
||||
hr = LoadIconMetric(NULL, IDI_SHIELD, LIM_SMALL, &shieldIcon);
|
||||
if (hr != S_OK)
|
||||
diehr("LoadIconMetric(IDI_SHIELD)", hr);
|
||||
hr = LoadIconMetric(NULL, IDI_APPLICATION, LIM_SMALL, &applicationIcon);
|
||||
if (hr != S_OK)
|
||||
diehr("LoadIconMetric(IDI_APPLICATION)", hr);
|
||||
hr = LoadIconMetric(NULL, IDI_QUESTION, LIM_SMALL, &helpIcon);
|
||||
if (hr != S_OK)
|
||||
diehr("LoadIconMetric(IDI_QUESTION)", hr);
|
||||
rightList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
|
||||
ILC_COLOR32, 0, 3);
|
||||
if (rightList == NULL)
|
||||
diele("ImageList_Create()");
|
||||
if (ImageList_ReplaceIcon(rightList, -1, shieldIcon) == -1)
|
||||
diele("ImageList_ReplaceIcon(IDI_SHIELD)");
|
||||
if (ImageList_ReplaceIcon(rightList, -1, applicationIcon) == -1)
|
||||
diele("ImageList_ReplaceIcon(IDI_APPLICATION)");
|
||||
if (ImageList_ReplaceIcon(rightList, -1, helpIcon) == -1)
|
||||
diele("ImageList_ReplaceIcon(IDI_QUESTION)");
|
||||
|
||||
ZeroMemory(&wc, sizeof (WNDCLASSW));
|
||||
wc.lpszClassName = L"mainwin";
|
||||
wc.lpfnWndProc = wndproc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = hDefaultIcon;
|
||||
wc.hCursor = hDefaultCursor;
|
||||
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||
if (RegisterClassW(&wc) == 0)
|
||||
diele("RegisterClassW()");
|
||||
|
||||
mainwin = CreateWindowExW(0,
|
||||
L"mainwin", L"Main Window",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, NULL, hInstance, NULL);
|
||||
if (mainwin == NULL)
|
||||
diele("CreateWindowExW(L\"mainwin\")");
|
||||
|
||||
ShowWindow(mainwin, nCmdShow);
|
||||
if (UpdateWindow(mainwin) == 0)
|
||||
diele("UpdateWindow()");
|
||||
|
||||
for (;;) {
|
||||
int res;
|
||||
|
||||
res = GetMessageW(&msg, NULL, 0, 0);
|
||||
if (res < 0)
|
||||
diele("GetMessageW()");
|
||||
if (res == 0)
|
||||
break;
|
||||
if (IsDialogMessageW(mainwin, &msg) == 0) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,676 +0,0 @@
|
|||
// 9 october 2018
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
#define STRICT
|
||||
#define STRICT_TYPED_ITEMIDS
|
||||
#define WINVER 0x0600 /* from Microsoft's winnls.h */
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
|
||||
#define _WIN32_IE 0x0700
|
||||
#define NTDDI_VERSION 0x06000000
|
||||
#include <windows.h>
|
||||
#include <commctrl.h>
|
||||
#include <uxtheme.h>
|
||||
#include <vsstyle.h>
|
||||
#include <vssym32.h>
|
||||
#include <windowsx.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// cl winrebarexplorertheme.cpp -MT -link user32.lib kernel32.lib gdi32.lib comctl32.lib uxtheme.lib msimg32.lib windows.res
|
||||
|
||||
void diele(const char *func)
|
||||
{
|
||||
DWORD le;
|
||||
|
||||
le = GetLastError();
|
||||
fprintf(stderr, "%s: %I32u\n", func, le);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
void diehr(const char *func, HRESULT hr)
|
||||
{
|
||||
fprintf(stderr, "%s: 0x%08I32X\n", func, hr);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
HINSTANCE hInstance;
|
||||
HWND rebar;
|
||||
HWND leftbar;
|
||||
HWND rightbar;
|
||||
HWND rebarCombo;
|
||||
HWND toolbarCombo;
|
||||
HWND toolbarTransparentCheckbox;
|
||||
|
||||
HICON shieldIcon;
|
||||
HICON applicationIcon;
|
||||
HICON helpIcon;
|
||||
HIMAGELIST rightList;
|
||||
|
||||
#define toolbarStyles (WS_CHILD | CCS_NODIVIDER | CCS_NOPARENTALIGN | CCS_NORESIZE | TBSTYLE_FLAT)
|
||||
|
||||
static struct {
|
||||
const WCHAR *text;
|
||||
BOOL dropdown;
|
||||
} leftbarButtons[] = {
|
||||
{ L"Organize", TRUE },
|
||||
{ L"Include in library", TRUE },
|
||||
{ L"Share with", TRUE },
|
||||
{ L"Burn", FALSE },
|
||||
{ L"New folder", FALSE },
|
||||
};
|
||||
|
||||
// TODO check errors
|
||||
// TODO extract colors from the theme
|
||||
void drawExplorerBackground(HTHEME theme, HDC dc, RECT *rcWindow, RECT *rcPaint)
|
||||
{
|
||||
static TRIVERTEX vertices[] = {
|
||||
{ 0, 0, 4 << 8, 80 << 8, 130 << 8, 255 << 8 },
|
||||
{ 0, 0, 17 << 8, 101 << 8, 132 << 8, 255 << 8 },
|
||||
{ 0, 0, 17 << 8, 101 << 8, 132 << 8, 255 << 8 },
|
||||
{ 0, 0, 29 << 8, 121 << 8, 134 << 8, 255 << 8 },
|
||||
};
|
||||
static GRADIENT_RECT gr[2] = {
|
||||
{ 0, 1 },
|
||||
{ 2, 3 },
|
||||
};
|
||||
|
||||
vertices[0].x = rcPaint->left;
|
||||
vertices[0].y = 0;
|
||||
vertices[1].x = rcPaint->right;
|
||||
vertices[1].y = (rcWindow->bottom - rcWindow->top) / 2;
|
||||
vertices[2].x = rcPaint->left;
|
||||
vertices[2].y = (rcWindow->bottom - rcWindow->top) / 2;
|
||||
vertices[3].x = rcPaint->right;
|
||||
vertices[3].y = rcWindow->bottom - rcWindow->top;
|
||||
GradientFill(dc, vertices, 4, (PVOID) gr, 2, GRADIENT_FILL_RECT_V);
|
||||
DrawThemeBackground(theme, dc,
|
||||
1, 0,
|
||||
rcWindow, rcPaint);
|
||||
}
|
||||
|
||||
// TODO check errors
|
||||
void drawExplorerChevron(HTHEME theme, HDC dc, HWND rebar, WPARAM band, RECT *rcPaint)
|
||||
{
|
||||
REBARBANDINFOW rbi;
|
||||
RECT r;
|
||||
int state;
|
||||
|
||||
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
|
||||
rbi.cbSize = sizeof (REBARBANDINFOW);
|
||||
rbi.fMask = RBBIM_CHILD | RBBIM_CHEVRONLOCATION | RBBIM_CHEVRONSTATE;
|
||||
SendMessageW(rebar, RB_GETBANDINFOW, band, (LPARAM) (&rbi));
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_INVISIBLE) != 0)
|
||||
return;
|
||||
state = 1;
|
||||
// TODO check if this is correct
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_FOCUSED) != 0)
|
||||
state = 4;
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_HOTTRACKED) != 0)
|
||||
state = 2;
|
||||
if ((rbi.uChevronState & STATE_SYSTEM_PRESSED) != 0)
|
||||
state = 3;
|
||||
r = rbi.rcChevronLocation;
|
||||
// TODO commctrl.h says this should be correct for the chevron rect, but it's not?
|
||||
// MapWindowRect(rbi.hwndChild, rebar, &r);
|
||||
DrawThemeBackground(theme, dc,
|
||||
3, state,
|
||||
&r, rcPaint);
|
||||
DrawThemeBackground(theme, dc,
|
||||
7, 1,
|
||||
&r, rcPaint);
|
||||
}
|
||||
|
||||
// TODO check errors
|
||||
LRESULT customDrawExplorerRebar(NMCUSTOMDRAW *nm)
|
||||
{
|
||||
HTHEME theme;
|
||||
RECT r;
|
||||
|
||||
if (nm->dwDrawStage != CDDS_PREPAINT)
|
||||
return CDRF_DODEFAULT;
|
||||
theme = OpenThemeData(nm->hdr.hwndFrom, L"CommandModule");
|
||||
GetClientRect(nm->hdr.hwndFrom, &r);
|
||||
drawExplorerBackground(theme, nm->hdc, &r, &(nm->rc));
|
||||
// TODO dwItemSpec is often invalid?!
|
||||
drawExplorerChevron(theme, nm->hdc, nm->hdr.hwndFrom, 0, &(nm->rc));
|
||||
CloseThemeData(theme);
|
||||
return CDRF_SKIPDEFAULT;
|
||||
}
|
||||
|
||||
// TODO check errors
|
||||
LRESULT customDrawExplorerToolbar(NMTBCUSTOMDRAW *nm)
|
||||
{
|
||||
HWND toolbar, rebar;
|
||||
WPARAM itemIndex;
|
||||
TBBUTTON tbb;
|
||||
HTHEME theme;
|
||||
RECT r;
|
||||
int part, state;
|
||||
|
||||
toolbar = nm->nmcd.hdr.hwndFrom;
|
||||
switch (nm->nmcd.dwDrawStage) {
|
||||
case CDDS_PREPAINT:
|
||||
theme = OpenThemeData(toolbar, L"CommandModule");
|
||||
rebar = GetParent(toolbar);
|
||||
GetWindowRect(rebar, &r);
|
||||
MapWindowRect(NULL, toolbar, &r);
|
||||
drawExplorerBackground(theme, nm->nmcd.hdc, &r, &(nm->nmcd.rc));
|
||||
CloseThemeData(theme);
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
case CDDS_ITEMPREPAINT:
|
||||
itemIndex = (WPARAM) SendMessageW(toolbar, TB_COMMANDTOINDEX, nm->nmcd.dwItemSpec, 0);
|
||||
ZeroMemory(&tbb, sizeof (TBBUTTON));
|
||||
SendMessageW(toolbar, TB_GETBUTTON, itemIndex, (LPARAM) (&tbb));
|
||||
theme = OpenThemeData(toolbar, L"CommandModule");
|
||||
part = 3;
|
||||
if ((tbb.fsStyle & BTNS_DROPDOWN) != 0)
|
||||
part = 4;
|
||||
state = 1;
|
||||
// TODO this doesn't work; both keyboard and mouse are listed as HOT
|
||||
if ((nm->nmcd.uItemState & CDIS_FOCUS) != 0)
|
||||
state = 4;
|
||||
if ((nm->nmcd.uItemState & CDIS_HOT) != 0)
|
||||
state = 2;
|
||||
if ((nm->nmcd.uItemState & CDIS_SELECTED) != 0)
|
||||
state = 3;
|
||||
SendMessageW(toolbar, TB_GETITEMRECT, itemIndex, (LPARAM) (&r));
|
||||
DrawThemeBackground(theme, nm->nmcd.hdc,
|
||||
3, state,
|
||||
&r, &(nm->nmcd.rc));
|
||||
CloseThemeData(theme);
|
||||
return TBCDRF_NOBACKGROUND;
|
||||
}
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
|
||||
static struct {
|
||||
const WCHAR *text;
|
||||
LRESULT (*handleRebar)(NMCUSTOMDRAW *nm);
|
||||
LRESULT (*handleToolbar)(NMTBCUSTOMDRAW *nm);
|
||||
} drawmodes[] = {
|
||||
{ L"SetWindowTheme()", NULL, NULL },
|
||||
{ L"Custom Draw Explorer", customDrawExplorerRebar, customDrawExplorerToolbar },
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
int drawmode = 0;
|
||||
|
||||
static const WCHAR *rebarThemes[] = {
|
||||
L"NULL",
|
||||
L"",
|
||||
L"AlternateRebar",
|
||||
L"BrowserTabBar",
|
||||
L"Communications",
|
||||
L"Default",
|
||||
L"ExplorerBar",
|
||||
L"Help",
|
||||
L"InactiveNavbar",
|
||||
L"InactiveNavbarComposited",
|
||||
L"ITBarBase",
|
||||
L"MaxInactiveNavbar",
|
||||
L"MaxInactiveNavbarComposited",
|
||||
L"MaxNavbar",
|
||||
L"MaxNavbarComposited",
|
||||
L"Media",
|
||||
L"Navbar",
|
||||
L"NavbarBase",
|
||||
L"NavbarComposited",
|
||||
L"NavbarNonTopmost",
|
||||
L"Rebar",
|
||||
L"RebarStyle",
|
||||
L"TaskBar",
|
||||
L"TaskBarComposited",
|
||||
NULL,
|
||||
};
|
||||
|
||||
static WCHAR *toolbarThemes[] = {
|
||||
L"NULL",
|
||||
L"",
|
||||
L"Alternate",
|
||||
L"BB",
|
||||
L"BBComposited",
|
||||
L"Communications",
|
||||
L"ExplorerMenu",
|
||||
L"Go",
|
||||
L"GoComposited",
|
||||
L"InactiveBB",
|
||||
L"InactiveBBComposited",
|
||||
L"InactiveGo",
|
||||
L"InactiveGoComposited",
|
||||
L"InfoPaneToolbar",
|
||||
L"LVPopup",
|
||||
L"LVPopupBottom",
|
||||
L"MaxBB",
|
||||
L"MaxBBComposited",
|
||||
L"MaxGo",
|
||||
L"MaxGoComposited",
|
||||
L"MaxInactiveBB",
|
||||
L"MaxInactiveBBComposited",
|
||||
L"MaxInactiveGo",
|
||||
L"MaxInactiveGoComposited",
|
||||
L"Media",
|
||||
L"Placesbar",
|
||||
L"SearchButton",
|
||||
L"SearchButtonComposited",
|
||||
L"StartMenu",
|
||||
L"TaskBar",
|
||||
L"TaskBarComposited",
|
||||
L"TaskBarVert",
|
||||
L"TaskBarVertComposited",
|
||||
L"Toolbar",
|
||||
L"ToolbarStyle",
|
||||
L"TrayNotify",
|
||||
L"TrayNotifyComposited",
|
||||
NULL,
|
||||
};
|
||||
|
||||
// TODO toolbarThemes
|
||||
|
||||
void onWM_CREATE(HWND hwnd)
|
||||
{
|
||||
TBBUTTON tbb[5];
|
||||
RECT btnrect;
|
||||
DWORD tbbtnsize;
|
||||
LONG tbsizex, tbsizey;
|
||||
REBARBANDINFOW rbi;
|
||||
HWND button;
|
||||
LONG buttonx, buttony;
|
||||
LONG combox, comboy;
|
||||
int i;
|
||||
|
||||
rebar = CreateWindowExW(0,
|
||||
REBARCLASSNAMEW, NULL,
|
||||
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CCS_NODIVIDER | CCS_TOP | RBS_FIXEDORDER,
|
||||
0, 0, 0, 0,
|
||||
hwnd, (HMENU) 100, hInstance, NULL);
|
||||
if (rebar == NULL)
|
||||
diele("CreateWindowExW(REBARCLASSNAMEW)");
|
||||
|
||||
leftbar = CreateWindowExW(0,
|
||||
TOOLBARCLASSNAMEW, NULL,
|
||||
toolbarStyles | TBSTYLE_LIST | TBSTYLE_TRANSPARENT,
|
||||
0, 0, 0, 0,
|
||||
hwnd, (HMENU) 101, hInstance, NULL);
|
||||
if (leftbar == NULL)
|
||||
diele("CreateWindowExW(TOOLBARCLASSNAMEW) leftbar");
|
||||
SendMessageW(leftbar, TB_BUTTONSTRUCTSIZE, sizeof (TBBUTTON), 0);
|
||||
// I_IMAGENONE causes the button text to be left-aligned; don't use it
|
||||
// if (SendMessageW(leftbar, TB_SETBITMAPSIZE, 0, 0) == FALSE)
|
||||
// diele("TB_SETBITMAPSIZE");
|
||||
SendMessageW(leftbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS | TBSTYLE_EX_HIDECLIPPEDBUTTONS | TBSTYLE_EX_MIXEDBUTTONS);
|
||||
// TODO this *should* be DIPs...
|
||||
// TODO figure out where the *2 is documented
|
||||
// SendMessageW(leftbar, TB_SETPADDING, 0, MAKELPARAM(6 * 2, 5 * 2));
|
||||
ZeroMemory(tbb, 5 * sizeof (TBBUTTON));
|
||||
for (i = 0; i < 5; i++) {
|
||||
tbb[i].iBitmap = 0;
|
||||
tbb[i].idCommand = i;
|
||||
tbb[i].fsState = TBSTATE_ENABLED;
|
||||
tbb[i].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON | BTNS_NOPREFIX | BTNS_SHOWTEXT;
|
||||
if (leftbarButtons[i].dropdown)
|
||||
tbb[i].fsStyle |= BTNS_DROPDOWN | BTNS_WHOLEDROPDOWN;
|
||||
tbb[i].iString = (INT_PTR) (leftbarButtons[i].text);
|
||||
}
|
||||
if (SendMessageW(leftbar, TB_ADDBUTTONSW, 5, (LPARAM) tbb) == FALSE)
|
||||
diele("TB_ADDBUTTONSW");
|
||||
|
||||
tbsizex = 0;
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (SendMessageW(leftbar, TB_GETITEMRECT, (WPARAM) i, (LPARAM) (&btnrect)) == FALSE)
|
||||
diele("TB_GETITEMRECT");
|
||||
tbsizex += btnrect.right - btnrect.left;
|
||||
}
|
||||
tbbtnsize = (DWORD) SendMessageW(leftbar, TB_GETBUTTONSIZE, 0, 0);
|
||||
tbsizey = HIWORD(tbbtnsize);
|
||||
|
||||
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
|
||||
rbi.cbSize = sizeof (REBARBANDINFOW);
|
||||
rbi.fMask = RBBIM_CHILD | RBBIM_STYLE | RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_IDEALSIZE | RBBIM_ID;
|
||||
rbi.fStyle = RBBS_NOGRIPPER | RBBS_CHILDEDGE | RBBS_USECHEVRON | RBBS_HIDETITLE;
|
||||
rbi.hwndChild = leftbar;
|
||||
rbi.cx = tbsizex;
|
||||
rbi.cyChild = tbsizey;
|
||||
rbi.cxMinChild = 0;
|
||||
rbi.cyMinChild = tbsizey;
|
||||
rbi.cxIdeal = tbsizex;
|
||||
rbi.wID = 0;
|
||||
if (SendMessageW(rebar, RB_INSERTBANDW, (WPARAM) (-1), (LPARAM) (&rbi)) == 0)
|
||||
diele("RB_INSERTBANDW leftbar");
|
||||
|
||||
rightbar = CreateWindowExW(0,
|
||||
TOOLBARCLASSNAMEW, NULL,
|
||||
toolbarStyles | TBSTYLE_TRANSPARENT,
|
||||
0, 0, 0, 0,
|
||||
hwnd, (HMENU) 102, hInstance, NULL);
|
||||
if (rightbar == NULL)
|
||||
diele("CreateWindowExW(TOOLBARCLASSNAMEW) rightbar");
|
||||
SendMessageW(rightbar, TB_BUTTONSTRUCTSIZE, sizeof (TBBUTTON), 0);
|
||||
SendMessageW(rightbar, TB_SETIMAGELIST, 0, (LPARAM) rightList);
|
||||
SendMessageW(rightbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_DRAWDDARROWS);
|
||||
// TODO this *should* be DIPs...
|
||||
// TODO figure out where the *2 is documented
|
||||
// SendMessageW(rightbar, TB_SETPADDING, 0, MAKELPARAM(6 * 2, 5 * 2));
|
||||
ZeroMemory(tbb, 5 * sizeof (TBBUTTON));
|
||||
tbb[0].iBitmap = 0;
|
||||
tbb[0].idCommand = 0;
|
||||
tbb[0].fsState = TBSTATE_ENABLED;
|
||||
tbb[0].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON | BTNS_DROPDOWN;
|
||||
tbb[1].iBitmap = 1;
|
||||
tbb[1].idCommand = 1;
|
||||
tbb[1].fsState = TBSTATE_ENABLED;
|
||||
tbb[1].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON;
|
||||
tbb[2].iBitmap = 2;
|
||||
tbb[2].idCommand = 2;
|
||||
tbb[2].fsState = TBSTATE_ENABLED;
|
||||
tbb[2].fsStyle = BTNS_AUTOSIZE | BTNS_BUTTON;
|
||||
if (SendMessageW(rightbar, TB_ADDBUTTONSW, 3, (LPARAM) tbb) == FALSE)
|
||||
diele("TB_ADDBUTTONSW");
|
||||
// TODO check error
|
||||
// TODO figure out why this works here but not elsewhere
|
||||
// SendMessageW(rightbar, TB_SETBUTTONSIZE, 0, 0);
|
||||
|
||||
tbsizex = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (SendMessageW(rightbar, TB_GETITEMRECT, (WPARAM) i, (LPARAM) (&btnrect)) == FALSE)
|
||||
diele("TB_GETITEMRECT");
|
||||
tbsizex += btnrect.right - btnrect.left;
|
||||
}
|
||||
tbbtnsize = (DWORD) SendMessageW(rightbar, TB_GETBUTTONSIZE, 0, 0);
|
||||
tbsizey = HIWORD(tbbtnsize);
|
||||
|
||||
ZeroMemory(&rbi, sizeof (REBARBANDINFOW));
|
||||
rbi.cbSize = sizeof (REBARBANDINFOW);
|
||||
rbi.fMask = RBBIM_CHILD | RBBIM_STYLE | RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_ID;
|
||||
rbi.fStyle = RBBS_NOGRIPPER | RBBS_HIDETITLE;
|
||||
rbi.hwndChild = rightbar;
|
||||
rbi.cx = tbsizex;
|
||||
rbi.cyChild = tbsizey;
|
||||
rbi.cxMinChild = tbsizex;
|
||||
rbi.cyMinChild = tbsizey;
|
||||
rbi.wID = 1;
|
||||
if (SendMessageW(rebar, RB_INSERTBANDW, (WPARAM) (-1), (LPARAM) (&rbi)) == 0)
|
||||
diele("RB_INSERTBANDW rightbar");
|
||||
|
||||
buttonx = 10;
|
||||
buttony = 40;
|
||||
#define buttonwid 200
|
||||
#define buttonht 25
|
||||
for (i = 0; drawmodes[i].text != NULL; i++) {
|
||||
button = CreateWindowExW(0,
|
||||
L"BUTTON", drawmodes[i].text,
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
buttonx, buttony,
|
||||
buttonwid, buttonht,
|
||||
hwnd, (HMENU) (200 + i), hInstance, NULL);
|
||||
if (button == NULL)
|
||||
diele("CreateWIndowExW(L\"BUTTON\")");
|
||||
if (i == 0) {
|
||||
combox = buttonx + buttonwid + 5;
|
||||
comboy = buttony;
|
||||
}
|
||||
buttony += buttonht + 5;
|
||||
}
|
||||
button = CreateWindowExW(0,
|
||||
L"BUTTON", L"Give Toolbar Focus",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
||||
buttonx, buttony,
|
||||
buttonwid, buttonht,
|
||||
hwnd, (HMENU) (200 + i), hInstance, NULL);
|
||||
if (button == NULL)
|
||||
diele("CreateWIndowExW(L\"BUTTON\")");
|
||||
rebarCombo = CreateWindowExW(WS_EX_CLIENTEDGE,
|
||||
L"COMBOBOX", L"",
|
||||
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
|
||||
combox, comboy,
|
||||
buttonwid, buttonht,
|
||||
hwnd, (HMENU) 300, hInstance, NULL);
|
||||
if (rebarCombo == NULL)
|
||||
diele("CreateWindowExW(L\"COMBOBOX\")");
|
||||
for (i = 0; rebarThemes[i] != NULL; i++)
|
||||
// TODO check error
|
||||
SendMessageW(rebarCombo, CB_ADDSTRING, 0, (LPARAM) (rebarThemes[i]));
|
||||
comboy += buttonht + 5;
|
||||
toolbarCombo = CreateWindowExW(WS_EX_CLIENTEDGE,
|
||||
L"COMBOBOX", L"",
|
||||
WS_CHILD | WS_VISIBLE | CBS_DROPDOWN,
|
||||
combox, comboy,
|
||||
buttonwid, buttonht,
|
||||
hwnd, (HMENU) 301, hInstance, NULL);
|
||||
if (toolbarCombo == NULL)
|
||||
diele("CreateWindowExW(L\"COMBOBOX\")");
|
||||
for (i = 0; toolbarThemes[i] != NULL; i++)
|
||||
// TODO check error
|
||||
SendMessageW(toolbarCombo, CB_ADDSTRING, 0, (LPARAM) (toolbarThemes[i]));
|
||||
comboy += buttonht + 5;
|
||||
toolbarTransparentCheckbox = CreateWindowExW(0,
|
||||
L"BUTTON", L"Transparent toolbar",
|
||||
WS_CHILD | WS_VISIBLE | BS_CHECKBOX,
|
||||
combox, comboy,
|
||||
buttonwid, buttonht,
|
||||
hwnd, (HMENU) 302, hInstance, NULL);
|
||||
if (toolbarTransparentCheckbox == NULL)
|
||||
diele("CreateWindowExW(L\"BUTTON\")");
|
||||
SendMessage(toolbarTransparentCheckbox, BM_SETCHECK, BST_CHECKED, 0);
|
||||
}
|
||||
|
||||
// TODO it seems like I shouldn't have to do this?
|
||||
void repositionRebar(HWND hwnd)
|
||||
{
|
||||
RECT win, rb;
|
||||
|
||||
if (GetClientRect(hwnd, &win) == 0)
|
||||
diele("GetClientRect()");
|
||||
if (GetWindowRect(rebar, &rb) == 0)
|
||||
diele("GetWindowRect()");
|
||||
if (SetWindowPos(rebar, NULL,
|
||||
0, 0, win.right - win.left, rb.bottom - rb.top,
|
||||
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER) == 0)
|
||||
diele("SetWindowPos()");
|
||||
}
|
||||
|
||||
// TODO check errors
|
||||
void handleEvents(HWND hwnd, WPARAM wParam)
|
||||
{
|
||||
LRESULT n;
|
||||
const WCHAR *selRebar = NULL, *selToolbar = NULL;
|
||||
WCHAR *bufRebar = NULL, *bufToolbar = NULL;
|
||||
BOOL changeRebar = FALSE, changeToolbar = FALSE;
|
||||
BOOL invalidate = FALSE;
|
||||
WPARAM check;
|
||||
|
||||
switch (wParam) {
|
||||
case MAKEWPARAM(300, CBN_SELCHANGE):
|
||||
n = SendMessageW(rebarCombo, CB_GETCURSEL, 0, 0);
|
||||
selRebar = rebarThemes[n];
|
||||
changeRebar = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(301, CBN_SELCHANGE):
|
||||
n = SendMessageW(toolbarCombo, CB_GETCURSEL, 0, 0);
|
||||
selToolbar = toolbarThemes[n];
|
||||
changeToolbar = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(200, BN_CLICKED):
|
||||
drawmode = 0;
|
||||
n = SendMessageW(rebarCombo, WM_GETTEXTLENGTH, 0, 0);
|
||||
bufRebar = new WCHAR[n + 1];
|
||||
GetWindowTextW(rebarCombo, bufRebar, n + 1);
|
||||
n = SendMessageW(toolbarCombo, WM_GETTEXTLENGTH, 0, 0);
|
||||
bufToolbar = new WCHAR[n + 1];
|
||||
GetWindowTextW(toolbarCombo, bufToolbar, n + 1);
|
||||
selRebar = bufRebar;
|
||||
selToolbar = bufToolbar;
|
||||
changeRebar = TRUE;
|
||||
changeToolbar = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(201, BN_CLICKED):
|
||||
drawmode = 1;
|
||||
invalidate = TRUE;
|
||||
break;
|
||||
case MAKEWPARAM(302, BN_CLICKED):
|
||||
ShowWindow(leftbar, SW_HIDE);
|
||||
check = BST_CHECKED;
|
||||
if (SendMessage(toolbarTransparentCheckbox, BM_GETCHECK, 0, 0) == BST_CHECKED)
|
||||
check = BST_UNCHECKED;
|
||||
SendMessage(toolbarTransparentCheckbox, BM_SETCHECK, check, 0);
|
||||
if (check == BST_CHECKED)
|
||||
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST | TBSTYLE_TRANSPARENT);
|
||||
else
|
||||
SendMessageW(leftbar, TB_SETSTYLE, 0, toolbarStyles | TBSTYLE_LIST);
|
||||
ShowWindow(leftbar, SW_SHOW);
|
||||
break;
|
||||
case MAKEWPARAM(202, BN_CLICKED):
|
||||
SetFocus(leftbar);
|
||||
break;
|
||||
}
|
||||
if (changeRebar) {
|
||||
if (selRebar != NULL && wcscmp(selRebar, L"NULL") == 0)
|
||||
selRebar = NULL;
|
||||
if (selRebar != NULL && *selRebar != L'\0')
|
||||
SendMessageW(rebar, RB_SETWINDOWTHEME, 0, (LPARAM) selRebar);
|
||||
else
|
||||
SetWindowTheme(rebar, selRebar, selRebar);
|
||||
invalidate = TRUE;
|
||||
}
|
||||
if (changeToolbar) {
|
||||
if (selToolbar != NULL && wcscmp(selToolbar, L"NULL") == 0)
|
||||
selToolbar = NULL;
|
||||
if (selToolbar != NULL && *selToolbar != L'\0') {
|
||||
SendMessageW(leftbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
|
||||
SendMessageW(rightbar, TB_SETWINDOWTHEME, 0, (LPARAM) selToolbar);
|
||||
} else {
|
||||
SetWindowTheme(leftbar, selToolbar, selToolbar);
|
||||
SetWindowTheme(rightbar, selToolbar, selToolbar);
|
||||
}
|
||||
invalidate = TRUE;
|
||||
}
|
||||
if (invalidate)
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
if (bufRebar != NULL)
|
||||
delete[] bufRebar;
|
||||
if (bufToolbar != NULL)
|
||||
delete[] bufToolbar;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
NMHDR *nm = (NMHDR *) lParam;
|
||||
|
||||
switch (uMsg) {
|
||||
case WM_CREATE:
|
||||
onWM_CREATE(hwnd);
|
||||
break;
|
||||
case WM_CLOSE:
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_SIZE:
|
||||
repositionRebar(hwnd);
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
handleEvents(hwnd, wParam);
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
switch (nm->code) {
|
||||
case NM_CUSTOMDRAW:
|
||||
if (drawmode == 0)
|
||||
break;
|
||||
if (nm->hwndFrom == rebar)
|
||||
return (*(drawmodes[drawmode].handleRebar))((NMCUSTOMDRAW *) nm);
|
||||
else if (nm->hwndFrom == leftbar || nm->hwndFrom == rightbar)
|
||||
return (*(drawmodes[drawmode].handleToolbar))((NMTBCUSTOMDRAW *) nm);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
EXTERN_C IMAGE_DOS_HEADER __ImageBase;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
STARTUPINFOW si;
|
||||
int nCmdShow;
|
||||
INITCOMMONCONTROLSEX icc;
|
||||
HICON hDefaultIcon;
|
||||
HCURSOR hDefaultCursor;
|
||||
WNDCLASSW wc;
|
||||
HWND mainwin;
|
||||
MSG msg;
|
||||
HRESULT hr;
|
||||
|
||||
hInstance = (HINSTANCE) (&__ImageBase);
|
||||
nCmdShow = SW_SHOWDEFAULT;
|
||||
GetStartupInfoW(&si);
|
||||
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
|
||||
nCmdShow = si.wShowWindow;
|
||||
|
||||
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
|
||||
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
|
||||
icc.dwICC = ICC_STANDARD_CLASSES | ICC_BAR_CLASSES | ICC_COOL_CLASSES;
|
||||
if (InitCommonControlsEx(&icc) == 0)
|
||||
diele("InitCommonControlsEx()");
|
||||
|
||||
hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
|
||||
if (hDefaultIcon == NULL)
|
||||
diele("LoadIconW(IDI_APPLICATION)");
|
||||
hDefaultCursor = LoadCursorW(NULL, IDC_ARROW);
|
||||
if (hDefaultCursor == NULL)
|
||||
diele("LoadCursorW(IDC_ARROW)");
|
||||
|
||||
hr = LoadIconMetric(NULL, IDI_SHIELD, LIM_SMALL, &shieldIcon);
|
||||
if (hr != S_OK)
|
||||
diehr("LoadIconMetric(IDI_SHIELD)", hr);
|
||||
hr = LoadIconMetric(NULL, IDI_APPLICATION, LIM_SMALL, &applicationIcon);
|
||||
if (hr != S_OK)
|
||||
diehr("LoadIconMetric(IDI_APPLICATION)", hr);
|
||||
hr = LoadIconMetric(NULL, IDI_QUESTION, LIM_SMALL, &helpIcon);
|
||||
if (hr != S_OK)
|
||||
diehr("LoadIconMetric(IDI_QUESTION)", hr);
|
||||
rightList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
|
||||
ILC_COLOR32, 0, 3);
|
||||
if (rightList == NULL)
|
||||
diele("ImageList_Create()");
|
||||
if (ImageList_ReplaceIcon(rightList, -1, shieldIcon) == -1)
|
||||
diele("ImageList_ReplaceIcon(IDI_SHIELD)");
|
||||
if (ImageList_ReplaceIcon(rightList, -1, applicationIcon) == -1)
|
||||
diele("ImageList_ReplaceIcon(IDI_APPLICATION)");
|
||||
if (ImageList_ReplaceIcon(rightList, -1, helpIcon) == -1)
|
||||
diele("ImageList_ReplaceIcon(IDI_QUESTION)");
|
||||
|
||||
ZeroMemory(&wc, sizeof (WNDCLASSW));
|
||||
wc.lpszClassName = L"mainwin";
|
||||
wc.lpfnWndProc = wndproc;
|
||||
wc.hInstance = hInstance;
|
||||
wc.hIcon = hDefaultIcon;
|
||||
wc.hCursor = hDefaultCursor;
|
||||
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
|
||||
if (RegisterClassW(&wc) == 0)
|
||||
diele("RegisterClassW()");
|
||||
|
||||
mainwin = CreateWindowExW(0,
|
||||
L"mainwin", L"Main Window",
|
||||
WS_OVERLAPPEDWINDOW,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
NULL, NULL, hInstance, NULL);
|
||||
if (mainwin == NULL)
|
||||
diele("CreateWindowExW(L\"mainwin\")");
|
||||
|
||||
ShowWindow(mainwin, nCmdShow);
|
||||
if (UpdateWindow(mainwin) == 0)
|
||||
diele("UpdateWindow()");
|
||||
|
||||
for (;;) {
|
||||
int res;
|
||||
|
||||
res = GetMessageW(&msg, NULL, 0, 0);
|
||||
if (res < 0)
|
||||
diele("GetMessageW()");
|
||||
if (res == 0)
|
||||
break;
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,9 +1,5 @@
|
|||
// 27 february 2018
|
||||
|
||||
// TODO
|
||||
// - https://blogs.msdn.microsoft.com/oldnewthing/20181107-00/?p=100155 https://blogs.msdn.microsoft.com/oldnewthing/20181108-00/?p=100165 https://blogs.msdn.microsoft.com/oldnewthing/20181109-00/?p=100175
|
||||
// - also in the above: note the unspecified order of data in the sub-segments...
|
||||
|
||||
#ifndef testingprivIncludeGuard_testing_h
|
||||
#define testingprivIncludeGuard_testing_h
|
||||
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
multi-platform {
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/get-started-multiplatform?view=azure-devops
|
||||
}
|
||||
|
||||
microsoft-hosted agents {
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#use-a-microsoft-hosted-agent
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops
|
||||
https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2017-Server2016-Readme.md
|
||||
https://github.com/Microsoft/azure-pipelines-image-generation/blob/master/images/win/Vs2015-Server2012R2-Readme.md
|
||||
}
|
||||
|
||||
maximum number of processors (for ninja -j) {
|
||||
msbuild supports this with the -m option natively; meanwhile:
|
||||
https://www.gnu.org/software/coreutils/manual/html_node/nproc-invocation.html
|
||||
}
|
||||
|
||||
potentially useful tasks {
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact?view=azure-devops
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/xcode?view=azure-devops
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/github-release?view=azure-devops
|
||||
https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
|
||||
}
|
||||
|
||||
meson CI reference {
|
||||
https://github.com/mesonbuild/meson/blob/master/docs/markdown/Continuous-Integration.md
|
||||
}
|
||||
|
||||
job templates, which will clean up our pipelines {
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops
|
||||
}
|
||||
|
||||
migrating from travis {
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/migrate/from-travis?view=azure-devops
|
||||
}
|
||||
|
||||
32-bit {
|
||||
https://github.com/numpy/numpy/issues/12856
|
||||
https://github.com/numpy/numpy/pull/12863/files
|
||||
https://github.com/numpy/numpy/blob/master/azure-pipelines.yml (also explains what the @s mean; thanks guys)
|
||||
}
|
||||
|
||||
using visual studio tools {
|
||||
https://docs.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs
|
||||
https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=vs-2019#developer_command_file_locations
|
||||
}
|
||||
|
||||
OLD using visual studio tools; also some docker {
|
||||
https://github.com/mesonbuild/meson/blob/master/ci/azure-steps.yml
|
||||
https://github.com/reactiveui/Akavache/blob/master/azure-pipelines.yml
|
||||
https://github.com/vector-of-bool/CMakeCM/blob/master/azure-pipelines.yml
|
||||
https://docs.microsoft.com/en-us/visualstudio/install/advanced-build-tools-container?view=vs-2019
|
||||
https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019
|
||||
https://devblogs.microsoft.com/cppblog/using-msvc-in-a-docker-container-for-your-c-projects/
|
||||
https://devblogs.microsoft.com/cppblog/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
|
||||
}
|
||||
|
||||
reference {
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#task
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/apps/windows/cpp?view=azure-devops
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops
|
||||
https://docs.microsoft.com/en-us/azure/devops/pipelines/process/conditions?view=azure-devops&tabs=yaml
|
||||
}
|
||||
|
||||
C++ binary compatibility and shared libraries (TODO split into its own notes file) {
|
||||
https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=vs-2017
|
||||
}
|
||||
|
||||
others I forgot why I had them open {
|
||||
https://github.com/Microsoft/cpprestsdk/blob/master/azure-pipelines.yml (32-bit?)
|
||||
https://docs.microsoft.com/en-us/azure/devops/release-notes/2018/sprint-142-update (I forget, maybe also 32-bit?)
|
||||
}
|
||||
|
||||
others that might not be relevant {
|
||||
https://github.com/Microsoft/azure-pipelines-agent/blob/master/docs/start/envubuntu.md has instructions on how to build the agent tool itself
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
https://blogs.msdn.microsoft.com/oldnewthing/20181226-00/?p=100565
|
|
@ -13,4 +13,3 @@ https://www.microsoft.com/en-us/language/Terminology
|
|||
https://www.microsoft.com/en-us/language/LicenseAgreement
|
||||
https://www.microsoft.com/en-us/language/Translations
|
||||
http://www.ttt.org/oscarstandards/tbx/
|
||||
https://blogs.msdn.microsoft.com/oldnewthing/20181122-00/?p=100295
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
https://developer.apple.com/documentation/corefoundation/1542764-cfurlcopyresourcepropertyforkey?language=objc
|
||||
https://developer.apple.com/documentation/foundation/nsargumentdomain?language=objc
|
||||
https://developer.apple.com/documentation/appkit/1428499-nsapplicationmain
|
||||
https://webkit.googlesource.com/WebKit/+/9ae3deefb7df48bd85f01edcf8382ee300eafbd4%5E!/
|
||||
https://stackoverflow.com/questions/11181324/how-to-change-retina-display-system-preferences-in-osx
|
||||
https://web.archive.org/web/20150828053709/http://garethjenkins.com/2012/07/01/investigating-a-high-resolution-retina-utility-for-macbook-pro-1x-and-2x-modes/
|
||||
https://github.com/avibrazil/RDM
|
||||
https://www.google.com/search?client=firefox-b-1-d&q=IOFramebuffer+subclass
|
||||
https://developer.apple.com/documentation/kernel/ioframebuffer?language=objc
|
||||
https://stackoverflow.com/questions/51846999/how-to-write-macos-display-driver
|
||||
https://twitter.com/kenkeiter/status/3631378994298882
|
||||
http://en.ennowelbers.info/node/33
|
||||
https://www.insanelymac.com/forum/topic/114528-how-to-compile-a-driver-from-source/
|
||||
https://github.com/mkernel/EWProxyFramebuffer
|
||||
https://stackoverflow.com/questions/46904493/ioframebuffer-cant-access-vram-framebuffer-in-macos-10-13
|
||||
https://www.google.com/search?client=firefox-b-1-d&q=IOFramebuffer+10.13
|
||||
https://github.com/codykrieger/gfxCardStatus/issues/296
|
||||
https://plugable.com/2018/03/30/macos-10-13-4-disables-displaylink-duet-display-devices/
|
||||
https://www.tekrevue.com/tip/hidpi-mode-os-x/
|
||||
https://medium.com/@ivan.ha/how-to-mimic-a-2k-monitor-as-retina-display-in-macos-sierra-using-hidpi-f53d87630c48
|
||||
https://www.google.com/search?client=firefox-b-1-d&q=IOFramebuffer+10.13
|
||||
https://www.quora.com/What-is-the-underlying-reason-if-DisplayLink-is-no-longer-working-properly-on-Mac-OS
|
||||
https://github.com/Siguza/iokit-utils
|
|
@ -204,10 +204,3 @@ font1.gif (GIF Image, 424 × 475 pixels) http://www.functionx.com/win32/controls
|
|||
Inskcape’s Hidden Little Feature: Mesh Gradients | OCS-Mag http://www.ocsmag.com/2016/02/27/inskcapes-hidden-little-feature-mesh-gradients/ (near "When you’re done colouring in all the nodes, you may want to drag")
|
||||
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632615(v=vs.85).aspx we need to handle this alongisde WM_CAPTURECHANGED
|
||||
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/dn424996%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
|
||||
whatever this is seems to have no documentation... it appears to be related to UWP, if not only Store apps...
|
||||
|
||||
unreachable code optimizations
|
||||
https://docs.microsoft.com/en-us/cpp/intrinsics/assume?view=vs-2017
|
||||
https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
https://docs.microsoft.com/en-us/windows/desktop/uxguide/cmd-toolbars
|
||||
https://docs.microsoft.com/en-us/windows/desktop/controls/cc-faq-iemenubar
|
||||
https://docs.microsoft.com/en-us/windows/desktop/controls/cc-faq-ietoolbar
|
||||
https://docs.microsoft.com/en-us/windows/desktop/controls/create-rebar-controls
|
||||
https://docs.microsoft.com/en-us/windows/desktop/controls/create-toolbars
|
||||
https://docs.microsoft.com/en-us/windows/desktop/controls/handle-drop-down-buttons
|
||||
https://docs.microsoft.com/en-us/windows/desktop/controls/tb-buttonstructsize
|
||||
https://www.google.com/search?q=winapi+toolbar+dropdown+position&ie=utf-8&oe=utf-8&client=firefox-b-1
|
||||
https://www.google.com/search?q=winapi+toolbar+dropdown+arrow+position&ie=utf-8&oe=utf-8&client=firefox-b-1
|
|
@ -16,6 +16,3 @@ https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#
|
|||
https://msdn.microsoft.com/library/windows/desktop/mt843498(v=vs.85).aspx(d=robot)#appendix_c_common_high_dpi_issues
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#addressing_high_dpi_issues
|
||||
https://msdn.microsoft.com/library/windows/desktop/mt843498(v=vs.85).aspx(d=robot)#addressing_high_dpi_issues
|
||||
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/dn302215(v=vs.85).aspx
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/hh802769(v=vs.85).aspx
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
# TODO is there a -Wno-switch equivalent?
|
||||
# TODO /sdl turns C4996 into an ERROR
|
||||
# don't use /analyze; that requires us to write annotations everywhere
|
||||
# TODO undecided flags from qo?
|
||||
# the RTC flags are only supplied in debug builds because they are only supposed to be used by debug builds (see "This is because run-time error checks are not valid in a release (optimized) build." in https://docs.microsoft.com/cpp/build/reference/rtc-run-time-error-checks)
|
||||
# /RTCc is not supplied because it's discouraged as of VS2015; see https://www.reddit.com/r/cpp/comments/46mhne/rtcc_rejects_conformant_code_with_visual_c_2015/d06auq5
|
|
@ -1,5 +1,36 @@
|
|||
# 3 june 2016
|
||||
|
||||
if(WIN32)
|
||||
set(_EXAMPLE_RESOURCES_RC resources.rc)
|
||||
endif()
|
||||
|
||||
macro(_add_example _name)
|
||||
_add_exec(${_name} ${ARGN})
|
||||
# because Microsoft's toolchain is dumb
|
||||
if(MSVC)
|
||||
set_property(TARGET ${_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " /ENTRY:mainCRTStartup")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_add_example(controlgallery
|
||||
controlgallery/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(histogram
|
||||
histogram/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(cpp-multithread
|
||||
cpp-multithread/main.cpp
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(cpp-multithread pthread)
|
||||
endif()
|
||||
|
||||
_add_example(drawtext
|
||||
drawtext/attributes.c
|
||||
drawtext/basic.c
|
||||
|
@ -17,3 +48,11 @@ _add_example(opentype
|
|||
)
|
||||
target_include_directories(opentype
|
||||
PRIVATE opentype)
|
||||
|
||||
add_custom_target(examples
|
||||
DEPENDS
|
||||
controlgallery
|
||||
histogram
|
||||
cpp-multithread
|
||||
drawtext
|
||||
opentype)
|
||||
|
|
|
@ -1,378 +0,0 @@
|
|||
# 31 march 2019
|
||||
|
||||
trigger:
|
||||
branches:
|
||||
include:
|
||||
- '*'
|
||||
tags:
|
||||
include:
|
||||
- '*'
|
||||
|
||||
variables:
|
||||
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
|
||||
|
||||
jobs:
|
||||
|
||||
# linux {
|
||||
|
||||
- job: linux_386_shared
|
||||
displayName: 'Linux 386 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
|
||||
- job: linux_386_static
|
||||
displayName: 'Linux 386 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
|
||||
- job: linux_amd64_shared
|
||||
displayName: 'Linux amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
|
||||
- job: linux_amd64_static
|
||||
displayName: 'Linux amd64 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
|
||||
# }
|
||||
|
||||
# windows vs2015 {
|
||||
|
||||
- job: windows_386_msvc2015_shared
|
||||
displayName: 'Windows 386 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_386_msvc2015_static
|
||||
displayName: 'Windows 386 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2015_shared
|
||||
displayName: 'Windows amd64 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2015_static
|
||||
displayName: 'Windows amd64 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
# }
|
||||
|
||||
# windows vs2017 {
|
||||
|
||||
- job: windows_386_msvc2017_shared
|
||||
displayName: 'Windows 386 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_386_msvc2017_static
|
||||
displayName: 'Windows 386 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2017_shared
|
||||
displayName: 'Windows amd64 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
- job: windows_amd64_msvc2017_static
|
||||
displayName: 'Windows amd64 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
|
||||
# }
|
||||
|
||||
# mac {
|
||||
|
||||
# TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
|
||||
|
||||
- job: darwin_amd64_shared
|
||||
displayName: 'Darwin amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/darwin-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.A.dylib
|
||||
osHeader: ui_darwin.h
|
||||
|
||||
- job: darwin_amd64_static
|
||||
displayName: 'Darwin amd64 Static'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: azure-pipelines/darwin-install-ninja.yml
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_darwin.h
|
||||
|
||||
# }
|
|
@ -1,399 +0,0 @@
|
|||
# 31 march 2019
|
||||
|
||||
variables:
|
||||
releaseExamples: 'controlgallery cpp-multithread datetime drawtext histogram tester timer'
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
# targetname:
|
||||
# os: 'fill this in'
|
||||
# arch: 'fill this in'
|
||||
# toolchain: 'fill this in'
|
||||
# libtype: 'fill this in'
|
||||
# vmImage: 'fill this in'
|
||||
# python3Template: 'fill filename'
|
||||
# depsAndNinjaTemplate: 'fill filename'
|
||||
# beforeConfigure: 'fill this in'
|
||||
# beforeBuild: 'fill this in'
|
||||
# afterBuild: 'fill this in'
|
||||
# artifactTemplate: 'fill filename'
|
||||
# libfiles: 'fill this in'
|
||||
# osHeader: 'fill this in'
|
||||
linux_386_shared:
|
||||
os: 'linux'
|
||||
arch: '386'
|
||||
libtype: 'shared'
|
||||
vmImage: 'ubuntu-16.04'
|
||||
python3Template: 'azure-pipelines/setup-python3.yml'
|
||||
depsAndNinjaTemplate: 'azure-pipelines/linux-386-install-gtk-dev.yml'
|
||||
beforeConfigure: 'export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig'
|
||||
artifactTemplate: 'azure-pipelines/artifacts.yml'
|
||||
libfiles: 'libui.so.0'
|
||||
osHeader: 'ui_unix.h'
|
||||
|
||||
pool:
|
||||
vmImage: $(vmImage)
|
||||
|
||||
workspace:
|
||||
clean: all
|
||||
|
||||
steps:
|
||||
- template: $(variables.python3Template)
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
- template: $(variables.depsAndNinjaTemplate)
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: $(beforeConfigure)
|
||||
defaultLibrary: $(libtype)
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: $(beforeBuild)
|
||||
afterBuild: $(afterBuild)
|
||||
- template: $(variables.artifactTemplate)
|
||||
parameters:
|
||||
os: $(os)
|
||||
arch: $(arch)
|
||||
toolchain: $(toolchain)
|
||||
libtype: $(libtype)
|
||||
libfiles: $(libfiles)
|
||||
osHeader: $(osHeader)
|
||||
|
||||
## linux {
|
||||
#- job: linux_386_static
|
||||
# displayName: 'Linux 386 Static'
|
||||
# pool:
|
||||
# vmImage: 'ubuntu-16.04'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: linux
|
||||
# arch: 386
|
||||
# libtype: static
|
||||
# libfiles: libui.a
|
||||
# osHeader: ui_unix.h
|
||||
#
|
||||
#- job: linux_amd64_shared
|
||||
# displayName: 'Linux amd64 Shared'
|
||||
# pool:
|
||||
# vmImage: 'ubuntu-16.04'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: linux
|
||||
# arch: amd64
|
||||
# libtype: shared
|
||||
# libfiles: libui.so.0
|
||||
# osHeader: ui_unix.h
|
||||
#
|
||||
#- job: linux_amd64_static
|
||||
# displayName: 'Linux amd64 Static'
|
||||
# pool:
|
||||
# vmImage: 'ubuntu-16.04'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: linux
|
||||
# arch: amd64
|
||||
# libtype: static
|
||||
# libfiles: libui.a
|
||||
# osHeader: ui_unix.h
|
||||
#
|
||||
## }
|
||||
#
|
||||
## windows vs2015 {
|
||||
#
|
||||
#- job: windows_386_msvc2015_shared
|
||||
# displayName: 'Windows 386 MSVC2015 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2015
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_386_msvc2015_static
|
||||
# displayName: 'Windows 386 MSVC2015 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2015
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2015_shared
|
||||
# displayName: 'Windows amd64 MSVC2015 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2015
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2015_static
|
||||
# displayName: 'Windows amd64 MSVC2015 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2015-win2012r2'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/vs2015-install-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2015
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
## }
|
||||
#
|
||||
## windows vs2017 {
|
||||
#
|
||||
#- job: windows_386_msvc2017_shared
|
||||
# displayName: 'Windows 386 MSVC2017 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2017
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_386_msvc2017_static
|
||||
# displayName: 'Windows 386 MSVC2017 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: 386
|
||||
# toolchain: msvc2017
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2017_shared
|
||||
# displayName: 'Windows amd64 MSVC2017 Shared'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2017
|
||||
# libtype: shared
|
||||
# libfiles: libui.dll libui.exp libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
#- job: windows_amd64_msvc2017_static
|
||||
# displayName: 'Windows amd64 MSVC2017 Static'
|
||||
# pool:
|
||||
# vmImage: 'vs2017-win2016'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/windows-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# parameters:
|
||||
# beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
# afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
# - template: azure-pipelines/windows-artifacts.yml
|
||||
# parameters:
|
||||
# os: windows
|
||||
# arch: amd64
|
||||
# toolchain: msvc2017
|
||||
# libtype: static
|
||||
# libfiles: libui.lib
|
||||
# osHeader: ui_windows.h
|
||||
#
|
||||
## }
|
||||
#
|
||||
## mac {
|
||||
#
|
||||
## TODO beforeConfigure/beforeBuild: export SDKROOT=$(xcodebuild -version -sdk macosx10.13 Path)?
|
||||
#
|
||||
#- job: darwin_amd64_shared
|
||||
# displayName: 'Darwin amd64 Shared'
|
||||
# pool:
|
||||
# vmImage: 'macos-10.13'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/darwin-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: shared
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: darwin
|
||||
# arch: amd64
|
||||
# libtype: shared
|
||||
# libfiles: libui.A.dylib
|
||||
# osHeader: ui_darwin.h
|
||||
#
|
||||
#- job: darwin_amd64_static
|
||||
# displayName: 'Darwin amd64 Static'
|
||||
# pool:
|
||||
# vmImage: 'macos-10.13'
|
||||
# workspace:
|
||||
# clean: all
|
||||
# steps:
|
||||
# - template: azure-pipelines/setup-python3.yml
|
||||
# - template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
# - template: azure-pipelines/darwin-install-ninja.yml
|
||||
# - template: azure-pipelines/configure.yml
|
||||
# parameters:
|
||||
# defaultLibrary: static
|
||||
# - template: azure-pipelines/build.yml
|
||||
# - template: azure-pipelines/artifacts.yml
|
||||
# parameters:
|
||||
# os: darwin
|
||||
# arch: amd64
|
||||
# libtype: static
|
||||
# libfiles: libui.a
|
||||
# osHeader: ui_darwin.h
|
||||
#
|
||||
## }
|
|
@ -1,28 +0,0 @@
|
|||
# 6 april 2019
|
||||
|
||||
parameters:
|
||||
os: ''
|
||||
arch: ''
|
||||
libtype: ''
|
||||
libfiles: ''
|
||||
osHeader: ''
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
set -x
|
||||
pushd build/meson-out
|
||||
cp ../../ui.h ../../${{ parameters.osHeader }} .
|
||||
tar czf $(Build.ArtifactStagingDirectory)/libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz ${{ parameters.libfiles }} ui.h ${{ parameters.osHeader}}
|
||||
tar czf $(Build.ArtifactStagingDirectory)/examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.tgz $(releaseExamples)
|
||||
rm ui.h ${{ parameters.osHeader }}
|
||||
popd
|
||||
displayName: 'Create Artifacts'
|
||||
- task: GitHubRelease@0
|
||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
||||
inputs:
|
||||
gitHubConnection: andlabs
|
||||
repositoryName: andlabs/libui
|
||||
action: 'edit'
|
||||
addChangelog: false
|
||||
assets: '$(Build.ArtifactStagingDirectory)/*'
|
||||
assetUploadMode: 'replace'
|
|
@ -1,12 +0,0 @@
|
|||
# 5 april 2019
|
||||
|
||||
parameters:
|
||||
beforeBuild: ''
|
||||
afterBuild: ''
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
${{ parameters.beforeBuild }}
|
||||
ninja -C build -v
|
||||
${{ parameters.afterBuild }}
|
||||
displayName: 'Build'
|
|
@ -1,43 +0,0 @@
|
|||
# 7 april 2019
|
||||
|
||||
BEGIN {
|
||||
RS = ""
|
||||
FS = "\n +- "
|
||||
}
|
||||
|
||||
/^- job:/ {
|
||||
for (i = 1; i <= NF; i++) {
|
||||
if (!(i in nextindex)) {
|
||||
# fast path for first occurrence
|
||||
lines[i, 0] = $i
|
||||
nextindex[i] = 1
|
||||
if (maxIndex < i)
|
||||
maxIndex = i
|
||||
continue
|
||||
}
|
||||
found = 0
|
||||
for (j = 0; j < nextindex[i]; j++)
|
||||
if (lines[i, j] == $i) {
|
||||
found = 1
|
||||
break
|
||||
}
|
||||
if (!found) {
|
||||
lines[i, nextindex[i]] = $i
|
||||
nextindex[i]++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
for (i = 1; i <= maxIndex; i++) {
|
||||
if (nextindex[i] == 1) {
|
||||
# only one entry here, just print it
|
||||
print "- " lines[i, 0]
|
||||
continue
|
||||
}
|
||||
print "{"
|
||||
for (j = 0; j < nextindex[i]; j++)
|
||||
print "- " lines[i, j]
|
||||
print "}"
|
||||
}
|
||||
}
|
|
@ -1,298 +0,0 @@
|
|||
{
|
||||
- - job: linux_386_shared
|
||||
displayName: 'Linux 386 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: linux_386_static
|
||||
displayName: 'Linux 386 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: linux_amd64_shared
|
||||
displayName: 'Linux amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: linux_amd64_static
|
||||
displayName: 'Linux amd64 Static'
|
||||
pool:
|
||||
vmImage: 'ubuntu-16.04'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2015_shared
|
||||
displayName: 'Windows 386 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2015_static
|
||||
displayName: 'Windows 386 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2015_shared
|
||||
displayName: 'Windows amd64 MSVC2015 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2015_static
|
||||
displayName: 'Windows amd64 MSVC2015 Static'
|
||||
pool:
|
||||
vmImage: 'vs2015-win2012r2'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2017_shared
|
||||
displayName: 'Windows 386 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_386_msvc2017_static
|
||||
displayName: 'Windows 386 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2017_shared
|
||||
displayName: 'Windows amd64 MSVC2017 Shared'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: windows_amd64_msvc2017_static
|
||||
displayName: 'Windows amd64 MSVC2017 Static'
|
||||
pool:
|
||||
vmImage: 'vs2017-win2016'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: darwin_amd64_shared
|
||||
displayName: 'Darwin amd64 Shared'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
- - job: darwin_amd64_static
|
||||
displayName: 'Darwin amd64 Static'
|
||||
pool:
|
||||
vmImage: 'macos-10.13'
|
||||
workspace:
|
||||
clean: all
|
||||
steps:
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/setup-python3.yml
|
||||
- template: azure-pipelines/vs2015-install-python3.yml
|
||||
}
|
||||
- template: azure-pipelines/install-latest-meson-ninja.yml
|
||||
{
|
||||
- template: azure-pipelines/linux-386-install-gtk-dev.yml
|
||||
- template: azure-pipelines/linux-install-gtk-dev.yml
|
||||
- template: azure-pipelines/windows-install-ninja.yml
|
||||
- template: azure-pipelines/darwin-install-ninja.yml
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: export CFLAGS=-m32 CXXFLAGS=-m32 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
defaultLibrary: static
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: shared
|
||||
- template: azure-pipelines/configure.yml
|
||||
parameters:
|
||||
beforeConfigure: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
defaultLibrary: static
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/build.yml
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
- template: azure-pipelines/build.yml
|
||||
parameters:
|
||||
beforeBuild: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
afterBuild: ren build\meson-out\libui.a libui.lib
|
||||
}
|
||||
{
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: 386
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.so.0
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: linux
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_unix.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2015
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: 386
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: shared
|
||||
libfiles: libui.dll libui.exp libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/windows-artifacts.yml
|
||||
parameters:
|
||||
os: windows
|
||||
arch: amd64
|
||||
toolchain: msvc2017
|
||||
libtype: static
|
||||
libfiles: libui.lib
|
||||
osHeader: ui_windows.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: shared
|
||||
libfiles: libui.A.dylib
|
||||
osHeader: ui_darwin.h
|
||||
- template: azure-pipelines/artifacts.yml
|
||||
parameters:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
libtype: static
|
||||
libfiles: libui.a
|
||||
osHeader: ui_darwin.h
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# 5 april 2019
|
||||
|
||||
parameters:
|
||||
beforeConfigure: ''
|
||||
defaultLibrary: 'must-be-set'
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
${{ parameters.beforeConfigure }}
|
||||
meson setup build --buildtype=release --default-library=${{ parameters.defaultLibrary }}
|
||||
displayName: 'Configure'
|
|
@ -1,13 +0,0 @@
|
|||
# 5 april 2019
|
||||
# because brew install is also slow (it runs an update task first)
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
sudo mkdir -p /opt/ninja
|
||||
pushd /opt/ninja
|
||||
sudo wget https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-mac.zip
|
||||
sudo unzip ninja-mac.zip
|
||||
sudo chmod a+rx ninja
|
||||
popd
|
||||
echo '##vso[task.prependpath]/opt/ninja'
|
||||
displayName: 'Install Ninja'
|
|
@ -1,9 +0,0 @@
|
|||
# 4 april 2019
|
||||
|
||||
# TODO remove ninja installation from non-Linux OSs and make the same ninja via pip change in the AppVeyor script
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
pip install meson ninja
|
||||
displayName: 'Install Latest Meson and Ninja'
|
|
@ -1,17 +0,0 @@
|
|||
# 7 april 2019
|
||||
|
||||
# TODO figure out how to get meson to recognize the compiler is producing 32-bit output
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
# Azure Pipelines ships with a patched version of this and that patch is only available on 64-bit systems, so trying to install the 32-bit versions will remove the 64-bit versions outright
|
||||
# This is a dependency of Mesa, so we'll have to downgrade to the stock distro ones :/
|
||||
llvmPackages=
|
||||
for i in libllvm6.0 clang-6.0 libclang-common-6.0-dev liblldb-6.0 liblldb-6.0-dev lld-6.0 lldb-6.0 llvm-6.0-dev python-lldb-6.0 libclang1-6.0 llvm-6.0 llvm-6.0-runtime; do llvmPackages="$llvmPackages $i=1:6.0-1ubuntu2~16.04.1"; done
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install --allow-downgrades \
|
||||
gcc-multilib g++-multilib \
|
||||
$llvmPackages \
|
||||
libgtk-3-dev:i386
|
||||
displayName: 'Install GTK+ Dev Files'
|
|
@ -1,6 +0,0 @@
|
|||
# 7 april 2019
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
sudo apt-get install libgtk-3-dev
|
||||
displayName: 'Install GTK+ Dev Files'
|
|
@ -1,7 +0,0 @@
|
|||
# 4 april 2019
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: '3.6'
|
||||
architecture: 'x64'
|
|
@ -1,10 +0,0 @@
|
|||
# 4 april 2019
|
||||
# see https://github.com/Microsoft/azure-pipelines-image-generation/issues/374 for context and source
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
powershell -Command "Invoke-WebRequest https://www.python.org/ftp/python/3.7.1/python-3.7.1-amd64-webinstall.exe -OutFile C:\py3-setup.exe"
|
||||
C:\py3-setup.exe /quiet PrependPath=0 InstallAllUsers=0 Include_launcher=0 InstallLauncherAllUsers=0 Include_test=0 Include_doc=0 Include_dev=0 Include_debug=0 Include_tcltk=0 TargetDir=C:\Python37
|
||||
@echo ##vso[task.prependpath]C:\Python37
|
||||
@echo ##vso[task.prependpath]C:\Python37\Scripts
|
||||
displayName: 'Install Python 3'
|
|
@ -1,28 +0,0 @@
|
|||
# 6 april 2019
|
||||
|
||||
parameters:
|
||||
os: ''
|
||||
arch: ''
|
||||
toolchain: ''
|
||||
libtype: ''
|
||||
libfiles: ''
|
||||
osHeader: ''
|
||||
|
||||
steps:
|
||||
- powershell: |
|
||||
pushd build\meson-out
|
||||
Copy-Item @("..\..\ui.h","..\..\${{ parameters.osHeader }}") -Destination .
|
||||
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\libui-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.toolchain }}-${{ parameters.libtype }}.zip -Path @("${{ parameters.libfiles }}".Split(" ") + @("ui.h","${{ parameters.osHeader}}"))
|
||||
Compress-Archive -Destination $(Build.ArtifactStagingDirectory)\examples-$(Build.SourceBranchName)-${{ parameters.os }}-${{ parameters.arch }}-${{ parameters.libtype }}.zip -Path @("$(releaseExamples)".Split(" ") | % {$_ + ".exe"})
|
||||
Remove-Item @("ui.h","${{ parameters.osHeader }}")
|
||||
popd
|
||||
displayName: 'Create Artifacts'
|
||||
- task: GitHubRelease@0
|
||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
|
||||
inputs:
|
||||
gitHubConnection: andlabs
|
||||
repositoryName: andlabs/libui
|
||||
action: 'edit'
|
||||
addChangelog: false
|
||||
assets: '$(Build.ArtifactStagingDirectory)/*'
|
||||
assetUploadMode: 'replace'
|
|
@ -1,10 +0,0 @@
|
|||
# 4 april 2019
|
||||
# why this? because choco isn't available on the VS2015 image and is extremely slow on the VS2017 one (it should not take 2.5 minutes to install just ninja!)
|
||||
|
||||
steps:
|
||||
- script: |
|
||||
powershell -Command "Invoke-WebRequest https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -OutFile C:\ninja-win.zip"
|
||||
mkdir C:\ninja
|
||||
powershell -Command "Expand-Archive -LiteralPath C:\ninja-win.zip -DestinationPath C:\ninja"
|
||||
@echo ##vso[task.prependpath]C:\ninja
|
||||
displayName: 'Install Ninja'
|
|
@ -0,0 +1,23 @@
|
|||
# 3 june 2016
|
||||
|
||||
list(APPEND _LIBUI_SOURCES
|
||||
common/attribute.c
|
||||
common/attrlist.c
|
||||
common/attrstr.c
|
||||
common/areaevents.c
|
||||
common/control.c
|
||||
common/debug.c
|
||||
common/matrix.c
|
||||
common/opentype.c
|
||||
common/shouldquit.c
|
||||
common/tablemodel.c
|
||||
common/tablevalue.c
|
||||
common/userbugs.c
|
||||
common/utf.c
|
||||
)
|
||||
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND _LIBUI_INCLUDEDIRS
|
||||
common
|
||||
)
|
||||
set(_LIBUI_INCLUDEDIRS ${_LIBUI_INCLUDEDIRS} PARENT_SCOPE)
|
|
@ -1,17 +0,0 @@
|
|||
# 23 march 2019
|
||||
|
||||
libui_sources += [
|
||||
'common/attribute.c',
|
||||
'common/attrlist.c',
|
||||
'common/attrstr.c',
|
||||
'common/areaevents.c',
|
||||
'common/control.c',
|
||||
'common/debug.c',
|
||||
'common/matrix.c',
|
||||
'common/opentype.c',
|
||||
'common/shouldquit.c',
|
||||
'common/tablemodel.c',
|
||||
'common/tablevalue.c',
|
||||
'common/userbugs.c',
|
||||
'common/utf.c',
|
||||
]
|
|
@ -0,0 +1,64 @@
|
|||
# 3 june 2016
|
||||
|
||||
list(APPEND _LIBUI_SOURCES
|
||||
darwin/aat.m
|
||||
darwin/alloc.m
|
||||
darwin/area.m
|
||||
darwin/areaevents.m
|
||||
darwin/attrstr.m
|
||||
darwin/autolayout.m
|
||||
darwin/box.m
|
||||
darwin/button.m
|
||||
darwin/checkbox.m
|
||||
darwin/colorbutton.m
|
||||
darwin/combobox.m
|
||||
darwin/control.m
|
||||
darwin/datetimepicker.m
|
||||
darwin/debug.m
|
||||
darwin/draw.m
|
||||
darwin/drawtext.m
|
||||
darwin/editablecombo.m
|
||||
darwin/entry.m
|
||||
darwin/fontbutton.m
|
||||
darwin/fontmatch.m
|
||||
darwin/fonttraits.m
|
||||
darwin/fontvariation.m
|
||||
darwin/form.m
|
||||
darwin/future.m
|
||||
darwin/graphemes.m
|
||||
darwin/grid.m
|
||||
darwin/group.m
|
||||
darwin/image.m
|
||||
darwin/label.m
|
||||
darwin/main.m
|
||||
darwin/map.m
|
||||
darwin/menu.m
|
||||
darwin/multilineentry.m
|
||||
darwin/opentype.m
|
||||
darwin/progressbar.m
|
||||
darwin/radiobuttons.m
|
||||
darwin/scrollview.m
|
||||
darwin/separator.m
|
||||
darwin/slider.m
|
||||
darwin/spinbox.m
|
||||
darwin/stddialogs.m
|
||||
darwin/tab.m
|
||||
darwin/table.m
|
||||
darwin/tablecolumn.m
|
||||
darwin/text.m
|
||||
darwin/undocumented.m
|
||||
darwin/util.m
|
||||
darwin/window.m
|
||||
darwin/winmoveresize.m
|
||||
)
|
||||
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||
|
||||
# TODO is this correct?
|
||||
list(APPEND _LIBUI_INCLUDEDIRS
|
||||
darwin
|
||||
)
|
||||
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
|
||||
|
||||
set(_LIBUI_LIBS
|
||||
objc "-framework Foundation" "-framework AppKit"
|
||||
PARENT_SCOPE)
|
|
@ -1,64 +0,0 @@
|
|||
# 23 march 2019
|
||||
|
||||
libui_sources += [
|
||||
'darwin/aat.m',
|
||||
'darwin/alloc.m',
|
||||
'darwin/area.m',
|
||||
'darwin/areaevents.m',
|
||||
'darwin/attrstr.m',
|
||||
'darwin/autolayout.m',
|
||||
'darwin/box.m',
|
||||
'darwin/button.m',
|
||||
'darwin/checkbox.m',
|
||||
'darwin/colorbutton.m',
|
||||
'darwin/combobox.m',
|
||||
'darwin/control.m',
|
||||
'darwin/datetimepicker.m',
|
||||
'darwin/debug.m',
|
||||
'darwin/draw.m',
|
||||
'darwin/drawtext.m',
|
||||
'darwin/editablecombo.m',
|
||||
'darwin/entry.m',
|
||||
'darwin/fontbutton.m',
|
||||
'darwin/fontmatch.m',
|
||||
'darwin/fonttraits.m',
|
||||
'darwin/fontvariation.m',
|
||||
'darwin/form.m',
|
||||
'darwin/future.m',
|
||||
'darwin/graphemes.m',
|
||||
'darwin/grid.m',
|
||||
'darwin/group.m',
|
||||
'darwin/image.m',
|
||||
'darwin/label.m',
|
||||
'darwin/main.m',
|
||||
'darwin/map.m',
|
||||
'darwin/menu.m',
|
||||
'darwin/multilineentry.m',
|
||||
'darwin/opentype.m',
|
||||
'darwin/progressbar.m',
|
||||
'darwin/radiobuttons.m',
|
||||
'darwin/scrollview.m',
|
||||
'darwin/separator.m',
|
||||
'darwin/slider.m',
|
||||
'darwin/spinbox.m',
|
||||
'darwin/stddialogs.m',
|
||||
'darwin/tab.m',
|
||||
'darwin/table.m',
|
||||
'darwin/tablecolumn.m',
|
||||
'darwin/text.m',
|
||||
'darwin/undocumented.m',
|
||||
'darwin/util.m',
|
||||
'darwin/window.m',
|
||||
'darwin/winmoveresize.m',
|
||||
]
|
||||
|
||||
libui_deps += [
|
||||
meson.get_compiler('objc').find_library('objc',
|
||||
required: true),
|
||||
dependency('appleframeworks',
|
||||
modules: ['Foundation', 'AppKit'],
|
||||
required: true),
|
||||
]
|
||||
libui_soversion = 'A'
|
||||
# the / is required by some older versions of OS X
|
||||
libui_rpath = '@executable_path/'
|
|
@ -0,0 +1,62 @@
|
|||
# 3 june 2016
|
||||
|
||||
if(WIN32)
|
||||
set(_EXAMPLE_RESOURCES_RC resources.rc)
|
||||
endif()
|
||||
|
||||
macro(_add_example _name)
|
||||
_add_exec(${_name} ${ARGN})
|
||||
# because Microsoft's toolchain is dumb
|
||||
if(MSVC)
|
||||
set_property(TARGET ${_name} APPEND_STRING PROPERTY
|
||||
LINK_FLAGS " /ENTRY:mainCRTStartup")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
_add_example(controlgallery
|
||||
controlgallery/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(histogram
|
||||
histogram/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(cpp-multithread
|
||||
cpp-multithread/main.cpp
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(cpp-multithread pthread)
|
||||
endif()
|
||||
if(APPLE)
|
||||
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
|
||||
# see issue #302 for more details
|
||||
target_compile_options(cpp-multithread PRIVATE --stdlib=libc++)
|
||||
target_link_libraries(cpp-multithread --stdlib=libc++)
|
||||
endif()
|
||||
|
||||
_add_example(drawtext
|
||||
drawtext/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(timer
|
||||
timer/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
_add_example(datetime
|
||||
datetime/main.c
|
||||
${_EXAMPLE_RESOURCES_RC}
|
||||
)
|
||||
|
||||
add_custom_target(examples
|
||||
DEPENDS
|
||||
controlgallery
|
||||
histogram
|
||||
cpp-multithread
|
||||
drawtext
|
||||
timer
|
||||
datetime)
|
|
@ -1,61 +0,0 @@
|
|||
# 24 march 2019
|
||||
|
||||
libui_example_sources = []
|
||||
libui_example_link_args = []
|
||||
libui_example_cpp_extra_args = []
|
||||
if libui_OS == 'windows'
|
||||
libui_example_manifest = 'example.manifest'
|
||||
if libui_mode == 'static'
|
||||
libui_example_manifest = 'example.static.manifest'
|
||||
endif
|
||||
libui_example_sources += [
|
||||
windows.compile_resources('resources.rc',
|
||||
args: libui_manifest_args,
|
||||
depend_files: [libui_example_manifest]),
|
||||
]
|
||||
# because Microsoft's toolchain is dumb
|
||||
if libui_MSVC
|
||||
libui_example_link_args += ['/ENTRY:mainCRTStartup']
|
||||
endif
|
||||
elif libui_OS == 'darwin'
|
||||
# since we use a deployment target of 10.8, the non-C++11-compliant libstdc++ is chosen by default; we need C++11
|
||||
# see issue #302 for more details
|
||||
libui_example_cpp_extra_args += ['--stdlib=libc++']
|
||||
endif
|
||||
|
||||
libui_examples = {
|
||||
'controlgallery': {
|
||||
'sources': ['controlgallery/main.c'],
|
||||
},
|
||||
'histogram': {
|
||||
'sources': ['histogram/main.c'],
|
||||
},
|
||||
'cpp-multithread': {
|
||||
'sources': ['cpp-multithread/main.cpp'],
|
||||
'deps': [
|
||||
dependency('threads',
|
||||
required: true),
|
||||
],
|
||||
'cpp_args': libui_example_cpp_extra_args,
|
||||
'link_args': libui_example_cpp_extra_args,
|
||||
},
|
||||
'drawtext': {
|
||||
'sources': ['drawtext/main.c'],
|
||||
},
|
||||
'timer': {
|
||||
'sources': ['timer/main.c'],
|
||||
},
|
||||
'datetime': {
|
||||
'sources': ['datetime/main.c'],
|
||||
},
|
||||
}
|
||||
foreach name, args : libui_examples
|
||||
# TODO once we upgrade to 0.49.0, add pie: true
|
||||
executable(name, args['sources'] + libui_example_sources,
|
||||
dependencies: args.get('deps', []) + libui_binary_deps,
|
||||
link_with: libui_libui,
|
||||
cpp_args: args.get('cpp_args', []),
|
||||
link_args: args.get('link_args', []) + libui_example_link_args,
|
||||
gui_app: false,
|
||||
install: false)
|
||||
endforeach
|
176
meson.build
176
meson.build
|
@ -1,176 +0,0 @@
|
|||
# 17 march 2019
|
||||
|
||||
# TODO I'm not sure how to allow building 32-bit instead of 64-bit with meson
|
||||
|
||||
# TODO remove cpp from this list once https://github.com/mesonbuild/meson/issues/5181 is settled; move it to the OS checks and under cpp-multithread
|
||||
project('libui', ['c', 'cpp'],
|
||||
meson_version: '>=0.48.0',
|
||||
default_options: [
|
||||
'buildtype=debug', # build debug by default
|
||||
'default_library=shared', # build shared libraries by default
|
||||
'layout=flat', # keep all outputs together by default
|
||||
|
||||
# these are forced options, but meson doesn't let me set these up separately before I call project() (TODO https://github.com/mesonbuild/meson/issues/5179)
|
||||
'warning_level=3', # always max warnings
|
||||
'b_pch=false', # we don't want precompiled headers
|
||||
'b_staticpic=true', # use PIC even for static libraries
|
||||
'c_std=c99', # strict C99
|
||||
'c_winlibs=', # we define our own Windows libraries
|
||||
'cpp_std=c++11', # strict C++11
|
||||
'cpp_eh=sc', # shut the compiler up in some cases
|
||||
'cpp_winlibs=', # likewise as with c_winlibs
|
||||
],
|
||||
license: 'MIT')
|
||||
|
||||
# TODO after https://github.com/mesonbuild/meson/issues/5179 is settled, remove these
|
||||
libui_OS = host_machine.system()
|
||||
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
|
||||
|
||||
# TODO switch to tabs; the spaces are just so I can share this file while I'm writing it
|
||||
libui_forced_options = {
|
||||
'warning_level': '3', # always max warnings
|
||||
'b_pch': 'false', # we don't want precompiled headers
|
||||
'b_staticpic': 'true', # use PIC even for static libraries
|
||||
'c_std': 'c99', # strict C99
|
||||
'c_winlibs': '[]', # we define our own Windows libraries
|
||||
'cpp_std': 'c++11', # strict C++11
|
||||
'cpp_eh': 'sc', # shut the compiler up in some cases
|
||||
'cpp_winlibs': '[]', # likewise as with c_winlibs
|
||||
}
|
||||
foreach name, value : libui_forced_options
|
||||
# TODO rewrite this when https://github.com/mesonbuild/meson/issues/5181 is settled
|
||||
if not ((name == 'c_winlibs' or name == 'cpp_eh' or name == 'cpp_winlibs') and not libui_MSVC) and not (name == 'c_std' and libui_MSVC)
|
||||
actual = '@0@'.format(get_option(name))
|
||||
if actual != value
|
||||
error('sorry, but libui requires that option ' + name + ' has the default value ' + value)
|
||||
endif
|
||||
endif
|
||||
endforeach
|
||||
|
||||
libui_OS = host_machine.system()
|
||||
libui_MSVC = meson.get_compiler('c').get_id() == 'msvc'
|
||||
|
||||
if libui_OS == 'darwin'
|
||||
add_languages('objc',
|
||||
required: true)
|
||||
endif
|
||||
|
||||
libui_mode = get_option('default_library')
|
||||
if libui_mode == 'both'
|
||||
error('sorry, but libui does not support building both shared and static libraries at the same time, because Windows resource file rules differ between the two')
|
||||
endif
|
||||
|
||||
libui_is_debug = get_option('buildtype').startswith('debug')
|
||||
|
||||
libui_project_compile_args = []
|
||||
libui_project_link_args = []
|
||||
|
||||
if libui_OS == 'darwin'
|
||||
libui_macosx_version_min = '-mmacosx-version-min=10.8'
|
||||
libui_project_compile_args += [libui_macosx_version_min]
|
||||
libui_project_link_args += [libui_macosx_version_min]
|
||||
endif
|
||||
|
||||
if libui_MSVC
|
||||
# TODO subsystem version
|
||||
|
||||
libui_project_compile_args += [
|
||||
'/wd4100',
|
||||
'/bigobj',
|
||||
]
|
||||
if libui_is_debug
|
||||
libui_project_compile_args += ['/RTC1', '/RTCs', '/RTCu']
|
||||
endif
|
||||
|
||||
libui_project_link_args += [
|
||||
'/LARGEADDRESSAWARE',
|
||||
'/INCREMENTAL:NO',
|
||||
'/MANIFEST:NO',
|
||||
]
|
||||
|
||||
# TODO autogenerate a .def file?
|
||||
else
|
||||
libui_project_compile_args += [
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-switch',
|
||||
]
|
||||
|
||||
if libui_OS == 'windows'
|
||||
# don't require shipping the MinGW-w64 DLLs
|
||||
libui_project_link_args += [
|
||||
'-static',
|
||||
'-static-libgcc',
|
||||
'-static-libstdc++',
|
||||
]
|
||||
endif
|
||||
endif
|
||||
|
||||
# TODO come up with a better way to do this, both for libui (the compiler define, used by winapi.hpp, and the manifest args) and for the binaries (the manifest args)
|
||||
# TODO (after the above TODO is resolved) move that below the part below that actually adds these arguments
|
||||
libui_manifest_args = []
|
||||
if libui_mode == 'static'
|
||||
libui_project_compile_args += ['-D_UI_STATIC']
|
||||
libui_manifest_args = ['-D_UI_STATIC']
|
||||
endif
|
||||
|
||||
add_project_arguments(libui_project_compile_args,
|
||||
language: ['c', 'cpp', 'objc'])
|
||||
add_project_link_arguments(libui_project_link_args,
|
||||
language: ['c', 'cpp', 'objc'])
|
||||
|
||||
# TODO:
|
||||
# meson determins whether -Wl,--no-undefined is provided via
|
||||
# built-in option b_lundef, and it's true by default, which is what
|
||||
# we want (so I don't make mistakes like asking for unknown
|
||||
# functions in my dependencies). However, meson also is smart
|
||||
# about specifying this properly on systems that don't support it, like
|
||||
# FreeBSD (where I had the comment "figure out why FreeBSD
|
||||
# follows linked libraries here" when I was on cmake) and OpenBSD
|
||||
# (according to someone on freenode #mesonbuild), but it isn't clear
|
||||
# whether it's just ignored or if the value is forced to false.
|
||||
# Therefore, once this is determined, we can uncomment the
|
||||
# following.
|
||||
libui_libui_link_args = []
|
||||
#if not libui_MSVC and get_option("b_lundef")
|
||||
# TODO what should this be on MSVC?
|
||||
# libui_libui_link_args += ['-Wl,--no-allow-shlib-undefined']
|
||||
#endif
|
||||
|
||||
libui_sources = []
|
||||
libui_deps = []
|
||||
libui_soversion = ''
|
||||
libui_rpath = ''
|
||||
subdir('common')
|
||||
if libui_OS == 'windows'
|
||||
subdir('windows')
|
||||
install_headers('ui_windows.h')
|
||||
elif libui_OS == 'darwin'
|
||||
subdir('darwin')
|
||||
install_headers('ui_darwin.h')
|
||||
else
|
||||
subdir('unix')
|
||||
install_headers('ui_unix.h')
|
||||
endif
|
||||
libui_libui = library('ui', libui_sources,
|
||||
dependencies: libui_deps,
|
||||
build_rpath: libui_rpath,
|
||||
install_rpath: libui_rpath,
|
||||
name_prefix: 'lib', # always call it libui, even in Windows DLLs
|
||||
install: true,
|
||||
gnu_symbol_visibility: 'hidden',
|
||||
c_args: ['-Dlibui_EXPORTS'],
|
||||
cpp_args: ['-Dlibui_EXPORTS'],
|
||||
objc_args: ['-Dlibui_EXPORTS'],
|
||||
link_args: libui_libui_link_args,
|
||||
soversion: libui_soversion,
|
||||
darwin_versions: []) # TODO
|
||||
install_headers('ui.h')
|
||||
|
||||
# TODO when the API is stable enough to be versioned, create a pkg-config file (https://mesonbuild.com/Pkgconfig-module.html) and a declare_dependency() section too
|
||||
|
||||
libui_binary_deps = []
|
||||
if libui_mode == 'static'
|
||||
libui_binary_deps = libui_deps
|
||||
endif
|
||||
subdir('test')
|
||||
subdir('examples')
|
|
@ -0,0 +1,40 @@
|
|||
# 3 june 2016
|
||||
|
||||
if(WIN32)
|
||||
set(_TEST_RESOURCES_RC resources.rc)
|
||||
endif()
|
||||
|
||||
_add_exec(tester
|
||||
drawtests.c
|
||||
images.c
|
||||
main.c
|
||||
menus.c
|
||||
page1.c
|
||||
page2.c
|
||||
page3.c
|
||||
page4.c
|
||||
page5.c
|
||||
page6.c
|
||||
page7.c
|
||||
page7a.c
|
||||
page7b.c
|
||||
page7c.c
|
||||
# page8.c
|
||||
# page9.c
|
||||
# page10.c
|
||||
page11.c
|
||||
page12.c
|
||||
page13.c
|
||||
page14.c
|
||||
page15.c
|
||||
page16.c
|
||||
spaced.c
|
||||
${_TEST_RESOURCES_RC}
|
||||
)
|
||||
target_include_directories(tester
|
||||
PRIVATE test
|
||||
)
|
||||
set_target_properties(tester PROPERTIES
|
||||
OUTPUT_NAME test
|
||||
WIN32_EXECUTABLE FALSE
|
||||
)
|
|
@ -1,48 +0,0 @@
|
|||
# 23 march 2019
|
||||
|
||||
libui_test_sources = [
|
||||
'drawtests.c',
|
||||
'images.c',
|
||||
'main.c',
|
||||
'menus.c',
|
||||
'page1.c',
|
||||
'page2.c',
|
||||
'page3.c',
|
||||
'page4.c',
|
||||
'page5.c',
|
||||
'page6.c',
|
||||
'page7.c',
|
||||
'page7a.c',
|
||||
'page7b.c',
|
||||
'page7c.c',
|
||||
# 'page8.c',
|
||||
# 'page9.c',
|
||||
# 'page10.c',
|
||||
'page11.c',
|
||||
'page12.c',
|
||||
'page13.c',
|
||||
'page14.c',
|
||||
'page15.c',
|
||||
'page16.c',
|
||||
'spaced.c',
|
||||
]
|
||||
|
||||
if libui_OS == 'windows'
|
||||
libui_test_manifest = 'test.manifest'
|
||||
if libui_mode == 'static'
|
||||
libui_test_manifest = 'test.static.manifest'
|
||||
endif
|
||||
libui_test_sources += [
|
||||
windows.compile_resources('resources.rc',
|
||||
args: libui_manifest_args,
|
||||
depend_files: [libui_test_manifest]),
|
||||
]
|
||||
endif
|
||||
|
||||
# TODO meson doesn't let us name this target test, but also doesn't seem to provide a way to override the executable name???? we'll probably need to file a feature request for this
|
||||
# TODO once we upgrade to 0.49.0, add pie: true
|
||||
executable('tester', libui_test_sources,
|
||||
dependencies: libui_binary_deps,
|
||||
link_with: libui_libui,
|
||||
gui_app: false,
|
||||
install: false)
|
|
@ -0,0 +1,66 @@
|
|||
# 3 june 2016
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(GTK REQUIRED gtk+-3.0)
|
||||
|
||||
list(APPEND _LIBUI_SOURCES
|
||||
unix/alloc.c
|
||||
unix/area.c
|
||||
unix/attrstr.c
|
||||
unix/box.c
|
||||
unix/button.c
|
||||
unix/cellrendererbutton.c
|
||||
unix/checkbox.c
|
||||
unix/child.c
|
||||
unix/colorbutton.c
|
||||
unix/combobox.c
|
||||
unix/control.c
|
||||
unix/datetimepicker.c
|
||||
unix/debug.c
|
||||
unix/draw.c
|
||||
unix/drawmatrix.c
|
||||
unix/drawpath.c
|
||||
unix/drawtext.c
|
||||
unix/editablecombo.c
|
||||
unix/entry.c
|
||||
unix/fontbutton.c
|
||||
unix/fontmatch.c
|
||||
unix/form.c
|
||||
unix/future.c
|
||||
unix/graphemes.c
|
||||
unix/grid.c
|
||||
unix/group.c
|
||||
unix/image.c
|
||||
unix/label.c
|
||||
unix/main.c
|
||||
unix/menu.c
|
||||
unix/multilineentry.c
|
||||
unix/opentype.c
|
||||
unix/progressbar.c
|
||||
unix/radiobuttons.c
|
||||
unix/separator.c
|
||||
unix/slider.c
|
||||
unix/spinbox.c
|
||||
unix/stddialogs.c
|
||||
unix/tab.c
|
||||
unix/table.c
|
||||
unix/tablemodel.c
|
||||
unix/text.c
|
||||
unix/util.c
|
||||
unix/window.c
|
||||
)
|
||||
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND _LIBUI_INCLUDEDIRS
|
||||
unix
|
||||
)
|
||||
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
|
||||
|
||||
# TODO the other variables don't work?
|
||||
set(_LIBUI_CFLAGS
|
||||
${GTK_CFLAGS}
|
||||
PARENT_SCOPE)
|
||||
|
||||
set(_LIBUI_LIBS
|
||||
${GTK_LDFLAGS} m ${CMAKE_DL_LIBS}
|
||||
PARENT_SCOPE)
|
|
@ -248,9 +248,6 @@ static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
|
|||
// clicking doesn't automatically transfer keyboard focus; we must do so manually (thanks tristan in irc.gimp.net/#gtk+)
|
||||
gtk_widget_grab_focus(w);
|
||||
|
||||
me.Down = e->button;
|
||||
me.Up = 0;
|
||||
|
||||
// we handle multiple clicks ourselves here, in the same way as we do on Windows
|
||||
if (e->type != GDK_BUTTON_PRESS)
|
||||
// ignore GDK's generated double-clicks and beyond
|
||||
|
@ -269,6 +266,9 @@ static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
|
|||
e->time, maxTime,
|
||||
maxDistance, maxDistance);
|
||||
|
||||
me.Down = e->button;
|
||||
me.Up = 0;
|
||||
|
||||
// and set things up for window drags
|
||||
a->dragevent = e;
|
||||
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
|
||||
|
|
|
@ -1,62 +0,0 @@
|
|||
# 23 march 2019
|
||||
|
||||
libui_sources += [
|
||||
'unix/alloc.c',
|
||||
'unix/area.c',
|
||||
'unix/attrstr.c',
|
||||
'unix/box.c',
|
||||
'unix/button.c',
|
||||
'unix/cellrendererbutton.c',
|
||||
'unix/checkbox.c',
|
||||
'unix/child.c',
|
||||
'unix/colorbutton.c',
|
||||
'unix/combobox.c',
|
||||
'unix/control.c',
|
||||
'unix/datetimepicker.c',
|
||||
'unix/debug.c',
|
||||
'unix/draw.c',
|
||||
'unix/drawmatrix.c',
|
||||
'unix/drawpath.c',
|
||||
'unix/drawtext.c',
|
||||
'unix/editablecombo.c',
|
||||
'unix/entry.c',
|
||||
'unix/fontbutton.c',
|
||||
'unix/fontmatch.c',
|
||||
'unix/form.c',
|
||||
'unix/future.c',
|
||||
'unix/graphemes.c',
|
||||
'unix/grid.c',
|
||||
'unix/group.c',
|
||||
'unix/image.c',
|
||||
'unix/label.c',
|
||||
'unix/main.c',
|
||||
'unix/menu.c',
|
||||
'unix/multilineentry.c',
|
||||
'unix/opentype.c',
|
||||
'unix/progressbar.c',
|
||||
'unix/radiobuttons.c',
|
||||
'unix/separator.c',
|
||||
'unix/slider.c',
|
||||
'unix/spinbox.c',
|
||||
'unix/stddialogs.c',
|
||||
'unix/tab.c',
|
||||
'unix/table.c',
|
||||
'unix/tablemodel.c',
|
||||
'unix/text.c',
|
||||
'unix/util.c',
|
||||
'unix/window.c',
|
||||
]
|
||||
|
||||
libui_deps += [
|
||||
dependency('gtk+-3.0',
|
||||
version: '>=3.10.0',
|
||||
method: 'pkg-config',
|
||||
required: true),
|
||||
# We specify these as not required because some Unix systems include them with libc instead of providing them as separate files (thanks textshell and jpakkane in freenode #mesonbuild)
|
||||
meson.get_compiler('c').find_library('m',
|
||||
required: false),
|
||||
meson.get_compiler('c').find_library('dl',
|
||||
required: false),
|
||||
]
|
||||
libui_soversion = '0'
|
||||
libui_rpath = '$ORIGIN'
|
|
@ -62,7 +62,6 @@ static void setEditable(uiTableModel *m, GtkTreeIter *iter, int modelColumn, Gtk
|
|||
// TODO avoid the need for this
|
||||
path = gtk_tree_model_get_path(GTK_TREE_MODEL(m), iter);
|
||||
row = gtk_tree_path_get_indices(path)[0];
|
||||
gtk_tree_path_free(path);
|
||||
editable = uiprivTableModelCellEditable(m, row, modelColumn) != 0;
|
||||
g_object_set(r, prop, editable, NULL);
|
||||
}
|
||||
|
@ -257,7 +256,6 @@ static void progressBarColumnDataFunc(GtkTreeViewColumn *c, GtkCellRenderer *r,
|
|||
// TODO avoid the need for this
|
||||
path = gtk_tree_model_get_path(GTK_TREE_MODEL(m), iter);
|
||||
rc->row = gtk_tree_path_get_indices(path)[0];
|
||||
gtk_tree_path_free(path);
|
||||
rc->col = p->modelColumn;
|
||||
val = (gint *) g_hash_table_lookup(p->t->indeterminatePositions, rc);
|
||||
if (pval == -1) {
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
# 3 june 2016
|
||||
|
||||
list(APPEND _LIBUI_SOURCES
|
||||
windows/alloc.cpp
|
||||
windows/area.cpp
|
||||
windows/areadraw.cpp
|
||||
windows/areaevents.cpp
|
||||
windows/areascroll.cpp
|
||||
windows/areautil.cpp
|
||||
windows/attrstr.cpp
|
||||
windows/box.cpp
|
||||
windows/button.cpp
|
||||
windows/checkbox.cpp
|
||||
windows/colorbutton.cpp
|
||||
windows/colordialog.cpp
|
||||
windows/combobox.cpp
|
||||
windows/container.cpp
|
||||
windows/control.cpp
|
||||
windows/d2dscratch.cpp
|
||||
windows/datetimepicker.cpp
|
||||
windows/debug.cpp
|
||||
windows/draw.cpp
|
||||
windows/drawmatrix.cpp
|
||||
windows/drawpath.cpp
|
||||
windows/drawtext.cpp
|
||||
windows/dwrite.cpp
|
||||
windows/editablecombo.cpp
|
||||
windows/entry.cpp
|
||||
windows/events.cpp
|
||||
windows/fontbutton.cpp
|
||||
windows/fontdialog.cpp
|
||||
windows/fontmatch.cpp
|
||||
windows/form.cpp
|
||||
windows/graphemes.cpp
|
||||
windows/grid.cpp
|
||||
windows/group.cpp
|
||||
windows/image.cpp
|
||||
windows/init.cpp
|
||||
windows/label.cpp
|
||||
windows/main.cpp
|
||||
windows/menu.cpp
|
||||
windows/multilineentry.cpp
|
||||
windows/opentype.cpp
|
||||
windows/parent.cpp
|
||||
windows/progressbar.cpp
|
||||
windows/radiobuttons.cpp
|
||||
windows/separator.cpp
|
||||
windows/sizing.cpp
|
||||
windows/slider.cpp
|
||||
windows/spinbox.cpp
|
||||
windows/stddialogs.cpp
|
||||
windows/tab.cpp
|
||||
windows/table.cpp
|
||||
windows/tabledispinfo.cpp
|
||||
windows/tabledraw.cpp
|
||||
windows/tableediting.cpp
|
||||
windows/tablemetrics.cpp
|
||||
windows/tabpage.cpp
|
||||
windows/text.cpp
|
||||
windows/utf16.cpp
|
||||
windows/utilwin.cpp
|
||||
windows/window.cpp
|
||||
windows/winpublic.cpp
|
||||
windows/winutil.cpp
|
||||
)
|
||||
# resources.rc only contains the libui manifest.
|
||||
# For a DLL, we have to include this directly, so we do so.
|
||||
# Windows won't link resources in static libraries, so including this would have no effect.
|
||||
# In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process).
|
||||
# TODO make sure this gets added to both binary-only archives and install rules in this case
|
||||
if(BUILD_SHARED_LIBS)
|
||||
list(APPEND _LIBUI_SOURCES
|
||||
windows/resources.rc
|
||||
)
|
||||
endif()
|
||||
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
|
||||
|
||||
list(APPEND _LIBUI_INCLUDEDIRS
|
||||
windows
|
||||
)
|
||||
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
|
||||
|
||||
# TODO prune this list
|
||||
set(_LIBUI_LIBS
|
||||
user32 kernel32 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid windowscodecs
|
||||
PARENT_SCOPE)
|
||||
|
||||
if(NOT MSVC)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
message(FATAL_ERROR
|
||||
"Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC."
|
||||
)
|
||||
endif()
|
||||
endif()
|
|
@ -16,7 +16,7 @@
|
|||
// get Windows version right; right now Windows Vista
|
||||
// unless otherwise stated, all values from Microsoft's sdkddkver.h
|
||||
// TODO is all of this necessary? how is NTDDI_VERSION used?
|
||||
// TODO platform update sp2
|
||||
// TODO plaform update sp2
|
||||
#define WINVER 0x0600 /* from Microsoft's winnls.h */
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
|
||||
|
|
|
@ -314,7 +314,7 @@ static void drawGrid(ID2D1RenderTarget *rt, D2D1_RECT_F *fillRect)
|
|||
pformat = rt->GetPixelFormat();
|
||||
#else
|
||||
{
|
||||
typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *) const;
|
||||
typedef D2D1_PIXEL_FORMAT *(__stdcall ID2D1RenderTarget::* GetPixelFormatF)(D2D1_PIXEL_FORMAT *);
|
||||
GetPixelFormatF gpf;
|
||||
|
||||
gpf = (GetPixelFormatF) (&(rt->GetPixelFormat));
|
||||
|
|
|
@ -19,7 +19,7 @@ HRESULT _logLastError(debugargs, const WCHAR *s)
|
|||
|
||||
useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, le, 0, (LPWSTR) (&formatted), 0, NULL) != 0;
|
||||
if (!useFormatted)
|
||||
formatted = (WCHAR *) L"\n"; // TODO
|
||||
formatted = L"\n";
|
||||
msg = strf(L"[libui] %s:%s:%s() %s: GetLastError() == %I32u %s",
|
||||
file, line, func,
|
||||
s, le, formatted);
|
||||
|
@ -46,7 +46,7 @@ HRESULT _logHRESULT(debugargs, const WCHAR *s, HRESULT hr)
|
|||
|
||||
useFormatted = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, hr, 0, (LPWSTR) (&formatted), 0, NULL) != 0;
|
||||
if (!useFormatted)
|
||||
formatted = (WCHAR *) L"\n"; // TODO
|
||||
formatted = L"\n";
|
||||
msg = strf(L"[libui] %s:%s:%s() %s: HRESULT == 0x%08I32X %s",
|
||||
file, line, func,
|
||||
s, hr, formatted);
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// 20 may 2015
|
||||
#include "uipriv_windows.hpp"
|
||||
|
||||
// TODO no scrollbars? also not sure if true for combobox as well
|
||||
|
||||
// we as Common Controls 6 users don't need to worry about the height of comboboxes; see http://blogs.msdn.com/b/oldnewthing/archive/2006/03/10/548537.aspx
|
||||
|
||||
struct uiEditableCombobox {
|
||||
|
|
|
@ -368,7 +368,7 @@ static void fontDialogDrawSampleText(struct fontDialog *f, ID2D1RenderTarget *rt
|
|||
sample = uiprivFontCollectionCorrectString(f->fc, sampleStrings);
|
||||
sampleStrings->Release();
|
||||
} else
|
||||
sample = (WCHAR *) L"The quick brown fox jumps over the lazy dog."; // TODO
|
||||
sample = L"The quick brown fox jumps over the lazy dog.";
|
||||
|
||||
// DirectWrite doesn't allow creating a text format from a font; we need to get this ourselves
|
||||
family = cbGetItemText(f->familyCombobox, f->curFamily);
|
||||
|
|
|
@ -22,7 +22,7 @@ static const char *initerr(const char *message, const WCHAR *label, DWORD value)
|
|||
|
||||
hassysmsg = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, value, 0, (LPWSTR) (&sysmsg), 0, NULL) != 0;
|
||||
if (!hassysmsg)
|
||||
sysmsg = (WCHAR *) L""; // TODO
|
||||
sysmsg = L"";
|
||||
wmessage = toUTF16(message + 1);
|
||||
wout = strf(L"-error initializing libui: %s; code %I32d (0x%08I32X) %s",
|
||||
wmessage,
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
# 23 march 2019
|
||||
|
||||
windows = import('windows')
|
||||
|
||||
libui_sources += [
|
||||
'windows/alloc.cpp',
|
||||
'windows/area.cpp',
|
||||
'windows/areadraw.cpp',
|
||||
'windows/areaevents.cpp',
|
||||
'windows/areascroll.cpp',
|
||||
'windows/areautil.cpp',
|
||||
'windows/attrstr.cpp',
|
||||
'windows/box.cpp',
|
||||
'windows/button.cpp',
|
||||
'windows/checkbox.cpp',
|
||||
'windows/colorbutton.cpp',
|
||||
'windows/colordialog.cpp',
|
||||
'windows/combobox.cpp',
|
||||
'windows/container.cpp',
|
||||
'windows/control.cpp',
|
||||
'windows/d2dscratch.cpp',
|
||||
'windows/datetimepicker.cpp',
|
||||
'windows/debug.cpp',
|
||||
'windows/draw.cpp',
|
||||
'windows/drawmatrix.cpp',
|
||||
'windows/drawpath.cpp',
|
||||
'windows/drawtext.cpp',
|
||||
'windows/dwrite.cpp',
|
||||
'windows/editablecombo.cpp',
|
||||
'windows/entry.cpp',
|
||||
'windows/events.cpp',
|
||||
'windows/fontbutton.cpp',
|
||||
'windows/fontdialog.cpp',
|
||||
'windows/fontmatch.cpp',
|
||||
'windows/form.cpp',
|
||||
'windows/graphemes.cpp',
|
||||
'windows/grid.cpp',
|
||||
'windows/group.cpp',
|
||||
'windows/image.cpp',
|
||||
'windows/init.cpp',
|
||||
'windows/label.cpp',
|
||||
'windows/main.cpp',
|
||||
'windows/menu.cpp',
|
||||
'windows/multilineentry.cpp',
|
||||
'windows/opentype.cpp',
|
||||
'windows/parent.cpp',
|
||||
'windows/progressbar.cpp',
|
||||
'windows/radiobuttons.cpp',
|
||||
'windows/separator.cpp',
|
||||
'windows/sizing.cpp',
|
||||
'windows/slider.cpp',
|
||||
'windows/spinbox.cpp',
|
||||
'windows/stddialogs.cpp',
|
||||
'windows/tab.cpp',
|
||||
'windows/table.cpp',
|
||||
'windows/tabledispinfo.cpp',
|
||||
'windows/tabledraw.cpp',
|
||||
'windows/tableediting.cpp',
|
||||
'windows/tablemetrics.cpp',
|
||||
'windows/tabpage.cpp',
|
||||
'windows/text.cpp',
|
||||
'windows/utf16.cpp',
|
||||
'windows/utilwin.cpp',
|
||||
'windows/window.cpp',
|
||||
'windows/winpublic.cpp',
|
||||
'windows/winutil.cpp',
|
||||
]
|
||||
|
||||
# resources.rc only contains the libui manifest.
|
||||
# For a DLL, we have to include this directly, so we do so.
|
||||
# Windows won't link resources in static libraries, so including this would have no effect.
|
||||
# In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process).
|
||||
if libui_mode == 'shared'
|
||||
libui_sources += [
|
||||
windows.compile_resources('resources.rc',
|
||||
args: libui_manifest_args,
|
||||
depend_files: ['libui.manifest']),
|
||||
]
|
||||
endif
|
||||
|
||||
# TODO prune this list
|
||||
foreach lib : ['user32', 'kernel32', 'gdi32', 'comctl32', 'uxtheme', 'msimg32', 'comdlg32', 'd2d1', 'dwrite', 'ole32', 'oleaut32', 'oleacc', 'uuid', 'windowscodecs']
|
||||
libui_deps += [
|
||||
meson.get_compiler('cpp').find_library(lib,
|
||||
required: true),
|
||||
]
|
||||
endforeach
|
||||
|
||||
if libui_OS == 'windows' and libui_mode == 'shared' and not libui_MSVC
|
||||
error('Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC.')
|
||||
endif
|
|
@ -16,7 +16,7 @@
|
|||
// get Windows version right; right now Windows Vista
|
||||
// unless otherwise stated, all values from Microsoft's sdkddkver.h
|
||||
// TODO is all of this necessary? how is NTDDI_VERSION used?
|
||||
// TODO platform update sp2
|
||||
// TODO plaform update sp2
|
||||
#define WINVER 0x0600 /* from Microsoft's winnls.h */
|
||||
#define _WIN32_WINNT 0x0600
|
||||
#define _WIN32_WINDOWS 0x0600 /* from Microsoft's pdh.h */
|
||||
|
|
|
@ -144,7 +144,7 @@ D2D1_SIZE_F realGetSize(ID2D1RenderTarget *rt)
|
|||
return rt->GetSize();
|
||||
#else
|
||||
D2D1_SIZE_F size;
|
||||
typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *) const;
|
||||
typedef D2D1_SIZE_F *(__stdcall ID2D1RenderTarget::* GetSizeF)(D2D1_SIZE_F *);
|
||||
GetSizeF gs;
|
||||
|
||||
gs = (GetSizeF) (&(rt->GetSize));
|
||||
|
|
Loading…
Reference in New Issue