Compare commits

...

2293 Commits

Author SHA1 Message Date
Jeff Carr fecbab8d69 clean go mod
Signed-off-by: Jeff Carr <jcarr@wit.com>
2024-01-14 20:13:34 -06:00
Pietro Gagliardi fea45b2d5b
Merge pull request #521 from kojix2/patch-1
Update Ruby bindings
2021-01-02 00:39:49 -05:00
kojix2 ab9fcbf6ee
Update Ruby bindings
(#519)
2020-12-30 01:02:42 +09:00
Pietro Gagliardi f3982618e7
Merge pull request #517 from timgates42/bugfix_typo_platform
docs: Fix simple typo, plaform -> platform
2020-10-02 10:29:32 -04:00
Tim Gates ce8c2dc22c
docs: Fix simple typo, plaform -> platform
There is a small typo in windows/_rc2bin/winapi.hpp, windows/winapi.hpp.

Should read `platform` rather than `plaform`.
2020-09-30 07:05:44 +10:00
Pietro Gagliardi 34d1d0ac48
Merge pull request #500 from L4r0x/table-mem-leak
Fix memory leak in uiTable setEditable on unix.
2020-06-07 21:09:04 -04:00
Pietro Gagliardi 4ee9c47ddc Looks like meson now requires a newer ninja than what ships with whatever version of whatever Debian-derived distribution Azure Pipelines uses. Use ninja from pip instead (it's a special distribution maintained by the SciPy guys, apparently). 2020-06-07 21:05:16 -04:00
Lars Wrenger 6b124b6f55 Fix memory leak in uiTable setEditable on unix.
GtkTreePath was not freed correctly.
2020-06-07 20:41:31 +02:00
Lars Wrenger 54567bd4f6 Fix memory leak uiTable setEditable on unix.
The tree_model_path was not freed correctly.
2020-06-07 17:13:36 +02:00
Pietro Gagliardi a0a980712e
Merge pull request #480 from rjopek/patch-1
Update README.md
2020-01-01 11:35:45 -05:00
Rafał Jopek 9e8bda22a7
Update README.md
Removed outdated link, original project restored.
2019-12-29 19:40:51 +01:00
Pietro Gagliardi e8a4562744
Merge pull request #479 from jaens/patch-1
Remove pylibui-cffi from README
2019-12-29 09:58:45 -05:00
Jaen bd420fed73
Remove pylibui-cffi from README
The owner has archived the repository, which I assume means it's unmaintained.
2019-12-27 12:09:44 -08:00
Pietro Gagliardi 1b05846892 Fixed a use-before-initialize bug in unix/area.c. This was present from the start, and was an error in my Go code conversion; oops. Fixes #472. 2019-09-15 22:53:23 -04:00
Pietro Gagliardi 17486fd175 More notes. 2019-05-05 23:39:16 -04:00
Pietro Gagliardi ee3dbefcf6
Merge pull request #463 from lailton/master
Harbour version
2019-04-23 09:09:58 -04:00
Harbour Developer 73742a0210
Harbour version 2019-04-23 01:46:20 -03:00
Pietro Gagliardi 28755bdbc0 Make the AppVeyor badge always reflect master.
Let's stop sending mixed signals about the build status in the CI environment; Travis and AppVeyor both used "the latest build" by default, and not "master", and apparently this confused people. See https://news.ycombinator.com/item?id=16331432 for an example.
2019-04-17 23:16:05 -04:00
Pietro Gagliardi 6247f94a74 Fixed the only-on-tags check. This documentation is unclear. 2019-04-07 23:38:28 -04:00
Pietro Gagliardi ab58d0053c Oh, I had to make the connectiona vailable to use on all pipelines. 2019-04-07 23:31:08 -04:00
Pietro Gagliardi 88a3267cdd Merge branch 'meson'
This switches the build system from CMake to Meson. This also switches from Travis CI to Azure Pipelines.

Fixes #450.
Fixes #449.
2019-04-07 23:24:01 -04:00
Pietro Gagliardi 425c920952 And updated the README with both the Azure Pipelines badge and Meson merge date. We're good to go! 2019-04-07 23:22:09 -04:00
Pietro Gagliardi c9ae167d90 I'm a dumb 2019-04-07 23:08:08 -04:00
Pietro Gagliardi 1761f99e81 Triple oops, maybe?? 2019-04-07 23:03:43 -04:00
Pietro Gagliardi 7fb9cfae21 Double oops 2019-04-07 23:01:50 -04:00
Pietro Gagliardi 50f019abef Oops 2019-04-07 23:00:50 -04:00
Pietro Gagliardi d62e767056 That didn't work; try it with template syntax instead. 2019-04-07 22:58:21 -04:00
Pietro Gagliardi 6d1e1d7f26 Try to fix Azure Pipelines. I won't be able to make a tag to test the binaries until I merge back in, but I can't figure out how to set the default branch with YAML configurations (unless I have to do it on master), so. 2019-04-07 22:55:28 -04:00
Pietro Gagliardi e8daaf659e windows/direct2d: fix ID2D1RenderTarget::GetPixelFormat() and ID2D1RenderTarget::GetSize() typedefs in MinGW-w64 ABI workaround
MinGW-w64 recently added manual workarounds directly into the class via overloads that make existing Direct2D code source-compatible. However, that exposed an error in my definition of the typedefs I was using in my own workaround: both of these methods are const, even in MSVC, but I neglected to include the const qualifier. I'm not sure how this code compiled in the past, but now the overload resolution engine finds no match.

I want to remain compatible with versions of MinGW-w64 old enough to not have their fix, so our fix remains.

Fixes #446.
2019-04-07 21:56:35 -04:00
Pietro Gagliardi 9c164a2c5c Okay, at this point I'm betting pushd/popd just don't work on AppVeyor's cmd.exe. I'm betting it has to do with popd /? showing me the output of call /? instead. Just use cd. 2019-04-07 21:03:20 -04:00
Pietro Gagliardi 73e4e58c80 Okay, let's see if it's because of the multiline scripts. 2019-04-07 20:53:32 -04:00
Pietro Gagliardi 0b319032b6 Other way 2019-04-07 20:44:19 -04:00
Pietro Gagliardi fbdd84ac86 Not sure why popd is exiting with status 1... 2019-04-07 20:43:49 -04:00
Pietro Gagliardi d08ab7d260 Double oops. But this should work now! 2019-04-07 20:35:56 -04:00
Pietro Gagliardi 6e915321cc Oops 2019-04-07 20:29:46 -04:00
Pietro Gagliardi 52f07b0533 No reason pip shouldn't work... 2019-04-07 20:23:07 -04:00
Pietro Gagliardi acc0586fd6 Okay so .appveyor.yml cmd scripts must not have multiline commands, ugh. 2019-04-07 20:16:04 -04:00
Pietro Gagliardi 3f815718b1 Oops 2019-04-07 18:17:10 -04:00
Pietro Gagliardi 3037d7b87f Completely update the AppVeyor proejct. It now only handles MinGW and VS2013 builds, and uses YAML better. Partially based on guidance in the meson documentation. 2019-04-07 18:15:45 -04:00
Pietro Gagliardi 69bfbbf19c And set up tagging and GitHub releases. That'll be all for the Azure Pipelines configuration; now we just need the AppVeyor configuration. 2019-04-07 17:47:30 -04:00
Pietro Gagliardi 102693e1be Wrong backup 2019-04-07 17:22:10 -04:00
Pietro Gagliardi 36594e3759 Okay, so it seems I can't insert template names as matrix fields, and I'd rather not have a bunch of tiny jobs for all these different templates. So forget it for now. 2019-04-07 17:20:52 -04:00
Pietro Gagliardi 5492d34bce Do I need to use variables.? 2019-04-07 17:13:59 -04:00
Pietro Gagliardi a0ef6f6ca7 Okay, I guess I need to use the full pathname for templates? 2019-04-07 17:09:45 -04:00
Pietro Gagliardi c0c9a3ae92 Ah 2019-04-07 17:06:23 -04:00
Pietro Gagliardi 9af82be7f7 Oops again 2019-04-07 17:03:50 -04:00
Pietro Gagliardi ac26cf7521 Oops 2019-04-07 17:02:32 -04:00
Pietro Gagliardi c2eb806992 Start the matrixification 2019-04-07 17:01:28 -04:00
Pietro Gagliardi 9b483d972d Wrote a script to diff all the jobs we have so I can matrix-ify them. 2019-04-07 16:34:22 -04:00
Pietro Gagliardi 0969f43196 Delete the now-merged files. 2019-04-07 16:12:12 -04:00
Pietro Gagliardi b85c5c542a Merged all the files back together. 2019-04-07 16:11:59 -04:00
Pietro Gagliardi 851bbfe74f And the MinGW-w64 in Ubuntu 16.04 is too old. Oh well. 2019-04-07 16:06:17 -04:00
Pietro Gagliardi 93383cd45a Oh, the altenratives use win32 by default. 2019-04-07 15:57:53 -04:00
Pietro Gagliardi 46459dc8b2 OK then, it's a meson bug. Also -win32 doesn't have C++11 threads :| 2019-04-07 15:52:41 -04:00
Pietro Gagliardi 31a91d6fc0 Hm. 2019-04-07 15:45:27 -04:00
Pietro Gagliardi 8b908aedc1 Oops, MinGW-w64 isn't installed by default. 2019-04-07 15:34:40 -04:00
Pietro Gagliardi 2dcdbe02c9 Let's try using Linxu MinGW-w64. 2019-04-07 15:32:01 -04:00
Pietro Gagliardi 87bdb4e736 Moved the linux 386 steps to azure-pipelines_linux. Next up is trying the MinGW-w64 setup again, but using the MinGW-w64 in Linux instead of Windows. 2019-04-07 14:28:08 -04:00
Pietro Gagliardi 30a363baf1 Normalized template filenames and split the 64-bit apt-get step into its own template. 2019-04-07 14:24:16 -04:00
Pietro Gagliardi 9dc7a2bc7f Try to speed up the build process by consolidating all the apt-get installs into one. These 386 binaries do work, at least. 2019-04-07 14:04:57 -04:00
Pietro Gagliardi 85544275d0 All right, now split all those steps into its own file, clean up all the debugging nonsense, and apply it to the static build as well. Let's hope the artifacts are useful! 2019-04-07 13:45:02 -04:00
Pietro Gagliardi dffdb63f01 All right, that's the full list of packages. Now let's actually try this! 2019-04-07 13:27:48 -04:00
Pietro Gagliardi 9660c15fd1 More missing packages 2019-04-07 13:13:44 -04:00
Pietro Gagliardi b2c44efd7f More complete package list 2019-04-07 13:07:37 -04:00
Pietro Gagliardi d53d68226d I guess we'll need to do this :/ 2019-04-07 13:02:23 -04:00
Pietro Gagliardi 3813e520b5 Urgh. I guess we'll have to try downgrading? 2019-04-07 12:51:19 -04:00
Pietro Gagliardi b6ba770c12 Okay let's try this now 2019-04-07 12:05:05 -04:00
Pietro Gagliardi 9fad02d689 ?????? 2019-04-07 11:55:41 -04:00
Pietro Gagliardi f7d6d2db89 Oops; also I might have one last trick up my sleeves... 2019-04-07 11:49:46 -04:00
Pietro Gagliardi ef87e00543 Let's try other stuff 2019-04-07 11:44:28 -04:00
Pietro Gagliardi 8b9fa82616 Oops 2019-04-07 11:37:58 -04:00
Pietro Gagliardi cebfec8c2c Try doing what the wiki suggests. 2019-04-07 11:35:05 -04:00
Pietro Gagliardi e33612e1c9 One more shot here 2019-04-07 11:25:27 -04:00
Pietro Gagliardi 4e3a69c5f3 Not yet 2019-04-07 11:20:12 -04:00
Pietro Gagliardi c2f79d98c5 Okay I think we've got it this time???? 2019-04-07 11:15:56 -04:00
Pietro Gagliardi 9f1b19eb93 Try something else 2019-04-07 11:06:55 -04:00
Pietro Gagliardi a0ce3f1793 Try some more things 2019-04-07 10:57:11 -04:00
Pietro Gagliardi 3129cd7b46 OKay, let's use apt-cache to see how the packages here are set up. We'll go up the chain. 2019-04-07 10:19:44 -04:00
Pietro Gagliardi 416f4b4f70 Let's try installing libgtk-3-0:amd64 just for the heck of it 2019-04-07 09:06:49 -04:00
Pietro Gagliardi a564d66304 Oops, missed a spot. Good night for real. 2019-04-07 04:01:27 -04:00
Pietro Gagliardi d8781c961f One more, because I should have slept an hour ago. Not all those packages are lib32-able, and apparently libc6-i386 is a thing. 2019-04-07 03:57:26 -04:00
Pietro Gagliardi 08abc9972c Oh it's lib32 stuff. There used to be a metapackage for this why did they get rid of it 2019-04-07 03:50:07 -04:00
Pietro Gagliardi 16849b0a57 Okay, that had no effect, so follow the chain again: libgl1-mesa-dri:i386 -> libllvm6.0:i386 2019-04-07 03:40:16 -04:00
Pietro Gagliardi 8634048aba Okay, looks like for it to take effect I also need --no-upgrade. 2019-04-07 03:35:01 -04:00
Pietro Gagliardi f6022bdcc0 Okay, we have to run sudo apt-get update without --no-download. Try to force apt-get install to ignore updates. 2019-04-07 03:30:05 -04:00
Pietro Gagliardi e98a50b51c Shot in the dark; I'm starting to think the problem really is just outdated packages. 2019-04-07 03:23:44 -04:00
Pietro Gagliardi 1372d0d128 Follow the chain: libeg1-mesa:i386 -> libgl1-mesa-dri:i386 2019-04-07 03:15:42 -04:00
Pietro Gagliardi 92f0163563 Follow the chain: libwayland-egl1-mesa:i386 -> libegl1-mesa:i386 2019-04-07 03:06:24 -04:00
Pietro Gagliardi 574971c58d Yep that's what I thought; it tried to update the entire system instead :| Let's check the apt-cache policy. 2019-04-07 03:00:16 -04:00
Pietro Gagliardi b2d3d7f29d Okay, some people say apt-get upgrade is also needed. I'm doubtful, but let's try it. 2019-04-07 02:49:34 -04:00
Pietro Gagliardi 9c62325367 What is held 2019-04-07 02:45:37 -04:00
Pietro Gagliardi 2ee12f0bcb Okay we do want GCC 5 after all, and also ugh in general 2019-04-07 02:36:45 -04:00
Pietro Gagliardi e66257a2b5 Okay which version of GCC do we want 2019-04-07 02:33:53 -04:00
Pietro Gagliardi 6b2453ab4d Okay, that wasn't quite right; we don't want GCC 5, and I'm not sure why it doesn't want to install GTK+ 3 itself... 2019-04-07 02:30:47 -04:00
Pietro Gagliardi 6f26d869f2 Oops 2019-04-07 02:24:47 -04:00
Pietro Gagliardi 6e688b6476 Okay, that wasn't quite right... 2019-04-07 02:22:20 -04:00
Pietro Gagliardi 5452f8258f Let's try a Linux 386 build next! NumPy uses Docker; let's see if the Travis CI thing we did works here too instead. 2019-04-07 02:12:35 -04:00
Pietro Gagliardi 60687e6aff So apparently only macosx10.13 is valid?! Just use the default SDK. 2019-04-07 02:02:32 -04:00
Pietro Gagliardi efd7e8d07d Okay, so MinGW-w64 on Azure Pipelines is a non-starter. Let's find out what the macOS SDKs are *actually* called. 2019-04-07 01:57:47 -04:00
Pietro Gagliardi 23a0a041f0 ??? 2019-04-07 01:50:53 -04:00
Pietro Gagliardi f7c1515ae1 Roadblocks roadblocks 2019-04-07 01:43:31 -04:00
Pietro Gagliardi 5ded8398ba Bleh 2019-04-07 01:38:02 -04:00
Pietro Gagliardi 29b9e820da Some more guesswork. I have an idea... 2019-04-07 01:34:20 -04:00
Pietro Gagliardi d994dcb0b0 Hmmm 2019-04-07 01:29:44 -04:00
Pietro Gagliardi 4ec1a642a2 Getting closer... 2019-04-07 01:23:07 -04:00
Pietro Gagliardi 58cdf151a5 Ah, Write-Host was the key 2019-04-07 01:20:09 -04:00
Pietro Gagliardi 98e814f013 Grrr 2019-04-07 01:17:28 -04:00
Pietro Gagliardi e9792a2216 Oops again 2019-04-07 01:13:53 -04:00
Pietro Gagliardi 21591e4f6f Hm, Chocolatey is being annoying... 2019-04-07 01:11:18 -04:00
Pietro Gagliardi 651d502624 That didn't quite work 2019-04-07 00:43:41 -04:00
Pietro Gagliardi d3c553c424 Okay, things are not quite working right (and I forgot about shared builds not being available on MinGW-w64). Set up the next round of debugging early, and debug our PowerShell now. 2019-04-07 00:39:27 -04:00
Pietro Gagliardi a8f643c09c Sigh 2019-04-07 00:31:54 -04:00
Pietro Gagliardi 40100a17d1 Oops 2019-04-07 00:22:19 -04:00
Pietro Gagliardi 1500c750b6 Let's try MinGW-w64! 2019-04-07 00:19:28 -04:00
Pietro Gagliardi 21d4ad54b6 Part 2 of previous change 2019-04-06 23:56:05 -04:00
Pietro Gagliardi 26449f444f Executive decision: only run Ninja builds on CI. I only use these anyway, and this will let CI builds and releases go faster. If something breaks for other people, they will report bugs anyway, as they already have... 2019-04-06 23:53:40 -04:00
Pietro Gagliardi 31adbb419e Move the old Travis file out of the way and get rid of most of it. We still need some of its contents, but we will be getting rid of Travis entirely. 2019-04-06 21:13:16 -04:00
Pietro Gagliardi 6ba124ba83 Oops, let's not clobber Windows artifacts. 2019-04-06 20:58:56 -04:00
Pietro Gagliardi 8d90ae1dc9 And another oops, but I confirmed the archive commands look right, so let's go for real now. 2019-04-06 20:52:38 -04:00
Pietro Gagliardi 08096e13a4 Oops again 2019-04-06 20:45:14 -04:00
Pietro Gagliardi c1a0e2e3b6 Oops 2019-04-06 20:34:45 -04:00
Pietro Gagliardi f49253cbf8 Now try Windows artifacts. 2019-04-06 20:24:41 -04:00
Pietro Gagliardi 7e30a2afc1 Oops 2019-04-06 20:06:25 -04:00
Pietro Gagliardi 2584e82191 Moved the linux/darwn pipeline out of the way so we can start working on the Windows one. Also more TODOs. 2019-04-06 19:33:53 -04:00
Pietro Gagliardi 0c410022bb Oops 2019-04-06 19:28:33 -04:00
Pietro Gagliardi 988ca49e41 Split the Linux artifact rules into a template and try them on macOS and static builds too. 2019-04-06 19:26:35 -04:00
Pietro Gagliardi 963f230196 Okay, so we apparently need to explicitly Publish the artifacts we staged if we want to download them (in the final pipeline, this will be replaced with a GitHub step). 2019-04-06 16:16:45 -04:00
Pietro Gagliardi 20409b7599 Oops 2019-04-06 01:09:58 -04:00
Pietro Gagliardi fec8042cfa Sigh 2019-04-06 01:06:13 -04:00
Pietro Gagliardi 58753f8478 One more shot 2019-04-06 01:02:43 -04:00
Pietro Gagliardi 2c73c4f175 Jiggle Azure Pipelines 2/2 2019-04-06 00:54:25 -04:00
Pietro Gagliardi 318bc1437d Jiggle Azure Pipelines 1/2 2019-04-06 00:54:10 -04:00
Pietro Gagliardi 8be1b9603a Try again again 2019-04-06 00:51:25 -04:00
Pietro Gagliardi 494962b330 Try again 2019-04-06 00:49:11 -04:00
Pietro Gagliardi 7692103f7f Split the example names into a variable and echoed the commands for archiving so I can make sure everything is right. 2019-04-06 00:46:18 -04:00
Pietro Gagliardi f929365b6e Temporarily wipe azure-pipelines.yml and start testing the release setup. 2019-04-05 22:20:48 -04:00
Pietro Gagliardi a9fb246d74 More macOS options. 2019-04-05 20:52:26 -04:00
Pietro Gagliardi 7082146f9e Oops again 2019-04-05 20:26:27 -04:00
Pietro Gagliardi aa0753ffc7 Oops 2019-04-05 20:19:35 -04:00
Pietro Gagliardi 47948df5de Speed up Ninja downloading on Mac. 2019-04-05 11:20:15 -04:00
Pietro Gagliardi 15ffbeaa8a Oops 2019-04-05 10:42:43 -04:00
Pietro Gagliardi 77193006b9 Added the first Darwin build, to make sure everything works. 2019-04-05 10:40:24 -04:00
Pietro Gagliardi dbed420d32 Oops 2019-04-05 01:44:47 -04:00
Pietro Gagliardi ef7a341ec7 Split the meson setp into its own template. 2019-04-05 01:42:23 -04:00
Pietro Gagliardi cd2d5ea78e Even more templateization, including splitting the Python and meson steps into templates. The next template will be the Meson template, and that will be fun :V 2019-04-05 01:29:43 -04:00
Pietro Gagliardi 7a108adc4a Consolidated download and install steps. 2019-04-05 00:54:51 -04:00
Pietro Gagliardi ef7b698205 Ugh 2019-04-04 22:57:46 -04:00
Pietro Gagliardi 5ec9a2fbc0 Oops 2019-04-04 22:56:36 -04:00
Pietro Gagliardi a6b48771d5 Fix Windows ninja. 2019-04-04 22:55:23 -04:00
Pietro Gagliardi 04964839f2 Well that answers that 2019-04-04 22:40:18 -04:00
Pietro Gagliardi 15856e15da Why 2019-04-04 22:36:08 -04:00
Pietro Gagliardi 91e7473d00 Fix VS2015 vcvarsall. Will do ninja next. 2019-04-04 22:32:07 -04:00
Pietro Gagliardi 57b11c7ce8 Oops 2019-04-04 22:26:15 -04:00
Pietro Gagliardi 31970127b6 Fix VS2015 build. Ugh. 2019-04-04 22:24:20 -04:00
Pietro Gagliardi 8a090bd90b Added VS2015. 2019-04-04 21:59:11 -04:00
Pietro Gagliardi 994a37e336 Added 32-bit MSVC2017 builds. 2019-04-04 21:08:09 -04:00
Pietro Gagliardi 7e83ba9ffe Completed the matrix a bit more for 64-bit builds. Need to do the 32-bit VS2017 builds and all the VS2015 and macOS builds next. 2019-04-04 20:27:45 -04:00
Pietro Gagliardi 07dfea4a4f More TODOs. 2019-04-04 11:31:47 -04:00
Pietro Gagliardi d280aa40cb Jiggle Azure Pipelines again. 2019-04-04 11:23:58 -04:00
Pietro Gagliardi b480050550 Jiggle Azure Pipelines. 2019-04-04 11:21:00 -04:00
Pietro Gagliardi 7d22d84584 Deduplicate the install latest meson steps. 2019-04-04 11:02:59 -04:00
Pietro Gagliardi f23ba94d70 Properly specify job names. 2019-04-04 10:49:31 -04:00
Pietro Gagliardi d6c30352ee Split each of the build types into their own job. 2019-04-04 10:46:59 -04:00
Pietro Gagliardi 60df014315 Saved all the pages I had open on Azure Pipelines while writing what I have now, so I can restart Firefox as well as look these up later. 2019-04-04 01:17:01 -04:00
Pietro Gagliardi 9889477a25 It turns out the Ninja in CMake is either too old or a CI fluke that the VC env overrides. Try again. 2019-04-04 00:20:10 -04:00
Pietro Gagliardi e1abd02ed2 Don't use the VS backend with GCC. 2019-04-03 10:31:44 -04:00
Pietro Gagliardi 4afebf4d8e Try again again. 2019-04-03 10:20:07 -04:00
Pietro Gagliardi 466f542bd3 Try again. 2019-04-03 10:11:57 -04:00
Pietro Gagliardi 30a8cbf8b1 Fixed VS2017 build for now. 2019-04-03 10:05:00 -04:00
Pietro Gagliardi 514b8ecbc6 So apparently Azure Pipelines comes with Ninja as part of CMake. Ok. 2019-04-02 23:21:59 -04:00
Pietro Gagliardi 0da0240875 Oops 2019-04-02 23:18:02 -04:00
Pietro Gagliardi ce3fa7485f Okay, manually devenv. 2019-04-02 23:15:19 -04:00
Pietro Gagliardi 68901322d4 Okay, try to make it use Visual Studio =P 2019-04-02 22:13:02 -04:00
Pietro Gagliardi 6e0a8915af Try a Windows build. 2019-04-02 22:09:43 -04:00
Pietro Gagliardi 9f814dd47f Fix apt-get invocation on Azure. 2019-04-02 11:03:13 -04:00
Pietro Gagliardi af03601fde Follow the proper Python instructions in https://docs.microsoft.com/en-us/azure/devops/pipelines/languages/python?view=azure-devops for our Azure Pipelines file. 2019-04-02 10:41:17 -04:00
Pietro Gagliardi 5ad39011ce Try again 2019-04-02 10:29:08 -04:00
Pietro Gagliardi 7dfc11f645 Try to set up meson on Travis. 2019-04-02 10:22:40 -04:00
Pietro Gagliardi 0ad8c85de0 Fixred meson installation. 2019-04-01 11:03:08 -04:00
Pietro Gagliardi 151ee9a52e Try an initial build. 2019-04-01 10:58:03 -04:00
Pietro Gagliardi 8586ca35cb Merge branch 'master' into meson 2019-03-31 23:50:29 -04:00
Pietro Gagliardi 2aea38b446 Always build everything. 2019-03-31 23:50:05 -04:00
Pietro Gagliardi 0b6b68c6a1 Added codedate to azure-pipelines.yml. 2019-03-31 23:45:53 -04:00
Pietro Gagliardi 54e90aaafd Merge branch 'master' into meson 2019-03-31 23:44:56 -04:00
Pietro Gagliardi bca7dacd31 Set up CI with Azure Pipelines [skip ci] 2019-03-31 23:38:39 -04:00
Pietro Gagliardi 07f04f1cc8 Updated the README to talk about Meson. Now we have to just set up the CI and all is good to merge. 2019-03-31 21:07:46 -04:00
Pietro Gagliardi f7907f38c6 Decided to just deal with the name tester instead of test for now. It's not that important to block merging. 2019-03-31 11:09:16 -04:00
Pietro Gagliardi ff3d39213e Decided to just build everything by default and not have separate all or examples targets since we don't really have much control over what's a top-level target anyway (and ninja on its own == ninja all). Also set layout to flat by default, since it keeps everything together, which will lead to less surprising behavior on Windows and is more useful for our release packages. 2019-03-31 11:04:20 -04:00
Pietro Gagliardi 35750c41fe Removed the TODO on the spurious MSVC warning; it's a meson bug and I've filed it now. When I rewrite the README, I'll link that bug. 2019-03-31 01:02:00 -04:00
Pietro Gagliardi 5c0f542222 Removed TODO about incremental linking; I checked meson's source code and the way I'm specifying to turn it off is indeed the way to turn it off (and in fact is how it's disabled with --buildtype=minsize as well, so). 2019-03-30 17:56:47 -04:00
Pietro Gagliardi 31ca852cef Demote various MESONTODOs to TODOs now that I filed issues for them with mesonbuild/meson. Almost done! 2019-03-30 15:43:33 -04:00
Pietro Gagliardi 629074d269 Slightly refactored a TODO. 2019-03-30 14:17:13 -04:00
Pietro Gagliardi 223972f87b Removed the MESONTODO for Haiku (*_machine.system() already supports this) and DESTDIR (Meson handles this for us; see https://mesonbuild.com/Installing.html#destdir-support). 2019-03-30 11:36:51 -04:00
Pietro Gagliardi 5c8dd4e7c3 Demote the TODO about 32-bit Mac from a MESONTODO to a normal TODO, meaning it doesn't block merging this branch back. Turns out we're not 32-bit compliant anymore :/ I'll handle that separately. 2019-03-30 11:30:55 -04:00
Pietro Gagliardi 4023e1bba3 Removed the TODO on meson dist; that's documented at https://mesonbuild.com/Creating-releases.html. Also deduplicated some TODOs. 2019-03-29 11:47:17 -04:00
Pietro Gagliardi 257536103f Clean up specification of Windows dependency listp also suggested by TheQwertiest in freenode #mesonbuild. Also more TODOs. 2019-03-29 11:03:07 -04:00
Pietro Gagliardi 7ea8c33547 Removed TODO about bulk Windows libraries as the answer is no; thanks TheQwertiest in freenode #mesonbuild. 2019-03-29 10:46:27 -04:00
Pietro Gagliardi 53c2fe9d00 Properly specified -lm and -ldl on Unix. 2019-03-29 09:35:38 -04:00
Pietro Gagliardi d62775ad02 And migrated the last missing bit from the CMakeLists.txt into meson.build; thanks to someone from freenode #mesonbuild. No more CMake files! 2019-03-28 20:18:05 -04:00
Pietro Gagliardi 81e25f76f2 Moved the binary PIC as a TODO and marked merge blockers as MESONTODO. Also removed a stale cmake-era TODO, because the manifest distribution idea it had will eventually be part of the uires tool. 2019-03-27 21:34:09 -04:00
Pietro Gagliardi 70fe716d06 Removed bit about PIC in libraries; meson builds shared libraries as PIC always (and by default in the future, should the need to not have a PIC shared library arise). Executables will be a bit harder due to meson versioning. 2019-03-27 21:02:50 -04:00
Pietro Gagliardi 922dca4f1e Resolved \$ORIGIN question; thanks to someone in freenode #cmake. 2019-03-27 10:19:40 -04:00
Pietro Gagliardi 65b97b6836 Pruned unnecessary stuff from _wip/examples_drawtext_CMakeLists.txt. Not sure what's going to happen to these examples, but we're going to have to keep this particular file around until that's decided. 2019-03-27 01:11:01 -04:00
Pietro Gagliardi e1d6f35ef0 And settled examples/CMakeLists.txt. 2019-03-27 01:09:54 -04:00
Pietro Gagliardi 99f2b8f5ad And settled test/CMakeLists.txt; nothing there that needed to be moved. 2019-03-27 01:07:03 -04:00
Pietro Gagliardi f6ef61cdee And settled common/CMakeLists.txt (it also had nothing that needed to be moved). 2019-03-27 01:05:57 -04:00
Pietro Gagliardi 8b37a98170 Settled unix/CMakeLists.txt (was already complete in unix/meson.build) and darwin/CMakeLists.txt (just had one other thing needing to be moved). 2019-03-27 01:02:50 -04:00
Pietro Gagliardi 6a5fedf3f4 Settled windows/CMakeLists.txt. 2019-03-27 00:59:32 -04:00
Pietro Gagliardi f65caac1ce More CMakeLists.txt cleanup. What's left in the top-level CMakeLists.txt is gonna take a while to put back properly... 2019-03-27 00:56:43 -04:00
Pietro Gagliardi beba7470f4 Started cleaning out the CMakeLists.txt. meson automatically includes -fomit-frame-pointer for the address sanitizer, so no extra work needed. 2019-03-27 00:46:34 -04:00
Pietro Gagliardi b3232cc50c Cleaned up the comment at the top of meson.build, removing stale information and converting remaining loose ends into explicit TODOs. 2019-03-26 22:10:48 -04:00
Pietro Gagliardi 77f3b41940 Removed a stale TODO and moved notes about Windows flags into its own file because these probably won't be handled any time soon... 2019-03-26 22:06:20 -04:00
Pietro Gagliardi c940b85b84 Removed TODOs about finding the best wya to do things, as either there is none or the way I was doing it was already the right way (as with -mmacosx-version-min, judging from the repo code). 2019-03-26 22:03:39 -04:00
Pietro Gagliardi fec83e72bf Clean up add_project_arguments()/add_project_link_arguments() invocations. 2019-03-26 21:53:00 -04:00
Pietro Gagliardi 0d9cfa0f68 Resolved some TODOs/removed some stale TODOs. The one about libui_is_debug was confirmed by freenode elibrokeit as the pacman package manager uses it. 2019-03-25 23:12:28 -04:00
Pietro Gagliardi 0b87ee9f93 More TODOs. 2019-03-25 20:52:49 -04:00
Pietro Gagliardi 9527bb73ca Remove /nologo options from meson.build files; according to jpakkane, this is already provided by meson. 2019-03-25 20:17:42 -04:00
Pietro Gagliardi 1b9250e41e Removed include_directories hackery, as suggested by various people in freenode #mesonbuild. 2019-03-25 20:07:22 -04:00
Pietro Gagliardi 87f2be6849 Rewrote one expression to reduce the number of variables. 2019-03-25 10:46:41 -04:00
Pietro Gagliardi c449ab7da9 Fixed the name of the Windows DLL in meson.build. 2019-03-25 10:29:18 -04:00
Pietro Gagliardi 3457082b1b Set up examples meson.build. 2019-03-24 17:26:15 -04:00
Pietro Gagliardi 467a9102ec Fixed static builds on all platforms. So close to getting all this set up! 2019-03-24 14:11:02 -04:00
Pietro Gagliardi c1dfc0ab5d And got the Windows build working. Woo! 2019-03-24 12:57:25 -04:00
Pietro Gagliardi 2be9a4f3a3 Added the initial Windows meson.build. Windows Meson is having problems running, so we'll have to test this later. 2019-03-23 22:28:17 -04:00
Pietro Gagliardi 5e557d61b3 Set the minimum required meson version and moved the libui-specific OS X variables into darwin.build like we did with unix.build. 2019-03-23 21:50:54 -04:00
Pietro Gagliardi dff8ec0f22 Set up the Unix meson.build. That seems to work too. 2019-03-23 21:06:19 -04:00
Pietro Gagliardi cdd997b6f6 Added tester build file and made sure everything works. It works! 2019-03-23 18:12:33 -04:00
Pietro Gagliardi 1deacb55aa And massaged things into a buildable state. Woo. NOW things are starting to get annoying, but at least it's not so much *voodoo* anymore? 2019-03-23 16:18:13 -04:00
Pietro Gagliardi 253ce9a3cc Decided to just use add_project_(link_)arguments() for now, and set up the macOS build for testing. 2019-03-23 15:42:42 -04:00
Pietro Gagliardi 035139a1e9 Set up the macOS dependencies; I found it by accident :V Also removed the independent temporary dependency variables. 2019-03-22 22:46:53 -04:00
Pietro Gagliardi a440b174f7 Use host_machine instead of target_machine. Confusingly, host_machine is not the build host, but rather the target machine that the binaries will run on. build_machine is the build host. It probably made sense to the person in the 1980s who came up with this, but meh. 2019-03-22 22:04:07 -04:00
Pietro Gagliardi 7063ed6e32 Take some suggestions from the meson IRC channel: don't set unnecessary variables before project(); don't disallow plain builds since the options that meson doesn't apply aren't any of the ones I care about. 2019-03-22 22:00:19 -04:00
Pietro Gagliardi 1a9b0881bc Clean up meson.build slightly and add a section to the top to describe what I want to do so I can ask people. 2019-03-21 23:21:30 -04:00
Pietro Gagliardi 355b5d05d3 Filled meson.build a bit more, so I can ask questions about it. 2019-03-21 11:23:30 -04:00
Pietro Gagliardi f8543fc641 Started a top-level meson.build file. This might actually work... maybe. 2019-03-17 21:26:52 -04:00
Pietro Gagliardi 751ce562bb Renamed the doc folder to _doc so as to make room for newer, more final documentation. 2019-03-17 19:29:58 -04:00
Pietro Gagliardi 65a0c5958e Delete OLD_uitable.h; forgot to do it sooner. 2019-03-17 19:27:59 -04:00
Pietro Gagliardi 39d4542de3
Merge pull request #455 from torkleyy/patch-1
Update Rust bindings
2019-02-10 08:54:34 -05:00
Thomas Schaller 853d97aecb Update Rust bindings
All the other bindings are either abandoned
or forks of rust-native/libui-rs
2019-02-10 11:59:43 +01:00
Pietro Gagliardi e753ae9b57 More notes. 2019-02-09 21:38:10 -05:00
Pietro Gagliardi 7ce5070eeb
Merge pull request #454 from NoraCodes/readme-rust-link-fix
Point to the correct canonical location for Rust
2019-02-08 09:03:08 -05:00
Leonora Tindall e8db7f9bf9
Point to the correct canonical location for Rust 2019-01-31 20:57:57 -06:00
Pietro Gagliardi d305440fa0 Merge branch 'windows-namespace-and-hresult-cleanup'
Branch is abandoned, but notes files were changed, so keep those.
2019-01-05 18:57:37 -05:00
Pietro Gagliardi f1d9e36a0e Abandon the current work on windows-namespace-and-hresult-cleanup. I'll take a different approach. 2019-01-05 18:56:04 -05:00
Pietro Gagliardi a03754512f Merge branch 'master' into windows-namespace-and-hresult-cleanup 2019-01-05 18:46:25 -05:00
Pietro Gagliardi 04891a99ab Remove the autolayout --no-ff merge dummy file. 2019-01-05 17:40:59 -05:00
Pietro Gagliardi dabf2e6b93 Merge branch 'autolayout'
PROPERLY this time.
2019-01-05 17:40:33 -05:00
Pietro Gagliardi b95dd8fab5 Add a dummy file to ensure that branch autolayout can be --no-ff merged with master. 2019-01-05 17:35:41 -05:00
Pietro Gagliardi c65865d5c2 Merge branch 'master' into autolayout
For some reason the merge of this ages ago was forgotten. We're gonna make a dummy commit and properly --no-ff this.
2019-01-05 17:34:08 -05:00
Pietro Gagliardi acc0e3e5ea Merge branch 'master' of github.com:andlabs/libui 2018-12-30 20:18:26 -05:00
Pietro Gagliardi 000f699ba6
Merge pull request #426 from tacdevel/libuisharp-bindings-update
LibUISharp binding project rename
2018-12-30 20:17:16 -05:00
Pietro Gagliardi 0d9e3c4b67 More notes. 2018-12-26 12:40:37 -05:00
Pietro Gagliardi 38e5d23891 More notes. 2018-11-24 19:57:05 -05:00
Thomas Corwin 97609af771 Update the C# binding LibUISharp's name and link. 2018-11-20 15:16:38 -05:00
Pietro Gagliardi 6490cdadb7 More TODOs. 2018-11-11 21:25:45 -05:00
Pietro Gagliardi ae8a3939ae More TODOs. 2018-11-08 11:32:41 -05:00
Pietro Gagliardi df5d144dbd More TODOs. 2018-11-07 10:11:51 -05:00
Pietro Gagliardi c25831ec66 Properly sized the explorer bar now. 2018-11-05 21:09:50 -05:00
Pietro Gagliardi a5fb198558 Started work to properly size the explorer bars. 2018-11-04 22:19:44 -05:00
Pietro Gagliardi 7138276ccf And completed the genericization for Vista. It works!!! 2018-11-02 23:23:35 -04:00
Pietro Gagliardi 3d4b959632 More work on generalizing the winbuttonexplorertheme program. 2018-11-01 10:50:10 -04:00
Pietro Gagliardi d9a851169e More work. More platform-specific parameters, yay! 2018-10-30 23:34:06 -04:00
Pietro Gagliardi 447dc24651 Start of refactoring of stuff into classes! It's spaghetti already~ 2018-10-29 21:11:16 -04:00
Pietro Gagliardi c49151a4dc Background now draws correctly on Vista. Something weird is going on with the theme there; the parts (except for part 1) seem to be shifted down one... and the UIFILE there uses named constants directly... 2018-10-28 22:03:56 -04:00
Pietro Gagliardi b82d1b0a3b More work; we now have the background. Oh boy, this is gonna be fun, because Vista doesn't have things set up quite right compared to 7... 2018-10-28 18:17:37 -04:00
Pietro Gagliardi 9e6baf0a61 And cleaned up the button sizing, metrics, and drawing code. It seems to position the content correctly still! :D 2018-10-26 23:23:08 -04:00
Pietro Gagliardi d15dfa06a8 More text drawing work. I might need to make a generic button metrics function for this instead. 2018-10-21 22:23:11 -04:00
Pietro Gagliardi 836e0dc2c7 Resolved sizing woes for now. 2018-10-20 19:22:02 -04:00
Pietro Gagliardi 71ddf6ce91 Figured out more stuff about our button size woes. 2018-10-19 22:22:45 -04:00
Pietro Gagliardi 24e8649c87 More experiments. This is getting absurd. 2018-10-18 22:32:53 -04:00
Pietro Gagliardi 7e34fac79d More experimentation. DirectUI is doing something with the sizing that I'm not... 2018-10-16 23:19:23 -04:00
Pietro Gagliardi 83ba0b1a41 More experiments in properly sizing our themed buttons since I'll just be custom-drawing them in their entirety based on the UIFILE's specification of content alignment. 2018-10-16 11:25:22 -04:00
Pietro Gagliardi fcec8693ca Started drawing the button properly. Focus rects are now in the way... 2018-10-15 09:30:22 -04:00
Pietro Gagliardi 38723aeff9 More TODOs. 2018-10-15 01:54:15 -04:00
Pietro Gagliardi ba9c42e5bb More theming work. We may actually have it this time! 2018-10-15 01:53:22 -04:00
Pietro Gagliardi 760a7c09f5 Started a new test program that works like the rebar one except with real button controls instead. 2018-10-14 23:56:00 -04:00
Pietro Gagliardi 359c08aa11 Tried to custom-draw the split button properly. Not sure it's possible... 2018-10-14 19:08:02 -04:00
Pietro Gagliardi c216d8953d Undid all custom sizing stuff for now. Let's just make this work first. 2018-10-14 18:42:51 -04:00
Pietro Gagliardi ddd6afbf36 Refined icon loading and tried to expand the winrebarexplorertheme test a bit more elaborate. This is going badly again... 2018-10-14 15:12:00 -04:00
Pietro Gagliardi 79d1d58af2 Oops 2018-10-13 18:12:04 -04:00
Pietro Gagliardi 1d94e95e83 More work. That chevron is going to be annoying... 2018-10-13 17:56:44 -04:00
Pietro Gagliardi 9d31dddd13 Figured out what I was doing wrong to get rightbar not working; it was some code I forgot about =P 2018-10-13 14:17:17 -04:00
Pietro Gagliardi fc2ef2c904 More work. This is starting to get twisted. 2018-10-12 22:45:37 -04:00
Pietro Gagliardi a5aa4624df More work. We're definitely building up to something... 2018-10-12 20:56:53 -04:00
Pietro Gagliardi 87d3fc5064 And started the custom draw code. 2018-10-11 22:49:37 -04:00
Pietro Gagliardi 6a22c61cd4 More work on winrebarexplorertheme.cpp, including the boilerplate for custom draw. More TODOs in general. 2018-10-11 22:19:10 -04:00
Pietro Gagliardi d082b4efa4 More work on winrebarexplorertheme.cpp. It registers themes. 2018-10-11 21:03:34 -04:00
Pietro Gagliardi 91fe6e7c47 More rebar refinements. 2018-10-11 05:35:06 -04:00
Pietro Gagliardi 97b11e027d Refined the rebar test some more. 2018-10-11 04:10:36 -04:00
Pietro Gagliardi fa4f5d78cb More notes. 2018-10-10 22:13:05 -04:00
Pietro Gagliardi 30ee36f8d2 More test programs. This isn't done yet, and it's not working right... 2018-10-09 23:40:13 -04:00
Pietro Gagliardi 30d4129a38
Merge pull request #421 from Garland-g/master
Perl6 NativeCall bindings
2018-09-20 06:58:00 -04:00
Travis Gibson 186a92f6e9
Perl6 NativeCall bindings 2018-09-19 20:48:52 -07:00
Pietro Gagliardi 6891017cbe Wait I thought I did PIC already wtf 2018-09-01 20:37:05 -04:00
Pietro Gagliardi e2222e414d Sigh MinGW 2018-09-01 20:03:15 -04:00
Pietro Gagliardi 7268f2c78f Oops, clarified the README I just wrote. 2018-09-01 19:15:41 -04:00
Pietro Gagliardi 2606235a74 And fixed the documentation and marked Alpha 4.1. 2018-09-01 19:14:30 -04:00
Pietro Gagliardi db9977a4ee Fixed uiImage on Windows. Phew. Also made it have Windows decide the best parameters, like on other platforms. 2018-09-01 19:09:47 -04:00
Pietro Gagliardi 869992010c Fixed uiImage on GTK+. Also changed it to have cairo manage memory and decide best parameters for us. I forgot to mention that the fix on OS X did this there too. Also made sure we use cairo surfaces properly this time. 2018-08-30 11:08:44 -04:00
Pietro Gagliardi e098cb5585 More TODOs 2018-08-29 20:36:18 -04:00
Pietro Gagliardi f065abedd7 Fixed the uiImage implemenation on OS X. Even though libui won't be running on a big-endian Mac any time soon, I still want to test that code on one to make sure it's correct. 2018-08-29 20:32:12 -04:00
Pietro Gagliardi abeb0144d4 Changed the image generator for the tester to print the premultiplied RGBA byte stream instead of uint32_ts; regenerated images.c. 2018-08-29 19:58:35 -04:00
Pietro Gagliardi 9f89071db3 More notes. 2018-08-19 21:56:22 -04:00
Pietro Gagliardi dcf6a2c178 More notes. 2018-08-19 04:38:14 -04:00
Pietro Gagliardi c552c4bcae More typo fixes. 2018-08-14 21:28:51 -04:00
Pietro Gagliardi 1692d5d465 Quick documentation fix. 2018-08-13 20:11:20 -04:00
Pietro Gagliardi 76edc665b7 More TODOs. 2018-08-11 19:38:49 -04:00
Pietro Gagliardi 6a513038f4 Okay let's try this again, with deployment keys this time. 2018-08-10 20:11:15 -04:00
Pietro Gagliardi 2872e65db0 Declare Alpha 4. It doesn't have everything I want, but some of what I want will require bigger changes than I feel comfortable making in such a long-awaited release. 2018-08-10 19:45:04 -04:00
Pietro Gagliardi 419c584523
Merge pull request #379 from mischnic/attrstr-delete
Fix uiAttributedStringDelete
2018-08-09 05:16:52 -04:00
Pietro Gagliardi 9120d6b93f Continuation of previous commit. 2018-08-09 05:08:38 -04:00
Pietro Gagliardi 5d959e5cbc
Merge pull request #387 from mischnic/area-scroll
"Fix area setSize macOS"

I forgot to change this when I made scrollview.m not use Auto Layout. Oops.
2018-08-09 05:07:01 -04:00
Pietro Gagliardi 52bd45bb09 More TODOs. Update #395 2018-08-09 04:54:49 -04:00
Pietro Gagliardi 24df7bc3f2 Cleaned up timers in uiUninit() on GTK+. Update #395. 2018-08-09 04:49:07 -04:00
Pietro Gagliardi ad1641f9ab Cleaned up timers in uiUninit() on Windows. Update #395. 2018-08-09 04:29:16 -04:00
Pietro Gagliardi ea1fde52ad More TODOs and removed the old C++. 2018-08-08 21:31:58 -04:00
Pietro Gagliardi b3de605d50 Started template support, writing the initial C++ template. 2018-08-08 21:31:12 -04:00
Pietro Gagliardi ecf9efd6d7 More functions in funclist.proto. 2018-08-08 20:53:32 -04:00
Pietro Gagliardi 1f4d7dc374 Adjusted mk.sh slightly. 2018-08-08 19:51:20 -04:00
Pietro Gagliardi c33ea32e0f Started a new hresultwrap in Go. I'll run it locally. 2018-08-08 19:48:52 -04:00
Pietro Gagliardi 2df2d565f9 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-08-08 18:29:24 -04:00
Pietro Gagliardi 075d5efb61 Merge branch 'table'
FINALLY.

Update #310
2018-08-08 09:33:27 -04:00
Pietro Gagliardi 1a8e5555da Updated the README and merged uitable.h into ui.h. Now to merge! 2018-08-08 09:24:22 -04:00
Pietro Gagliardi f47e1423cf And finished documenting uitable.h. Yay, we can merge back in now! 2018-08-08 09:17:50 -04:00
Pietro Gagliardi 1c3d7be227 More uiTableModel documentation. 2018-08-07 11:18:11 -04:00
Pietro Gagliardi 9202aeee2a Documented uiTableModel. 2018-08-07 10:58:12 -04:00
Pietro Gagliardi dee35216ac Added documentation for uiTableValue. Also added a @role to uiFreeAttribute(). 2018-08-06 20:03:57 -04:00
Pietro Gagliardi cd38f77490 More TODOs regarding strides. 2018-08-06 08:52:51 -04:00
Pietro Gagliardi 976279ef33
Merge pull request #402 from mischnic/table-image-fix
"Fix uiImage on mac"

uiImageAppend()'s swizzling only works if the pixel stride is a multiple of four. Don't swizzle the pixel stride pixels.

Also a minor documentation fix.
2018-08-06 08:15:36 -04:00
Niklas Mischkulnig 68dade3e81
Rename loop variable 2018-08-06 10:54:19 +02:00
Niklas Mischkulnig c0742d3de0
Mac uiImageAppend: handle stride correctly 2018-08-06 09:28:25 +02:00
Pietro Gagliardi e0ca00e55b Resolved confusion about the terminology of strides in uiImageAppend(). Also prevents overallocation on some platforms. Thanks to @mischnic and @msink for spotting this. Update #402. 2018-08-05 18:39:29 -04:00
Pietro Gagliardi e7305349f3 Documented uiImage functions. 2018-08-05 17:52:15 -04:00
Pietro Gagliardi 4eaf01f840 Fix double-free spotted by @mischnic in #402. 2018-07-29 13:25:53 -04:00
Pietro Gagliardi b60953ed1c More TODOs. 2018-07-28 13:57:20 -04:00
Pietro Gagliardi 3c44d332da More notes. 2018-07-22 21:41:03 -04:00
Pietro Gagliardi 6812cab625 Implemented uiControlDestroy() for uiTable on GTK+. 2018-07-08 21:50:16 -04:00
Pietro Gagliardi a37fdadbd7 Implemented uiControlDestroy() for uiTable on OS X. 2018-07-08 21:22:55 -04:00
Pietro Gagliardi 095e63d522 Fixed memory leaks in the tester and a symbol name flub in OS X's image.m. 2018-07-08 21:20:42 -04:00
Pietro Gagliardi 1700c0ccea Reworded a TODO. 2018-07-08 21:13:19 -04:00
Pietro Gagliardi 5e2b8cb6ae Removed nowintable.diff; we don't need it anymore. 2018-07-08 21:04:23 -04:00
Pietro Gagliardi ce0168e1a5 I give up 2018-07-01 17:35:34 -04:00
Pietro Gagliardi 37bd4fc5a1 Added a test program to demonstrate the GTK+ progress bar cell renderer timer issues. 2018-06-25 21:25:23 -04:00
Pietro Gagliardi bd197684aa Added internationalization notes in the meantime. 2018-06-25 09:11:07 -04:00
Pietro Gagliardi 5d9928028f Wrote the initial version of the indeterminate progressbar in tables code on GTK+. VirtualBox is giving me issues when any indeterminate progressbar (real or table-based) is up; I wonder what's going on. 2018-06-24 18:23:25 -04:00
Pietro Gagliardi bd685f24f9 Removed a stale TODO; added more TODOs. 2018-06-24 14:48:09 -04:00
Pietro Gagliardi 4ed6e3ec8a Minor TODO resolution. 2018-06-24 14:46:24 -04:00
Pietro Gagliardi f3882d6124 Cleaned up color access across platforms. 2018-06-24 14:22:05 -04:00
Pietro Gagliardi acb40964f3 Deduplicated editable logic across platforms. 2018-06-24 11:41:19 -04:00
Pietro Gagliardi fb67c429d8 Made background color columns only settable at creation time; added a uiTableParams struct for the purpose. This should end edits to uitable.h for now (until we're ready to document it). Now to just clean up all the implementations. 2018-06-24 10:28:41 -04:00
Pietro Gagliardi 72c7c05f04 Fixed up AddColumn parameter and private fields names; made them consistent. 2018-06-24 09:52:01 -04:00
Pietro Gagliardi 4dbf1994a6 Deduplicated the default text column parameters across platforms. 2018-06-24 00:45:54 -04:00
Pietro Gagliardi 9b340ed40c Fixed checkboxes on Mac OS X. 2018-06-23 23:48:47 -04:00
Pietro Gagliardi 8f4598f641 Finally removed the extra uiImage declarations that were there for long-irrelevant compiler errors. 2018-06-23 23:45:58 -04:00
Pietro Gagliardi 74ec21f4c7 Turned the direct method calls on uiTableModel into functions to make the call sites look a bit cleaner. More stuff will go into common/tablemodel.c... 2018-06-23 23:35:42 -04:00
Pietro Gagliardi 9a79eed2ac Final cleanup, first part: renamed uiTableData to uiTableValue. 2018-06-23 20:19:30 -04:00
Pietro Gagliardi ac27e24add And even more still. I'm just gonna clean everything up for a merge at this point. 2018-06-23 11:27:02 -04:00
Pietro Gagliardi 888bb450b3 More TODOs. 2018-06-23 11:26:14 -04:00
Pietro Gagliardi 7d17df7121 HRESULT-chained the drawing functions together and fixed bugs in the focus drawing code. 2018-06-22 21:50:04 -04:00
Pietro Gagliardi d0f7cf81c5 And rewired the focus rect. 2018-06-21 23:47:24 -04:00
Pietro Gagliardi c2000ea54d Gave up with CDDS_SUBITEM; it just refuses to play nice with focus rects. Will try drawing focus rects again next commit. 2018-06-21 21:56:24 -04:00
Pietro Gagliardi 4dc7f4c2de Wrote the initial code to draw the focus rect. 2018-06-20 21:11:15 -04:00
Pietro Gagliardi 5854b0f638 Loose ends for editing: drew the proper background for text and committing text works now. 2018-06-20 19:31:21 -04:00
Pietro Gagliardi ccb7005dc6 Properly clipped the edit within the listview. 2018-06-20 18:56:03 -04:00
Pietro Gagliardi f180423096 Integrated tablemetrics.cpp into tableediting.cpp and added resize-on-type. 2018-06-20 18:47:55 -04:00
Pietro Gagliardi 5ae45a1fcb Integrated tablemetrics.cpp with tabledraw.cpp. 2018-06-20 18:03:56 -04:00
Pietro Gagliardi ec07b12295 Split table cell metrics into its own file. We still need to actually integrate this with everything. 2018-06-20 11:05:34 -04:00
Pietro Gagliardi df59eee783 Renamed tableevents.cpp to the more accurate tableediting.cpp. 2018-06-20 10:45:14 -04:00
Pietro Gagliardi bff9d0e311 More work on table edit controls, including: subclassing the edit control to actually handle escape and enter, setting focus on the eidt control, selecting all text in the edit control, and splitting the sizing stuff into a separate function. We'll have to split the rect-gathering code into a separate file before we can add live resize to the edit control... which will probably be useful because then I could just write a function to enumerate focus rects later. 2018-06-20 10:39:27 -04:00
Pietro Gagliardi 25a443f4f2 Handled the finished-editing cases I can right now. It is... mostly good???????????? IListView is very tantalizing now... 2018-06-19 23:07:24 -04:00
Pietro Gagliardi ff4b424ab0 Added WS_CLIPCHILDREN to uiTable to prevent drawing over children. 2018-06-19 07:51:34 -04:00
Pietro Gagliardi 4c107997d2 Round two: fully custom edit sizing code. We're getting somewhere now. Now we'll need to actually manage this thing =P 2018-06-18 23:51:58 -04:00
Pietro Gagliardi 1edb406045 Let's start over with this edit control sizing stuff. 2018-06-18 09:39:14 -04:00
Pietro Gagliardi d81b365396 More edit control stuff. We've almost got it, but it's too wide and the text is still aligned wrong. 2018-06-17 21:22:57 -04:00
Pietro Gagliardi 51f98d1f7b Started implementing the edit control for our table view. 2018-06-17 17:56:45 -04:00
Pietro Gagliardi 799c613a6f Added code for detecting that text is to be edited. Now for actually implementing editing text. 2018-06-17 15:06:45 -04:00
Pietro Gagliardi 6d0b276d6d Started handling table events. This covers checkboxes and buttons. 2018-06-17 11:48:39 -04:00
Pietro Gagliardi 2fb3676a8f More TODOs. 2018-06-17 10:50:24 -04:00
Pietro Gagliardi db2f3352c4 Added dummy code to evaluate LVM_SUBITEMHITTEST. The code will remain, but will be #if'd out. 2018-06-17 09:29:51 -04:00
Pietro Gagliardi 7bc121b1ec And drew buttons. Woo! Now for the harder part: editing. 2018-06-17 09:01:24 -04:00
Pietro Gagliardi 9fba903c4a Started button columns. LVN_GETDISPINFO handled. Also filled in the rest of the new column functions. 2018-06-16 22:12:54 -04:00
Pietro Gagliardi a00ca05136 Added themed progressbars. 2018-06-16 20:10:39 -04:00
Pietro Gagliardi 301376706f And made indeterminate progressbars work. Now to theme them. 2018-06-16 19:40:06 -04:00
Pietro Gagliardi c7555dcfd3 Started a more flexible indeterminate-state implementation. Now to build and test it. 2018-06-16 19:05:36 -04:00
Pietro Gagliardi c978f6fece Started indeterminate progress bars. This is gonna be interesting. 2018-06-16 18:06:44 -04:00
Pietro Gagliardi 8769bea3a0 Added code for unthemed definite progressbars. 2018-06-16 13:57:46 -04:00
Pietro Gagliardi f96c0f410e Started the implementation of progressbar columns. This handles LVN_GETDISPINFO. 2018-06-16 13:06:20 -04:00
Pietro Gagliardi d63af885ba Oops, that's why tooltips weren't working right: I had inverted a test in tabledispinfo.cpp. Fixed. 2018-06-16 12:52:16 -04:00
Pietro Gagliardi bcab521311 And consolidated the LVN_DISPINFO handlers. Everything's a lot cleaner now too, woo! 2018-06-16 12:33:16 -04:00
Pietro Gagliardi b9289c93a6 And drew checkboxes. We can FINALLY move on to other data types! ...almost. First we have to consolidate LVN_GETDISPINFO handlers. 2018-06-16 11:59:17 -04:00
Pietro Gagliardi 4bfd950caa Centered the table image. 2018-06-16 10:22:41 -04:00
Pietro Gagliardi f92c83992e Fixed image matching. 2018-06-16 08:52:55 -04:00
Pietro Gagliardi f1341a0485 Fixed image drawing. Still need to figure out why it's using the wrong size... 2018-06-16 04:26:36 -04:00
Pietro Gagliardi f852359acb Fixed build errors. The image list selection part works, at least!! Let's figure out why nothing else does. 2018-06-15 23:00:39 -04:00
Pietro Gagliardi 43bb983f5b Wrote new (incomplete) image drawing code. Now to build and test. 2018-06-15 22:50:39 -04:00
Pietro Gagliardi d6cebf4ca0 Added scaling to uiImage on Windows. We'll need this for what we're about to do. 2018-06-15 22:28:37 -04:00
Pietro Gagliardi 32ee36eb22 Fixed some of the technical glitches. 2018-06-15 19:29:01 -04:00
Pietro Gagliardi e6da33121e And integrated tabledraw.cpp. It works, barring some technical gltiches. It also makes me realize the alpha blending issue was my fault... 2018-06-15 10:04:32 -04:00
Pietro Gagliardi fda8f2fbae Started a separate file just for drawing tables; integrated text. 2018-06-14 21:31:45 -04:00
Pietro Gagliardi 75063ec266 Fixed text positioning in non-image columns. This separation probably isn't working... 2018-06-14 20:26:51 -04:00
Pietro Gagliardi c79f9b4ecd Added bitmap margins to the draw parameters. We'll need it later. 2018-06-13 21:46:28 -04:00
Pietro Gagliardi caa0688687 Started drawing uiTable text. We're drawing fully manually from here on out. Also fixed LVIF_INDENT settings and a few other things. 2018-06-13 21:07:58 -04:00
Pietro Gagliardi 15bc55dd5e Started work on backgrounds. This isn't ideal quite yet, but. 2018-06-13 10:09:13 -04:00
Pietro Gagliardi c01b010fd7 Fixed memory corruption issues. See code for details. 2018-06-13 08:30:00 -04:00
Pietro Gagliardi c4251894b5 Flipped the memory corruption back on so we can debug it. 2018-06-12 20:15:59 -04:00
Pietro Gagliardi f216af94e7 Made our new custom draw code only run on item prepaint. 2018-06-12 08:20:15 -04:00
Pietro Gagliardi f28c97d4d6 Switched checkboxes from postpaint to prepaint and turned off drawing everything while we slowly transition everything over. 2018-06-12 08:17:31 -04:00
Pietro Gagliardi e52373c59a Reintegrated wintablemetrics, properly this time (for the most part). It works. Now we can start switching to custom-drawing everything. 2018-06-12 07:58:27 -04:00
Pietro Gagliardi 59d8e81b85 There, found the reason that code doesn't work (LVIF_ICON was as tall as LVIF_BOUNDS) and fixed it (use the actual icon size for vertical centering) 2018-06-12 01:54:21 -04:00
Pietro Gagliardi 0f89418a95 Fixed a typo in tableimages.cpp. Okay, so the code I had before worked purely by accident, and this code doesn't. Wonderful... 2018-06-12 01:40:26 -04:00
Pietro Gagliardi 8f0019af10 Tried to combine all the Windows table metrics stuff. This broke things, so we'll have to go back to the drawing board here. 2018-06-11 22:22:54 -04:00
Pietro Gagliardi c843f1e62d More TODOs. 2018-06-11 08:01:18 -04:00
Pietro Gagliardi 0c6e7add01 Experimented with custom-drawing the text, this time in a nicer place thatn the default. Okay, this isn't too bad, especially now that it seems everything is vertically centered... 2018-06-10 23:03:54 -04:00
Pietro Gagliardi dfb3bd39f1 Some more TODO work. I might as well try custom drawing text now. 2018-06-10 20:18:07 -04:00
Pietro Gagliardi cd2a6f7c29 Fixed the checkbox y-offset issue. There are other issues, but this is more hopeful already... 2018-06-10 19:54:44 -04:00
Pietro Gagliardi 2a2990f19c I have no clue anymore. Tempted to undo checkbox stuff entirely for now. 2018-06-10 19:07:34 -04:00
Pietro Gagliardi 94a3397894 Tried to resolve checkboxes appearing selected. It doesn't work fully yet, so the actual drawing that makes it work is disabled for now. But the handler for NM_CUSTOMDRAW now has a hook to become cleaner in the future. 2018-06-10 17:38:51 -04:00
Pietro Gagliardi 5a5f9ba9ac And added themed checkboxes. 2018-06-10 13:15:21 -04:00
Pietro Gagliardi 8dd9f08ba4 Actually one more quick test fix to cycle through all the images before continuing. Okay, NOW for themed checkboxes. 2018-06-10 10:45:50 -04:00
Pietro Gagliardi c22f643df7 More image and checkbox fixups. Next: themed checkboxes. 2018-06-10 10:43:29 -04:00
Pietro Gagliardi a3feb425a1 Started splitting image and checkbox stuff into its own file. Also started adopting HRESULT returns everywhere, because why not make the conversion to it later slightly easier by starting now. 2018-06-10 00:51:50 -04:00
Pietro Gagliardi 8d43b55ff8 Removed some now-unused stuff. 2018-06-09 23:55:43 -04:00
Pietro Gagliardi 405a6defd2 Started using normal images for checkboxes in Windows uiTables. It doesn't quite work yet. 2018-06-09 23:25:16 -04:00
Pietro Gagliardi 4c5f0961fe Started an implementation of checkboxes in table.cpp. List View simply does not seem to support state images in subitems, so we'll have to improvise. Hopefully this won't screw accessibility. 2018-06-09 23:02:37 -04:00
Pietro Gagliardi 0f59bf7399 More TODOs. 2018-06-09 20:42:13 -04:00
Pietro Gagliardi b43fb4b247 And added images to uiTable. Right now it's loading the 32x32 images into the table instead of the 16x16 ones, but hey, it works! 2018-06-09 20:35:05 -04:00
Pietro Gagliardi a858300f25 Filled in image.cpp. Also switched on WIC since we'll need it for uiArea, though uiTable will still need classic GDI. Now let's integrate this into uiTable. 2018-06-09 19:24:36 -04:00
Pietro Gagliardi 3aee505f4e Weirdness workarounds. 2018-06-09 14:32:04 -04:00
Pietro Gagliardi ff64685655 More work. List View is starting to show its dumbness again. 2018-06-09 13:57:43 -04:00
Pietro Gagliardi 1c9f9627c0 Started image support for Windows tables. 2018-06-09 12:15:50 -04:00
Pietro Gagliardi c6c4dbd580 Started handling colors in the Windows table code. 2018-06-09 10:40:42 -04:00
Pietro Gagliardi 06a8044c2c Oops, forgot to keep the string queue full. It works! Now to switch to custom draw. 2018-06-08 22:11:46 -04:00
Pietro Gagliardi 69e91a9678 Fixed build errors and some logic errors. Let's hope it works! 2018-06-08 22:05:11 -04:00
Pietro Gagliardi 71a310909d Oops 2018-06-08 21:45:30 -04:00
Pietro Gagliardi 41d63bd0cf And finished rewriting table.cpp. That wasn't too bad for just text columns. Let's hope it works. 2018-06-08 21:44:55 -04:00
Pietro Gagliardi 516eb312fc Rearranged stuff in table.cpp on Windows and started rewriting it to handle owner-data in the new API. 2018-06-08 21:16:06 -04:00
Pietro Gagliardi 3aa16e844d Adjusted uiTableModel on Windows for owner-data list views. 2018-06-08 01:35:23 -04:00
Pietro Gagliardi ca2115ca57 Removed some old files from wintable that we won't use anymore. 2018-06-08 01:23:11 -04:00
Pietro Gagliardi 0adad7743a Drop mixing of C and C++ class allocations, including placement new. This is the easiest change I can make to the Windows table code for now... 2018-06-07 22:54:01 -04:00
Pietro Gagliardi 7a40bdfb3f Amazingly, it worked the first time! Just a quick logic error here. 2018-06-07 22:30:43 -04:00
Pietro Gagliardi 66ca3315cf Fixed compile errors. Now for runtime errors, if any! 2018-06-07 22:25:17 -04:00
Pietro Gagliardi d6ac22a20a Finished rewriting table.c. Now to test. 2018-06-07 21:50:38 -04:00
Pietro Gagliardi b7151388e3 Started rewriting the column constructors. 2018-06-05 22:47:11 -04:00
Pietro Gagliardi 18d8a8fe22 Converted column functions and editable handlers on GTK+. 2018-06-05 22:00:54 -04:00
Pietro Gagliardi 75a5a050cb Split the uiTableModel GTK+ code into its own file, tablemodel.c. 2018-06-04 23:46:30 -04:00
Pietro Gagliardi 94fa10b35e Started rewriting GTK+ uiTable. Did uiTableModel first. 2018-06-04 23:39:52 -04:00
Pietro Gagliardi 7a5577db94 Deleted now-irrelevant code from OLD_table.m. 2018-06-04 23:28:46 -04:00
Pietro Gagliardi 3c063c71d5 And one more TODO before we move on. 2018-06-04 22:15:05 -04:00
Pietro Gagliardi 0a6a781be7 And implemented row background colors and button clicks. OS X implementation done for now! 2018-06-04 22:14:05 -04:00
Pietro Gagliardi 3fa15d5277 Fixed graphical glitches in the OS X Table. Finally. SOMEHOW. 2018-06-04 20:17:15 -04:00
Pietro Gagliardi 8c611cf95d And added the rest of the column types to the tester. 2018-06-04 20:13:35 -04:00
Pietro Gagliardi 71e02a5c6e And set up the constraints for the other column types. 2018-06-04 20:09:09 -04:00
Pietro Gagliardi 8a0ca54e93 Fixed constraint issues in tablecolumn.m for text-containing columns. I guess that one constraint function needs to go... 2018-06-04 20:03:05 -04:00
Pietro Gagliardi 2cfbb0144e Fixed segfaults. Now to fix logic errors. (Technically one of the two changes here is a logic error too.) 2018-06-04 18:17:05 -04:00
Pietro Gagliardi 3bb050777b Started converting the test program. First column works fine, second segfaults. 2018-06-03 23:23:48 -04:00
Pietro Gagliardi 2b428d50f6 And fixed build errors. Now I just need to rewrite the tester and try this out... 2018-06-03 23:06:44 -04:00
Pietro Gagliardi 8fc4a9aaf5 Filled in the rest of tablecolumn.m: wrote the NSTableColumn subclasses and implemented the public functions. Let's build and see what breaks! 2018-06-03 22:37:36 -04:00
Pietro Gagliardi 6457e1668f Rewrote uiTableModelRowChanged() to properly update rows. We can do this now that we have the setup for row updates and reuse, but this is better than calling reloadData anyway (and reloadData doesn't update the row view, but we (almost) do, so...)... 2018-06-03 21:39:49 -04:00
Pietro Gagliardi 247d63be60 Added a table.h and simplified uiprivTableColumn into an abstract interface. 2018-06-03 20:55:08 -04:00
Pietro Gagliardi da2a4c1e36 Started building back the uiTable implementation. 2018-06-03 19:59:05 -04:00
Pietro Gagliardi 8ee5c61fe8 And added button columns. Now to start writing the rest of the uiTable glue. 2018-06-03 19:21:01 -04:00
Pietro Gagliardi b74b987fff Added progressbar columns. 2018-06-03 18:34:29 -04:00
Pietro Gagliardi 54ca41afb6 Moved common/table.c out of the way for now; it's not relevant with the proposed colum changes and definite data changes. 2018-06-03 17:57:17 -04:00
Pietro Gagliardi c04f3d3fbe Adjusted tablecolumn.m to use the new data functions. 2018-06-03 17:39:02 -04:00
Pietro Gagliardi 43b1a46669 Wrote the common table data functions. 2018-06-03 17:28:54 -04:00
Pietro Gagliardi 705bf2d9bf Planned a new system for transferring data between tables and models, based on uiAttribute. 2018-06-03 17:18:01 -04:00
Pietro Gagliardi 9c519f1bfa Added checkboxes and consolidated all the columns with or without text. Progressbars and buttons will be separate object types. I do need to redo the data-passing method, and now that there's uiAttribute I can just model a better one off that. 2018-06-03 16:50:35 -04:00
Pietro Gagliardi d1b7d14a82 Added image columns. 2018-06-03 14:13:32 -04:00
Pietro Gagliardi 5d57666764 Started writing the new table column code on OS X. This new code will take full advantage of NSTableView features like the reuse cache. Right now we just have the boilerplate for text-only columns. 2018-06-03 13:28:42 -04:00
Pietro Gagliardi 2f83428ebe Trying out a new uiTable API. This will make implementations easier, and figures that very few people need dynamic control over table column layout or contents. 2018-06-03 12:26:23 -04:00
Niklas Mischkulnig 3e5f4b3674 Fix area setSize macOS 2018-06-01 15:45:55 +02:00
Niklas Mischkulnig 773856fa90 Fix uiAttributedStringDelete 2018-05-31 17:49:44 +02:00
Pietro Gagliardi c4ce1072c7 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-31 08:21:40 -04:00
Pietro Gagliardi 7911ed0e81 Merge branch 'master' into table 2018-05-31 08:21:21 -04:00
Pietro Gagliardi cda991b7e2
Merge pull request #376 from mischnic/datetime-unreg
Fix uiDateTimePicker-related crashes in test on OS X: they were not being destroyed properly.
2018-05-31 08:20:16 -04:00
Niklas Mischkulnig 1b4c898a0c Fix datetimepicker crash 2018-05-31 13:03:19 +02:00
Pietro Gagliardi 1cb0e9046f Made the button cell renderer draw and size much more nicely than it did before, fixing a few bugs along the way. 2018-05-30 22:48:46 -04:00
Pietro Gagliardi 0907ea47bd Merge branch 'master' into table 2018-05-30 08:53:40 -04:00
Pietro Gagliardi 2f0e6e974b And updated the README. 2018-05-30 08:52:24 -04:00
Pietro Gagliardi 246abee8a4 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-30 08:50:58 -04:00
Pietro Gagliardi 61dbbdbf96 Merge branch 'master' into table 2018-05-30 08:50:40 -04:00
Pietro Gagliardi 1530192673 Finally got around to merging ANNOUNCE and Changelog into NEWS. 2018-05-30 08:49:24 -04:00
Pietro Gagliardi bba2d30362 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-30 08:07:40 -04:00
Pietro Gagliardi 32840cd88c Merge branch 'master' into table 2018-05-30 08:07:19 -04:00
Pietro Gagliardi 5bd78c1932 Merge branch 'master' of github.com:andlabs/libui 2018-05-30 08:06:39 -04:00
Pietro Gagliardi 9020b248e2
Merge pull request #372 from zhaozg/patch-1
Add another libui bare bindings for lua
2018-05-30 08:06:11 -04:00
Pietro Gagliardi 0e7f866531 More bindings. 2018-05-30 08:05:16 -04:00
Pietro Gagliardi 374eed7432 Removed the facilities for printing an int as text; this was causing the tester to crash in a weird way on OS X (through NSApplication _crashOnException: without telling me what that exception was) and I didn't intend on this part type to be used in this way anyway... 2018-05-29 20:27:31 -04:00
Pietro Gagliardi a7fe45b8a5 Removed carriage returns. 2018-05-29 20:26:48 -04:00
Pietro Gagliardi 32a83241cb
Merge pull request #361 from bcampbell/table-comctl
Add minimal uiTable implementation for Windows.

🎉
2018-05-29 20:00:22 -04:00
Ben Campbell b3b21196a1 minor windows table tweaks 2018-05-29 18:17:10 +12:00
Pietro Gagliardi 039a9db2e5 Wrapped the processing in a class and collapsed consecutive blank lines. 2018-05-28 22:57:52 -04:00
Pietro Gagliardi d4517fab84 And changed hresultwrap to only write to the output file in main(). 2018-05-28 22:50:00 -04:00
Pietro Gagliardi b590482ccb Expanded the tool input slightly and (finally) changed hresultwrap.cpp to use WriteCloser. 2018-05-28 22:46:30 -04:00
Pietro Gagliardi 7e2c505b1d Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-28 13:39:36 -04:00
Pietro Gagliardi cb5b6bf924 Merge branch 'master' into table 2018-05-28 13:39:11 -04:00
Pietro Gagliardi c3be9f221c Fixed a typo that led to CRLF bugs in uiMultilineEntry on Windows. Thanks to @mimecorg for spotting it.
Update #359
2018-05-28 13:38:36 -04:00
Ben Campbell ba13227bed further style consistency tweaks 2018-05-28 20:26:07 +12:00
Pietro Gagliardi ea5bd79b89 Made WINAPI (stdcall) the default calling convention. Hopefully this will opt us into some compiler optimizations... hopefully. 2018-05-27 20:44:34 -04:00
Pietro Gagliardi eef179c1e5 And added function bodies to hresultwrap. 2018-05-27 20:38:10 -04:00
Pietro Gagliardi a1a20837cd And cleaned up the item class, turning it into a Function class. 2018-05-27 20:17:35 -04:00
Pietro Gagliardi 620b03f442 And fixed the remaining errors, including runtime erorrs. It works! 2018-05-27 19:48:39 -04:00
Pietro Gagliardi cf945367a3 Rewrote hresultwrap.cpp with the new changes, fixing some build errors too. Now to fix the remaining build errors. 2018-05-27 16:32:33 -04:00
Pietro Gagliardi 4a7e7ed983 Rewrote the library to use ByteSlice. 2018-05-27 15:50:00 -04:00
Pietro Gagliardi 8231bd337f Built a new ByteSlice interface in lib.cpp that will keep shuffling the bytes around much nicer. I'll change everything to use it next. 2018-05-27 15:36:16 -04:00
George Zhao bd79a2fa8f
Update README.md
Add another libui bare bindings for lua
2018-05-27 14:52:21 +08:00
Pietro Gagliardi 481e1e30bb And updated hresultwrap to produce signatures. Man this is so un-C++-y it actually feels like I'm doing it wrong... 2018-05-26 20:09:16 -04:00
Pietro Gagliardi ef9e08d4ad Started assembling the input file to this hresult utility. 2018-05-26 19:40:55 -04:00
Pietro Gagliardi 8f5eba45bd Added more support for writing hresultwrap itself. There is probably a more C++-y way to write all this :| If only I could use Go... 2018-05-26 17:42:26 -04:00
Pietro Gagliardi a07727515f Updated hresultwrap to use lib.cpp, fixing errors along the way. 2018-05-26 16:56:53 -04:00
Pietro Gagliardi a6634f775b Minor style fretting 2018-05-25 21:17:29 -04:00
Pietro Gagliardi 472476392c Started expanding what were scanner.cpp and scanner.hpp into a more flexible library for tool writing. Also decided to go with separate POSIX and Windows implementations. 2018-05-25 21:07:45 -04:00
Pietro Gagliardi ca11bf1e42 More notes. 2018-05-25 20:25:36 -04:00
Pietro Gagliardi 43c2f26de3 Split Scanner into its own files. 2018-05-25 00:33:56 -04:00
Pietro Gagliardi 8b35ab973d Simplification through adversity, or, POSIX is not as portable as it would like :D It still works, though! 2018-05-24 16:11:58 -04:00
Pietro Gagliardi a5e07be2f5 Fixed EOF behavior. 2018-05-22 21:23:38 -04:00
Pietro Gagliardi c38564a8f7 And integrated Scanner into the mix. C's EOF behavior is gonna make things harder... 2018-05-22 21:19:54 -04:00
Pietro Gagliardi b769b37189 Attempted to simplify hresultwrap.cpp through a Scanner class, similar to Go's bufio.Scanner. There are a few snags right now... 2018-05-22 21:03:54 -04:00
Ben Campbell 4246ae5549 assorted consistancy cleanup 2018-05-22 22:53:25 +12:00
Ben Campbell 7402dec266 remove superfluous #include <vector> 2018-05-22 20:41:49 +12:00
Ben Campbell fc2ea17bb8 Add minimal uiTable implementation for windows
This uses the win32 common controls listview to implement uiTable.
There are limitations:
 - It supports only a single TextPart per column.
 - ImagePart, CheckboxPart and ProgessBarPart are not implemented.
 - There is no support for cell coloring.
 - Cell editing is not implemented.
Some of these will be very hard to support using the standard
common control listview, and probably require an entire custom
listview.
2018-05-22 20:41:49 +12:00
Pietro Gagliardi d09be0d5fc Fixed bugs in hresultwrap.cpp. 2018-05-21 23:05:39 -04:00
Pietro Gagliardi fb745e80e3 Started the tool to convert Windows API functions into HRESULT wrappers. 2018-05-21 22:42:19 -04:00
Pietro Gagliardi 20483669b2 Merge branch 'master' into windows-namespace-and-hresult-cleanup 2018-05-21 20:12:42 -04:00
Pietro Gagliardi 0da7b3fceb More bindings. Thanks to anonymous-coward on reddit. 2018-05-21 20:10:46 -04:00
Pietro Gagliardi 6c1a7b2b9b Cleared up exactly where libui stands. I didn't realize people were expecting more out of it than I let out, because I thought I was letting out exactly what I promised, when I didn't. Thanks to Bloodmeow (I think that was what their username was...). 2018-05-21 10:44:10 -04:00
Pietro Gagliardi 483c037d41 Merge branch 'master' of github.com:andlabs/libui 2018-05-21 08:41:24 -04:00
Pietro Gagliardi f55d34636b
Merge pull request #369 from msink/kotlin-libui
Kotlin/Native bindings
2018-05-21 08:40:27 -04:00
Mike Sinkovsky bb3066e3f5 Kotlin/Native bindings 2018-05-21 16:10:12 +05:00
Pietro Gagliardi cc477d58f8 More notes. 2018-05-20 12:55:50 -04:00
Pietro Gagliardi 919ad1f16e More Rust bindings. This list is getting nuttily formatted; need to improve it... 2018-05-20 10:20:19 -04:00
Pietro Gagliardi 422ec83162 Okay, so any future changes will require super complex cmd.exe fuckery combined with yaml's bizarre, complex quoting rules, sooooo nope.avi (I'll try again after spliting all the appveyor stuff into batch files, but at this point I'm tempted to switch to VSTS, which I can pay for). 2018-05-18 09:19:53 -04:00
Pietro Gagliardi cfb51cb1b9 And let's try again for MSVC. 2018-05-18 09:08:14 -04:00
Pietro Gagliardi 634ca8470d Gotta love curl (so much for a clean revert of this...) 2018-05-18 08:59:48 -04:00
Pietro Gagliardi abc489095e Let's try jom with 1 to start. 2018-05-18 08:56:42 -04:00
Pietro Gagliardi 96f2bf2603 And now with 3. 2018-05-18 01:28:32 -04:00
Pietro Gagliardi 4c8af90d64 Okay, that seemed to apply the flag correctly. Let's turn off the debugging spew and see if it has the effect we want. 2018-05-18 00:13:51 -04:00
Pietro Gagliardi e4852c17b7 motherfucking 2018-05-18 00:08:46 -04:00
Pietro Gagliardi b463590289 fucking 2018-05-18 00:07:09 -04:00
Pietro Gagliardi dc62cbd27f Let's try simultaneous builds in AppVeyor. 2018-05-18 00:05:19 -04:00
Pietro Gagliardi d4c41e0270 And undid all those changes. 2018-05-17 10:14:13 -04:00
Pietro Gagliardi d6ced62aab Hooray Microsoft 2018-05-17 10:08:15 -04:00
Pietro Gagliardi 911ef405c7 Okay, THAT worked, so let's fix the cmd.exe quoting 2018-05-17 10:03:24 -04:00
Pietro Gagliardi 4748828a2e Good to experience that YAML is a complicated mess for myself now! 2018-05-17 10:01:31 -04:00
Pietro Gagliardi 26e5843083 ... *sigh* 2018-05-17 09:59:25 -04:00
Pietro Gagliardi 3f1b6b3a49 Fucking YAML; so much for simple git revert of all this. 2018-05-17 09:56:11 -04:00
Pietro Gagliardi 18817c7633 Oops 2018-05-17 09:54:47 -04:00
Pietro Gagliardi 4e9f498dd3 Dump AppVeyor CPU count information. Update #364 2018-05-17 09:49:02 -04:00
Pietro Gagliardi 9d74f9f930 And added an announcement entry for this. 2018-05-16 22:18:02 -04:00
Pietro Gagliardi a0367201c9 Some more CI fine-tuning. 2018-05-16 22:04:46 -04:00
Pietro Gagliardi 02b7ae90f1 Some fixups to the AppVeyor and Travis CIs: rearranged artifact name parts to match existing ones, changed "platform" to "arch" wherever possible, changed "osx" to "darwin" in artifacts. Also added the AppVeyor badge to the README. 2018-05-16 21:55:04 -04:00
Pietro Gagliardi 4245120f6a
Merge pull request #358 from msink/ci-buildability
This adds AppVeyor as CI for the Windows builds.

This also lets both AppVeyor and Travis upload binary packages for tagged releases, so I don't have to keep making these myself.

The setup isn't optimal for everyone yet, but we can work that out.
2018-05-16 21:44:02 -04:00
Mike Sinkovsky 9aef70b980 Travis: upload artifacts 2018-05-16 17:36:57 +05:00
Mike Sinkovsky 2b1c43c642 Travis: refactor matrix 2018-05-16 16:17:16 +05:00
Mike Sinkovsky 858a497978 AppVeyor: deploy artifacts 2018-05-16 12:45:45 +05:00
Mike Sinkovsky c4b1e1b237 AppVeyor: refactor matrix 2018-05-15 16:21:51 +05:00
Mike Sinkovsky fb19345e10 CI: use AppVeyor for testing Windows buildability 2018-05-14 12:11:02 +05:00
Mike Sinkovsky 8be9195302 Travis: matrix build 2018-05-14 12:11:02 +05:00
Pietro Gagliardi 31090442be Merge branch 'master' into table 2018-05-13 18:05:50 -04:00
Pietro Gagliardi 02fc3e267e And fixed on OS X too. IIRC I handled it on Windows in a prior commit. 2018-05-13 18:04:57 -04:00
Pietro Gagliardi e00a91ded4 Fixed event propagation in GTK+ uiDateTimePicker. 2018-05-13 18:00:25 -04:00
Pietro Gagliardi 6533c0be32 Fixed the datetime example 2018-05-13 13:00:42 -04:00
Pietro Gagliardi 9dad806693 Merge branch 'master' into table 2018-05-13 12:05:43 -04:00
Pietro Gagliardi ca1079f344 Cleaned up from the previous merge and added it to the README. 2018-05-13 12:05:09 -04:00
Pietro Gagliardi d02784838e
Merge pull request #297 from cody271/datetime
Improve uiDateTimePicker by adding functions to set and get the displayed date.

Updates #309
2018-05-13 11:22:44 -04:00
Pietro Gagliardi 8874532302 Updated the README with the previous commit and updated CMakeLists.txt to address issues raised by the other PR.
Update #261
2018-05-13 11:19:30 -04:00
Pietro Gagliardi f7ea901460
Merge pull request #249 from l0calh05t/fix-msvc-release
Fix release build on MSVC.

Update #261
2018-05-13 11:10:05 -04:00
cody271 fd3b693ffe uiDateTimePicker Use more 'uipriv' on OS X 2018-05-12 21:40:47 -07:00
cody271 9aba97714d uiDateTimePicker Add comments 2018-05-12 21:35:07 -07:00
cody271 266c633972 uiprivDateTimePickerWidget Fix calendarBlock GTK+ signal 2018-05-12 21:35:07 -07:00
cody271 f3d0fee21a uiDateTimePicker Use 'uipriv' convention 2018-05-12 21:35:07 -07:00
cody271 edd4127f8e uiDateTimePicker Fix style consistency 2018-05-12 21:35:07 -07:00
cody271 0b436a8c74 uiDateTimePicker Use proper Windows backend conventions 2018-05-12 21:35:07 -07:00
cody271 0ac4ffdc87 Implement uiDateTimePickerTime() for Windows 2018-05-12 21:35:07 -07:00
cody271 594e3a1ccc uiDateTimePicker Move struct definition back 2018-05-12 21:35:07 -07:00
cody271 5ec5ebdfae uiDateTimePicker Emit proper GTK+ signal in dateTimePickerWidget 2018-05-12 21:35:07 -07:00
cody271 0baf2d2eb6 uiDateTimePicker Keep libui constructors at the end of the file 2018-05-12 21:35:07 -07:00
cody271 cf671c1da5 uiDateTimePicker Fix NSDatePicker timezone handling 2018-05-12 21:35:07 -07:00
cody271 57b225a629 Implement uiDateTimePickerTime() for GTK+ 2018-05-12 21:35:07 -07:00
cody271 04ce39a941 Implement uiDateTimePickerTime() for OS X 2018-05-12 21:35:07 -07:00
cody271 3e9bdd26f1 Fix layout in datetime/main.c 2018-05-12 21:35:07 -07:00
cody271 bc14042935 Add uiDateTimePickerTime() APIs 2018-05-12 21:35:07 -07:00
Pietro Gagliardi 86798f72b1 Merge branch 'master' into table 2018-05-13 00:15:37 -04:00
Pietro Gagliardi 2768fef3ce Cleaned up old static-library stuff from CMakeLists.txt. 2018-05-12 23:59:43 -04:00
Pietro Gagliardi 0b8e86e4f8 Started applying new uipriv names to table.c. Let's let the compiler tell us what we missed. 2018-05-12 13:59:22 -04:00
Pietro Gagliardi fd65a065c6 Merge branch 'master' into table 2018-05-12 13:56:37 -04:00
Pietro Gagliardi f647dda850 Made the past few branches into an update in README.md. 2018-05-12 13:52:07 -04:00
Pietro Gagliardi 1b23cd4e72 Merge branch 'unix-namespace-cleanup' 2018-05-12 13:48:44 -04:00
Pietro Gagliardi af192eedab And removed static library hacks from GTK+. Let's hope this works! 2018-05-12 13:43:13 -04:00
Pietro Gagliardi 241d8b59f0 And handled the functions in draw.h. Now to test this final build, then get rid of the shared library stuff from CMakeLists.txt... 2018-05-12 13:25:40 -04:00
Pietro Gagliardi add92694bf And renamed the things in future.c, to round out uipriv_unix.h. 2018-05-12 13:19:35 -04:00
Pietro Gagliardi e0a2fc5841 Renamed shared functions in draw.c, image.c, and cellrendererbutton.c. 2018-05-12 13:14:39 -04:00
Pietro Gagliardi 70fd8cbf8e Migrated the types and functions of child.c. 2018-05-12 13:03:55 -04:00
Pietro Gagliardi afaec644cc Migrated the margin and padding constants and functions in menu.c, alloc.c, and util.c. 2018-05-12 12:47:21 -04:00
Pietro Gagliardi 1c83d674a5 Dummy commit to split uipriv_unix.h and move the old stuff out of the way first, to create this branch. 2018-05-12 11:20:11 -04:00
Pietro Gagliardi 5ac579df35 Fixed table.m to line up with the changes on master that have since been merged in. 2018-05-06 22:13:03 -04:00
Pietro Gagliardi 3b5ef559f5 Merge branch 'master' into table 2018-05-06 21:30:29 -04:00
Pietro Gagliardi 221e8731c0 Revert "Avoid merge conflict in uipriv_darwin.h."
Nope, this confused git further

This reverts commit dc98bc2c25.
2018-05-06 21:26:51 -04:00
Pietro Gagliardi dc98bc2c25 Avoid merge conflict in uipriv_darwin.h. 2018-05-06 20:01:54 -04:00
Pietro Gagliardi 55023a5f99 Merge branch 'darwin-namespace-cleanup'
Doesn't handle Objective-C data yet; that'll come later.

Also starts a naming document.

Update #308
2018-05-06 19:35:39 -04:00
Pietro Gagliardi f1c4976fe0 Oh right, I forgot to remove the static library fuckery from the darwin CMakeLists.txt. NOW MERGING. 2018-05-06 19:34:58 -04:00
Pietro Gagliardi 7be597f674 TODO-ize names.md. I'm just going to merge this as-is, since I have not yet solidified the Obj-C rules yet. 2018-05-06 19:32:56 -04:00
Pietro Gagliardi 1e5f1b8254 More name stuff. Argh. 2018-05-06 14:56:38 -04:00
Pietro Gagliardi fb60d5860e Started pinning down reserved names. This is awkward... 2018-05-06 11:27:43 -04:00
Pietro Gagliardi 98fe8736b5 ...draw.h has nothing, so more TODOs. Now for investigating each file in turn. 2018-05-05 22:14:29 -04:00
Pietro Gagliardi fdff9b2dbb Renamed future and undocumented names. Now for draw.h (and whatever other headers are left behind), and then we figure out what to do about other names (including specifically pinning a naming convention). 2018-05-05 22:02:25 -04:00
Pietro Gagliardi 3914451c34 Migrated newLabel(), imageImage(), doManualMove(), and doManualResize(). 2018-05-05 21:28:13 -04:00
Pietro Gagliardi 69922a0fb3 Migrated shared scrollview.m types and functions. 2018-05-05 21:21:44 -04:00
Pietro Gagliardi cc271ccc37 Migrated newContext(), freeContext(), and colorButtonInhibitSendAction(). 2018-05-05 20:28:00 -04:00
Pietro Gagliardi 323a8945eb Migrated sendAreaEvents() and the areaevents.m keycode functions. 2018-05-05 20:20:57 -04:00
Pietro Gagliardi b8fc9fa817 Migrated shared functions and types of autolayout.m. 2018-05-05 20:15:48 -04:00
Pietro Gagliardi eb28beff1b Migrated alloc.m functions. 2018-05-05 19:46:57 -04:00
Pietro Gagliardi 090c783147 Migrated functions from window.m. 2018-05-05 19:38:16 -04:00
Pietro Gagliardi 7b570a4026 Merge branch 'master' into table 2018-05-05 09:15:08 -04:00
Pietro Gagliardi 2f92f644b5 Migrated util.m and the new NSTextField functions. 2018-05-04 20:26:13 -04:00
Pietro Gagliardi 1381edfa6e Migrated main.m functions. Before we merge this back in I absoltuely must do something about main.m and menu.m, even if ethereal. 2018-05-04 19:50:02 -04:00
Pietro Gagliardi 60e71c7174 Migrated menu.m for now. Need to figure out what to do about ivars and methods and properties. Also still not happy with the property and autoreleasepool mess of main.m... 2018-05-03 23:20:12 -04:00
Pietro Gagliardi b8316c61dd Converted struct mapTable to uiprivMap first, since that typedef will be a dependency of later stuff. ALso I didn't realize whoever wrote that new menu code also completely rewrote map.m... Cleaned up style inconsistencies I found in both. Anyway I plan on getting rid of that menu code anyway, and I could just have something else for target-action instead of this depending on whatever happens with ARC... 2018-05-03 23:02:38 -04:00
Pietro Gagliardi 5a113e1e0b Renamed toNSString() and fromNSString() to uiprivToNSString() and uiprivFromNSString(), respectively. 2018-05-03 22:38:21 -04:00
Pietro Gagliardi 4fe74fbd56 Started OS X name migration by moving uipriv_darwin.h out of the way. 2018-05-03 22:28:02 -04:00
Pietro Gagliardi 6a4a3e1b4d More TODOs. 2018-05-03 01:55:35 -04:00
Pietro Gagliardi 0359c2fa5c Merge branch 'windows-resource-removal'
Updates #308.
2018-05-02 23:40:04 -04:00
Pietro Gagliardi 134acf6ec0 And now that I tested everything to see that it worked, including msbuild and MinGW-w64 builds, updated the README.md. Time to merge back with master! 2018-05-02 23:38:08 -04:00
Pietro Gagliardi 7ee7de1b92 And removed the rc file copying stuff from CMakeLists.txt. I wonder if this fixes the msbuild generators in cmake, so let's find out... 2018-05-02 23:04:43 -04:00
Pietro Gagliardi 4432e39a44 And the color dialog. All done! Now we just need to clean up and remove the kludge. 2018-05-02 21:13:35 -04:00
Pietro Gagliardi e3e88c7a6a And migrated the font dialog. 2018-05-02 20:57:50 -04:00
Pietro Gagliardi 3522ec02b3 Fixed out. 2018-05-02 20:24:30 -04:00
Pietro Gagliardi a4cb17820c Forgot a fix (thanks to two people on Telegram) 2018-05-02 20:21:51 -04:00
Pietro Gagliardi b975cfb83e Fixes and TODOs in rc2bin. Going to manually adjust out instead of regenerating it, though. 2018-05-02 20:20:06 -04:00
Pietro Gagliardi c6979fa738 Removed rcTabPageDIalog from the resources. Also removed CRs from the out file. Need to fix that generator... 2018-05-02 20:17:08 -04:00
Pietro Gagliardi e11196304f Since out32 and out64 are identical, deduplicate them. Now we can move its contents elsewhere. 2018-05-02 10:00:44 -04:00
Pietro Gagliardi 88882592ac Fixed compiler errors and generated the output. 2018-05-02 09:59:29 -04:00
Pietro Gagliardi 10de22f9ac Added a program to dump resources to C structs. 2018-05-02 09:56:06 -04:00
Pietro Gagliardi 17ec9562ea Cleanup of previous merge, including TODOs and massive infodumps. 2018-04-30 21:55:54 -04:00
Pietro Gagliardi b9fd9fc395
Merge pull request #354 from bcampbell/new-msys-fixes
Fixes to compile utflib-and-attrstr changes on Windows with MinGW-w64

I did not do this myself; thanks @bcampbell for the fixes!
2018-04-30 21:45:29 -04:00
Ben Campbell 2be8fd3eb3 Fixes to compile on windows with msys2
msys2 seems to be unsure of it's IDWriteTypography definition and
disables it by default. This overrides the disabling (The
IDWriteTypography definition looks OK to me, and seems to work
fine).

This commit also adds in a canary to detect compilers that have a non-16bit
wchar_t on windows (eg a gcc focused on porting unix code rather
than compiling windows code).
2018-05-01 12:59:26 +12:00
Pietro Gagliardi 55f2eba45b Add wchar_t overloads to utf.h for C++ on Windows with non-MSVC compilers; I did not realize that was also a thing I needed to worry about!
Update #287
2018-04-30 07:46:38 -04:00
Pietro Gagliardi f88c23602e More notes. 2018-04-22 23:47:22 -04:00
Pietro Gagliardi 5cc85c2609 More ifxes. 2018-04-19 20:33:20 -04:00
Pietro Gagliardi 3f421f9816
Merge pull request #340 from parro-it/fix-timer-windows-2
Fix uiprivTimer::f,  it should return an int
2018-04-19 20:31:08 -04:00
Andrea Parodi e61f7fb0cb Fix uiprivTimer::f: it should return an int 2018-04-19 21:03:49 +02:00
Pietro Gagliardi 591b9c8772 And added to the README. Woo! (Also more TODOs.) 2018-04-18 21:11:23 -04:00
Pietro Gagliardi 83b04cda47 And added documentation nits and TODOs to the uiTimer() code. 2018-04-18 21:09:24 -04:00
Pietro Gagliardi cac4cd9e81 Cleaned up stylistic nits and common branch naming issues on the new uiTimer() code. Also switched the Windows code to use a simple struct instead of the class (and with a uipriv name). 2018-04-18 21:04:12 -04:00
Pietro Gagliardi 85a4c6d35d
Merge pull request #277 from cody271/timer
Adds a function uiTimer() that runs code on the main loop at certain intervals.

Original comment: Add Timer API
2018-04-18 20:52:59 -04:00
Pietro Gagliardi ab336e0e8b Fixed uiImage redeclaration warnings on OS X. 2018-04-18 10:29:16 -04:00
Pietro Gagliardi bd2f436d91 Fixed uiImage redeclaration warnings on GTK+. 2018-04-18 10:20:55 -04:00
Pietro Gagliardi 6507a0d3a1 Updated common uipriv names on Unix. 2018-04-18 10:17:41 -04:00
Pietro Gagliardi d441455112 Updated common uipriv names on OS X. 2018-04-18 10:06:43 -04:00
Pietro Gagliardi ae2eea7975 Merge branch 'master' into table
Long-overdue sync.
2018-04-18 10:00:13 -04:00
Pietro Gagliardi 9cf6c3faf5 Updated the README with the previous merge.
Update #308. Oops, forgot to do this with the merge...
2018-04-18 00:58:21 -04:00
Pietro Gagliardi 3539cda280 Merge branch 'common-namespace-cleanup'
This begins the process of cleaning up the libui namespace.
2018-04-18 00:55:21 -04:00
Pietro Gagliardi 52dc39a553 Decided to keep attrstr.h for now; removed extern "C" hack from attrstr.hpp on Windows and moved it into attrstr.h. Let's merge back. 2018-04-18 00:54:24 -04:00
Pietro Gagliardi 4df47a6ee8 Decided what to do about uipriv.h including ui.h (uipriv_OS.h* wrecks that plan, so make a note of us not doing it). Now to just decide what to do about attrstr.h and then we can merge back. 2018-04-17 21:04:04 -04:00
cody271 5622b13c23 uiTimer() Use uiNew() and uiFree() 2018-04-16 17:49:08 -07:00
cody271 f921dde9f6 uiTimer() Use 'uipriv' prefix convention 2018-04-16 17:48:33 -07:00
cody271 fa7466e7b4 uiTimer() Qualify Objective-C instance variables with 'self' 2018-04-16 17:45:30 -07:00
Pietro Gagliardi ee986363c8 More notes. 2018-04-16 20:35:47 -04:00
cody271 d99549ec18 uiTimer() Use TimerHandler pointers directly as Windows timer IDs 2018-04-16 17:28:13 -07:00
cody271 c9d11a85cc uiTimer() Refactor TimerHandler for Windows timer IDs 2018-04-16 17:28:13 -07:00
cody271 4e6adca08c uiTimer() Ensure Windows timer IDs are unique 2018-04-16 17:28:13 -07:00
cody271 b1210165a0 Implement uiTimer() for Windows 2018-04-16 17:28:13 -07:00
cody271 68e1223e4d Fix TimerDelegate memory leak 2018-04-16 17:28:13 -07:00
cody271 5dbe20593d Implement uiTimer() for GTK+ and OS X 2018-04-16 17:28:12 -07:00
cody271 27b8ce1db3 Add uiTimer() API and example 2018-04-16 17:28:12 -07:00
Pietro Gagliardi 750f4214b7 Cleaned up private symbols (and in one case, explicit initialization) of symbols in all *.c files in common/. Now to decide what to do about whether uipriv.h should include ui.h and if attrstr.h should even stay, and then I can merge this back. 2018-04-16 02:31:24 -04:00
Pietro Gagliardi 7cd88ddd03 More notes. 2018-04-16 01:33:21 -04:00
Pietro Gagliardi b3df05eb8e More TODOs. (This was originally added in a prior commit but I forgot to mention it; I wanted it to be LONGTERM but forgot about that the first time.) 2018-04-15 23:16:04 -04:00
Pietro Gagliardi fcc26ab9a9 Fixed a serious bug in windows/utf16.cpp that went unnoticed for this long: we wanted utf16UTF8Count(), not utf16RuneCount(), in toUTF8(); any non-ASCII text had the wrong number of bytes, and thus random heap corruption. The string "鎿嶄綔鎴愬姛瀹屾垚銆" (taken from the completely unrelated #337) and the Set Button Text button was enough to trigger this. 2018-04-15 23:10:11 -04:00
Pietro Gagliardi c3992cc647 uipriv-ized utf.c. 2018-04-15 23:08:57 -04:00
Pietro Gagliardi 8e2004cf67 struct graphemes -> uiprivGraphemes. Also deleted OLD_uipriv.h now that that one is settled. 2018-04-15 22:43:14 -04:00
Pietro Gagliardi 01d6422664 Added uipriv prefixes to the matrix functions. 2018-04-15 22:39:34 -04:00
Pietro Gagliardi 24a4b0997c fromScancode() -> uiprivFromScancode(). 2018-04-15 22:31:17 -04:00
Pietro Gagliardi 0dddf4a490 clickCounter -> uiprivClickCounter. 2018-04-15 22:26:51 -04:00
Pietro Gagliardi f5be05f143 shouldQuit() -> uiprivShouldQuit(). 2018-04-15 21:54:46 -04:00
Pietro Gagliardi 59835a9bae Removed the declaration of newControl(): it was completely unused, as it was superceded by uiAllocControl() long ago. 2018-04-15 21:49:58 -04:00
Pietro Gagliardi f93973d3cb Migrated implbug() and userbug() to uipriv forms. 2018-04-15 21:46:08 -04:00
Pietro Gagliardi c6bb463692 uiAlloc() et al -> uiprivAlloc() et al, Windows code. 2018-04-15 18:12:58 -04:00
Pietro Gagliardi 099c4ff631 uiAlloc() et al -> uiprivAlloc() et al, GTK+ code. 2018-04-15 16:36:03 -04:00
Pietro Gagliardi 8ca32f098f uiAlloc() et al -> uiprivAlloc() et al, OS X code. 2018-04-15 16:05:24 -04:00
Pietro Gagliardi 72e8b9a198 Started FINALLY renaming uiAlloc(), uiNew(), uiRealloc(), and uiFree() into uipriv* forms. This handles the common folder. 2018-04-15 15:53:27 -04:00
Pietro Gagliardi 4a57b15d09 Renamed the common options variable to uiprivOptions. 2018-04-15 15:49:45 -04:00
Pietro Gagliardi e0f800d5eb Started cleaning up the common/ folder. Backed up the current uipriv.h. 2018-04-15 15:39:28 -04:00
Pietro Gagliardi f3fcf9918b
Merge pull request #336 from Qwerp-Derp/patch-1
Added link to Hedron
2018-04-14 12:59:33 -04:00
Pietro Gagliardi 0f8c59ef49
Merge pull request #330 from tom-corwin/libuisharp-bindings
Added the LibUISharp project to the list of bindings.
2018-04-14 12:59:05 -04:00
Pietro Gagliardi 03d0d4074a More notes. 2018-04-14 12:36:52 -04:00
Pietro Gagliardi a24085bd5e More notes. 2018-04-13 22:30:21 -04:00
Pietro Gagliardi 8e7bd22d6c More notes. 2018-04-12 21:55:57 -04:00
Pietro Gagliardi a098f7f78b More notes. 2018-04-09 21:32:50 -04:00
Hanyuan Li 34fd48ae0d
Added link to Hedron 2018-04-09 18:29:46 +10:00
Pietro Gagliardi ceec25f061 More notes. 2018-04-08 21:26:16 -04:00
Pietro Gagliardi 1266a77e61 More notes. 2018-04-07 23:39:41 -04:00
Pietro Gagliardi d53ab65589 More notes. 2018-04-04 11:27:59 -04:00
Thomas Corwin e45c7b4d87 Added the LibUISharp project to the list of bindings. 2018-04-02 12:47:23 -04:00
Pietro Gagliardi 177527c959 More notes. 2018-03-29 23:36:53 -04:00
Pietro Gagliardi 696459be85 More notes. 2018-03-26 22:03:17 -04:00
Pietro Gagliardi e244a0edf4 More notes. 2018-03-25 13:13:31 -04:00
Pietro Gagliardi a7c58c2c2e More notes. 2018-03-25 02:01:37 -04:00
Pietro Gagliardi 84ff1890c5 More notes. 2018-03-24 21:16:58 -04:00
Pietro Gagliardi 51f72abba8 Updated the list of bindings, adding new ones and removing some deleted ones.
Fixed #244.
FIxed #217.
Updates #206.
2018-03-23 08:25:41 -04:00
Pietro Gagliardi 6d8150d6a4
Merge pull request #304 from marcotrosi/master
added link to Lua binding library lui by Gunnar Z.
2018-03-22 15:45:21 -04:00
marcotrosi 93789560ce added link to Lua binding library lui by Gunnar Z. 2018-03-22 18:37:07 +01:00
Pietro Gagliardi 6667cf2f51
Merge pull request #254 from nopara73/patch-1
Add .NET Core bindings to readme
2018-03-20 22:21:40 -04:00
Pietro Gagliardi 242620ff0f Fixing deployment target issues on OS X broke cpp-multithread due to deployment target libc++ issues. Fixed.
Fixes #302.
2018-03-20 02:10:48 -04:00
Pietro Gagliardi 3e76d799b1 Fixed leftovers from utflib-and-attrstr that broke builds of things I didn't fully update yet, since people want to build them anyway (for testing in a CI environment, I suppose; a real unit test suite would be better for this, though, which is one of the reasons for the _future/unittest stuff...)
Updates #302.
2018-03-20 01:58:34 -04:00
Pietro Gagliardi 8d6e41e199 Oops, missed a spot 2018-03-18 15:54:55 -04:00
Pietro Gagliardi 9cf56e1674 Merge branch 'utflib-and-attrstr'
FINALLY.
2018-03-18 15:51:22 -04:00
Pietro Gagliardi c402dcac30 And finally got rid of ui_attrstr.h (it's now all in ui.h) and updated the README. Time to FINALLY merge this back in! 2018-03-18 15:49:44 -04:00
Pietro Gagliardi df03c09a9c More TODOs. 2018-03-18 15:40:45 -04:00
Pietro Gagliardi d788d86239 Removed the margins from the drawtext example. It looks better this way. 2018-03-18 15:39:44 -04:00
Pietro Gagliardi a0d2d6a1f8 Added alignment to the drawtext example. 2018-03-18 15:30:50 -04:00
Pietro Gagliardi 8944a3fc55 Finally documented the remaining functions in ui_attrstr.h. 2018-03-18 15:11:03 -04:00
Pietro Gagliardi 9aea7fa62e Polished up the drawtext demo a bit (such as finally fixing that titlebar). Also more crash-related TODOs. 2018-03-18 11:24:09 -04:00
Pietro Gagliardi bc895d6707 And added the necessary functions on OS X. Now to do some final cleanup before merging back in (at long last). 2018-03-17 23:55:33 -04:00
Pietro Gagliardi 0125e33720 Made the likewise changes on Unix. 2018-03-17 23:42:54 -04:00
Pietro Gagliardi 93f0eea140 Likewise codified uiprivStricmp(). Honestly this will probably do for the Windows code for now... 2018-03-17 23:22:17 -04:00
Pietro Gagliardi 8709838a8f Added a uiFreeFontButtonFont() function to free resources allocated by uiFontButtonFont(), implemented it on Windows, and integrated it into the drawtext example. I'm going to continue chipping away at the Windows code for a bit longer, so I'll add this to the other platforms later. 2018-03-17 23:07:40 -04:00
Pietro Gagliardi 78e0684435 Cleaned up memory management in windows attrstr.cpp; also got rid of the logHRESULT(HELP) I was using in case DirectWrite doesn't return NULL+S_OK on a nonexistent drawing effect (thankfully it does). 2018-03-17 21:26:34 -04:00
Pietro Gagliardi 70321353a1 Moved a few more future files out of the way. 2018-03-17 21:06:45 -04:00
Pietro Gagliardi fa293717af Removed the NumLines and LineByteRange functions for now; I'll count them under extents. 2018-03-17 21:05:05 -04:00
Pietro Gagliardi d358e87583 Moved the old metrics attrstr code out of the way. 2018-03-17 21:00:11 -04:00
Pietro Gagliardi 5d116d87fe Fixed a typo in the drawtext example and made it redraw immediately on a font change. 2018-03-17 16:14:50 -04:00
Pietro Gagliardi 45d11962b1 Turns out there was only one real runtime bug (a bad castee). It works! Now to clean up. 2018-03-17 16:10:11 -04:00
Pietro Gagliardi a5bbc83359 Fixed build errors. Now to test. 2018-03-17 15:49:00 -04:00
Pietro Gagliardi 2f02836181 Fixed attrstr.cpp. Wow, that unordered_map custom hash and equal_to actually compiles! 2018-03-17 15:29:06 -04:00
Pietro Gagliardi 51952b4599 And fixed the CMakeLists.txt. Now to build. 2018-03-17 14:50:10 -04:00
Pietro Gagliardi cdaf49ec30 And quick and dirty migration of fontdialog.cpp back. Okay, after fixing the CMakeLists.txt, let's see how bad this is. 2018-03-17 14:47:20 -04:00
Pietro Gagliardi e08460adc3 Cleanup from the previous commit. 2018-03-17 14:45:45 -04:00
Pietro Gagliardi 8352cd72b8 "Migrated" dwrite.cpp back. Not much to say here; it'll do for now. 2018-03-17 14:44:38 -04:00
Pietro Gagliardi 1d1b6c3162 Migrated fontbutton.cpp back. 2018-03-16 20:06:23 -04:00
Pietro Gagliardi 1b1d609c88 More migrations of attrstr.cpp and drawtext.cpp. My this is a mess :D 2018-03-14 21:08:19 -04:00
Pietro Gagliardi 5314295e4c Started migrating drawtext.cpp. This is a bigger mess than I was hoping for... 2018-03-13 22:56:30 -04:00
Pietro Gagliardi 5282951681 Oops, self -> this. 2018-03-13 22:06:33 -04:00
Pietro Gagliardi f25b8dce37 Finished migrating attrstr.cpp. 2018-03-13 22:01:15 -04:00
Pietro Gagliardi 12e97a1b29 Started migrating attrstr.cpp, using the same techniques as attrstr.m. 2018-03-13 18:43:32 -04:00
Pietro Gagliardi abc6fd2825 uiDrawFontDescriptor -> uiFontDescriptor. 2018-03-11 22:36:31 -04:00
Pietro Gagliardi 86264d32a0 And migrated the IDWriteFont -> uiFontDescriptor code. 2018-03-11 22:17:16 -04:00
Pietro Gagliardi 1f61fb30de Wrote a fontmatch.cpp. 2018-03-11 22:11:19 -04:00
Pietro Gagliardi 6c95ce849a Migrated graphemes.cpp and opentype.cpp back. 2018-03-11 21:17:39 -04:00
Pietro Gagliardi e020ba465a Moved the old Windows text code out of the way. 2018-03-11 21:04:38 -04:00
Pietro Gagliardi bffe311afe Switched to using Pango background color attributes. Unix code done for now. 2018-03-11 20:23:18 -04:00
Pietro Gagliardi 602060a673 Fixed build errors, some of which were overisghts and others were habits from the OS X code. 2018-03-11 19:59:11 -04:00
Pietro Gagliardi 697c926c92 And migrated fontmatch.c back. Let's test. 2018-03-11 19:37:30 -04:00
Pietro Gagliardi 5939c3203d Created a new file for the font matching code. 2018-03-11 19:32:08 -04:00
Pietro Gagliardi 24d2220fe5 Migrated drawtext.c. 2018-03-11 18:12:15 -04:00
Pietro Gagliardi 7dc5c6d940 Migrated attrstr.c back. 2018-03-11 17:36:22 -04:00
Pietro Gagliardi 1cce6dc704 Migrated opentype.c and graphemes.c back. 2018-03-11 16:15:28 -04:00
Pietro Gagliardi 008be9b6d8 Began migrating the Unix draw text code by moving the existing files out of the way. 2018-03-11 15:55:28 -04:00
Pietro Gagliardi acbe7c3149 Implemented uiAttributeTypeBackground for OS X 10.12 and newer using the attribute included with Core Text. Also laid out a non-block-based API for drawing backgrounds on older versions of OS X (not implemented here yet, however; that will require bringing back the old metrics code). 2018-03-11 03:30:02 -04:00
Pietro Gagliardi 6ba2d3606d Removed uiprivStrdup() (we'll just uiprivAlloc()+strcpy() instead) and fleshed out the drawtext example's text a bit more. 2018-03-10 22:51:39 -05:00
Pietro Gagliardi 6643a148e0 More TODOs. 2018-03-10 22:18:48 -05:00
Pietro Gagliardi 5ef04f2675 And fixed the other issue: didn't fully set uiDrawTextLayoutParams. Oops =P It works! Also did proper memory management before uiUninit()... but it's crashing for other reasons now (using strdup() instead of uiAlloc()). And Skia doesn't map correctly... 2018-03-10 22:16:43 -05:00
Pietro Gagliardi b15f88412b Fixed the infinite loop: end is exclusive, and my code was correct in handling that, so <= (which i though was needed there because I thought the code wouldn't handle it) is wrong. Now for a segfault. 2018-03-10 22:04:07 -05:00
Pietro Gagliardi 1fae3eea02 And wrote a new, simpler drawtext example. Now to debug run-time issues in the new attributed string code! First up: some infinite loop. 2018-03-10 21:57:45 -05:00
Pietro Gagliardi 427e013d78 And moved the OpenType example out of the way too. 2018-03-10 19:42:50 -05:00
Pietro Gagliardi 8fda407183 Moved the old drawtext example out of the way. 2018-03-10 19:24:20 -05:00
Pietro Gagliardi 4bb6a56c99 More warning fixes. Made private uiAttributeString functions const-correct to expose more potential issues later. Const-correctness and uiAttributeRetain() are going to be an issue... 2018-03-10 19:21:39 -05:00
Pietro Gagliardi 115a60c950 uiAttribute copies family names, so its internal copy doesn't need to be const. Fix this. 2018-03-10 19:13:20 -05:00
Pietro Gagliardi 9194ba29fe And fixed build errors. Now I'm sure there are warnings that are real bugs, so let's handle those next. 2018-03-10 19:02:10 -05:00
Pietro Gagliardi c82197f408 And fixed other compile errors. Of course I forgot to add uiFontButton back in (I wanted to properly comment that first :/ ). Now for linker errors, which may result in some warning fixes along the way. 2018-03-09 18:01:23 -05:00
Pietro Gagliardi 82d3de7c31 More compiler error fixes. Oops, I forgot to finish attrstr.m! 2018-03-08 23:27:04 -05:00
Pietro Gagliardi e9a62461c2 Started fixing compile errors. I forgot I renamed uiDrawFontDescriptor to uiFontDescriptor! 2018-03-08 23:04:45 -05:00
Pietro Gagliardi 9661d14262 And fixed up loose ends preventing a build. Let's build! 2018-03-08 22:44:35 -05:00
Pietro Gagliardi 5535c43bd8 And finished up drawtext.m for now. 2018-03-08 22:38:53 -05:00
Pietro Gagliardi 7451d455e5 Started a new drawtext.m with a different way to handle the empty-string crash problem. 2018-03-07 23:53:36 -05:00
Pietro Gagliardi bf58601ff8 More TODOs. 2018-03-05 23:16:43 -05:00
Pietro Gagliardi 00749b07ac And cleaned up all the font handling stuff in attrstr.m. A lot cleaner now! Not fully clean, but clean*er*, and probably more efficient, too... 2018-03-05 23:15:31 -05:00
Pietro Gagliardi 93c375fd94 Implemented -[uiprivCombinedFontAttr hash]. 2018-03-05 08:59:45 -05:00
Pietro Gagliardi 9e57c78fb3 Started really refactoring attrstr.m by turning uiprivCombinedFontAttr into an actual attribute that CFAttributedString will manage itself; it will store uiAttributes (so we can use uiprivAttributeEqual() instead of duplicating its logic). Later, we will make it convert to CTFontRefs in place. 2018-03-04 23:57:18 -05:00
Pietro Gagliardi 49c3f77d46 Started cleaning up attrstr.m. This is gonna be fun... 2018-03-04 20:45:05 -05:00
Pietro Gagliardi 232b14ccde Migrated attrstr.m. This file needs to be cleaned up... 2018-03-04 20:01:52 -05:00
Pietro Gagliardi 1fc9f137bc Migrated fontbutton.m back. 2018-03-04 19:51:45 -05:00
Pietro Gagliardi 0b3176cead Migrated the font matchng stuff on OS X. 2018-03-04 18:01:08 -05:00
Pietro Gagliardi d8ad3300c9 Migrated aat.m back. 2018-03-04 15:53:46 -05:00
Pietro Gagliardi 36567cc522 Migrated OS X graphemes.m. 2018-03-04 15:48:45 -05:00
Pietro Gagliardi 7fd012418d Migrated (and cleaned up) OS X opentype.m. 2018-03-04 15:09:27 -05:00
Pietro Gagliardi 036c7c12e6 Updated CONTRIBUTING.md and moved the old OS X draw text stuff out of the way. 2018-03-04 13:52:33 -05:00
Pietro Gagliardi 32041a2ecc More TODOs. 2018-03-04 11:25:06 -05:00
Pietro Gagliardi 9c8f6849c3 Synced const-correctness in ui_attrstr.h to attrstr.c, propagated that to the necessary private functions, and added some references to testing.h. 2018-03-04 11:15:18 -05:00
Pietro Gagliardi 77c07075e3 Updated grapheme function names in attrsr.h and updated allocator function names in attrstr.c. 2018-03-04 10:46:00 -05:00
Pietro Gagliardi f025783632 Migrated attrstr.c back like we just did to attrlist.c. RIP "graphemes()" 2018-03-03 22:02:18 -05:00
Pietro Gagliardi 766f3a0cb2 Moved the unit tests out of the way for now. We'll fill them in later. 2018-03-03 21:35:29 -05:00
Pietro Gagliardi 3337f06e2e Oops. 2018-03-03 21:32:18 -05:00
Pietro Gagliardi dcf6726239 More TODOs. 2018-03-03 21:29:45 -05:00
Pietro Gagliardi 2822dbcebc Decided to keep the existing attrlist.c, but updated it to the new attribute API and uipriv naming convention. Also resolved some TODOs along the way and decided that when in attribute lists, uiAttributes will be refcounted. 2018-03-03 21:27:01 -05:00
Pietro Gagliardi 4179ff86c2 Added more test cases. Also more TODOs in testing_testing.c. 2018-03-03 17:01:40 -05:00
Pietro Gagliardi 6c29932efe Added testingTDefer(). Now we can actually write the rest of these tests. 2018-03-03 16:24:10 -05:00
Pietro Gagliardi 70db51d23b Added testingTFail() and simplified the implementation of the logging macros. 2018-03-03 14:22:34 -05:00
Pietro Gagliardi b5570040b0 Added skipping and fatal to testing.h. 2018-03-03 14:08:17 -05:00
Pietro Gagliardi d0db6f9594 Added early termination mechanics to the testing framework. 2018-03-01 20:25:36 -05:00
Pietro Gagliardi 8d92003426 Broke apart the testing implementation code into their own files. 2018-02-28 22:07:06 -05:00
Pietro Gagliardi 010e878286 Wrote more of the testing framework, wrote the first test, and fixed compiler errors in opentype.c. 2018-02-28 19:43:29 -05:00
Pietro Gagliardi cf15dba2ef Oops, missed a spot when cleaning up the previous commit. Fixed. 2018-02-28 01:22:16 -05:00
Pietro Gagliardi 5ab1266b5d Finished the boilerplate for the uiOpenTypeFeatures test. 2018-02-28 01:21:10 -05:00
Pietro Gagliardi 70815d8d7b Started writing a test suite for uiOpenTypeFeatures. So far it's just the test boilerplate. 2018-02-27 23:44:50 -05:00
Pietro Gagliardi 3f62cb5cee Oops; forgot to update attrstr.h in the last commit. Also changed a TODO to a LONGTERM in opentype.c. 2018-02-25 20:40:23 -05:00
Pietro Gagliardi dcaf69bc51 Added a single cross-platform implementation of uiOpenTypeFeatures. 2018-02-25 20:38:06 -05:00
Pietro Gagliardi 886f1dbc4c Merge branch 'master' into utflib-and-attrstr 2018-02-23 07:29:57 -05:00
Pietro Gagliardi 20a94937b3 More TODOs. 2018-02-22 20:58:40 -05:00
Pietro Gagliardi 7891cd81c2
Merge pull request #276 from ForsakenHarmony/patch-1
Correct readme travis badge
2018-02-22 07:46:57 -05:00
Pietro Gagliardi 8b35d16144 More notes. Also fixed a typo (thanks Nicole from Jul). 2018-02-20 21:05:08 -05:00
Pietro Gagliardi 93bf0d403e Wrote the new uiAttribute code in attribute.c. 2018-02-19 18:37:50 -05:00
Pietro Gagliardi eeb7717d88 Moved old attributed-string stuff out of the way for now. 2018-02-19 01:52:38 -05:00
Pietro Gagliardi 6a737ba48e Flipped old and new ui_attrstr.h. 2018-02-19 01:46:16 -05:00
Pietro Gagliardi ec8952a8e8 More work on new_ui_attrstr.h. Almost finished with this, actually... 2018-02-18 22:02:42 -05:00
Pietro Gagliardi e768293b54 Merge branch 'master' into utflib-and-attrstr 2018-02-17 22:30:01 -05:00
Pietro Gagliardi a245ced3dc One last overdue README update before the package. Alpha 3.5. 2018-02-17 21:26:12 -05:00
Pietro Gagliardi 77ba614948 asdf. 2018-02-17 16:44:52 -05:00
Pietro Gagliardi dd54b3da93 And updated the README. Now to pull out a release. 2018-02-17 12:59:31 -05:00
Pietro Gagliardi 6c85f39584 Improved the comment in the previous commit. 2018-02-17 12:56:47 -05:00
Alexander Neumann ee87a9db23 Fix enter/escape crashes on Windows (#202)
* Do not let slip through IDOK and IDCANCEL as menu events, fixes #55

* Add comment about IDOK and IDCANCEL
2018-02-17 12:53:32 -05:00
Pietro Gagliardi 17f1499246 Some cleanup of the top-level directory. 2018-02-17 11:10:37 -05:00
Pietro Gagliardi a74923d574 Finally decided to add that httext file; gzipped to avoid git mangling it. 2018-02-17 11:04:02 -05:00
Pietro Gagliardi 686458cdb7 Added notes stuff. The TODO.md file will eventually wind up moving there. 2018-02-17 11:01:50 -05:00
Pietro Gagliardi cbc78248e7 More attrstr API finalization work, 2017-12-13 23:41:49 -08:00
Pietro Gagliardi 84756ab0ec Finished setting up the new uiAttribute format. 2017-12-10 19:22:49 -05:00
Pietro Gagliardi 4b7ca92ce7 Decided what to do about attributes. 2017-12-09 23:47:50 -05:00
Pietro Gagliardi bad2325323 More attributed string API work. Of note, decided to make each type of attribute have its own field in uiAttributeSpec, to make thinking about what to do next easier (and because why not). 2017-11-06 23:58:35 -05:00
Pietro Gagliardi e33879a283 Okay, I need to rethink these APIs. Let's start doing so. Then I should also write a testsuite for uiAttributedString. 2017-11-05 22:52:14 -05:00
Pietro Gagliardi 1f33ca14d8 Fixed Windows build issues and resolved a question in libui that I need to enshrine in documentation next. 2017-11-04 21:44:28 -04:00
Pietro Gagliardi ca5a5f1f72 More TODOs. I have to really think about this API and build a point-by-point test... 2017-11-04 20:47:09 -04:00
Pietro Gagliardi d44c20c4a1 Stashed diffs for fixing empty text layouts on OS X; the code is now utterly complicated AND my memory of what I did so far on this branch is starting to fail. 2017-11-04 16:48:02 -04:00
Pietro Gagliardi 243e210cbc Resolved some darwin/drawtext.m TODOs. 2017-11-04 11:52:33 -04:00
Pietro Gagliardi 84d49cd45b Decided to keep the minimum and maximum weights as 0 and 1000. 2017-11-04 11:18:25 -04:00
Pietro Gagliardi 67a7b64f56 More TODOs. 2017-11-04 02:52:12 -04:00
Pietro Gagliardi 6869f28718 Fixed fixed-point math issues. fvar tables now work fine, which means Skia finally works! 2017-11-04 02:44:38 -04:00
Pietro Gagliardi ad34745327 Fixed loading of undocumented symbols. Now we're making progress! And what's more, fvar support is working! But not perfectly — everything seems to be hitting extremes... 2017-11-03 21:55:43 -04:00
Pietro Gagliardi e0b584082d Reintegrated everything and fixed more compiler errors. Now we have to deal with linker errors, and then with testing to see if everything worked... 2017-11-03 20:59:27 -04:00
Pietro Gagliardi 2276a136cb And tied everything together. Now we move everything back and test. 2017-11-03 20:33:08 -04:00
Pietro Gagliardi 8333063cc0 And implemented fontvariation.m. 2017-11-03 19:52:49 -04:00
Pietro Gagliardi 72d31285c1 Migrated fonttraits.m to use the new fontStyleData class. 2017-11-03 18:52:15 -04:00
Pietro Gagliardi 51f0e3dbe5 Folded all CFNumber accesses into [self prepare] for error checking. This shouldn't make things *significantly* slower... 2017-11-03 18:41:13 -04:00
Pietro Gagliardi 4e7fb5e264 Added code that handles all the attribute stuff for a CTFontRef AND CTFontDescriptorRef for us; we'll use this throughout the various font style files instead of doing everything ourselves. 2017-11-03 15:51:21 -04:00
Pietro Gagliardi be6a07755b Described what each of the three .m files are going to do. 2017-11-02 21:51:00 -04:00
Pietro Gagliardi 57a6ea0a77 Moved fontmatch.m alongside the other font files as we prepare to combine everything. 2017-11-02 21:10:38 -04:00
Pietro Gagliardi f2971f637f Added fvar axis identifiers. 2017-11-02 19:33:41 -04:00
Pietro Gagliardi b7e6311621 Started writing the code for processing font variations for Core Text so we can process Skia correctly. 2017-11-02 19:27:57 -04:00
Pietro Gagliardi 2e5f2c273b More fvar.swift stuff. I'm going to need a font with an avar table... 2017-11-02 10:39:43 -04:00
Pietro Gagliardi 830753d888 More fvar.swift stuff. This is gonna hurt... 2017-11-02 03:17:33 -04:00
Pietro Gagliardi 03b089c972 Added a fvar table test. This might be a bit more complicated... 2017-11-02 02:46:16 -04:00
Pietro Gagliardi 6b295b2d3f And fixed a comment placeholder (and typo) and reformatted it slightly. 2017-11-01 20:23:52 -04:00
Pietro Gagliardi a7bbbc8bb9 Changed a slight thing in fonttraits.m. 2017-11-01 20:20:12 -04:00
Pietro Gagliardi 3108f65b39 Wrote the initial version of the final code for converting Core Text traits into libui traits. 2017-11-01 20:14:44 -04:00
Pietro Gagliardi 2481610ee4 And made a similar ctwidthscombined to the previous commit's ctweightscombined. Now I can start thinking about implementation. 2017-11-01 13:34:54 -04:00
Pietro Gagliardi b769b81639 Added an aggregation of Core Text weight values for my own thinking and planning. 2017-10-31 23:50:05 -04:00
Pietro Gagliardi 0a1b5ff6a8 Oops, accidentally chopped off a hex digit from one of the ctweights values. Fixed (manually). 2017-10-31 22:48:02 -04:00
Pietro Gagliardi 48594e3cd1 More TODOs. 2017-10-26 11:44:29 -04:00
Pietro Gagliardi 78bfc62399 Oops; generated weights instead of widths. 2017-10-22 10:06:28 -04:00
Pietro Gagliardi 1673156fd6 And the last bits for widths. 2017-10-22 01:31:26 -04:00
Pietro Gagliardi 1851fc8045 Added code to print the unregistered OS2 width values using the real instructions and constants used by Core Text. 2017-10-22 01:27:57 -04:00
Pietro Gagliardi e2369df648 More width stuff. 2017-10-21 23:55:03 -04:00
Pietro Gagliardi e186c0e69a Mapped out Core Text width value deduction. Will need to do the other files for this one too. 2017-10-21 22:43:43 -04:00
Pietro Gagliardi b2b5bc36b1 And annotated the ctweights list. 2017-10-21 12:45:15 -04:00
Pietro Gagliardi e5e0dca360 And processed the weights list. 2017-10-21 12:33:38 -04:00
Pietro Gagliardi e3deebaa1d And sorted out the weights. Now to determine what is and isn't sane. 2017-10-21 12:22:50 -04:00
Pietro Gagliardi 3b316ddb5b Sorted all the possible Core Text weight values into lists. Now to process those lists. 2017-10-21 12:07:07 -04:00
Pietro Gagliardi 2858c56528 CGFontCopyName() is too intricate to recreate. We might have to wind up calling it directly... 2017-10-21 02:54:39 -04:00
Pietro Gagliardi 9b28bd5ecd More name table work. 2017-10-20 14:14:32 -04:00
Pietro Gagliardi 9731d2e836 More work on ctweights. 2017-10-19 23:54:46 -04:00
Pietro Gagliardi f94de2eef8 And finally finished the core Core Text weight determination functionality pseudo-Go-code. God damn. And I have a funny feeling stretches are going to be a tad bit more inconsistent too... :| Not quite complete, though; need to fill in the name table parsing rules first. 2017-10-19 19:15:46 -04:00
Pietro Gagliardi 683bd47491 More ctweights stuff. 2017-10-19 00:01:14 -04:00
Pietro Gagliardi 9f1e1b25be Started converting the code in Core Text itself that determines what weight a font has into pseudocode. 2017-10-17 23:40:07 -04:00
Pietro Gagliardi 4d57a12dbc More general TODOs... I'm starting to feel like I'm over my head with text stuff, and stopping for those few months has made me forget what I wanted to do :| or maybe forget the specifics, I'm not sure what. All I know is that I accumulated more TODOs specific to this branch than I thought and now I'm just :S 2017-10-09 20:49:22 -04:00
Pietro Gagliardi eab8a98aa9 More TODOs. 2017-10-08 17:05:16 -04:00
Pietro Gagliardi 98e06716b6 More TODOs. 2017-10-08 14:42:15 -04:00
Pietro Gagliardi 55a97093f5 Removed a stale TODO. 2017-09-29 09:58:43 -04:00
Pietro Gagliardi e597d8ce3b More TODOs. 2017-09-27 14:24:07 -04:00
Pietro Gagliardi cb5f9b3c9c More TODOs. 2017-09-26 18:54:23 -04:00
Pietro Gagliardi c8c51502cb More TODOs. 2017-09-19 22:22:04 -04:00
Pietro Gagliardi 7b89fb21a1 More TODOs. 2017-09-17 21:03:41 -04:00
Pietro Gagliardi 21c99859e4 More TODOs. 2017-09-17 15:33:46 -04:00
Pietro Gagliardi 2702f4f874 More TODOs. 2017-09-03 16:14:58 -04:00
Pietro Gagliardi b98888a628 More TODOs. 2017-08-20 05:30:36 -04:00
Ashley 40bc1505ce Update README.md 2017-07-24 02:21:18 +02:00
Pietro Gagliardi 2bea99116d More TODOs. 2017-06-20 19:54:35 -04:00
Pietro Gagliardi 271a3bc022 More TODOs. 2017-06-19 23:34:59 -04:00
Pietro Gagliardi 180b6429ef More documentation, const correctness, and TODO wrangling. 2017-06-19 22:00:46 -04:00
Pietro Gagliardi 5d7128781b And const-corrected uiAttributedStringForEachAttribute(). 2017-06-19 21:45:18 -04:00
Pietro Gagliardi 3e20e4670c Made a decision on const correctness in uiOpenTypeFeatures. 2017-06-19 14:50:03 -04:00
Pietro Gagliardi e6ee2b0dbd Some TODO elminiation (for once). One TODO got reshuffled. 2017-06-18 20:10:42 -04:00
Pietro Gagliardi 4610a5a363 More TODOs. 2017-06-18 11:19:24 -04:00
Pietro Gagliardi cc8a412687 More TODOs. 2017-06-17 17:15:32 -04:00
Pietro Gagliardi fd7c436b8a More TODOs. 2017-06-14 22:07:41 -04:00
Pietro Gagliardi 6b989f80ca More TODOs. 2017-06-13 21:17:44 -04:00
Pietro Gagliardi c3568d5162 More TODOs. 2017-06-12 23:42:45 -04:00
Pietro Gagliardi c8f4ccc712 Did a patch for OS X. Fixing grid is gonna be FUN. 2017-06-11 12:21:49 -04:00
Pietro Gagliardi 85c39c6cb3 Connected events in the opentype example. 2017-06-11 00:37:26 -04:00
Pietro Gagliardi 8728dcb5c0 Started a new example for showing off OpenType features. This just lays out the UI and draws the string. 2017-06-10 23:33:25 -04:00
Pietro Gagliardi 39530a0a2e Another quick CONTRIBUTING fix. 2017-06-10 17:08:10 -04:00
Pietro Gagliardi 0c7ca9a346 Quick contributtion fixups. 2017-06-10 17:03:29 -04:00
Pietro Gagliardi fcbf706559 More README fixups. 2017-06-10 16:58:18 -04:00
Pietro Gagliardi 99e65d49a7 Added some real contribution guidelines. 2017-06-10 16:56:17 -04:00
Pietro Gagliardi f0813ac6e4 More stuff. I should probably write that OpenType features test now. 2017-06-10 03:37:17 -04:00
Pietro Gagliardi d63a5b23b1 Handled uiOpenTypeFeatures NULL equality. This only added more TODOs elsewhere :| 2017-06-09 19:59:48 -04:00
Pietro Gagliardi b73721905f Meh. 2017-06-09 19:43:55 -04:00
Pietro Gagliardi cde1a201f4 Expanded documentation in ui_attrstr.h in an attempt to reduce TODOs. Instead, I added more. :D 2017-06-08 15:31:28 -04:00
Pietro Gagliardi 20239df6f2 Some TODO resolution via documentation writing. 2017-06-08 00:59:17 -04:00
Pietro Gagliardi 39a8d1a07e More TODOs. 2017-06-07 15:58:11 -04:00
Pietro Gagliardi dbb17e441d Comments related to above. 2017-06-06 16:20:58 -04:00
Pietro Gagliardi ef3ed04e2d More hacking to fix visibility issues on GTK+. This is a mess. 2017-06-06 16:19:08 -04:00
Pietro Gagliardi ddf91df764 More cmake TODOs. 2017-06-06 15:32:51 -04:00
Pietro Gagliardi b3e3b27f71 Some more TODO cleanup and name adjustment. 2017-06-06 14:14:33 -04:00
Pietro Gagliardi a415a846f7 Some comment fixups. 2017-06-06 13:46:54 -04:00
Pietro Gagliardi 8e8cc12105 Added uiForEach for canonicalizing foreach function returns and used it everywhere. 2017-06-06 12:47:07 -04:00
Pietro Gagliardi ba2e9154f7 Some notes and failed bugfixes on NSProgressIndicators in tables. 2017-06-03 17:59:50 -04:00
Pietro Gagliardi 8c850a26b2 More TODOs. 2017-06-03 17:53:10 -04:00
Pietro Gagliardi aa455be1ae Sigh, cmake... 2017-06-03 00:33:40 -04:00
Pietro Gagliardi 18d67a016c Started work on OS X 10.12 API stupids. 2017-06-02 23:57:40 -04:00
Pietro Gagliardi 96d06121c8 And finally used OpenType features directly on supported OS X versions. 2017-06-01 10:57:34 -04:00
Pietro Gagliardi 8cacd0ba03 Quick fixup. 2017-05-31 22:25:10 -04:00
Pietro Gagliardi 933a8f592a And cleaned up the Windows drawing effect code like we did yesterday. 2017-05-31 22:24:34 -04:00
Pietro Gagliardi 2118259769 Set up text effect stuff. 2017-05-31 20:33:40 -04:00
Pietro Gagliardi 98459d2878 Dropped the redundant features collection stuff on Windows like we did on OS X and GTK+ yesterday. That just leaves all the drawing effects, which we have to collect in a different way (like we did on OS X). 2017-05-31 18:45:11 -04:00
Pietro Gagliardi b47431cd7c More TODOs. 2017-05-30 22:57:38 -04:00
Pietro Gagliardi 1e31ef24c6 Minor code cleanup. Not sure what to do next... 2017-05-30 22:22:56 -04:00
Pietro Gagliardi 1d40ab659c More TODOs. 2017-05-30 19:07:59 -04:00
Pietro Gagliardi 2e98219009 And fixed the whole OpenType features nonsense on GTK+, since we now group all OpenType features together. We're now much closer to pushing this back into master! 2017-05-30 19:07:01 -04:00
Pietro Gagliardi c61bbfe5c8 Updated the GTK+ code to the newest changes. I *do* need to fix this one. 2017-05-30 18:46:30 -04:00
Pietro Gagliardi 81a82723d0 Fixed the Windows code to run after the recent changes. Now to decide whether to clean it up like we did the OS X code... 2017-05-30 16:57:25 -04:00
Pietro Gagliardi 01df4631f6 And finished integrating the new attributed string stuff on OS X. 2017-05-30 15:24:31 -04:00
Pietro Gagliardi 06becce34c And finished the font attribute rewrite on OS X. Now to test. 2017-05-30 14:38:25 -04:00
Pietro Gagliardi 91bfceaf71 And FINALLY cleaned up all the AAT nonsense. Much saner now. 2017-05-30 14:00:58 -04:00
Pietro Gagliardi c4dd85bece More reworking the OS X attributed string code. Now we need to rework the AAT code somewhat too. 2017-05-30 13:18:13 -04:00
Pietro Gagliardi e356f1c48a Started reworking darwin/attrstr.m to be a lot more sane. 2017-05-30 13:06:58 -04:00
Pietro Gagliardi 1733c28b52 Added consts to the OpenType implementations. 2017-05-30 09:52:38 -04:00
Pietro Gagliardi d979f7a93e Updated a stale comment. 2017-05-28 21:55:10 -04:00
Pietro Gagliardi 02020e676a Managed attribute spec memory properly. 2017-05-28 00:41:40 -04:00
Pietro Gagliardi 475ae4a4bf Started making attribute manipulation better. In a sense. Pointers will be represented properly, and in a const-safe way. We'll need to make local copies of everything, of course. 2017-05-28 00:19:49 -04:00
Pietro Gagliardi 57873bae72 Stuff. 2017-05-27 18:19:08 -04:00
Pietro Gagliardi a17985b4cd Some big TODOs I didn't realize until now. 2017-05-19 20:46:56 -04:00
Pietro Gagliardi fb884abc41 Fixed memory issues with future.m. 2017-05-19 16:58:15 -04:00
Pietro Gagliardi dd54469677 Set up a future system for OS X like we have on GTK+ and moved everything we already have to it. You'll notice we also set up a loader for what we're going to use this for: using OpenType attributes directly on OS X. 2017-05-19 16:40:52 -04:00
Pietro Gagliardi 90962e18c4 And got rid of the remaining old stuff entirely. 2017-05-19 16:14:39 -04:00
Pietro Gagliardi bd39189a0e Fixed the build and an unspotted error in the drawtext example. 2017-05-19 16:10:54 -04:00
Pietro Gagliardi b7d34bf4f5 And tied everyhting together, sort of. 2017-05-19 15:48:15 -04:00
Pietro Gagliardi 1a2dd1f16b Converted darwin/aat.m to the new OpenType system. We can't use the code as-is just yet, though. 2017-05-19 15:14:41 -04:00
Pietro Gagliardi 72f5b680f2 Filled in darwin/opentype.m. 2017-05-19 14:12:04 -04:00
Pietro Gagliardi 39cec570d9 And implemented the new features stuff on the GTK+ side. 2017-05-17 23:37:16 -04:00
Pietro Gagliardi ff4ab7110c Filled in GTK+ opentype.c. This is gonna suck as much as it does now... 2017-05-17 22:56:55 -04:00
Pietro Gagliardi 4f427b2121 And ported the drawtext example to use the new features system. 2017-05-17 21:41:08 -04:00
Pietro Gagliardi 3e28887a24 Fixed the build. 2017-05-17 19:21:27 -04:00
Pietro Gagliardi 4f31a1331c And omitted the common OpenType stuff from the build. 2017-05-17 16:18:28 -04:00
Pietro Gagliardi 2f73df09e3 And adjusted the Windows attrstr.cpp to boot. Now to rewrite the example and test. 2017-05-17 16:15:54 -04:00
Pietro Gagliardi 4e6ccc05f1 Implemented the new opentype.cpp on Windows. 2017-05-17 15:57:39 -04:00
Pietro Gagliardi 676dfb87f2 Started the uiOpenTypeFeatures implementationss, filling in holes in the API. 2017-05-11 10:27:34 -04:00
Pietro Gagliardi a0454a6b43 Started dropping the whole features system in favor of a homogenous OpenType feature attribute just like every other API. Will make some things easier, hopefully... 2017-05-07 10:30:08 -04:00
Pietro Gagliardi df2a726c1b And fixed on Windows too. We're good. 2017-02-25 01:24:43 -05:00
Pietro Gagliardi 70940e5c06 More TODOs. 2017-02-24 21:43:37 -05:00
Pietro Gagliardi 3d5fbc0880 Checked empty strings on Pango. 2017-02-24 21:42:40 -05:00
Pietro Gagliardi c4400b83f3 Okay, notes on linelessness on OS X. 2017-02-24 21:24:52 -05:00
Pietro Gagliardi 58fff53f61 More TODOs... 2017-02-24 21:18:15 -05:00
Pietro Gagliardi 5234586ead Added a test for making uiDrawTextLayouts on empty strings. We're already off to a good start since we have a ~0 error on OS X... 2017-02-24 18:54:35 -05:00
Pietro Gagliardi 5fe4e27c5d TODO cleanup and stale TODO removal. That nLines == 0 TODO needs more testing... 2017-02-24 18:46:53 -05:00
Pietro Gagliardi 28b30367e2 Still more TODO resolution. 2017-02-24 18:19:34 -05:00
Pietro Gagliardi cca4db5ce9 More TODO resolution and pointless TODO elimination. 2017-02-24 18:15:20 -05:00
Pietro Gagliardi f6e9da916a Fixed Unix cursor positioning. 2017-02-24 14:25:16 -05:00
Pietro Gagliardi ce1a54a9d1 More documentation works. 2017-02-24 12:39:29 -05:00
Pietro Gagliardi 0db03e5f44 More TODO and documentation cleanup, including removing redundant or now-pointless TODOs. 2017-02-24 12:27:44 -05:00
Pietro Gagliardi 0df8346bff Also removed uiAttributeLangauge for compatibility reasons too. Let's settle all the TODOs now. 2017-02-24 12:12:03 -05:00
Pietro Gagliardi 074350bf99 Removed the TODOs from uiAttributes for attributes we don't yet support. That'll all come later. 2017-02-24 11:49:32 -05:00
Pietro Gagliardi f65fc1f25e Fixed text hit-testing on OS X. 2017-02-24 10:29:08 -05:00
Pietro Gagliardi be56ec3626 Removed the vertical forms attribute. This is a compatiblity nightmare. 2017-02-24 01:23:47 -05:00
Pietro Gagliardi e5f3646fcf Attempts to align the vertical glyphs with the orizontal baseline on OS X with Core Text. This is gonna be harder... 2017-02-23 21:37:41 -05:00
Pietro Gagliardi 0f2b2b1fe5 Fixed background drawing on Windows. 2017-02-22 21:46:15 -05:00
Pietro Gagliardi f2b158b529 And finished implementing attributes on Windows. 2017-02-22 19:13:36 -05:00
Pietro Gagliardi b42250e3a9 More text attributes on Windows, including the beginning of drawing effects for colors and underlines. 2017-02-22 15:19:11 -05:00
Pietro Gagliardi fb04feaebb Started Windows attribute handling. 2017-02-22 12:49:55 -05:00
Pietro Gagliardi ae8105c234 Added debugging to our custom IDWriteTextRenderer. 2017-02-22 11:23:26 -05:00
Pietro Gagliardi 9cc8b03516 Switched to a custom IDWriteTextRenderer, which will be necessary for some of our text attributes. More TODO. 2017-02-22 03:43:43 -05:00
Pietro Gagliardi efb7d5b21d More TODOs. 2017-02-21 16:06:29 -05:00
Pietro Gagliardi c111239b0d More TODOs. 2017-02-20 22:25:49 -05:00
Pietro Gagliardi 75c2c80534 And adding the background attributes. We're done with the Pango one! Now for the Windows one... yay. 2017-02-20 22:24:02 -05:00
Pietro Gagliardi 4ba4e4ba23 More attribute implementation. 2017-02-20 20:41:14 -05:00
Pietro Gagliardi 4a1642cea2 Fixed improper breaks in Unix attribute handling. 2017-02-20 19:51:00 -05:00
Pietro Gagliardi d4b38cd3b7 And switched attributes on on GTK+. We have a problem with attributes that span bytes. 2017-02-20 19:28:19 -05:00
Pietro Gagliardi d7a44a5168 Added uiAttribute handling code to the GTK+ backend. Not finished yet; not used yet. 2017-02-20 17:11:52 -05:00
Pietro Gagliardi ea473a3411 Ugh of course I screwed up the malloc() test. Fixed a crash on GTK+ since I guess OS X malloc() autofills to 0? 2017-02-20 15:14:53 -05:00
Pietro Gagliardi 6ae6e91238 Integrated opentype.c into the build. Finally. 2017-02-20 14:59:43 -05:00
Pietro Gagliardi 7920559aa5 More TODOs. 2017-02-20 12:50:00 -05:00
Pietro Gagliardi f65d4592d0 Combined attributes. We're good I guess. 2017-02-20 12:49:20 -05:00
Pietro Gagliardi fbd294c089 Filled in the rest of the typographic features. Now to write the any combination example. 2017-02-20 12:38:39 -05:00
Pietro Gagliardi 025dd16d76 More examples and crash fixes. 2017-02-16 15:02:19 -05:00
Pietro Gagliardi e27e51c4b8 Seemed to fix crashing issues for now. Character insertion is borked :| 2017-02-16 14:25:19 -05:00
Pietro Gagliardi 92b860c8f4 Added Address Sanitizer as a cmake option. This will help us figure out the crash. 2017-02-16 13:00:57 -05:00
Pietro Gagliardi 685e17fc0e More typographical features examples. This crashing thing is getting really annoying. 2017-02-16 12:49:06 -05:00
Pietro Gagliardi 768aba6614 Added test of Unicase. Had to use the Arial that comes with Windows 10, which seems to be the only font file I have out of **everything** that comes with Unicase. :S 2017-02-16 03:05:29 -05:00
Pietro Gagliardi 4262d893bc Fixed the Arabic embeds that demonstrate required ligatures. 2017-02-16 00:13:09 -05:00
Pietro Gagliardi dcc01f5b01 Started putting the typographical features attributes into the example program. 2017-02-15 23:52:16 -05:00
Pietro Gagliardi 3e941d008e Integrated aat.m into the build. 2017-02-15 23:10:23 -05:00
Pietro Gagliardi 1eb2ffaf82 FLIPPED THE SWITCH 2017-02-15 21:30:21 -05:00
Pietro Gagliardi 4f5328ae65 And added the typographical features for AAT. 2017-02-15 21:11:44 -05:00
Pietro Gagliardi ddffce6d44 More work. This is annoying, stupid 10.9. 2017-02-15 19:42:57 -05:00
Pietro Gagliardi 6761c0a9f7 Added the language tag stuff to the example program. More TODOs. 2017-02-15 16:40:04 -05:00
Pietro Gagliardi 669538e9ce Implemented uiAttributeLanguage on OS X. Untested. 2017-02-15 16:22:42 -05:00
Pietro Gagliardi 85fd3b72af More support for uiAttributeLanguage. 2017-02-15 09:44:57 -05:00
Pietro Gagliardi 81b520249b More attribute work. Getting a clearer idea. 2017-02-15 01:34:26 -05:00
Pietro Gagliardi bda35b40bd Filled in Core Text language details. 2017-02-14 23:56:20 -05:00
Pietro Gagliardi da22adac7f More feature list completeness work. 2017-02-14 22:37:01 -05:00
Pietro Gagliardi 16b0ca518e Synced opentype.c to AAT and more TODOs. 2017-02-14 21:18:56 -05:00
Pietro Gagliardi 2ffcd192c0 Wrote the common code (for DirectWrite and Pango) to deal with OpenType features. Now to merge with Core Text's internal AAT-to-OpenType mapping. 2017-02-14 19:00:35 -05:00
Pietro Gagliardi e4b761d611 Defined more of the OpenType attributes. 2017-02-14 17:15:19 -05:00
Pietro Gagliardi 4195bc3b4b Finalized and implemented underlines on OS X. 2017-02-14 14:57:56 -05:00
Pietro Gagliardi eb7dfa5cc4 More attribute work, including trimming unsupported or nonsensical attributes. 2017-02-14 14:21:58 -05:00
Pietro Gagliardi 250cba7c67 Added more potential attributes. 2017-02-14 13:21:47 -05:00
Pietro Gagliardi aa7d1e28ea More TODOs. 2017-02-14 02:55:42 -05:00
Pietro Gagliardi 9c1293736b Prepared the non-feature attributes based on the OS X list. 2017-02-14 02:53:21 -05:00
nopara73 8aa8259250 SharpUI is .NET Core, too. 2017-02-14 16:35:19 +09:00
Pietro Gagliardi fbae38ce2e Started mapping out attributes for typographic features. I FORGOT THE OTHER ATTRIBUTES I NEED TO DO THOSE FIRST. 2017-02-14 02:26:26 -05:00
Pietro Gagliardi e3b1e033b2 More TODOs. 2017-02-13 23:20:38 -05:00
Pietro Gagliardi 35a06e8540 Changed uiAttributeVerticalForms into a boolean. This is how the other features might need to be implemented :/ 2017-02-13 22:42:18 -05:00
Pietro Gagliardi 9a19c65323 Prepared the OS X backend for adding feature attributes. Each feature will be a separate attribute for better composability. 2017-02-13 10:34:25 -05:00
Pietro Gagliardi ff986858f1 Added vertical glyph forms. Next up is the rest of the various font features. 2017-02-13 10:24:12 -05:00
Pietro Gagliardi 1c238bf85b And implemented uiAttributeBackground on OS X. Not sure what else to add besides the feature variants... 2017-02-13 02:10:39 -05:00
Pietro Gagliardi 9eba197fd1 Adjusted the example for backgrounds. Nope brushes isn't gonna work; absolute positioning of gradients is a problem. 2017-02-13 01:44:18 -05:00
Pietro Gagliardi 40c388e01d Whoops, just realized I typo'd. 2017-02-13 01:28:46 -05:00
Pietro Gagliardi b2cd5ef851 Wrote code to draw the background of text. 2017-02-13 01:22:59 -05:00
Pietro Gagliardi 44f24fc900 Added the foreground color attribute. Considering making the background color a background BRUSH attribute instead... 2017-02-12 20:27:47 -05:00
Pietro Gagliardi 261dd4851a Changed the representation of an attribute type/value pair to allow more type safety and expressability. 2017-02-12 14:11:25 -05:00
Pietro Gagliardi 1c1b16a206 More attributes. Beyond this point I'd need to either redefine the way attributes are specified or make more header macros. 2017-02-12 13:41:52 -05:00
Pietro Gagliardi 5aaac84d55 Implemented uiAttributeFamily on OS X. ATTRIBUTES WORK!!! 2017-02-12 01:05:27 -05:00
Pietro Gagliardi 32a0284edc Started work on actual attributed text. This includes the beginnings of an attributed text example. Now to implement. 2017-02-11 23:19:30 -05:00
nopara73 de638f3e76 Add .NET Core bindings 2017-02-12 12:55:43 +09:00
Pietro Gagliardi c4a97792ea And implemented the new stuff on Windows. 2017-02-11 21:54:06 -05:00
Pietro Gagliardi 210c4507ca Implemented uiDrawTextLayoutParams and alignment on GTK+. 2017-02-11 21:25:41 -05:00
Pietro Gagliardi 44f8409b8c And implemented the alignment stuff on OS X. 2017-02-11 21:10:16 -05:00
Pietro Gagliardi bd66e70452 And added the alignment flag to the example program. 2017-02-11 19:56:26 -05:00
Pietro Gagliardi 8a64a1dfb0 Made the OS X code and the example program use the new layout stuff. 2017-02-11 19:47:20 -05:00
Pietro Gagliardi 491ec3ae49 Actually let's do paragraph alignment first. Haven't tested hit-test with that just yet. 2017-02-11 17:10:59 -05:00
Pietro Gagliardi dca92d507e And readded uiFontButton on Windows. Woo! Now we have to deal with styles. 2017-02-11 17:08:05 -05:00
Pietro Gagliardi 1a8f7ad405 Reimplemented uiFontButton on GTK+. 2017-02-11 14:45:58 -05:00
Pietro Gagliardi a014eb27e6 More TODO completion in the drawtext example. 2017-02-11 14:22:23 -05:00
Pietro Gagliardi 67949d79aa And re-added the uiFontButton on OS X and added one to the hit-test example. 2017-02-11 01:13:07 -05:00
Pietro Gagliardi bebaf72de3 Started putting uiFontButton back in on OS X. Just a bunch of boilerplate for now, namely the function to take a CTFontDesciptorRef and convert it into a uiDrawFontDescriptor. 2017-02-11 00:53:52 -05:00
Pietro Gagliardi 49094bb340 Merged uiFontButton back in, with an updated API that works directly with uiDrawFontDescriptors. 2017-02-11 00:25:07 -05:00
Pietro Gagliardi 230d23765a Removed Uniscribe from the Windows build process and header file list. Also more TODOs. Next major goal: reinstating the font button. 2017-02-10 22:22:47 -05:00
Pietro Gagliardi c4b6149ec2 Gave up and rewrote Windows graphemes.cpp to use CharNextW() instead of Uniscribe, since I can't manage Uniscribe memory properly, it seems. The CharNextW() bug is relatively painless to work around anyway. Next commit will drop Uniscribe from the headers and build system. 2017-02-10 22:12:37 -05:00
Pietro Gagliardi 5a1c733841 Something is wrong with the Windows code... 2017-02-10 20:37:05 -05:00
Pietro Gagliardi 6acb10a4fc Fixed hanging errors in uiDrawCaret(). 2017-02-10 19:29:07 -05:00
Pietro Gagliardi 5f05ebbffe Expanded the hittest example by handling keyboard input. I should probably rename it to The Caret and Graphemes. 2017-02-10 19:22:25 -05:00
Pietro Gagliardi 5354aa5262 And cleaned hittest.c up. 2017-02-10 19:08:31 -05:00
Pietro Gagliardi 5d18d477e3 Implemented uiDrawCaret() on OS X. 2017-02-10 18:19:32 -05:00
Pietro Gagliardi 746e4091cb Implemented uiDrawCaret() on Windows. 2017-02-10 17:38:17 -05:00
Pietro Gagliardi b5b0fae052 And implemented uiDrawCaret() on GTK+. 2017-02-10 16:53:08 -05:00
Pietro Gagliardi 642363ccae Added the uiDrawCaret() function for drawing text carets. Now to write the backend-specific code and test it out. 2017-02-10 16:29:36 -05:00
Pietro Gagliardi b52600d9cd Preparation for adding uiDrawCaret(). 2017-02-10 16:16:43 -05:00
Pietro Gagliardi 0e5be32299 And cleaned up the GTK+ code. 2017-02-10 15:49:36 -05:00
Pietro Gagliardi 5823c3a53e More cleanup. 2017-02-10 11:52:26 -05:00
Pietro Gagliardi bb50440e55 Started cleaning up the old API. 2017-02-10 11:14:24 -05:00
Pietro Gagliardi 4b46dab775 And that last fix also fixed the issue about byte 1 being wrong. 2017-02-10 11:09:36 -05:00
Pietro Gagliardi 8ac9e386b5 More TODOs. 2017-02-10 11:07:44 -05:00
Pietro Gagliardi 6fa009a7dd Fixed uiAttributedString not putting the right position for the last character. Simple case of using the wrong variables. 2017-02-10 11:06:37 -05:00
Pietro Gagliardi 49d36b340c Started adjusting all the implementations to the new API's formal definition. There's bugs in uiAttributedString... 2017-02-10 10:54:37 -05:00
Pietro Gagliardi 92d996f148 Okay so I can't fix Pango as the behavior is hardcoded in (https://git.gnome.org/browse/pango/tree/pango/pango-layout.c?id=f4cbd27f4e5bf8490ea411190d41813e14f12165#n4204); just write some documentation and get rid of the old APIs entirely. 2017-02-09 19:20:35 -05:00
Pietro Gagliardi b96114e02d Fixed the hit-test example to manage the cursor more sanely. 2017-02-08 21:52:52 -05:00
Pietro Gagliardi d53bc88f50 And filled in the new functions on GTK+. Not quite right yet... 2017-02-08 21:19:49 -05:00
Pietro Gagliardi 5458e10134 Implemented the new hit-test functions on Windows. 2017-02-08 20:10:34 -05:00
Pietro Gagliardi 749a0cddaf Wrote the new hit-testing API on OS X, the easiest target. Also updated the example. Had to slightly modify one function for this all to work. 2017-02-08 19:00:45 -05:00
Pietro Gagliardi 93537ebb83 Simpler hit-testing APIs based on Core Text's. Microsoft's PadWrite sample shows us how to implement these on both DirectWrite and the similarly-interfaced Pango. 2017-02-08 11:38:52 -05:00
Pietro Gagliardi 012ce92b71 And implemented the caret changes on Windows. 2017-02-07 19:55:21 -05:00
Pietro Gagliardi 3e4f99e0dd Notes for Windows equivalent of previous commits. Not actually done yet. 2017-02-07 19:42:00 -05:00
Pietro Gagliardi 01b6a16af6 And handled caret behavior on GTK+. 2017-02-07 19:14:51 -05:00
Pietro Gagliardi bbc03a489e Implemented the system on the hit-test example and on OS X. 2017-02-07 16:43:49 -05:00
Pietro Gagliardi a5dac81855 Refined the hit-test API some more. 2017-02-07 16:21:18 -05:00
Pietro Gagliardi ac9aefc43a Set up a new API specifically for caret positioning when hit-testing a point. Not yet implemented, just planned out. 2017-02-07 15:29:12 -05:00
Pietro Gagliardi e4ed1c337b And implemented the functions on Windows. Yeah I think I'll need cursor functions, perhaps. 2017-02-06 18:38:44 -05:00
Pietro Gagliardi 3d8bf01972 And implemented the hit-testing functions on GTK+. 2017-02-06 10:30:26 -05:00
Pietro Gagliardi c539362c15 Implemented the Pango hit test functions. Now to test. 2017-02-06 10:11:45 -05:00
Pietro Gagliardi 71176c2e33 Added the descriptive label to the caret. 2017-02-06 01:46:06 -05:00
Pietro Gagliardi 675e7594da More TODOs. 2017-02-06 00:26:47 -05:00
Pietro Gagliardi a1bebc82d8 And implemented caret motions in the hit test examples. 2017-02-06 00:26:22 -05:00
Pietro Gagliardi 64a1167e5f Added the blue caret to the drawtext example. Phew! 2017-02-05 21:44:48 -05:00
Pietro Gagliardi 0ae25c62ed Implemented the range-to-rect function on OS X. 2017-02-05 21:17:48 -05:00
Pietro Gagliardi b18cc88dce Boilerplate needed for implementing range-to-rect. 2017-02-05 20:42:52 -05:00
Pietro Gagliardi c336063b65 Decided what I need to do. 2017-02-05 20:26:59 -05:00
Pietro Gagliardi bb52275686 Corrected ambiguous wording in a comment. 2017-01-29 21:51:27 -05:00
Pietro Gagliardi ea93528cba IMPORTANT hidpi notes. 2017-01-29 03:21:15 -05:00
Pietro Gagliardi 9063b10691 More notes. 2017-01-28 15:33:17 -05:00
Pietro Gagliardi 7614d3e0ff More TODOs. 2017-01-27 15:39:24 -05:00
Pietro Gagliardi c9e7ee3a92 Reactivated the Core Text backend. 2017-01-24 23:13:44 -05:00
Pietro Gagliardi 8ff01c5034 Ugh 2017-01-24 17:15:57 -05:00
Pietro Gagliardi 8d3c68d7f0 Moved the AppKit text drawer out of the way for now. One last experiment first; didn't seem to matter :S 2017-01-24 17:12:44 -05:00
Pietro Gagliardi 877ffa5f89 More attempts. Ugggggh. 2017-01-24 10:36:13 -05:00
Pietro Gagliardi d1e2b17f6e Attempted to the layout er I mean attempted to define the ascent, desceitn, er descent, and leading for the NSLayoutManager based code AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA. 2017-01-24 01:04:08 -05:00
Pietro Gagliardi 1ca9a28f2d More work. 2017-01-23 15:07:28 -05:00
Pietro Gagliardi 08f2085f41 Quick fix. 2017-01-23 14:31:39 -05:00
Pietro Gagliardi b19f4cf251 Finished writing a NSLayoutManager-based text system. Not quite perfect yet, but we're getting somewhere! 2017-01-23 11:43:03 -05:00
Pietro Gagliardi 4e2dc90f4f Started an experimental port from Core Text to Cocoa's typesetting system, since that seems to produce more sensible results (and is somewhat easier to use...). We lose per-line spacing though :/ 2017-01-23 01:28:53 -05:00
l0calh05t b2ce7c8794 Fix release build on MSVC.
The /RTC* flags conflict with all optimizations, therefore they should only be added when building the Debug configuration.
2017-01-22 13:46:34 +01:00
Pietro Gagliardi 7eba767ffb Temporarily turning off excess text for magnification tests. 2017-01-21 18:27:03 -05:00
Pietro Gagliardi 313905230d Ugh, Core Text and NSLayoutManager produce inconsistent output :| 2017-01-21 15:22:19 -05:00
Pietro Gagliardi d8316790a0 More notes. 2017-01-21 10:21:39 -05:00
Pietro Gagliardi f0b9ff9aba Fixed multifragment lines on Windows, again with the help of the PadWrite sample. 2017-01-21 09:39:53 -05:00
Pietro Gagliardi 4de8d4402f More TODOs. 2017-01-20 23:15:10 -05:00
Pietro Gagliardi 351b3b6077 Added some debugging for that DirectWrite RTL stuff. 2017-01-20 22:39:37 -05:00
Pietro Gagliardi bbed231324 Fixed up misused Unicode. 2017-01-20 22:25:37 -05:00
Pietro Gagliardi c720e8147b Figured out what's going on. No clue how to fix it. 2017-01-20 20:57:20 -05:00
Pietro Gagliardi 339bdfc89b Started a hit-test and grapheme boundary test. Looks like we're not quite out of the woods with DirectWrite just yet. 2017-01-20 20:38:18 -05:00
Pietro Gagliardi 87b7d5b4b7 Decided to remove uiDrawTextLayoutByteIndexToGraphemeRect(); the Range one later on handles it. Now we can do the hit testing functions! 2017-01-20 19:34:16 -05:00
Pietro Gagliardi fc7fcd9f05 And implemented metrics stuff on Windows. 2017-01-20 18:09:06 -05:00
Pietro Gagliardi 6ccf436206 Implemented Pango text metrics and expanded the drawtext basic page to draw metrics. Works on both Pango and OS X; DirectWrite comes next. 2017-01-20 16:36:44 -05:00
Pietro Gagliardi 6ef6ed8cde Expanded the drawtext example to allow for multiple examples and options in the examples. Our old makefiles wouldn't allow examples to be spread across multiple files like this, so yay cmake? 2017-01-20 13:25:21 -05:00
Pietro Gagliardi 2d09f22932 Added a debugging guide for Windows. Will have to investigate this more, because I can't find any information online that suggests Direct2D should not respect clipping when drawing text :S Also more TODOs. 2017-01-20 12:46:00 -05:00
Pietro Gagliardi 88ea7c4665 Fixed runtime errors. Yay it works on all platforms now! Also more TODOs. Now the real work is getting the rest of the functionality in. 2017-01-20 04:34:15 -05:00
Pietro Gagliardi c0781a13ae Fixed compile errors. Jesus.
Runtime errors next.
2017-01-20 03:24:06 -05:00
Pietro Gagliardi cac390a821 Wrote much of the new text layout code on Windows. Now to test. 2017-01-19 21:13:03 -05:00
Pietro Gagliardi f7121774e1 Added some TODOs and started the work necessary for the Windows text system migration... which is gonna hurt. 2017-01-17 23:25:26 -05:00
Pietro Gagliardi 5444f76bd3 Started implementing the new text layout stuff on GTK+. The drawtext example works. 2017-01-17 21:06:45 -05:00
Pietro Gagliardi 7f270942a7 And fixed errors. Woo, it works!!!!! 2017-01-17 13:54:23 -05:00
Pietro Gagliardi 907d7c5830 Added the beginning of a text-drawing example (since I would need to heavily change the tester to test these things; hopefully in the future the example will be much more sophisticated). Time to fix segfaults! 2017-01-17 13:30:00 -05:00
Pietro Gagliardi 7bda3baee3 Fixed build errors. DOES IT WORK?!?!?!?!?!?!?!?! 2017-01-17 13:05:40 -05:00
Pietro Gagliardi 794d30154c And rewrote drawtext.m based around the new Core Text research. 2017-01-17 12:02:42 -05:00
Pietro Gagliardi e63a42a290 Okay, now that I know what I'm doing, let's make the line metrics struct useful again. 2017-01-17 02:17:12 -05:00
Pietro Gagliardi e32341b24b More work. 2017-01-07 20:09:44 -05:00
Pietro Gagliardi 1bd2ca22c2 Some more work on the new Cocoa text drawing code. 2017-01-06 23:53:23 -05:00
Pietro Gagliardi 6212ac7238 And integrated the rest of our important tests in. 2017-01-05 21:36:07 -05:00
Pietro Gagliardi 747a0bbfad More TODOs. 2017-01-05 17:56:47 -05:00
Pietro Gagliardi 3910ff1a13 Resolved Core Text pain by not even thinking about lines in terms of boxes. 2017-01-05 17:55:05 -05:00
Pietro Gagliardi dfaf640101 More work. Core Text chaos has resurged... 2017-01-04 23:50:08 -05:00
Pietro Gagliardi f147edf949 More work. 2017-01-03 23:59:23 -05:00
Pietro Gagliardi bab798543f Wrote the new font matching code. This is taken from the old code, but cleaned up considerably and updated with new knowledge. 2017-01-03 13:42:12 -05:00
Pietro Gagliardi 4318785eb2 More drawtext.m work. I was wrong; I'll need to do the trait matching anyway. Ugh. 2017-01-03 12:18:17 -05:00
Pietro Gagliardi 31274bcbd2 Started implementing the new attributed string system on OS X. 2017-01-02 23:53:31 -05:00
Pietro Gagliardi 30ca879c14 More API stuff. 2017-01-02 20:11:15 -05:00
Pietro Gagliardi e409943a50 One more support method before I can actually implement uiDrawTextLayout. Still need to figure out how I'm going to deal with fonts... 2016-12-23 14:01:09 -05:00
Pietro Gagliardi dfffc4c851 Started the API definition of the new uiDrawTextLayout. 2016-12-23 12:24:20 -05:00
Pietro Gagliardi 4f6ed98e40 And integrated the new attribute list implementation fully. 2016-12-23 00:31:11 -05:00
Pietro Gagliardi 5c1dfbd86f Got rid of the old attribute code and integrated exp_attrdll.c into attrstr.c. I'll rename the file to attrlist.c later. 2016-12-22 14:33:30 -05:00
Pietro Gagliardi ab8aa9266e Finished filling in exp_attrdll.c. I think this will stay. 2016-12-22 14:22:01 -05:00
Pietro Gagliardi 0078615662 More attribute list work. 2016-12-22 13:05:36 -05:00
Pietro Gagliardi ecc7b70a6b And FINALLY implemented that function :D 2016-12-20 16:16:52 -05:00
Pietro Gagliardi 28ca02673b Even more trying to reason about the algorithm. 2016-12-20 14:47:11 -05:00
Pietro Gagliardi 4f1ba0df84 Plotted out at a high level how insertion with attribute borrowing should work. 2016-12-20 14:24:26 -05:00
Pietro Gagliardi 643e2937c4 More stuff I guess? 2016-12-19 17:15:48 -05:00
Pietro Gagliardi 78f5ca5eb5 Implemented attrlistInsertCharactersUnattributed(). 2016-12-19 13:46:20 -05:00
Pietro Gagliardi fee06b9553 Wrote the prototypes for the other functions I will need. 2016-12-19 11:07:52 -05:00
Pietro Gagliardi 7ebfe73bce Some minor cleanup. 2016-12-19 11:02:33 -05:00
Pietro Gagliardi 96e15116ba Added some expository information about attribute lists. 2016-12-18 14:11:12 -05:00
Pietro Gagliardi 5c96266c7c And finished implementing attrlistInsertAt(). Woo! 2016-12-18 14:06:37 -05:00
Pietro Gagliardi 75525196b1 Even more expansion of the experimental attribute list. 2016-12-18 11:49:54 -05:00
Pietro Gagliardi 4c99899a1d More work. Much clearer now... not yet complete though. 2016-12-17 23:07:48 -05:00
Pietro Gagliardi 2f449887d8 More TODOs. 2016-12-17 12:23:09 -05:00
Pietro Gagliardi 722dd03193 Cleaned up exp_attrdll.c a bit. 2016-12-17 12:19:33 -05:00
Pietro Gagliardi 98082068f6 Started an experimental doubly linked list implementation of attribute lists. 2016-12-16 23:31:04 -05:00
Pietro Gagliardi 6726ab70a9 Changed attrstr.c to match ui_attrstr.h. 2016-12-15 13:39:19 -05:00
Pietro Gagliardi 3f48bddce0 Started the header file for attributed strings, drawing text layouts, and the new text system in general. 2016-12-12 06:45:49 -05:00
Pietro Gagliardi e9fdbf33f3 And plugged in the deletion stuff into the rest of attrstr.c. We're on a roll here! 2016-12-06 10:35:08 -05:00
Pietro Gagliardi 0503110ddd Fixed the delete attributes code. 2016-12-06 10:23:53 -05:00
Pietro Gagliardi cb8d75d431 Started implementing the attribute handling code itself. 2016-12-05 18:32:51 -05:00
Pietro Gagliardi b45e5f4de2 Extended attrstr.c. Much more complete API now. 2016-12-04 16:02:56 -05:00
Pietro Gagliardi 4f8f94b85a Updated the CMakeLists.txt for OS X. 2016-12-03 20:02:39 -05:00
Pietro Gagliardi da8b8de371 Wrote the new attributed string system's grapheme code for OS X. 2016-12-03 20:01:45 -05:00
Pietro Gagliardi 3218ba2a43 And migrated the Unix grapheme code for the new attributed string system. 2016-12-03 18:54:19 -05:00
Pietro Gagliardi 526173bf76 Started writing the implementation of uiAttributedString. Updated windows/graphemes.cpp for this new implementation. Also fixed up a bunch of subtle errors and other issues with windows/graphemes.cpp. 2016-12-03 18:34:06 -05:00
Pietro Gagliardi 0d5ff432b3 Rewrote utf16.cpp to use my utf lib. Maybe I should be doing attributed strings safter all, but I might as well optimize too I guess?? 2016-12-03 11:31:11 -05:00
Pietro Gagliardi c0f91058c4 Started the move to my utf library. Imported the library. 2016-12-03 11:20:22 -05:00
Pietro Gagliardi 5fa7ba487e Merge pull request #240 from lailton/master
Update uipriv_darwin.h
2016-12-01 14:28:40 -05:00
Lailton Fernando Mariano 39d1c0565e Update uipriv_darwin.h 2016-12-01 16:26:59 -02:00
Lailton Fernando Mariano cb927659fa Update uipriv_darwin.h 2016-12-01 14:32:14 -02:00
Pietro Gagliardi dd339699cd Oops, I forgot to remove the uiImage code from the GTK+ port when splitting uiTable into a branch. Fixed the build for now. Fixes #238. 2016-11-30 09:21:37 -05:00
Pietro Gagliardi 18b103c988 Fully reintegrated the table code. 2016-11-27 17:44:52 -05:00
Pietro Gagliardi 52d88d3f36 Re-added the table code. Need to patch together everything else, but. 2016-11-27 17:36:11 -05:00
Pietro Gagliardi e3dec183aa Started the process of splitting the table code into a separate branch. 2016-11-27 17:34:40 -05:00
Pietro Gagliardi 287d59b5c5 More TODOs. 2016-11-11 01:21:28 -05:00
Pietro Gagliardi 6b33c62b84 More TODOs. 2016-11-08 09:12:11 -05:00
Pietro Gagliardi 92965068e1 We no longer need this file. 2016-11-02 09:41:51 -04:00
Pietro Gagliardi f56411fde1 Use performWindowDragWithEvent: if available. 2016-11-02 09:34:40 -04:00
Pietro Gagliardi 17dc5f407e And implemented moves on OS X. 2016-11-02 09:29:44 -04:00
Pietro Gagliardi 81b95a59b1 Minor fixups. 2016-11-02 09:09:49 -04:00
Pietro Gagliardi 503e5d7768 More notes. 2016-11-02 08:23:26 -04:00
Pietro Gagliardi 7199d4c847 More notes. 2016-11-01 17:51:25 -04:00
Pietro Gagliardi fae0bb061b Fixed the obvious glitches with window resizes. 2016-11-01 15:19:02 -04:00
Pietro Gagliardi 4c429d5b7f Removed the titlebar logic. Let's try to get the core code working first. 2016-11-01 14:57:44 -04:00
Pietro Gagliardi 0311679e37 Let's continue working on OS X resize drags. 2016-11-01 13:31:34 -04:00
Pietro Gagliardi 3eeb15bcdb Added the initial implementation of the custom resize code. 2016-11-01 11:58:01 -04:00
Pietro Gagliardi d3b33e39ce Further enhancements to custom run loops on OS X for custom resize loops. 2016-10-31 14:33:11 -04:00
Pietro Gagliardi 211b11b80f Fixed a threading issue in uiQueueMain() on GTK+. 2016-10-31 13:38:38 -04:00
Pietro Gagliardi 6779ae91d7 Started a FAQ with the OS X activation issue as the only question for now. Fixes #218. 2016-10-28 18:56:55 -04:00
Pietro Gagliardi a1d14b8773 More TODOs. 2016-10-28 17:43:40 -04:00
Pietro Gagliardi 39fdf7457b More preparation for the OS X window move/resize code: uiMainStep() is split into an internal function that takes a pre-sendEvent: interception specifically intended for internal loops. 2016-10-27 23:32:33 -04:00
Pietro Gagliardi 8cbae7d2b7 More TODOs. 2016-10-27 20:51:37 -04:00
Pietro Gagliardi 5de62d073f Cal [NSApp finishLaunching]. Fixes #182. 2016-10-26 09:39:43 -04:00
Pietro Gagliardi cc1942a929 Prepared OS X for the new uiArea functions. 2016-10-26 01:15:01 -04:00
Pietro Gagliardi 8819d9cd58 Fixed the new Windows uiArea functions. 2016-10-25 23:41:37 -04:00
Pietro Gagliardi 9d754bbf2a Implemented the new functions on Windows. Now to test. 2016-10-25 23:24:13 -04:00
Pietro Gagliardi 7fbbba37f6 Added notes for adding the new uiArea functions to OS X. 2016-10-25 13:14:32 -04:00
Pietro Gagliardi 7abe97ec57 More TODOs. 2016-10-25 01:11:03 -04:00
Pietro Gagliardi 1fbfc9dd67 More TODOs. 2016-10-25 01:00:18 -04:00
Pietro Gagliardi 22caa5e502 Implemented the window drag stuff on GTK+. It works! 2016-10-25 00:34:12 -04:00
Pietro Gagliardi 67ff2fa855 Laid out the interface for user window drags. 2016-10-24 23:35:18 -04:00
Pietro Gagliardi 1871f7139d Some more test areas in the borderless resize test. Now to actually spec out the API (hint: it's two functions in uiArea). 2016-10-24 23:27:44 -04:00
Pietro Gagliardi 8556fc7cd1 Started work on custom user resizes. 2016-10-24 23:08:55 -04:00
Pietro Gagliardi fc243aed00 Cleaned up debugging code and added the main loop bugfix to the README. 2016-10-24 17:47:23 -04:00
Pietro Gagliardi 0c209a8277 Whoops, bugged that last one bad (yet it worked fine in X11 for some reason????). Fixed. 2016-10-24 15:44:02 -04:00
Pietro Gagliardi 3f1540b84a And got rid of message pumping in unix/window.c. Woo! Gotta clean it up a bit first though... 2016-10-24 14:39:10 -04:00
Pietro Gagliardi e17e69f2ad Let's experiment with making uiWindowSetSize() not require an event loop. 2016-10-23 22:02:07 -04:00
Pietro Gagliardi 0870a3065e Quick Windows fixes now localized. 2016-10-23 12:42:00 -04:00
Pietro Gagliardi ce37d12d23 Typo fixes. 2016-10-22 19:36:32 -04:00
Pietro Gagliardi 57379474f1 And finished offing the movement window events. I think the others can stay, though they need some tweaks. 2016-10-22 19:34:53 -04:00
Pietro Gagliardi 57fbf78ef3 More removal. 2016-10-22 19:31:57 -04:00
Pietro Gagliardi edd70b9fa5 More uiWindows cleanup. 2016-10-22 18:35:41 -04:00
Pietro Gagliardi 6d796b5642 More removal of uiWindow move events. 2016-10-22 18:11:49 -04:00
Pietro Gagliardi 570b794650 Started the work in removing the move and center functions from uiWindow; those simply cannot be done thanks to Wayland. 2016-10-22 15:40:15 -04:00
Pietro Gagliardi d344e1ae29 More bindings. Fixes #211. 2016-10-22 15:31:43 -04:00
Pietro Gagliardi 1369f53027 Meh, let's push 2016-10-22 09:01:26 -04:00
Pietro Gagliardi 8b3ce21886 More TODOs. 2016-10-21 18:27:40 -04:00
Pietro Gagliardi f46edd097b uiDrawTextWeightUtraBold. 2016-10-21 16:35:46 -04:00
Pietro Gagliardi bfa781f1c2 Merge branch 'master' of github.com:andlabs/libui 2016-10-19 20:28:23 -04:00
Pietro Gagliardi 229ed226f6 Merge pull request #215 from kornrunner/master
Mention PHP Binding
2016-10-19 20:27:42 -04:00
Boris Momčilović abbea5273f Mention PHP Binding
Add a link to PHP extension
2016-10-20 01:07:51 +02:00
Pietro Gagliardi a9c7ff9c6c Travis now installs the right version of cmake by default on OS X. No more special hacks. 2016-10-17 14:25:32 -04:00
Pietro Gagliardi e133903809 Merge branch 'master' of github.com:andlabs/libui 2016-10-17 12:41:58 -04:00
Pietro Gagliardi 15b069bb47 Merge pull request #176 from starius/no_res_suffix
cmake: do not reset unused variable _res_suffix
2016-10-17 12:38:19 -04:00
Pietro Gagliardi 05f7e2d3cf Merge pull request #208 from sclukey/swift
Add Swift binding
2016-10-17 12:34:19 -04:00
Pietro Gagliardi ba082864e1 Merge pull request #206 from yamadapc/patch-1
Add a complete Haskell binding to the README
2016-10-17 12:33:53 -04:00
Pietro Gagliardi 084ed53e63 Fixed a latent bug in uiFreeInitError() on Windows. 2016-10-15 01:21:04 -04:00
Steven Clukey 4bb9b58ec6 Add Swift binding 2016-09-15 09:24:34 -04:00
Pedro Tacla Yamada 2d5166c117 Add a complete Haskell binding to the README
The currently linked Haskell bindings to this library are just an empty repository. We've published complete bindings as well as OSX specific extensions like WebViews and MapViews (WIP) at https://github.com/beijaflor-io/haskell-libui. This just adds a link to it.
2016-09-06 11:55:00 -03:00
Pietro Gagliardi 0b5d4021f2 More TODOs. 2016-08-20 10:09:53 -04:00
Pietro Gagliardi 8964dff296 Reworked the README a bit. 2016-08-19 08:34:20 -04:00
Pietro Gagliardi 33e5defdb5 Merge branch 'master' of github.com:andlabs/libui 2016-08-19 08:13:56 -04:00
Pietro Gagliardi 86c4485578 Merge pull request #198 from mogud/patch-1
Add an oo binding reference in d
2016-08-19 08:12:56 -04:00
Lin Xi bc670c0b5f Add an oo binding reference in d 2016-08-19 16:07:48 +08:00
Pietro Gagliardi 3286c9b572 Merge branch 'master' of github.com:andlabs/libui 2016-08-10 22:08:45 -04:00
Pietro Gagliardi 6e45859b9b Merge pull request #192 from neelchauhan/master
Fix "cannot find -ldl" linking error with FreeBSD
2016-08-10 22:08:05 -04:00
Neel Chauhan 7324683ba2 Fix "cannot find -ldl" linking error with FreeBSD 2016-08-10 20:37:42 -04:00
Pietro Gagliardi 013659e805 More TODOs. 2016-08-08 09:52:04 -04:00
Pietro Gagliardi bea844c18e More TODOs. 2016-07-12 17:50:43 -04:00
Boris Nagaev 61bcb0d536 cmake: do not reset unused variable _res_suffix 2016-07-10 22:14:55 +03:00
Pietro Gagliardi 5f4e5ed8eb More bindings. 2016-07-05 07:44:57 -04:00
Pietro Gagliardi ef689c10f1 Started table part handling on Windows. 2016-06-30 20:38:12 -04:00
Pietro Gagliardi e20ce4e188 Some TODO resolution. 2016-06-29 19:20:43 -04:00
Pietro Gagliardi 9164e521e2 Changed the button cell renderer on GTK+ to actually work on 3.20. Thanks to baedert in irc.gimp.net/#gtk+ for suggestions. This actually has slightly fewer bugs! 2016-06-29 17:25:05 -04:00
Pietro Gagliardi 4fabbd18cf Split future symbols into a new file and added one we need to fix our button cell renderer on 3.20. 2016-06-29 15:33:30 -04:00
Pietro Gagliardi 621e301d5f Fixed backwards compatibility issues. 2016-06-29 08:53:49 -04:00
Pietro Gagliardi 6b0028d084 Added uiTable value setting and events on GTK+. 2016-06-28 22:36:56 -04:00
Pietro Gagliardi f484f568f6 Finished up and plugged in cellrendererbutton. 2016-06-28 13:09:44 -04:00
Pietro Gagliardi 575f4f3053 Added a button cell renderer. No events yet. Now to test. 2016-06-28 12:00:35 -04:00
Pietro Gagliardi 8b04f2062a More GTK+ uiTable work. 2016-06-27 19:12:08 -04:00
Pietro Gagliardi 53bd751461 Fixed uiImage byte order on OS X. 2016-06-27 16:34:57 -04:00
Pietro Gagliardi cf3182f4d2 Put images on uiTables. We're going to have to swizzle on OS X after all :( 2016-06-27 16:11:15 -04:00
Pietro Gagliardi af0dbd3a0e Fixed a bunch of bugs in GTK+ table.c. 2016-06-27 12:24:14 -04:00
Pietro Gagliardi 40e943eb43 Fixed compile issues. Now to fix other issues. Yay! 2016-06-27 12:01:36 -04:00
Pietro Gagliardi 99a3462eb4 Added GTK+ images. Will hook it up to tables later. 2016-06-27 11:38:11 -04:00
Pietro Gagliardi f7e5c7dd25 Finished the initial implemenetation of uiTable on GTK+. 2016-06-27 09:30:22 -04:00
Pietro Gagliardi f354d48bfd Started the GTK+ implementation of uiTable. 2016-06-26 23:17:34 -04:00
Pietro Gagliardi 6804f263d4 And implemented (mostly) the progressbar table parts. I think that'll do for uiTable features now. 2016-06-26 18:19:34 -04:00
Pietro Gagliardi d7caa150b8 Added checkbox table cells. Now just to add progressbar cells and we'll be good. 2016-06-26 15:36:46 -04:00
Pietro Gagliardi 44a723b314 Added uiTable buttons. Not fully working on OS X. 2016-06-26 13:06:33 -04:00
Pietro Gagliardi 15eca1372e Fixed cell editing in table on OS X. 2016-06-26 00:44:21 -04:00
Pietro Gagliardi 2f9a38b5fe Quick bugfix. 2016-06-25 23:06:13 -04:00
Pietro Gagliardi e0230d73a6 Started editable uiTable elements. 2016-06-25 23:04:49 -04:00
Pietro Gagliardi 49ab4a886f Added image table cell parts; implemented on OS X 2016-06-25 19:18:25 -04:00
Pietro Gagliardi 93bbf39aa4 Added some test images. Now to add image columns to uiTable and see what happens. 2016-06-25 17:26:50 -04:00
Pietro Gagliardi 165b3a8a51 Okay, decided on something for images. Let's try this. 2016-06-25 16:27:29 -04:00
Pietro Gagliardi 7995a4460c Got rid of uiDrawImage stuff. I need to decide if the drawing API should care about scaling or not. 2016-06-25 14:33:42 -04:00
Pietro Gagliardi 2da1273ec2 Drafted the README. 2016-06-25 11:23:45 -04:00
Pietro Gagliardi da24b7154b Started the work toward adding images. 2016-06-25 11:22:55 -04:00
Pietro Gagliardi 4914d0c64c Added a way to set the text color of a part. 2016-06-23 22:16:25 -04:00
Pietro Gagliardi 9d22d741c6 More TODOs. 2016-06-23 15:06:07 -04:00
Pietro Gagliardi 78e8dd3883 More TODOs. 2016-06-23 14:57:40 -04:00
Pietro Gagliardi 67e8db9efd Added row background colors. 2016-06-23 11:29:43 -04:00
Pietro Gagliardi f02fbd2ecf Some more API cleanup. Don't separate table cell parts from columns. 2016-06-23 09:56:24 -04:00
Pietro Gagliardi a57bef13e5 TODO updates. 2016-06-22 23:08:39 -04:00
Pietro Gagliardi cbb07113ca Fixed uiMultilineEntry to no longer use Auto Layout. 2016-06-22 23:07:59 -04:00
Pietro Gagliardi ddd0e82c90 Removed auto layout from scrollviews. Need to do the same to text views too. 2016-06-22 22:58:51 -04:00
Pietro Gagliardi 0ef01e1685 Added some debugging code to help figure out tables. 2016-06-22 13:28:12 -04:00
Pietro Gagliardi a82835fff3 Fixed uiTable selection colors on OS X. 2016-06-22 01:06:47 -04:00
Pietro Gagliardi 93923bbcb3 More TODOs. 2016-06-22 00:59:04 -04:00
Pietro Gagliardi 1c70edaef1 Fixed initial OS X uiTable. It works! 2016-06-22 00:58:10 -04:00
Pietro Gagliardi c26f438d3b Finished the initial implementation of OS X uiTable. Now to test. 2016-06-22 00:40:30 -04:00
Pietro Gagliardi 2f08ec683a Started the OS X uiTable implementation. 2016-06-21 23:58:17 -04:00
Pietro Gagliardi b21ec6cf6b Laid the foundation for uiTable: common code and a test. Now to start actually implementing it. 2016-06-21 22:22:13 -04:00
Pietro Gagliardi aa2e8cf4f5 Simplified the uiTable cell layout stuff a bit: rather than implying that a cell layout can be used by multiple columns, just have the column *be* the cell layout. 2016-06-21 22:07:39 -04:00
Pietro Gagliardi d93bb2c48f Formatting fixes. 2016-06-21 12:45:04 -04:00
Pietro Gagliardi 1f20772b46 Merge pull request #123 from kainjow/void-ptr-warning
Fix void* warning
2016-06-21 12:43:43 -04:00
Pietro Gagliardi 2d4f6eb2b8 Stop uiProgressBar pulsing on destroy on GTK+. Fixes #163. 2016-06-21 12:39:53 -04:00
Pietro Gagliardi 10480db895 Call gtk_widget_destroy() instead of g_object_unref() when destroying uiWindows. Fixes #165. 2016-06-21 12:15:38 -04:00
Pietro Gagliardi 80b8fddbea Started mapping out uiTable and uiTree. 2016-06-20 22:14:26 -04:00
Pietro Gagliardi ec15e25694 More announcements. 2016-06-18 22:08:17 -04:00
Pietro Gagliardi a07e2afc9c Made alignment work on uiGrid on OS X. 2016-06-18 13:32:10 -04:00
Pietro Gagliardi f2c0719e95 More TODOs. 2016-06-17 23:18:31 -04:00
Pietro Gagliardi 087a89dac9 Added menu planning. 2016-06-17 13:39:36 -04:00
Pietro Gagliardi 9785565c8c Expanded the control gallery a bit further. 2016-06-17 11:34:42 -04:00
Pietro Gagliardi 9656a81c77 Added uiNewVerticalSeparator(). 2016-06-17 11:02:17 -04:00
Pietro Gagliardi 605b09f2be Applied @tcyrus's README.md suggestions. 2016-06-17 10:31:17 -04:00
Pietro Gagliardi d36ef03630 More TODOs. 2016-06-17 10:28:31 -04:00
Pietro Gagliardi ebdcf7bf17 And THAT did it. 2016-06-17 10:24:30 -04:00
Pietro Gagliardi 3499e8335b Round 5 2016-06-17 10:16:53 -04:00
Pietro Gagliardi b95bbbd70b Round 4 2016-06-17 10:13:46 -04:00
Pietro Gagliardi f17483ccd2 Round 3 2016-06-17 10:09:47 -04:00
Pietro Gagliardi 721a934bf0 Round 2 2016-06-17 10:01:07 -04:00
Pietro Gagliardi 8c332591c9 Switched minimum cmake version to 3.1.0. Will announce after updating the Travis files. 2016-06-17 09:56:47 -04:00
Pietro Gagliardi fca6edd5a2 More TODOs. 2016-06-17 09:24:15 -04:00
Pietro Gagliardi ae14542c9a Improved uiMainSteps(). 2016-06-17 09:22:31 -04:00
Pietro Gagliardi cc4c5f7bd5 Tried to see if we can fix up uiMainSteps() to not need parameters after all. Now to actually apply it. 2016-06-17 09:16:30 -04:00
Pietro Gagliardi 99545e8775 Fixed up the progressbar changes. 2016-06-16 17:43:04 -04:00
Pietro Gagliardi e1a5d140db Merge branch 'master' of github.com:andlabs/libui 2016-06-16 16:45:35 -04:00
Pietro Gagliardi 015008976f More documentation stuff. 2016-06-16 16:44:53 -04:00
Pietro Gagliardi 798061f7f6 Merge pull request #144 from ProtonMail/progress-bar
Improves progress bar
2016-06-16 16:44:42 -04:00
Pietro Gagliardi 179042025a And implemented on Windows, and more TODOs on top of that. 2016-06-16 14:12:47 -04:00
Pietro Gagliardi c001c164f1 Implemented uiMainSteps() on GTK+. 2016-06-16 13:59:35 -04:00
Pietro Gagliardi d4492c06a9 Changed the uiMainSteps() API as the GTK+ port will need it to be done this way... 2016-06-16 13:49:50 -04:00
Pietro Gagliardi da4b396aaf Added uiMainSteps(), which sets things up to use uiMainStep() for the main loop. Implemented on OS X. 2016-06-16 13:45:24 -04:00
Pietro Gagliardi b4d0e08a22 Started the work to fix uiMainStep(). 2016-06-16 13:41:13 -04:00
Pietro Gagliardi dd2ee50710 And implemented borderless windows on OS X. 2016-06-16 11:46:58 -04:00
Pietro Gagliardi 256a452fbd Implemented borderless windows on GTK+. 2016-06-16 11:34:19 -04:00
Pietro Gagliardi 377f46814a Started adding borderless uiWindow support; implemented on Windows. 2016-06-16 11:20:28 -04:00
Pietro Gagliardi aafdb75a98 And implemented the fullscreen stuff on Windows. 2016-06-16 10:30:44 -04:00
Pietro Gagliardi 132d925b70 Implemented the fullscreen stuff on GTK+. 2016-06-16 10:03:35 -04:00
Pietro Gagliardi fd9af04123 Implemented fullscreen on OS X. 2016-06-16 09:29:28 -04:00
Pietro Gagliardi 69cafde7f3 Started the fullscreen window stuff. 2016-06-16 08:07:50 -04:00
emersion cff5dcf9c9 Adds indeterminate progressbar to darwin (not yet tested) 2016-06-16 09:45:08 +02:00
emersion 7770b5c850 Adds indeterminate progressbar to windows 2016-06-16 09:32:13 +02:00
Pietro Gagliardi caec39281b And implemented the new sizing stuff on OS X. 2016-06-16 00:58:40 -04:00
Pietro Gagliardi 88bb697bbd Implemented the new uiWindow stuff on GTK+. 2016-06-16 00:45:23 -04:00
Pietro Gagliardi e5064de86b More TODOs. 2016-06-15 23:00:26 -04:00
Pietro Gagliardi 6c56f1e1ce Implemented the window size stuff on Windows. 2016-06-15 22:52:35 -04:00
Pietro Gagliardi 5fbe85c21a Started adding the uiWindow size code. 2016-06-15 22:28:44 -04:00
Pietro Gagliardi c3777da0f4 And added the new uiWindow methods on Windows. 2016-06-15 21:55:42 -04:00
Pietro Gagliardi 48c13c738a Fixed the GTK+ window code. 2016-06-15 20:45:10 -04:00
emersion 983a53d3c3 Replaces uiProgressBar(Set)Indeterminate() by value=-1 2016-06-15 23:17:23 +02:00
Pietro Gagliardi f98318fb3a Started implementing the new uiWindows stuff on GTK+. 2016-06-15 16:45:49 -04:00
emersion 560cca5bc9 Adds uiProgressBar(Set)Indeterminate for unix 2016-06-15 21:51:08 +02:00
Pietro Gagliardi 53bec81925 More uiWindow positioning refinement and implementation on OS X. 2016-06-15 14:57:52 -04:00
Pietro Gagliardi 4465d37d2e Started uiWindow positioning stuff. 2016-06-15 13:21:07 -04:00
emersion e07a7b3d05 Adds uiProgressBarValue() in unix 2016-06-15 18:51:12 +02:00
emersion 6270af8cf9 Merge pull request #2 from andlabs/master
Merge upstream changes
2016-06-15 18:49:39 +02:00
Pietro Gagliardi efe207ca37 Added a test of uiFormDelete(). 2016-06-15 12:06:19 -04:00
Pietro Gagliardi dda58c9323 Fixed leaking issues with the previous commit. 2016-06-15 12:04:11 -04:00
Pietro Gagliardi 157a312e8a Merge branch 'master' of github.com:andlabs/libui 2016-06-15 12:01:06 -04:00
Pietro Gagliardi ac1a515820 Merge pull request #141 from ProtonMail/ui-form-delete
Adds uiFormDelete()
2016-06-15 12:00:38 -04:00
Pietro Gagliardi cea52e2df6 Preemptive README change for next merge. 2016-06-15 11:58:26 -04:00
Pietro Gagliardi e017c22409 Merge branch 'master' of github.com:andlabs/libui 2016-06-15 11:55:11 -04:00
Pietro Gagliardi e75b9cc4fa Merge pull request #142 from ProtonMail/fix-windows-static-copy
Fix windows static copy
2016-06-15 11:54:27 -04:00
emersion 3173fc6cdc Fixes windows static library copy 2016-06-15 17:07:52 +02:00
emersion 831fe1e73b Updates darwin to work with upstream changes 2016-06-15 16:39:23 +02:00
emersion 578ff39525 Merge pull request #1 from andlabs/master
Merge upstream changes
2016-06-15 10:27:35 +02:00
Pietro Gagliardi 16b4409f38 Amended TODO. 2016-06-15 00:04:55 -04:00
Pietro Gagliardi c60cbb72f9 More TODOs. 2016-06-15 00:04:39 -04:00
Pietro Gagliardi c8dd546804 I don't know what's up. Fix a leak anyway. 2016-06-14 23:03:40 -04:00
Pietro Gagliardi 4b2d646345 Fixed most of the grid problems. Now we just need to figure why the Assorted page both clips and doesn't position controls correctly... 2016-06-14 23:00:30 -04:00
Pietro Gagliardi 106d4b544a Edging ever closer to getting grids working right on Windows. 2016-06-14 21:55:14 -04:00
Pietro Gagliardi cf8c1c67fe Clarified the previous commit. 2016-06-14 21:00:57 -04:00
Pietro Gagliardi cdbe48cc83 Plugged a potential memory corruption in darwin/grid.m. Now we have to do the same on Windows: ensure that hidden cells are taken into account when computing xmin/xmax/ymin/ymax and abort if there's nothing there. 2016-06-14 20:58:44 -04:00
Pietro Gagliardi 0a4a8ae4f3 Getting closer. Adding hidden views makes things harder... hm. 2016-06-14 20:57:21 -04:00
Pietro Gagliardi 96ce336a8b Handled hidden controls in uiGrid properly. Spacing, on the other hand... 2016-06-14 19:44:28 -04:00
Pietro Gagliardi 8ae0823eee Implemented hidden controls properly on Windows uiForm. 2016-06-14 18:12:30 -04:00
emersion b817a16c05 Adds missing delete() method for darwin 2016-06-14 22:55:55 +02:00
emersion 52bd3b2c35 Adds uiFormDelete() 2016-06-14 22:41:37 +02:00
Pietro Gagliardi b6cb429d1a Fixed uiBox hidden control nonsense on Windows. FINALLY. 2016-06-14 16:06:39 -04:00
Pietro Gagliardi 997c8aac35 Implemented visibility change detection on Windows. Now to refine the actual implementation of hidden controls. 2016-06-14 15:55:24 -04:00
Pietro Gagliardi 6e5cf97623 Tied uiForm label visibility on GTK+ to the visibility of the control. This is the only visibility change needed on GTK+, fortunately. 2016-06-14 11:31:10 -04:00
Pietro Gagliardi cb81518e0f Implemented proper hiding and showing behavior on OS X on uiForm and uiGrid. 2016-06-14 11:18:38 -04:00
Pietro Gagliardi 44b4fa9c68 Fixed hiding on OS X uiBox. 2016-06-14 10:54:16 -04:00
Pietro Gagliardi d54f7dd682 Added a facility to the OS X port to be notified when a child's visibility has changed; this is necessary for implementing hiding and showing properly. 2016-06-14 10:37:19 -04:00
Pietro Gagliardi 48546f6b44 Clarified the update. 2016-06-13 22:44:11 -04:00
Pietro Gagliardi 207340f16f Finished the migration. 2016-06-13 22:42:11 -04:00
Pietro Gagliardi fa4542f217 Got rid of the last bit of intmax_t. Now to verify everything. 2016-06-13 22:00:18 -04:00
Pietro Gagliardi 4524ffce5e Removed most of the intmax_ts, which are all MinimumSize()s. 2016-06-13 21:54:15 -04:00
Pietro Gagliardi 8c974e7b77 Started removing intmax_ts, first with uipriv_windows.hpp. 2016-06-13 21:47:04 -04:00
Pietro Gagliardi cb3f10f243 Quick fix in the meantime. 2016-06-13 21:38:48 -04:00
Pietro Gagliardi 75a8ee9bf9 Removed intmax_t from everything else EXCEPT the Windows code. Now it's time for THAT... 2016-06-13 21:37:50 -04:00
Pietro Gagliardi 2affdab837 Removed intmax_t from the rest of the public API. 2016-06-13 21:23:05 -04:00
Pietro Gagliardi 864c6c2511 Finished stripping ui.h of intmax. 2016-06-13 21:20:20 -04:00
Pietro Gagliardi 155299cdb9 More intmax_t removal. 2016-06-13 21:11:59 -04:00
Pietro Gagliardi 440635447d More intmax_t removal. 2016-06-13 21:05:40 -04:00
Pietro Gagliardi 8d48d42201 More intmax_t elminiation. 2016-06-13 20:55:50 -04:00
Pietro Gagliardi b26354d1e7 Started replacement of intmax_t and uintmax_t with int. 2016-06-13 20:46:11 -04:00
Pietro Gagliardi 857bbbf506 Don't use 10.10-specific selectors in uiNewSearchEntry(). Fixes #132. 2016-06-13 15:15:40 -04:00
Pietro Gagliardi e46554f481 More work on the uiGrid test. 2016-06-13 13:57:20 -04:00
Pietro Gagliardi ba8e5b80ea More uiGrid tests. OS X falls apart as usual :D 2016-06-13 08:12:01 -04:00
Pietro Gagliardi f08cd96688 More control gallery rewriting. Removed some debugging code in the OS X grid. 2016-06-12 19:55:35 -04:00
Pietro Gagliardi 41ec54cb47 Started a new controlgallery. Fixed some glitches in OS X uiForm. 2016-06-12 19:08:08 -04:00
Pietro Gagliardi 9f4092dab5 And put uiGrid in the updates. Yay! 2016-06-12 18:28:34 -04:00
Pietro Gagliardi 144366c775 And got the last bit of grid working :D 2016-06-12 18:26:13 -04:00
Pietro Gagliardi 2cd97c8e60 Reworked hugging priorities a bit. We're getting closer... 2016-06-12 18:23:43 -04:00
Pietro Gagliardi 99e660377c More experiments. 2016-06-12 16:56:06 -04:00
Pietro Gagliardi f89feba680 Included spanning views in hugging priority management. 2016-06-12 16:27:29 -04:00
Pietro Gagliardi 629c242a83 Forgot to make the dummy views ignore autoresizing masks. 2016-06-12 15:35:54 -04:00
Pietro Gagliardi 0ce4fd6efd FIgured out that we need to ignore spanning cells; added support for that. Not yet perfect; still need to do a bit more... 2016-06-12 15:30:36 -04:00
Pietro Gagliardi 7908972d34 Continuing the current approach. This might work out better... 2016-06-12 15:08:07 -04:00
Pietro Gagliardi 77f4c2f309 Split out more of the uiGrid logic. Rewrote the edge constraints to use a topological map of views. Added dummy views for empty cells. 2016-06-12 13:47:33 -04:00
Pietro Gagliardi ebf4bce245 Moved the .m files out of the way. 2016-06-12 13:28:44 -04:00
Pietro Gagliardi a2e5dbc94c Saved some experiments. 2016-06-12 13:12:36 -04:00
Pietro Gagliardi 6496de0fb2 More TODOs. 2016-06-12 12:35:13 -04:00
Pietro Gagliardi 8f0bac54a3 Took an alternate route through the constraints in the grid. This should be a bit easier... 2016-06-12 12:31:44 -04:00
Pietro Gagliardi 31f2b6d059 More future plans. 2016-06-12 11:55:26 -04:00
Pietro Gagliardi 2c08f52a5b Moved Compatibility.md from ui to libui. 2016-06-12 11:55:02 -04:00
Pietro Gagliardi bf1595795c Fixed a tester bug. 2016-06-11 23:53:49 -04:00
Pietro Gagliardi fc2218b51c Added some rather fickle debugging. 2016-06-11 23:52:35 -04:00
Pietro Gagliardi 9650770554 Fixed a typo. Doesn't fix runtime bugs yet. 2016-06-11 23:42:58 -04:00
Pietro Gagliardi faa989aefd Fixed compile errors. Runtime errors, on the other hand... 2016-06-11 23:28:51 -04:00
Pietro Gagliardi d528fae1f4 Added uiGrid on OS X. Now to fix build errors. 2016-06-11 23:09:53 -04:00
Kevin Wojniak a18e3c71b9 Fix void* warning
"Format specifies type 'void *' but the argument has type 'uiWindow *' (aka 'struct uiWindow *')"
2016-06-10 21:23:13 -07:00
Pietro Gagliardi 61a94fde57 Fixed a memory leak in Windows uiForm. NOW OS X. 2016-06-10 22:29:20 -04:00
Pietro Gagliardi 662c9de179 Fixed the Windows grid code. Now it's time for the OS X code (giant bottle of alcohol here). 2016-06-10 21:24:30 -04:00
Pietro Gagliardi 554221fd66 Added Windows uiGrid. Doesn't quite work yet. 2016-06-10 19:34:48 -04:00
Pietro Gagliardi 3a3b96a38e Implemented more of GTK+'s grid tests. 2016-06-09 21:30:33 -04:00
Pietro Gagliardi 4b149ddfef Implemented uiGrid on GTK+. 2016-06-09 18:57:58 -04:00
Pietro Gagliardi 075eae15e5 Started uiGrid. 2016-06-09 17:15:59 -04:00
Pietro Gagliardi 04b83a2680 Merge pull request #114 from hugows/patch-1
Cmake 2.8.12 doesn't understand LANGUAGES keyword on project command
2016-06-09 11:26:38 -04:00
Pietro Gagliardi ddbd6c2133 Merge pull request #115 from ghaberek/master
Added Euphoria binding to README.md
2016-06-09 11:25:16 -04:00
Pietro Gagliardi 06ae417cb3 Split old announcements and updates out. 2016-06-09 11:22:02 -04:00
Pietro Gagliardi 3fad148200 Extracted the old grid.go for migration. 2016-06-09 08:20:39 -04:00
Pietro Gagliardi c96068316a More TODOs. 2016-06-08 23:52:53 -04:00
Pietro Gagliardi afe27177d5 Implemented uiForm on Windows. 2016-06-08 23:33:32 -04:00
Pietro Gagliardi 4b2858b53a Implemented uiForm on GTK+. 2016-06-08 18:19:41 -04:00
Pietro Gagliardi 69cad5e608 Fixed uiForm on OS X. 2016-06-08 16:26:23 -04:00
Pietro Gagliardi d232342779 I give up. MCVE time. 2016-06-08 08:55:57 -04:00
Pietro Gagliardi 45d394fc81 Okay new plan. 2016-06-08 07:54:43 -04:00
Pietro Gagliardi 9295af59ab More TODOs. 2016-06-07 23:25:01 -04:00
Pietro Gagliardi 2f3c0449ba Tried to debug all this ambiguity. Argh. 2016-06-07 23:24:29 -04:00
Pietro Gagliardi 0fe5214c09 Revert "Undid all of that. There's an easier way..."
...that only works for nibs. :(

This reverts commit 0fa706b8d4.
2016-06-07 18:57:02 -04:00
Pietro Gagliardi 0fa706b8d4 Undid all of that. There's an easier way... 2016-06-07 18:49:59 -04:00
Gregory Haberek 958893a73d Added Euphoria binding to README.md 2016-06-07 17:45:57 -04:00
Hugo Schmitt 4fde812156 Cmake 2.8.12 doesn't understand LANGUAGES keyword
Fortunately we can just use project(libui) since C and CPP are the languages enabled by default.
2016-06-07 16:09:03 -03:00
Pietro Gagliardi 39f76bdb25 Part 2: leading and trailing edges. 2016-06-07 15:04:14 -04:00
Pietro Gagliardi 95fcceef2f Re-establishing uiForm constraints: vertical constraints. 2016-06-07 14:59:12 -04:00
Pietro Gagliardi 7f05b796aa Started rewriting the OS X uiForm auto layout. 2016-06-07 14:38:03 -04:00
Pietro Gagliardi ff3c9f0c67 Made uiSearchEntry appropriately rounded on OS X. 2016-06-07 14:35:43 -04:00
Pietro Gagliardi c6e8537269 Started the implementation of uiForm on OS X. Mostly works, but there are Auto Layout glitches (of course there are Auto Layout glitches) 2016-06-07 11:29:49 -04:00
Pietro Gagliardi 1ad18ddc8e We are FINALLY adding uiForm. About time :V 2016-06-07 09:56:53 -04:00
Pietro Gagliardi 3e1258cc62 Implemented the new radio button stuff on OS X. 2016-06-06 20:12:17 -04:00
Pietro Gagliardi 9a5bc738c5 Implemented likewise on Windows. 2016-06-06 19:51:46 -04:00
Pietro Gagliardi 8ede507d36 Merge branch 'master' of github.com:andlabs/libui 2016-06-06 19:04:06 -04:00
Pietro Gagliardi 40128080da Merge pull request #112 from dom96/patch-1
Add Nim binding to readme
2016-06-06 19:03:23 -04:00
Pietro Gagliardi 5accda32e5 Added new uiRadioButtons functions and implemented them on GTK+. More TODOs. 2016-06-06 18:56:58 -04:00
Dominik Picheta 8d660431d7 Add Nim binding to readme 2016-06-06 23:49:04 +01:00
Pietro Gagliardi 852d2ee143 Clarified the README a bit. 2016-06-06 10:29:55 -04:00
Pietro Gagliardi 6cb3cd4ed7 More robust accelerator tests. 2016-06-06 09:27:07 -04:00
Pietro Gagliardi f1e3ecf786 Merge branch 'master' of github.com:andlabs/libui 2016-06-05 22:12:41 -04:00
Pietro Gagliardi fe2d85590e Merge pull request #8 from actionless/patch-1
chore(readme): add the link to arch linux aur
2016-06-05 22:11:59 -04:00
Pietro Gagliardi 812086be1b Improved the appearance of uiSearchEntry on Windows somewhat. 2016-06-05 21:27:44 -04:00
Pietro Gagliardi 15456c8b41 Implemented uiPasswordEntry and uiSearchEntry on Windows. 2016-06-05 21:02:59 -04:00
Pietro Gagliardi 3d5d1408c7 Implemented uiPasswordEntry and uiSearchEntry on GTK+. 2016-06-05 20:54:16 -04:00
Pietro Gagliardi 4e7d2812bd Implemented uiPasswordEntry() and uiSearchEntry() on OS X. 2016-06-05 20:39:18 -04:00
Pietro Gagliardi d0be2979e4 Added Password and Search Entries. Now for the implementation. 2016-06-05 20:26:44 -04:00
Pietro Gagliardi 6ebdc96b93 Updated the README and example screenshots. Here we go for real! 2016-06-05 18:00:18 -04:00
Pietro Gagliardi eeb20c316b Fixed uiSpinbox events not working on Windows. NOW let's alpha 3.1. 2016-06-05 17:12:10 -04:00
Pietro Gagliardi 02d09bdf95 Revert "One last try to fix the OS X builder on Travis."
It didn't work :(

This reverts commit b779cddef4.
2016-06-05 16:55:37 -04:00
Pietro Gagliardi b779cddef4 One last try to fix the OS X builder on Travis. 2016-06-05 16:45:18 -04:00
Pietro Gagliardi 0ffd8badb8 Er whoops. 2016-06-05 16:39:31 -04:00
Pietro Gagliardi df5e0a3e37 Expanded the README. Let's package alpha3.1! 2016-06-05 16:34:39 -04:00
Pietro Gagliardi ea6db7d815 Statically linked MinGW-w64 libraries in those executable builds. 2016-06-05 16:23:01 -04:00
Pietro Gagliardi 538965b4ef Fixed the MinGW ABI stuff again... 2016-06-05 16:07:40 -04:00
Pietro Gagliardi 10aa198ac3 string(APPEND) is too recent for travis's cmake (or 2.8.11, for that matter). 2016-06-05 13:48:51 -04:00
Pietro Gagliardi 044e10165d Added cmake --version for debugging OS X builds. 2016-06-05 13:45:27 -04:00
Pietro Gagliardi 80a0ba1448 tester not test. 2016-06-05 13:43:18 -04:00
Pietro Gagliardi 14c8630d1c Adjusted travis.yml. 2016-06-05 13:40:32 -04:00
Pietro Gagliardi b8d9218b7f More TODOs. 2016-06-05 11:50:42 -04:00
Pietro Gagliardi b21ef44a05 Defaulted to debug mode. 2016-06-05 10:43:04 -04:00
Pietro Gagliardi dac8aea49a Removed now-irrelevant stuff. 2016-06-05 00:20:22 -04:00
Pietro Gagliardi acbeb86c7f Pruned out and merged in th erest of the migrate_build files. 2016-06-04 18:52:40 -04:00
Pietro Gagliardi 0bca3e21da Even more old build tools removal. Next will be a one-fell-swoop thing. 2016-06-04 15:52:55 -04:00
Pietro Gagliardi d57035e59d More deleting old build systems. 2016-06-04 15:49:43 -04:00
Pietro Gagliardi cb5fa98e75 Let's start removing the old files, putting in any missed bells and whistles. 2016-06-04 15:40:59 -04:00
Pietro Gagliardi fac03b050b More TODOs. 2016-06-04 15:31:29 -04:00
Pietro Gagliardi cfc92c64ac Worked around the OS X issue for now. Let's go! 2016-06-04 14:59:26 -04:00
Pietro Gagliardi c31699e4cd Pinned down resource numbers now. 2016-06-04 14:36:55 -04:00
Pietro Gagliardi 66fde9ee0c More fixups to the previous commit. 2016-06-04 14:30:43 -04:00
Pietro Gagliardi 7d2f364256 Fixed Windows static linking issues. 2016-06-04 13:57:10 -04:00
Pietro Gagliardi edbbe6eb59 Removed TODO for the previous commit. 2016-06-04 00:17:19 -04:00
Pietro Gagliardi b65fb6509b More notes. 2016-06-04 00:16:37 -04:00
Pietro Gagliardi 7dcfb8c6c3 Reworked how _UI_EXTERN works to allow MinGW static linking on Windows. 2016-06-03 22:19:33 -04:00
Pietro Gagliardi abcf1edf43 Re-added OS X file. Now to just prune everything again. 2016-06-03 21:48:10 -04:00
Pietro Gagliardi bbb8791a47 More Unix fixes. 2016-06-03 21:28:39 -04:00
Pietro Gagliardi 5c01a8dec3 Re-added the Unix stuff. 2016-06-03 21:14:55 -04:00
Pietro Gagliardi 838851f55a Started the gcc stuff. Doesn't work on Windows; too much to fix. 2016-06-03 20:26:58 -04:00
Pietro Gagliardi 0d88e5eb8b More cmake work. That's enough of Visual Studio for now. 2016-06-03 19:25:43 -04:00
Pietro Gagliardi a3fe7edf3b More cmake work. 2016-06-03 18:28:14 -04:00
Pietro Gagliardi 05b542182a More cmake stuff. MSVC shared builds work as we want them to so far (mostly). 2016-06-03 17:30:00 -04:00
Pietro Gagliardi 44b4d24881 Started a new cmake file. Seems to work so far... 2016-06-03 14:56:21 -04:00
Pietro Gagliardi 089793e25d Restored unmodified GNU make files. 2016-06-03 10:29:54 -04:00
Pietro Gagliardi 1903115bbd Pushed all the build files elsewhere. I'm rewriting the CMakeLists files from scratch. 2016-06-03 00:29:31 -04:00
Pietro Gagliardi 14f5d5388a Tried harder with the CMake lists. Still no go. They should probably be rewritten again... 2016-06-02 17:28:51 -04:00
Pietro Gagliardi da8649312e More cmake work. Better, but not all there. 2016-06-02 12:52:32 -04:00
Pietro Gagliardi 2d1b6093f0 More CMake Windows fixes. 2016-06-02 00:52:29 -04:00
Pietro Gagliardi 2ef3dafbc6 Fixed more Windows bits. 2016-06-02 00:23:42 -04:00
Pietro Gagliardi 1dbbab50a5 More Windows work. 2016-06-01 22:18:40 -04:00
Pietro Gagliardi ee373a94d6 Started the Windows cmake stuff and tried to get it to work on MinGW again. 2016-06-01 21:45:39 -04:00
Pietro Gagliardi e4a66b786e Fixed static builds, added GTK+ builds, and cleaned out things in general for cmake. 2016-06-01 20:21:10 -04:00
Pietro Gagliardi 7bdeefedeb More cmake setup. Now we can start the Unix tests, which we should have ready to go as-is... 2016-06-01 14:50:35 -04:00
Pietro Gagliardi 81c555ea3b Added the examples CMakeLists.txt. 2016-06-01 14:42:24 -04:00
Pietro Gagliardi 08c06f24c0 Added the test program to the CMake setup. 2016-06-01 14:07:43 -04:00
Pietro Gagliardi 0fff9c6fd6 More CMake work. Thanks to Mr-Hide in irc.freenode.net/#cmake. 2016-06-01 12:48:26 -04:00
Pietro Gagliardi ec730962aa More work with cmake. 2016-05-31 11:10:35 -04:00
Pietro Gagliardi fcec2b87e5 Started refactoring the cmake file again. 2016-05-31 09:12:45 -04:00
Pietro Gagliardi 0b5fbb81c9 Merge pull request #86 from joaoventura/master
Declare 10.9 version in Darwin
2016-05-31 08:19:26 -04:00
Pietro Gagliardi aa28904408 Removed the -DMACOSX_DEPLOYMENT_TARGET; this is an env var, not a macro. Thanks to Psy in irc.freenode.net/#macdev. 2016-05-30 22:26:08 -04:00
Pietro Gagliardi 517661f935 More cmake work. 2016-05-30 21:32:38 -04:00
Pietro Gagliardi cec5df44c1 Added wscript. 2016-05-30 18:51:34 -04:00
Pietro Gagliardi 3f3c6fc09b More cmake work. Enough for now; let's try another one to see if it's any better. 2016-05-30 15:40:44 -04:00
Pietro Gagliardi 308d0eca88 Even more cmake work. 2016-05-30 14:32:05 -04:00
Pietro Gagliardi ee8b4f71c0 More cmake work. 2016-05-30 13:28:27 -04:00
Pietro Gagliardi 0fc4ff588f Added a preliminary CMakeLists.txt. This might be the one I go with. 2016-05-30 12:00:08 -04:00
João Ventura f779978a42 Declare 10.9 version in Darwin
Fixes compilation issues in Mavericks
2016-05-30 13:06:25 +01:00
Pietro Gagliardi 8247bc2b2b Alpha 3 release. 2016-05-29 22:38:29 -04:00
Pietro Gagliardi 708d8f38e9 Don't use -fPIC on static builds. 2016-05-29 22:02:49 -04:00
Pietro Gagliardi 2ed29a7fa0 More stuff. Screw this; releasing as is. 2016-05-29 21:13:03 -04:00
Pietro Gagliardi a226c80993 More TODO resolution and elimination and delegation and explanation. 2016-05-29 19:55:53 -04:00
Pietro Gagliardi 0738eca6e4 More work. 2016-05-29 19:01:48 -04:00
Pietro Gagliardi efc1e55e58 More OS X spinbox stuff. 2016-05-29 18:40:53 -04:00
Pietro Gagliardi 473e3b593b Quick README fix. 2016-05-29 18:36:11 -04:00
Pietro Gagliardi be8a957689 Fixed static linking on Windows. 2016-05-29 18:35:06 -04:00
Pietro Gagliardi 56cb25b230 Started Windows TODO resolution. 2016-05-29 13:07:48 -04:00
Pietro Gagliardi e114502605 Tried to set up Windows static linking. 2016-05-29 12:00:55 -04:00
Pietro Gagliardi 52917c7e71 Added static linking to the test program. 2016-05-29 04:57:06 -04:00
Pietro Gagliardi d88233a0fb Documentation updates. 2016-05-29 04:53:49 -04:00
Pietro Gagliardi f2e8dab465 Merge pull request #69 from pcwalton/static
Add support for static linking.
2016-05-29 04:50:48 -04:00
Pietro Gagliardi 84d3df031f Either solved, dropped, or relegated to LONGTERM many of drawtext.m's TODOs. 2016-05-28 23:37:07 -04:00
Pietro Gagliardi 58d59f4370 Cleaned up events and proper string manipulation on uiMultilineEntry on OS X. Woo! 2016-05-28 23:08:56 -04:00
Pietro Gagliardi 0c85469e52 More TODO and intrinsic size work. 2016-05-28 22:49:27 -04:00
Pietro Gagliardi 1e8a90d9a2 Eschewed chronological order in ui.h for logical order. 2016-05-28 22:35:40 -04:00
Pietro Gagliardi c99ad0f0c5 10.8 build fix. 2016-05-28 21:50:24 -04:00
Pietro Gagliardi ae0dcada45 More TODO resolution work. 2016-05-28 21:41:07 -04:00
Pietro Gagliardi b130ddc04b Added a test of having multiple uiRadioButtons in the same parent container and started a test of intrinsic sizes of all non-container controls. 2016-05-28 21:29:00 -04:00
Pietro Gagliardi 6e94671782 More TODO resolution and LONGTERM relegation. 2016-05-28 21:17:54 -04:00
Pietro Gagliardi a0084df23a Completely redid creating uiMultilineEntry on OS X. Much better now :D 2016-05-28 19:29:25 -04:00
Pietro Gagliardi eb4bc4bfb5 Added NSTextView attributes. Let's fix uiMultilineEntry! 2016-05-28 18:59:20 -04:00
Pietro Gagliardi 42d837806d More stale and duplicate TODO removal. 2016-05-28 18:16:13 -04:00
Pietro Gagliardi eb11452dd3 More TODO resolution. Some TODOs were moved to the issue tracker. 2016-05-28 18:01:25 -04:00
Patrick Walton 5f1e8fa601 Add support for static linking.
Use `make STATIC=1` to build a static library.

Some language ecosystems, like those of Rust, have a convention of
static linking in order to make binaries easier to distribute. In those
environments, this feature helps libui fit in more easily.

In order to prevent internal symbols from linking, we first create an
intermediate object file with `ld -r` and strip private symbols from it
before using `ar` to create the library.
2016-05-28 14:46:02 -07:00
Pietro Gagliardi 18a84988fd Moved sv/ into _wip/. 2016-05-28 17:41:50 -04:00
Pietro Gagliardi ec4efe027b Some TODO resolution. 2016-05-28 17:36:31 -04:00
Pietro Gagliardi 1f9f317e7a More TODOs. 2016-05-28 17:04:28 -04:00
Pietro Gagliardi 52c3c52b56 Removed a TODO I can no longer fully confirm (only the focus rect of the NSComboBox seems to be clipped, which I'm sure is not my bug). 2016-05-28 16:09:07 -04:00
Pietro Gagliardi a6c48e087b 10.8 fixups. 2016-05-28 15:57:01 -04:00
Pietro Gagliardi e45e0e89e9 More notes. 2016-05-28 13:19:10 -04:00
Pietro Gagliardi dbf8316e9e More notes. 2016-05-28 13:13:38 -04:00
Pietro Gagliardi 0d6dac5c5a Migrated from GTK+ 3.4 to 3.10 and from OS X 10.7 to 10.8. 2016-05-28 13:06:16 -04:00
Pietro Gagliardi ba97455ab3 Stale TODO removal. 2016-05-28 12:40:30 -04:00
Pietro Gagliardi 3d9d782db3 Implemented enabling/disabling on uiArea on OS X. 2016-05-28 12:32:47 -04:00
Pietro Gagliardi 4c98fda7ff Added Enable/Disable buttons to page 6. 2016-05-28 11:36:16 -04:00
Pietro Gagliardi 119825f0de More scroll view refinements. 2016-05-28 00:35:56 -04:00
Pietro Gagliardi c74ac88598 Changed uiArea to use the new scroll view stuff on OS X. 2016-05-28 00:21:30 -04:00
Pietro Gagliardi 923a678e87 Integrated the new scrollview stuff with uiMultilineEntry. Nice and stable now :D 2016-05-27 23:56:44 -04:00
Pietro Gagliardi 34d54f29b4 Started cleaning up all the NSScrollView stuff into its own file so it can be reused. 2016-05-27 23:42:05 -04:00
Pietro Gagliardi 46f6f2aac1 Updated bindings list. 2016-05-27 22:32:24 -04:00
Pietro Gagliardi d39cd76a8a Quick fixup. 2016-05-27 12:25:26 -04:00
Pietro Gagliardi e2266ab577 More NSScrollView auto layout fixes. 2016-05-27 12:18:35 -04:00
Pietro Gagliardi b65175a19c Refactored NSScrollView auto layout stuff. I should probably just split it into a separate file when I do implementt he shared scrollview source code. 2016-05-27 01:13:45 -04:00
Pietro Gagliardi 3adb485c66 More old WIP file removal. 2016-05-26 23:50:54 -04:00
Pietro Gagliardi 59f4c8a460 Removed old NSTextView files. I'll rebuild this myself. 2016-05-26 23:49:19 -04:00
Pietro Gagliardi 221d57cac5 More unnecessary TODO removal. Thanks to swillits in irc.freenode.net/#macdev. 2016-05-26 23:43:51 -04:00
Pietro Gagliardi 386c9b57e6 Removed timestamps. 2016-05-26 22:52:07 -04:00
Pietro Gagliardi 325a288029 More scroll view parameters. 2016-05-26 22:44:55 -04:00
Pietro Gagliardi 5040af30dd Really calculated info about scrollviews this time. 2016-05-26 22:42:35 -04:00
Pietro Gagliardi f8311aa14d More TODO resolution. 2016-05-26 22:00:08 -04:00
Pietro Gagliardi b082f69e3f More TODOs. 2016-05-26 21:27:13 -04:00
Pietro Gagliardi 834cc12299 Named the margins and padding. Made them functions that can take parameters in the future to allow more complex spacing options in the future. 2016-05-26 21:25:32 -04:00
Pietro Gagliardi baf46c5434 Removed an unnecessary TODO; mapTables cannot be freed unless empty anyway. 2016-05-26 21:09:42 -04:00
Pietro Gagliardi 88e0a9c165 Fixed the botched formula for attribute substring length on OS X. 2016-05-26 20:48:49 -04:00
Pietro Gagliardi 3896861f39 Added another facet to page 10's tests: whether the letter after the combined one gets colored. 2016-05-26 17:44:35 -04:00
Pietro Gagliardi 0b7b9a94e7 More bindings stuff. 2016-05-25 23:35:09 -04:00
Pietro Gagliardi 965c2712e4 Updated bindings list based on wiki. 2016-05-25 23:18:21 -04:00
Pietro Gagliardi c856ff1976 Merge branch 'master' of github.com:andlabs/libui 2016-05-25 23:14:05 -04:00
Pietro Gagliardi daabfe3653 Merge pull request #61 from kainjow/osx-memory
Fix additional OS X memory management issues
2016-05-25 23:12:44 -04:00
Pietro Gagliardi d7b537e9ed Came to a consensus about combobox fonts on OS X. 2016-05-25 21:37:45 -04:00
Pietro Gagliardi cb98f4cc45 Merge pull request #70 from mogucpp/master
fix header name
2016-05-25 21:22:29 -04:00
mogucpp 01e126f9cc fix header name 2016-05-26 09:17:34 +08:00
Pietro Gagliardi 5272e749c0 Fixed grapheme stuff on GTK+. 2016-05-25 15:07:32 -04:00
Pietro Gagliardi ac652f0690 Did most of the work for grapheme cluster boundary based text layout characters on GTK+. 2016-05-25 01:52:53 -04:00
Pietro Gagliardi a8aa842172 More TODOs. 2016-05-25 01:15:43 -04:00
Pietro Gagliardi 474d3fb1d5 Oops, forgot to free something in the previous commit. 2016-05-25 01:10:47 -04:00
Pietro Gagliardi 47632fe560 Switched text layout attributes to grapheme-based indices on Windows, just like on OS X. 2016-05-25 01:08:55 -04:00
Pietro Gagliardi 278227a3d7 More announcements. 2016-05-24 23:27:56 -04:00
Kevin Wojniak bef8c4663f Fix additional OS X memory management issues
Some of these were found via clang's analyzer
2016-05-24 20:17:08 -07:00
Pietro Gagliardi ff1971d8d6 More longterming. 2016-05-24 23:13:44 -04:00
Pietro Gagliardi 31d6939c48 README updates. 2016-05-24 22:46:53 -04:00
Pietro Gagliardi 558e56c124 Implemented uiMainStep() on OS X. 2016-05-24 22:44:40 -04:00
Pietro Gagliardi 8bf24cb791 Implemented uiMainStep() on GTK+. 2016-05-24 22:29:33 -04:00
Pietro Gagliardi a9e731ed59 Added uiMainStep() and implemented it on Windows. 2016-05-24 22:14:05 -04:00
Pietro Gagliardi c349edda5e Merge branch 'master' of github.com:andlabs/libui 2016-05-24 21:37:25 -04:00
Pietro Gagliardi 890643c5b2 Merge pull request #60 from kainjow/osx-test-crash
Fix test crash on exit on OS X
2016-05-24 21:36:57 -04:00
Pietro Gagliardi 45edacf8ca Consolidated GetAncestor() calls again. 2016-05-24 21:18:29 -04:00
Kevin Wojniak 7fdcbb5365 Fix test crash on exit on OS X 2016-05-24 12:24:54 -07:00
Pietro Gagliardi 095e08bc79 Added uiEditableCombobox on Windows. 2016-05-24 10:06:24 -04:00
Pietro Gagliardi ce338bcaaf Quick fix. 2016-05-24 01:41:54 -04:00
Pietro Gagliardi e8cedf502f Split uiCombobox on GTK+. 2016-05-24 01:35:05 -04:00
Pietro Gagliardi b9bc71a9ba Clarified some stuff in darwin/editablecombo.m. 2016-05-24 01:19:57 -04:00
Pietro Gagliardi 18f225fddb Merge branch 'master' of github.com:andlabs/libui 2016-05-24 01:04:25 -04:00
Pietro Gagliardi ea6bef5146 Merge pull request #58 from kainjow/osx-mapTable-leak-crash
Fix crash when closing program on OS X
2016-05-24 01:04:12 -04:00
Pietro Gagliardi 3272515de6 Merge branch 'master' of github.com:andlabs/libui 2016-05-24 00:58:33 -04:00
Pietro Gagliardi 275c818868 Merge pull request #57 from kainjow/travis-osx
Enable OS X Travis tests
2016-05-24 00:57:48 -04:00
Kevin Wojniak 49e17cbfd7 Fix "attempt to destroy map with items inside" when menuManager is deallocated
Fixes #58. The map needs to have its contents properly freed which requires releasing the properly retaining the NSMenuItem object.
2016-05-23 21:41:52 -07:00
Kevin Wojniak abb3c39c78 Spaces to tabs 2016-05-23 21:11:12 -07:00
Kevin Wojniak 2ebb9052cc Fix crash when closing program on OS X
This fixes #14. Autorelease pools need to be used to make sure objects get properly released. Unfortunately this produces a new error when menuManager gets deallocated, which I am looking at fixing:

map.m:25:mapDestroy() POSSIBLE IMPLEMENTATION BUG; CONTACT ANDLABS:
attempt to destroy map with items inside
2016-05-23 21:09:46 -07:00
Kevin Wojniak ab35ae254f Enable OS X Travis tests 2016-05-23 20:18:41 -07:00
Pietro Gagliardi 363916855c Split uiCombobox on OS X. 2016-05-23 18:50:02 -04:00
Pietro Gagliardi 996ba99b0f Began uiEditableCombobox splitting. 2016-05-23 17:41:37 -04:00
Pietro Gagliardi a571bd4779 Added a composed character test to page 10. 2016-05-23 08:11:22 -04:00
Pietro Gagliardi 156c3584f7 Documentation update. 2016-05-23 01:12:52 -04:00
Pietro Gagliardi 5d63fe4cec Fixed surrogate pair drawing on OS X. 2016-05-23 01:11:43 -04:00
Pietro Gagliardi e3bcf31764 More TODO resolution. 2016-05-23 00:41:56 -04:00
Pietro Gagliardi 399af0319c Whoops, forgot the date 2016-05-22 23:30:22 -04:00
Pietro Gagliardi 268bdbcb34 More announcements. 2016-05-22 23:28:17 -04:00
Pietro Gagliardi 0e5e37f98b Fixed multilne entry changed events on GTK+. 2016-05-22 23:14:33 -04:00
Pietro Gagliardi 60627e13a1 Fleshed out page 12. 2016-05-22 23:05:37 -04:00
Pietro Gagliardi 4ab0d9c1f6 More TODO resolution. 2016-05-22 22:57:18 -04:00
Pietro Gagliardi a99a81f584 Answered matrix scaling stuff. https://www.willamette.edu/~gorr/classes/GeneralGraphics/Transforms/transforms2d.htm#Combining 2016-05-22 22:52:29 -04:00
Pietro Gagliardi b66be0bf2d Stale TODO removal. Expanded page 9 to also show the positions of the second line. 2016-05-22 20:49:16 -04:00
Pietro Gagliardi 9b4a13e9b3 Some more TODO resolution in the GTK+ backend. 2016-05-22 20:35:40 -04:00
Pietro Gagliardi 61185072f7 More TODO -> LONGTERM migration. Also made it so uiSpinbox and uiSlider merely swap min and max if min is larger. 2016-05-22 20:11:52 -04:00
Pietro Gagliardi ab0a9102b4 Added a user bug for calling SetParent() on a uiWindow. 2016-05-22 20:02:47 -04:00
Pietro Gagliardi b957558ef4 Even more TODO resolution in uiDateTimePicker on GTK+. 2016-05-22 19:40:56 -04:00
Pietro Gagliardi f0011d6227 Started resolving TODOs in the GTK+ backend, marking some LONGTERM. In particular, uiDateTimePicker no longer will be localized, as there doesn't seem to be a way to get that info out. 2016-05-22 19:17:42 -04:00
Pietro Gagliardi a641a7eda8 Some TODO cleanup. Started changing long-term TODOs to say LONGTERM instead. 2016-05-22 18:37:53 -04:00
Pietro Gagliardi b73a96ad27 More TODOs. 2016-05-22 17:49:41 -04:00
Pietro Gagliardi 6d421e9349 Implemented a test of non-BMP characters that need surrogate pairs on UTF-16-based systems on test page 10. 2016-05-22 17:01:18 -04:00
Pietro Gagliardi ea37e13c67 Quick README clarification. 2016-05-22 16:19:19 -04:00
Pietro Gagliardi 878778c683 Implemented WM_PRINTCLIENT for uiArea and the Direct2D scratch windows. 2016-05-22 16:16:20 -04:00
Pietro Gagliardi 585872839d Made uiColorButton on Windows draw with actual alpha values. 2016-05-22 16:07:31 -04:00
Pietro Gagliardi 531f8ea19c Finally wrote makeDCRenderTarget() for the Windows backend. Now to use it. 2016-05-22 15:59:23 -04:00
Pietro Gagliardi 44cdc82fc7 Adjusted the intrinsic size of NSColorWell. 2016-05-22 14:55:12 -04:00
Pietro Gagliardi bbae4478f6 More TODOs. 2016-05-22 14:41:42 -04:00
Pietro Gagliardi d9f133d81b Fixed the README. 2016-05-22 14:39:14 -04:00
Pietro Gagliardi 6c6843dac6 Fixed non-wrapping uiMultlineEntries. 2016-05-22 14:37:02 -04:00
Pietro Gagliardi 07cd03452d Implemented non-wrapping multiline entries in GTK+ and started implementing them in OS X. 2016-05-22 14:20:54 -04:00
Pietro Gagliardi 313ce47833 Started non-wrapping multiline entries. Implemented on Windows. 2016-05-22 13:56:36 -04:00
Pietro Gagliardi f3dad94039 Added CRLF translation to uiMultilineEntry on Windows. More TODOs. 2016-05-22 13:42:37 -04:00
Pietro Gagliardi d060744f87 Some TODO resolution. 2016-05-22 13:09:13 -04:00
Pietro Gagliardi 3705ef05d1 Fixed up uiWindow ownership mechanics in the Darwin backend. 2016-05-22 12:15:50 -04:00
Pietro Gagliardi 5a4b6aa6f0 Switched from using M_PI to a named constant uiPi. 2016-05-22 12:00:44 -04:00
Pietro Gagliardi 1d8ea79e45 Removed uiControlVerifyDestroy(); we could have just had it in uiFreeControl(). 2016-05-22 01:07:25 -04:00
Pietro Gagliardi 1c2acf59a3 Implemented uiControlDestroy() for uiRadioButtons on GTK+. Fixes #40. 2016-05-21 22:42:55 -04:00
Pietro Gagliardi 5891b764cb Forgot to take a reference on GtkWindows; this led to weird GObject warnings on the command line when closing a window. Update #40. 2016-05-21 22:36:21 -04:00
Pietro Gagliardi a8fe3004a3 Fixed uiRadioButtons rendering on Windows. 2016-05-21 22:17:29 -04:00
Pietro Gagliardi 772caf19f3 Link to issue because for some reason github doesn't auto-link. 2016-05-21 18:09:09 -04:00
Pietro Gagliardi da9ee6a913 Vast README updates. 2016-05-21 18:07:36 -04:00
Pietro Gagliardi f5aa8cd32d Consistency: calibrated color space -> sRGB color space. 2016-05-21 11:34:30 -04:00
Pietro Gagliardi 7b04d974ac More OS X 10.7 fixes and TODOs. 2016-05-21 11:28:11 -04:00
Pietro Gagliardi 2c0e333ca0 Converted uiRadioButtons on OS X to use a NSView of NSButtons instead of NSMatrix; the latter was deprecated on 10.8 and has lots of little quirks that made it annoying to use. 2016-05-21 02:00:08 -04:00
Pietro Gagliardi 46a280cf46 More TODOs. 2016-05-20 15:07:10 -04:00
Pietro Gagliardi 6575f44818 Removed some dummy debug code. Fixes #24. Fixes #33. 2016-05-20 15:06:02 -04:00
Pietro Gagliardi 33f4a427c3 Added a uiColorButton to the control gallery. 2016-05-18 14:40:03 -04:00
Pietro Gagliardi de1571cd1f And implemented the opacity slider. We're done with this dialog! 2016-05-18 00:46:14 -04:00
Pietro Gagliardi 341f8373d3 Implemented the previewer. That just leaves the opacity slider! 2016-05-18 00:20:41 -04:00
Pietro Gagliardi 22a1525d24 Implemented the grid-drawing function. Now we can write the other two views. 2016-05-17 22:55:35 -04:00
Pietro Gagliardi b226288584 Implemented the H slider. 2016-05-17 20:46:28 -04:00
Pietro Gagliardi bc69da86af Implemented the hex entry. That just leaves the other Direct2D views! 2016-05-17 17:41:38 -04:00
Pietro Gagliardi 70635858bd Implemented the integer entries. 2016-05-17 17:00:00 -04:00
Pietro Gagliardi d42864c696 Implemented the other double entry fields and drawing alpha on the SV chooser. 2016-05-17 16:46:47 -04:00
Pietro Gagliardi 571faf9582 Implemented mouse control of the SV area; updated the color button immediately after a change. 2016-05-17 14:44:57 -04:00
Pietro Gagliardi 9654ca793d Changed the color dialog to edit HSV instead of RGB. This fixes issues with conversion that we had in the previous commit. The real question: will this break entering RGB values? 2016-05-17 13:52:56 -04:00
Pietro Gagliardi d892a8f710 Started making the color dialog editable. I'm going to have to store HSV and alpha instead of RGB and alpha... 2016-05-17 13:44:14 -04:00
Pietro Gagliardi 7c34acc2b7 And an itoutf16() too, because why not. Okay, NOW for updating the labels. 2016-05-17 12:44:43 -04:00
Pietro Gagliardi 8a1fe1f48a And added a proper invalidateRect(). 2016-05-17 12:41:41 -04:00
Pietro Gagliardi 473e0c9b69 Actually first let's do event handling. This adds a ftoutf16() function we can use here. 2016-05-17 12:35:44 -04:00
Pietro Gagliardi 027bb6782b Drew the marker on the color panel. Now for the hue slider. 2016-05-17 12:18:36 -04:00
Pietro Gagliardi 3128e58c5b Started drawing the SV chooser part of the Windows color dialog. 2016-05-16 23:54:28 -04:00
Pietro Gagliardi 2c160bb5eb Started work on the color dialog itself; positioned controls correctly to start. 2016-05-16 19:28:30 -04:00
Pietro Gagliardi 4b4a5c335f Laid out the Windows color dialog. 2016-05-16 17:07:30 -04:00
Pietro Gagliardi 6e7a74928d More TODOs. 2016-05-16 14:00:37 -04:00
Pietro Gagliardi 475326b111 Started implementing uiColorButton on Windows. This implements the color button itself. 2016-05-16 13:59:11 -04:00
Pietro Gagliardi 0ede964a3d TODO updates. 2016-05-16 09:58:16 -04:00
Pietro Gagliardi 695bca9033 Tested the worksWhenModal stuff for NSColorPanel; it works. 2016-05-16 09:40:02 -04:00
Pietro Gagliardi b47689090e Implemented uiColorButton on GTK+. 2016-05-15 23:18:11 -04:00
Pietro Gagliardi a038923060 Added a color well to the histogram example. 2016-05-15 21:02:35 -04:00
Pietro Gagliardi bf411e787e Implemented uiColorButton on OS X. 2016-05-15 20:51:33 -04:00
Pietro Gagliardi 68ad5f53fa Added uiColorButton. Let's implement this on OS X first. 2016-05-15 20:06:57 -04:00
Pietro Gagliardi 2226c54430 Made the font dialog respect our new modality rules on OS X. 2016-05-15 19:56:01 -04:00
Pietro Gagliardi 1db3027619 Finished the re-disabling of all windows on Windows dialogs. 2016-05-15 19:38:45 -04:00
Pietro Gagliardi 6a81921c1a More TODOs. 2016-05-15 19:26:58 -04:00
Pietro Gagliardi 1d08521cb7 Started reimplementing the old dialog helper stuff. Now that we're C++ on Windows, we can do this directly in window.cpp and save time. 2016-05-15 19:22:15 -04:00
Pietro Gagliardi c82942a81b More TODO stuff. 2016-05-15 19:15:00 -04:00
Pietro Gagliardi f855453aab More TODOs. 2016-05-15 19:06:20 -04:00
Pietro Gagliardi 0552e7c4a1 Revert "Made other windows get events when a dialog is running on OS X. Of course I only now realize this creates a recursiion problem..."
This isn't going to work. The only real solution is to disable every window like we're already doing here, make sure it happens on GTK+, and re-add the dialog helper stuff on Windows.

This reverts commit 20994639c0.
2016-05-15 19:04:35 -04:00
Pietro Gagliardi 52fff1520d Disabled page 11 for now. 2016-05-15 16:34:14 -04:00
Pietro Gagliardi 20994639c0 Made other windows get events when a dialog is running on OS X. Of course I only now realize this creates a recursiion problem... 2016-05-15 16:26:43 -04:00
Pietro Gagliardi 2f2db46109 Reverted the uiTab changes to allow NULL. Still debating whether to allow NULL or not. 2016-05-15 13:56:53 -04:00
Pietro Gagliardi 717486b7a2 Fixed some OS X 10.7 build errors. 2016-05-14 23:44:07 -04:00
Pietro Gagliardi 2c692eda36 More TODOs. 2016-05-14 22:10:43 -04:00
Pietro Gagliardi fd9f6cea6a Allowed uiGroups and uiTabs to have no and NULL controls with defined behavior on OS X. Actually added the test code this time. 2016-05-14 22:09:02 -04:00
Pietro Gagliardi 0e785d886b Started tests for truly empty uiGroups and uiTabs; started banning NULL in uiBox. 2016-05-14 21:53:24 -04:00
Pietro Gagliardi 79a522efb3 More TODO resolution. Thanks to someone (mikeash?) in irc.freenode.org/#macdev. 2016-05-14 21:29:44 -04:00
Pietro Gagliardi 232839020f More TODOs. 2016-05-14 11:39:51 -04:00
Pietro Gagliardi f0d6f84083 More TODOs. 2016-05-14 11:18:53 -04:00
Pietro Gagliardi 2f6329adcf Added the _UI_RELEASE macro for turning off debugging. We won't actually turn off debugging just yet. 2016-05-14 11:16:04 -04:00
Pietro Gagliardi 7ebb4cea9a Changed the release flag from NODEBUG to RELEASE. 2016-05-14 11:12:45 -04:00
Pietro Gagliardi aafb27cb2c Finished the complain() migration. 2016-05-13 23:29:41 -04:00
Pietro Gagliardi 8067dc76b7 Got rid of most of Windows's complain()s. 2016-05-13 22:53:56 -04:00
Pietro Gagliardi 6d2d977363 Cleaned up the debugging infrastructure on Windows (we stopped using the strsafe functions so there's no useful failure case anymore) and implemented the new one. 2016-05-13 22:05:02 -04:00
Pietro Gagliardi 15b370bc36 Started migrating out implbug() in the windows backend. I'm gonna need a cstrf() to go along with wstrf(). 2016-05-13 21:07:48 -04:00
Pietro Gagliardi 0205f2e5ca Got rid of complain() on GTK+. 2016-05-13 21:00:12 -04:00
Pietro Gagliardi 59eebb1e48 Cleaned up the debugging functions slightly. Now to convert the other backends. 2016-05-13 20:20:15 -04:00
Pietro Gagliardi d52c92d2f8 Cleaned out complain()s in the OS X backend. Affects everything *except* drawtext.m, which will need its own migration. 2016-05-13 20:14:46 -04:00
Pietro Gagliardi 1fede348ef More complain() migration; common/* handled. 2016-05-13 19:46:59 -04:00
Pietro Gagliardi a4f9d08281 Began replacing complain() with the more appropriate implbug() and userbug(). 2016-05-13 18:27:08 -04:00
Pietro Gagliardi 329fff82f6 Some more fixups and cleanups, especially in the matrix code. 2016-05-13 18:10:43 -04:00
Pietro Gagliardi 94587b660f Some TODO resolution and stale TODO removal. 2016-05-13 17:54:10 -04:00
Pietro Gagliardi 03337f61f1 Fixed Visual Studio 2015 builds. 2016-05-13 15:13:41 -04:00
Pietro Gagliardi 3425963606 Updated the darwin screenshot with our new Auto Layout fixes. 2016-05-13 13:36:27 -04:00
Pietro Gagliardi 8d5442b83f Fixed the last remaining edge cases. We're done! Auto Layout works~ ♫ 2016-05-13 13:28:20 -04:00
Pietro Gagliardi 8f55b7e331 Applied the previous edge case fix to the single-child layout stuff. Just one more edge case left! 2016-05-13 13:08:00 -04:00
Pietro Gagliardi 26f9d86800 Fixed Page 3's weird issues. We're so close to having this *just working*! 2016-05-13 12:54:05 -04:00
Pietro Gagliardi 73c92dfbb5 Some uiMultilineEntry fixes. 2016-05-12 21:28:30 -04:00
Pietro Gagliardi 533a9b150e More fixes, this time to uiMultilineEntry. Almost there! 2016-05-12 21:24:12 -04:00
Pietro Gagliardi b1680aa8e2 More notes. 2016-05-12 20:20:39 -04:00
Pietro Gagliardi e3f822a003 Jiggled uiTab and uiGroup back to functioning properly when initially laid out. 2016-05-12 20:18:22 -04:00
Pietro Gagliardi 19006c46c6 Even more refinements. 2016-05-12 17:23:35 -04:00
Pietro Gagliardi 257c182f2b More work. I can't figure out where these phantom constraints come from. 2016-05-12 17:09:24 -04:00
Pietro Gagliardi 897674d20f Made the queuemaintest a multithreading example, because why not. 2016-05-12 12:50:05 -04:00
Pietro Gagliardi f5549a19bf Even more work to bring us closer to the correct answer. uiGroups look right again. We've still got some problems... 2016-05-12 12:34:35 -04:00
Pietro Gagliardi 28c9efa972 Some more work, edging us ever-closer to the correct solution... 2016-05-12 12:26:43 -04:00
Pietro Gagliardi 60c988100a Some more uiBox work. We've ALMOST got it; just a few more tweaks to get groupboxes and tabs right and to fix page 3... 2016-05-12 11:57:32 -04:00
Pietro Gagliardi b564d578ba More fixes. Still not all there... 2016-05-12 02:03:23 -04:00
Pietro Gagliardi 21f9b9666b Fixed more problems. 2016-05-12 01:49:00 -04:00
Pietro Gagliardi 63dac7c13a Fixed build errors and some runtime errors. Things don't look right yet... 2016-05-12 01:31:47 -04:00
Pietro Gagliardi f66b5a8873 Migrated uiBox. Now to test. 2016-05-12 01:23:55 -04:00
Pietro Gagliardi 89425f0fa7 Finished the new uiTab. That just leaves the new uiBox. 2016-05-12 00:43:52 -04:00
Pietro Gagliardi 1f96ee9b54 Started establishing a tabPage for uiTab on OS X. The constraints code was added now, I guess. 2016-05-11 19:11:26 -04:00
Pietro Gagliardi 7d874ee911 Migrated uiGroup. Before we do uiTab, I want to refactor it a bit like we have with uiBox... 2016-05-11 18:28:42 -04:00
Pietro Gagliardi 178c0301c2 Started implementing the new logic; darwin/window.m implemented. darwin/group.m and darwin/tab.m will be similar, so they use common code here (but this is NOT child.m all over again; this is ONLY for layout!). 2016-05-11 18:06:29 -04:00
Pietro Gagliardi 73eed9289c Instituted a new system: the parent control is responsible for extra space at the edges of controls, not the controls themselves. Let's hope this works better. 2016-05-11 17:00:01 -04:00
Pietro Gagliardi 8fb8b0eeba Nuked ALL the existing Auto Layout stuff. Let's do this again, and this time, do it *right*. 2016-05-11 16:46:42 -04:00
Pietro Gagliardi d110a836ba Fixed a labelling error. 2016-05-08 14:03:59 -04:00
Pietro Gagliardi 32ef7c3fd3 Revert "Started implementing the previous commit's changes in a more permanent way: set REAL hugging priorities and implemented them on uiBox."
This reverts commit 07930279c0.
2016-05-08 11:29:09 -04:00
Pietro Gagliardi f413456b60 Revert "Did the rest of it as stubs. Now to fix issues..."
This reverts commit 854e87b90a.
2016-05-08 11:28:51 -04:00
Pietro Gagliardi b20b790254 Revert "Removed the default box hugging priorities. We'll set them in group, tab, and window."
This reverts commit a485319c8b.
2016-05-08 11:28:28 -04:00
Pietro Gagliardi a485319c8b Removed the default box hugging priorities. We'll set them in group, tab, and window. 2016-05-08 11:00:01 -04:00
Pietro Gagliardi 854e87b90a Did the rest of it as stubs. Now to fix issues... 2016-05-08 10:53:52 -04:00
Pietro Gagliardi 07930279c0 Started implementing the previous commit's changes in a more permanent way: set REAL hugging priorities and implemented them on uiBox. 2016-05-08 10:42:20 -04:00
Pietro Gagliardi 8867742ec0 Found a possible solution! Needs fine-tuning. 2016-05-08 02:54:08 -04:00
Pietro Gagliardi 2aef3031e3 More TODOs. 2016-05-07 10:47:59 -04:00
Pietro Gagliardi f8b113dd18 Fixed the controlgallery somehow. 2016-05-07 10:43:12 -04:00
Pietro Gagliardi 11ef2c9076 Got rid of the messy -layout logic and just did that stuff in -updateConstraints instead; much simpler that way. Thanks to rudy in irc.freenode.net/#macdev. 2016-05-07 10:31:56 -04:00
Pietro Gagliardi e6592f6f04 More TODOs. 2016-05-07 10:07:37 -04:00
Pietro Gagliardi b03aa35da8 Adjusted uiGroup, uiTab, and uiWindow likewise. More TODOs. 2016-05-07 01:34:33 -04:00
Pietro Gagliardi 305b4b98cb Fixed up darwin/box.m and let it work properly. Now to just define the appropriate methods for the other controls... 2016-05-07 01:25:32 -04:00
Pietro Gagliardi abe502a046 Rewrote uiBox with everything in it. Let's test it so far. 2016-05-07 01:11:58 -04:00
Pietro Gagliardi ecd1ef2231 Started work on rewriting uiBox. 2016-05-06 23:27:46 -04:00
Pietro Gagliardi c04abae6e4 First part: get rid of noStretchyView. We won't need it anymore. 2016-05-06 23:03:31 -04:00
Pietro Gagliardi a3629e752d Added default implementations of the new methods where necessary. Before we go around implementing them, it's time for a massive rewrite of uiBox. 2016-05-06 21:50:14 -04:00
Pietro Gagliardi c9998fcd05 Set up a system to do what we need. 2016-05-06 21:13:36 -04:00
Pietro Gagliardi f9e3b7a2d5 Okay we've got a handle on how this is supposed to work now I think; I just need to figure out how to abstract out this should-expand behavior... 2016-05-06 20:55:33 -04:00
Pietro Gagliardi e462c7a660 Okay I think we're on to something now... 2016-05-06 20:34:02 -04:00
Pietro Gagliardi 117b8c92d2 Tried to change uiBox to use updateConstraints instead of a relayout() function. Maybe this will end my woes... 2016-05-06 19:21:41 -04:00
Pietro Gagliardi 885e7157d7 Removed the old osxaltest. Not needed now. I'll just design grids against master. 2016-05-06 17:49:09 -04:00
Pietro Gagliardi ac3ee981b3 More TODO work. 2016-05-06 16:12:56 -04:00
Pietro Gagliardi 9e0ff2e000 Some TODO resolution in the Windows backend. 2016-05-06 16:06:55 -04:00
Pietro Gagliardi 4444b79c30 Migrated windows/drawmatrix.cpp to use d2d1helper.hpp. 2016-05-06 11:44:48 -04:00
Pietro Gagliardi 4b3084c2fe Fixed up windows/drawtext.cpp. 2016-05-06 10:31:01 -04:00
Pietro Gagliardi 725a97faba More TODOs. 2016-05-05 21:57:20 -04:00
Pietro Gagliardi 9d2b637aa2 FINALLY got rid of ptrArray. Woo! 2016-05-05 21:51:14 -04:00
Pietro Gagliardi 02fbb5a559 A lot more drawing migration on Windows. With that done, though, we can finally do this... 2016-05-05 21:49:50 -04:00
Pietro Gagliardi 515c8398c0 Started doing the whole split apart thing to the Windows backend. 2016-05-05 20:23:52 -04:00
Pietro Gagliardi 4e53551e06 Split unix/draw.c into a bunch of smaller files. 2016-05-05 18:23:54 -04:00
Pietro Gagliardi 45dd9416d3 Moved some stuff out of the way. 2016-05-05 17:59:33 -04:00
Pietro Gagliardi eff0532760 Some TODO resolution/stale TODO elimination. 2016-05-05 17:58:26 -04:00
Pietro Gagliardi faeae31acc Cleaned up unix/box.c and made it not use struct child or ptrArray. 2016-05-05 14:04:07 -04:00
Pietro Gagliardi f10c760b00 More TODOs. 2016-05-04 23:41:25 -04:00
Pietro Gagliardi 440e8fa47f Integrated the GTK+ date/time picker. FINALLY! 2016-05-04 23:35:11 -04:00
Pietro Gagliardi a11e939b34 Wrote the finishing touches on the dptwidget.c needed for the final date-time picker. 2016-05-04 23:28:46 -04:00
Pietro Gagliardi 0942888b4a Set the current time on the date-time picker. I think we're good for now... 2016-05-04 23:18:48 -04:00
Pietro Gagliardi f0dc52d1dc Further GTK+ date/time picker refinement and bugfixes. 2016-05-04 21:33:32 -04:00
Pietro Gagliardi 8b7d661405 Refined the spinbox behavior some more. We are close to pushing this in main! 2016-05-04 20:17:15 -04:00
Pietro Gagliardi d6b2aeebbe More date/time picker work. Getting closer to stable. 2016-05-04 18:16:38 -04:00
Pietro Gagliardi 6d65718376 More dtpwidget.c work. 2016-05-04 14:24:52 -04:00
Pietro Gagliardi 75bee77cb6 More refinement. 2016-05-03 20:57:14 -04:00
Pietro Gagliardi a1a036eeed Started pulling everything together. 2016-05-03 20:04:29 -04:00
Pietro Gagliardi 4795e73f64 Formatted the spinbuttons nicely in the gtkdtp. Problem: both comboboxes and radiobuttons require grab! What do we do... 2016-05-03 17:12:22 -04:00
Pietro Gagliardi 218a50a2b1 More dtp work. I think we're good enough to start putting all the pieces together... 2016-05-03 16:10:35 -04:00
Pietro Gagliardi afac890502 More work on the GTK+ date-time picker. It now pops up like a combobox! 2016-05-03 12:34:11 -04:00
Pietro Gagliardi ac84b66724 Separated the presence of a no-stretchy view from the presence of a stretchy control. This will make experimenting easier. 2016-05-02 15:47:48 -04:00
Pietro Gagliardi 09a7fb7123 Decided not to do the drag/drop for our font button; I don't know what even provides a NSFont source, but the font panel does not. 2016-05-02 13:30:24 -04:00
Pietro Gagliardi b6a396dd4a Deactivated the current font button on window close and implemented cleanup, both on OS X. 2016-05-02 10:32:39 -04:00
Pietro Gagliardi c5f6a09200 More auto layout commentary. 2016-05-01 16:26:04 -04:00
Pietro Gagliardi 896a779e1e More auto layout fixes and hacks and TODOs. 2016-05-01 16:25:05 -04:00
Pietro Gagliardi 8efa8c19db Minor warning changes. 2016-05-01 16:15:54 -04:00
Pietro Gagliardi de4540dfca Some comment explanation. 2016-05-01 12:02:36 -04:00
Pietro Gagliardi 896c2590c5 FIxed the various uiGroup glitches. Woo! 2016-05-01 12:00:10 -04:00
Pietro Gagliardi 022f0a2591 More TODOs. 2016-05-01 11:43:34 -04:00
Pietro Gagliardi aecbf078d3 Fixed some of the uiBox glitches. 2016-05-01 11:25:35 -04:00
Pietro Gagliardi b653a8ac2c Fixed runtime errors. It MOSTLY works! 2016-04-30 18:40:09 -04:00
Pietro Gagliardi 1038b8d892 Compile fixes. Oh boy... 2016-04-30 18:07:36 -04:00
Pietro Gagliardi c87a932a6d Rewrote darwin/box.m's layout code to create constraints directly. Let's try this out. 2016-04-30 17:45:44 -04:00
Pietro Gagliardi 835c711a24 Started reworking the auto layout system. uiBox is next. 2016-04-30 17:14:14 -04:00
Pietro Gagliardi 97ab0b36e0 A few more positioning bugs fixed and TODOs. I guess we can merge this now! (The redraw bugs will have to wait.) 2016-04-29 17:41:17 -04:00
Pietro Gagliardi 974413bbe3 Quick typo in tabpage.cpp fixed. 2016-04-29 17:35:48 -04:00
Pietro Gagliardi bd2840255d Fixed the few runtime errors there were. It works! There's a bit of a drawing issue on some controls, though... 2016-04-29 17:33:56 -04:00
Pietro Gagliardi 1a77e9f301 Fixed all compiiler errors. Now for runtime errors! 2016-04-29 17:08:31 -04:00
Pietro Gagliardi fa88467609 Migrated the rest of the controls. Ready for this build to completely fall apart? 2016-04-29 14:12:01 -04:00
Pietro Gagliardi 1956270ed1 More conversions. Almost done! 2016-04-29 13:50:08 -04:00
Pietro Gagliardi 840e21456c Migrated checkbox.cpp and combobox.cpp. 2016-04-29 12:49:42 -04:00
Pietro Gagliardi abf9e202ef Got rid of child.cpp. Yay. :D 2016-04-29 12:22:06 -04:00
Pietro Gagliardi affa6a7080 Converted QueueRelayout to MinimumSizeChanged. 2016-04-29 12:20:41 -04:00
Pietro Gagliardi f16f287b97 Migrated button.cpp. Allowed NULL out parameters in the uiWindowsSizing functions. 2016-04-29 12:18:46 -04:00
Pietro Gagliardi 4600bca8d3 Migrated box.cpp. Now we can migrate the other controls, since we have a better idea of what we're doing. 2016-04-29 10:48:39 -04:00
Pietro Gagliardi 26b22b2da3 Migrated group.cpp. 2016-04-28 22:33:32 -04:00
Pietro Gagliardi d68e11eac1 Verified (see misctestprogs) that WM_GETMINMAXINFO *is* sufficient to constrain the container size during SetWindowPos(), even if the size doesn't change. More TODOs. 2016-04-28 17:48:40 -04:00
Pietro Gagliardi 9f12fbff89 Migrated tab.cpp to the new system and fixed a few bugs. 2016-04-28 17:36:07 -04:00
Pietro Gagliardi 447aa75dc6 Reworked container.cpp a bit to suit the new propagation system. 2016-04-28 17:19:06 -04:00
Pietro Gagliardi 3baa94476d Adjusted uiWindow to use the new system for propagating minimum size changes. 2016-04-28 17:11:32 -04:00
Pietro Gagliardi c457d9bf00 Started a newer, better system for propagating layout changes. This relies on WM_GETMINMAXINFO, at least... 2016-04-28 16:59:26 -04:00
Pietro Gagliardi 56853c5d86 Cleaned up some control ID stuff. 2016-04-27 17:51:33 -04:00
Pietro Gagliardi 8b42c22caf More TODOs. 2016-04-27 14:55:36 -04:00
Pietro Gagliardi 19b5ebd14d Some fixups. 2016-04-27 14:45:45 -04:00
Pietro Gagliardi 16aaeb5c26 Some TODO resolution; some more TODOs. 2016-04-27 14:25:52 -04:00
Pietro Gagliardi 38f501c092 Migrated tab.cpp. This might work just fine. 2016-04-27 14:21:05 -04:00
Pietro Gagliardi 009403e1ec Migrated tabpage.cpp. 2016-04-27 12:41:30 -04:00
Pietro Gagliardi f83e39e033 Decided something for how to actually perform a resize for a child control. This solidifies one-HWND-per-control. 2016-04-27 12:18:58 -04:00
Pietro Gagliardi 4866168ecf Quick bugfix in childMinimumSizeChanged for uiWindow. 2016-04-27 01:25:36 -04:00
Pietro Gagliardi 40672cc5c4 More TODOs. 2016-04-27 01:06:35 -04:00
Pietro Gagliardi 3563dd74e7 Finished migrating window.cpp. A few utility functions came along for the ride. Maybe child.cpp won't be needed...? 2016-04-27 00:54:22 -04:00
Pietro Gagliardi 78b49ae04d Started reworking window.cpp to get a feel for what's going to happen. This is a mess... 2016-04-26 22:44:40 -04:00
Pietro Gagliardi dd1d5c871e Migrated the container stuff. 2016-04-26 22:17:42 -04:00
Pietro Gagliardi 8f4678a1f0 Removed the resize timer from windows/utilwin.cpp. 2016-04-26 22:09:13 -04:00
Pietro Gagliardi e2f03de5ca More TODOs. 2016-04-26 22:07:14 -04:00
Pietro Gagliardi 227c3b3ec1 Split the public functions out of winutil.cpp to organize things. Renamed uiWindowsEnsureSetParent() to uiWindowsEnsureSetParentHWND() to denote its intended use. 2016-04-26 22:06:12 -04:00
Pietro Gagliardi 37e83d133b Started the migration. Got rid of a bunch of cruft, including the old delayed resize logic (except for timers; will have to get that back out). 2016-04-26 19:57:13 -04:00
Pietro Gagliardi dab10d13d2 Finished ui_windows.h. Now we have to actually write all this. Yay... 2016-04-26 19:07:56 -04:00
Pietro Gagliardi 25b9231ff8 Whoops, forgot the important bit! Minimum sizes! 2016-04-26 17:37:16 -04:00
Pietro Gagliardi d4d81a41a8 Started ~ the big Windows rewrite ~. You'll see a bunch of obviously new things. And as you can guess, we're dropping the scheduled sizing for now. 2016-04-26 17:35:10 -04:00
Pietro Gagliardi 2391454409 Added a rules.unix just to be safe. 2016-04-25 23:36:06 -04:00
Pietro Gagliardi 4e11b6efe1 Fixed build errors. It works! (Except for radiobuttons now needing a destroy; that'll come later.) Next up... Windows. Yay... 2016-04-25 20:34:12 -04:00
Pietro Gagliardi d65a263bb4 Whoops, forgot unix/area.c. Now let's try. 2016-04-25 20:19:57 -04:00
Pietro Gagliardi 3f16e28d1b Finished the conversions. Let's hope it works! 2016-04-25 20:15:02 -04:00
Pietro Gagliardi 289ca0ed78 More conversion work, including getting rid of a few now-unnecessary function declarations. 2016-04-25 20:09:20 -04:00
Pietro Gagliardi 01912877ce Converted the basic GTK+ controls. Now for the containers. 2016-04-25 20:00:25 -04:00
Pietro Gagliardi 85ee2e93dd More ui_unix.h and unix/control.c work. NOW we're ready to migrate the controls. 2016-04-25 19:45:05 -04:00
Pietro Gagliardi 6d655cde45 Finished rewriting ui_unix.h. Now to rewrite all the controls. Yay? 2016-04-25 19:16:48 -04:00
Pietro Gagliardi 12e519f928 Adjusted the rules based on the previous commit. 2016-04-25 18:08:26 -04:00
Pietro Gagliardi d7d7d4fd76 Fixed the SyncEnableState() machinery not quite working properly. 2016-04-25 18:07:29 -04:00
Pietro Gagliardi 7b0780be2a Made SyncEnableState() a uiDarwinControl method instead of a uiControl method since it's not needed on GTK+. 2016-04-25 17:52:16 -04:00
Pietro Gagliardi a651caac89 Started migrating ui_unix.h. SyncEnableState can be dropped from the GTK+ port, so let's do that next. 2016-04-25 16:45:49 -04:00
Pietro Gagliardi 98e7afc5de Freed most of the mapTables. 2016-04-25 13:47:24 -04:00
Pietro Gagliardi 5cfcf81a67 Fixed runtime errors. It seems to work! An autolayout step will need to be added... 2016-04-25 13:44:13 -04:00
Pietro Gagliardi d0d0efce1a Fixed build errors. Now to test! 2016-04-25 13:38:17 -04:00
Pietro Gagliardi 3ca4a28bb3 Settled the SetParent stuff. NOW we can test. 2016-04-25 12:59:45 -04:00
Pietro Gagliardi 23c2998040 Migrated darwin/control.m. Forgot the SetParent/SetSuperview rule! One more commit before we can build... 2016-04-25 12:55:51 -04:00
Pietro Gagliardi 189d661b7f Migrated darwin/tab.m and fixed up the other files. Now for darwin/control.m, then we can test... 2016-04-25 12:52:54 -04:00
Pietro Gagliardi b50eda0303 Migrated darwin/group.m. That just leaves darwin/tab.m and a few fixups to a number of other controls. 2016-04-25 12:42:43 -04:00
Pietro Gagliardi f0ca2dcee5 Migrated darwin/box.m. 2016-04-25 12:35:01 -04:00
Pietro Gagliardi 6e584f26d3 Migrated darwin/window.m. 2016-04-25 12:28:36 -04:00
Pietro Gagliardi c36d5079db Migrated the controls that don't have children to the new object method model on OS X. 2016-04-25 11:54:09 -04:00
Pietro Gagliardi e69010139d Fixed one last error. 2016-04-25 10:26:00 -04:00
Pietro Gagliardi 639a010a56 Tested everything by migrating darwin/combobox.m; fixed errors along the way. Also more TODOs. 2016-04-25 10:23:16 -04:00
Pietro Gagliardi a97171ed86 Quick fixes to previous commit. 2016-04-25 10:00:31 -04:00
Pietro Gagliardi a6b324a33c Finished the new ui_darwin.h. 2016-04-25 09:57:05 -04:00
Pietro Gagliardi 31dee85b5e More work with changing things for OS X. Still not fully sure about things... 2016-04-24 21:51:08 -04:00
Pietro Gagliardi e643dc3693 More new control structure work. This is turning into a disaster already. 2016-04-24 19:56:14 -04:00
Pietro Gagliardi dda30cdb3c Started the new uiControl infrastructure. 2016-04-24 19:22:21 -04:00
Pietro Gagliardi 19f563a2ac ...and a new system for allocating uiControls. 2016-04-24 18:49:28 -04:00
Pietro Gagliardi 5f624f6a38 Set up a new system for uiControl methods. 2016-04-24 18:46:03 -04:00
Pietro Gagliardi cf51ec823f Got rid of toplevelOwning(); I didn't like that one. 2016-04-24 18:23:00 -04:00
Pietro Gagliardi bc0a1d43c9 Applied the new type system to the Windows backend and fixed some more C++ stupidity related to it. 2016-04-24 17:38:48 -04:00
Pietro Gagliardi 96e8f1f8ea Did the rest of the object changes on GTK+. 2016-04-24 16:59:46 -04:00
Pietro Gagliardi fa4632d101 Fixed more build errors building the tests. OS X backend converted! 2016-04-24 16:20:57 -04:00
Pietro Gagliardi b6c54aac43 Fixed build errors. Let's test! 2016-04-24 16:14:19 -04:00
Pietro Gagliardi ded1ee6997 Removed typed stuff from darwin/menu.m. Now let's try building it. 2016-04-24 16:07:45 -04:00
Pietro Gagliardi 5efad5e850 Migrated the uiNewControl() definitions on OS X. This just leaves uiMenu. 2016-04-24 16:03:13 -04:00
Pietro Gagliardi b2c9577cb9 Set up all the control signatures and the framework for signature-based control types on OS X. 2016-04-24 15:46:29 -04:00
Pietro Gagliardi 24ac560f4b Elminated the type functions FOR REAL THIS TIME. 2016-04-24 15:18:14 -04:00
Pietro Gagliardi 8a532d66cc Adjusted common/control.c for the new type-based control system. Now to fix up the individual OSs. 2016-04-24 15:15:36 -04:00
Pietro Gagliardi f60178798f Removed common type code. 2016-04-24 15:08:48 -04:00
Pietro Gagliardi 7b0f930185 Removed all the type function declarations from all the controls. More TODOs. 2016-04-24 15:04:36 -04:00
Pietro Gagliardi 6f46bea054 Discontinued the Haiku port for now. 2016-04-24 14:18:56 -04:00
Pietro Gagliardi 46391367fe Removed the typefn stuff from ui_*.h*. 2016-04-24 14:15:56 -04:00
Pietro Gagliardi 2870f3239d More TODOs. 2016-04-24 13:32:20 -04:00
Pietro Gagliardi 712be2608e Got rid of the type checking stuff from ui.h. 2016-04-24 13:31:33 -04:00
Pietro Gagliardi 6760816b13 Updated the controlgallery screenshots. More TODOs. 2016-04-24 13:07:19 -04:00
Pietro Gagliardi d8f8812c85 Further reworking. 2016-04-24 09:50:06 -04:00
Pietro Gagliardi 68194bbfd1 Started reworking the controlgallery example's layout. 2016-04-24 09:48:38 -04:00
Pietro Gagliardi e90da765e3 Fixed a simple typo. IT WORKS! Also shortened one of the debug log messages. 2016-04-24 00:54:31 -04:00
Pietro Gagliardi 1f90366edd strsafe is a crock that does not follow its own documentation. Switch to the equivalent vcrt functions instead. 2016-04-24 00:50:19 -04:00
Pietro Gagliardi d258ac1d1d Fixed the other compiler and linker errors. We have a build! But does it work? If it does it's time to really tune this rewrite down. 2016-04-24 00:33:42 -04:00
Pietro Gagliardi c53e1c0b7d More fixes. Halfway through the alphabet now. 2016-04-23 22:29:54 -04:00
Pietro Gagliardi 158db39b68 More fixes. 2016-04-23 22:23:07 -04:00
Pietro Gagliardi 5236aa5855 More compiler error fixes. 2016-04-23 22:15:33 -04:00
Pietro Gagliardi 47aff78aae More compiler error fixes. Warning fixes will come later. 2016-04-23 21:38:51 -04:00
Pietro Gagliardi e0a8c8ce60 More fixes. 2016-04-23 21:25:56 -04:00
Pietro Gagliardi 2e352db4aa Fixed the wide string nonsense once and for all. Didn't need to switch to char at all! 2016-04-23 20:26:37 -04:00
Pietro Gagliardi 050cc3aa16 Fixed some things so far. It looks like I can't have __FILE__, etc. turned into wide strings because the way to do so works *ahead of time* :| Have to restructure debug.cpp. 2016-04-23 17:31:59 -04:00
Pietro Gagliardi ee6fa439f7 And updated the makefiles. Let's test! 2016-04-23 16:55:34 -04:00
Pietro Gagliardi cef1f90634 Oh right, also changed this to me in control implementations. Forgot that. NOW we can fix up the makefiles and test. 2016-04-23 16:52:53 -04:00
Pietro Gagliardi 0200af0301 Oh I forgot a few things. First, the other .cpp_ files. 2016-04-23 16:49:46 -04:00
Pietro Gagliardi 0307e11bf2 Migrated ui_windows.h. Now to fix up the makefiles and test. 2016-04-23 16:47:44 -04:00
Pietro Gagliardi e916c2f5fc Migrated uipriv_windows.h. Mostly. 2016-04-23 15:46:39 -04:00
Pietro Gagliardi 0e24e16bda Converted the uiArea files to C++. Now to fill in the header files... 2016-04-23 15:39:51 -04:00
Pietro Gagliardi 686e1ee58b "Migrated" menu.c. That just leaves the uiArea code and patching up holes in the header files, then we can test the build and further refine everything. 2016-04-23 15:26:57 -04:00
Pietro Gagliardi 2c097f5587 Mostly migrated draw.c. 2016-04-23 12:47:15 -04:00
Pietro Gagliardi a8b6cab2ab Did a proper migration of d2dscratch.c. 2016-04-23 11:50:47 -04:00
Pietro Gagliardi fbef804608 Quick and dirty C++ conversions of box.c, tab.c, and window.c. I feel like I need another rewrite... 2016-04-23 11:22:46 -04:00
Pietro Gagliardi ff096410a8 More migrations. 2016-04-22 22:20:02 -04:00
Pietro Gagliardi f829a06a7c Migrated child.c. Ugh... 2016-04-22 21:36:19 -04:00
Pietro Gagliardi 805e5f9811 Migrated spinbox.cpp. Now for the containers I guess... 2016-04-22 20:47:29 -04:00
Pietro Gagliardi 5d954712ea Migrated datetimepicker.c. 2016-04-22 20:40:16 -04:00
Pietro Gagliardi 955203bfb8 Migrated container.c and radiobuttons.c. 2016-04-22 20:37:28 -04:00
Pietro Gagliardi 6ec5f4800d Migrated simple controls to C++. 2016-04-22 20:14:12 -04:00
Pietro Gagliardi b514ba7cb0 Got rid of UtilText and UtilSetText. 2016-04-22 20:04:30 -04:00
Pietro Gagliardi b49091b897 Migrated label.c and separator.c. 2016-04-22 20:03:10 -04:00
Pietro Gagliardi 1ada1b346c Migrated resize.c. 2016-04-22 19:51:33 -04:00
Pietro Gagliardi 027d1f15ee Migrated parent.c. 2016-04-22 18:11:20 -04:00
Pietro Gagliardi 9e90475e11 Migrated stddialogs.c. 2016-04-22 17:49:14 -04:00
Pietro Gagliardi 02b5285aa0 Some more filter procedure rewriting, preparing for the future dialog message hack attempt. 2016-04-22 14:56:09 -04:00
Pietro Gagliardi 960533ab1f Abstracted out the message filter stuff so we can add a dialog message filter to allow tab navigation anywhere next. 2016-04-22 14:36:21 -04:00
Pietro Gagliardi 6124d45c62 Migrated main.c. 2016-04-22 14:06:22 -04:00
Pietro Gagliardi 0e85afb3ff Migrated utilwin.c. 2016-04-22 13:52:02 -04:00
Pietro Gagliardi 7a4c73ff92 Migrated init.c. 2016-04-22 13:31:33 -04:00
Pietro Gagliardi 57fbea1f3e Added utf16dup(). Completely forgot about this. 2016-04-22 13:01:55 -04:00
Pietro Gagliardi 277fa5d6bd Migrated control.c, I think. Changing the current way uiControl works will wait for another branch. 2016-04-22 12:44:18 -04:00
Pietro Gagliardi dafdaa4de4 Migrated text.c. 2016-04-21 23:29:44 -04:00
Pietro Gagliardi 63ce320021 Migrated util.c. 2016-04-21 23:05:10 -04:00
Pietro Gagliardi f3cf43da21 Migrated debug.cpp. 2016-04-21 21:57:36 -04:00
Pietro Gagliardi 9c9dc9a23e Added line ending manipulation routines now, just to be sure. 2016-04-21 18:10:30 -04:00
Pietro Gagliardi eb48bc1732 Wrote up a utf16 with conversion and allocating-sprintf() functions. Changed the way deubgging will work. 2016-04-21 18:03:52 -04:00
Pietro Gagliardi 35b2b490bb Changed complain() for bugs in libui and control implementations to implbug(). 2016-04-21 16:29:34 -04:00
Pietro Gagliardi 3b4eeee7bb Whops, left some stuff over in events.cpp. Also added a comment. 2016-04-21 15:01:05 -04:00
Pietro Gagliardi a8e897c1ec Started rewriting ui_windows.h and uipriv_windows.h(pp). 2016-04-21 12:55:09 -04:00
Pietro Gagliardi 82b1b363f2 Quick fix in events.cpp. 2016-04-21 12:22:02 -04:00
Pietro Gagliardi 99aba5a3b8 Got rid of all the template cruft and other nonsense from events.cpp. 2016-04-21 12:20:37 -04:00
Pietro Gagliardi df190dc368 Templatized this. I feel dirty. 2016-04-21 11:22:34 -04:00
Pietro Gagliardi 1f6bbdc268 Removed uthash. All its (one) uses are now using C++ instead. 2016-04-20 22:15:24 -04:00
Pietro Gagliardi 87c2c4f3f7 "Moved" events.c to C++. 2016-04-20 22:10:04 -04:00
Pietro Gagliardi b9384c0e32 Quick fixes to the previous commit. 2016-04-20 20:21:57 -04:00
Pietro Gagliardi 6b7b5de743 Migrated alloc.c to C++. This is working already :v 2016-04-20 20:20:10 -04:00
Pietro Gagliardi 55116199ac Pruned, organized, and formatted winapi.hpp. 2016-04-20 19:51:30 -04:00
Pietro Gagliardi a7ff1e7c78 Moved the files that are already C++ out of the way so we can migrate them later and separate them from the already-migrated files. 2016-04-20 19:41:14 -04:00
Pietro Gagliardi 09c1a62a8e Moved most of the headers to C++. 2016-04-20 19:39:20 -04:00
Pietro Gagliardi 655e05463d Implemented the new font button stuff on Windows. 2016-04-20 14:17:55 -04:00
Pietro Gagliardi e6effa042d Implemented the new fontbutton routines on GTK+. 2016-04-20 13:59:59 -04:00
Pietro Gagliardi cfa1b6bf0a Added uiFontButtonFont() and uiFontButtonOnChanged(); implemented on OS X. 2016-04-20 13:40:54 -04:00
Pietro Gagliardi 275b80a6d9 More TODOs. 2016-04-20 12:37:04 -04:00
Pietro Gagliardi 9b1d75bec2 More TODOs and stale TODO elimination. 2016-04-20 02:52:46 -04:00
Pietro Gagliardi 8493bc3c5d Fixed the GTK+ SetColor() issues. It works! 2016-04-20 01:14:46 -04:00
Pietro Gagliardi 78772ca62d Fixed most compiler errors and warnings. 2016-04-19 23:58:36 -04:00
Pietro Gagliardi 6b6d6861c1 Wrote the SetColor() for GTK+. Now to test. 2016-04-19 23:52:44 -04:00
Pietro Gagliardi 721269b3eb Implemented colored text on OS X and Windows. 2016-04-19 18:45:16 -04:00
Pietro Gagliardi e786d664cb Implemented text layout SetColor on OS X. 2016-04-19 16:06:50 -04:00
Pietro Gagliardi 7a568f6bf4 Added the first text layout attribute: foreground color. Now to implement. 2016-04-19 15:38:24 -04:00
Pietro Gagliardi 6fdbd8d68f Implemented the chars-to-bytes algorithm on the GTK+ code. Now to finally add attributes to uiDrawTextLayout! 2016-04-19 14:57:15 -04:00
Pietro Gagliardi 5b74b2752e Decided to use character offsets instead of byte offsets for text layout attributes. This removes the shaky code from the OS X and Windows backends to compute a list of character offsets for byte offsets. The equivalent code for GTK+ to convert chars to bytes will be much more solid; it will be written next. 2016-04-19 14:39:33 -04:00
Pietro Gagliardi c2d165af94 Implemented the uiDrawTextFont direct from system font-making functions on other platforms. 2016-04-19 11:23:05 -04:00
Pietro Gagliardi a1d0e669c8 Added some helpers for actually returning a font from the font button on Windows. Similar helpers are needed on other platforms. 2016-04-18 19:18:29 -04:00
Pietro Gagliardi 861b5f22df Finished changing the Windows font dialog and uiFontButton to manipulate IDWriteFonts directly. 2016-04-18 17:14:33 -04:00
Pietro Gagliardi b19a8c9c46 Okay, I made a mistake: we want uiFontButton to return uiDrawFonts, not uiDrawFontDescriptors. Started the work to change the Windows one likewise. 2016-04-18 15:31:52 -04:00
Pietro Gagliardi ccfa3d41a3 More work on the initial font and showing styles. I have a feeling my current approach is a mistake. 2016-04-18 13:32:48 -04:00
Pietro Gagliardi 84fc5dafaa More TODOs. 2016-04-18 10:22:36 -04:00
Pietro Gagliardi 4d025172fe And brought the new font out of the font dialog and into the font button. We should be good now... 2016-04-18 01:12:25 -04:00
Pietro Gagliardi dcbbced23b Implemented loading of the font dialog font. Now to save it too. 2016-04-18 00:56:13 -04:00
Pietro Gagliardi 97aad9a039 Added support routines for migrating DirectWrite attributes. 2016-04-18 00:41:17 -04:00
Pietro Gagliardi 7cf8420682 Hooked the Windows font button and font dialog together at last. More TODOs. Now we just need to actually convert everything to DirectWrite and implement the label. 2016-04-17 22:09:18 -04:00
Pietro Gagliardi 40d673fb01 Implemented the correct behavior for the initial display of the size combobox of the font dialog. At this point we can move straight to manipulating the uiDrawFontDescriptors. 2016-04-17 21:11:55 -04:00
Pietro Gagliardi 0e75a6f950 Properly implemented the size combobox. We're so close! 2016-04-17 20:10:14 -04:00
Pietro Gagliardi 39ea7e269f Implemented nearest style matches when changing families. Wow we're actually almost done here! 2016-04-17 19:37:03 -04:00
Pietro Gagliardi 156fae7bbb Implemented events and type-to-select for the Style combobox. 2016-04-17 19:22:37 -04:00
Pietro Gagliardi aa6778acbe Implemented type-to-search in the font dialog. 2016-04-17 19:03:34 -04:00
Pietro Gagliardi edef521ded Quick TODO resolution. 2016-04-17 16:49:50 -04:00
Pietro Gagliardi d45fdb4a3d Migrated the font dialog from drawing its own sample text to having a D2D scratch control do it. 2016-04-17 13:06:45 -04:00
Pietro Gagliardi 3bb2a0ab21 Added a Direct2D scratch control that will be used by the font and color dialogs we will implement. 2016-04-17 11:53:24 -04:00
Pietro Gagliardi cc7675ab5a More font dialog work: split out all the combobox manipulation functions into their own function, made the current selection part of the structure, made the font families item data to the family combobox, and changed the font face string function to use the dedicated font face string method (thanks Windows 7 ChooseFont sample program). 2016-04-17 01:34:05 -04:00
Pietro Gagliardi 46db0b30ee Oh fixed the font dialog not showing all styles thing; stupid me forgot that a IDWriteFontFamily is also a IDWriteFontList. 2016-04-16 22:46:39 -04:00
Pietro Gagliardi 9a1367c0bc More font dialog work. Ugh if only I could just use the Windows 7 sample code one... 2016-04-16 22:15:19 -04:00
Pietro Gagliardi f3ae17793d Quick compilation fixes. I really don't know what I'm doing right now. 2016-04-16 19:25:21 -04:00
Pietro Gagliardi ecbdddb703 More sample work. Ugh this is a mess I should just use Direct2D after all. 2016-04-16 19:07:17 -04:00
Pietro Gagliardi 351fc59b9f Started work on previewing samples of fonts in the new font dialog. This adds all the boilerplate, including sample positioning. Also tightens up the dialog a bit. Now just to implement the actual drawing. 2016-04-16 17:58:45 -04:00
Pietro Gagliardi d994ab9205 Some TODOs I will probably regret. 2016-04-16 15:41:34 -04:00
Pietro Gagliardi 23ec771c86 Removed uiFontDescriptor.SmallCaps; on Windows this has to be applied to layouts. 2016-04-15 14:23:16 -04:00
Pietro Gagliardi 9b27e12cfc Made the small caps stuff ineffective on page 9. We'll be removing it from FontDescriptor shortly. 2016-04-15 14:09:14 -04:00
Pietro Gagliardi cedb5394b4 Removed the small caps checkbox from the new font dialog. It turns out that the small caps in DirectWrite is applied to a text layout, not a part of a font like it is elsewhere. Do we even still need the custom font dialog? 2016-04-15 13:57:26 -04:00
Pietro Gagliardi 0ad767721d More font dialog stuff. 2016-04-15 13:18:06 -04:00
Pietro Gagliardi fa94298015 Split the function to extract the correct string of an IDWriteLocalizedStrings instance out into its own function. I'm not sure if I'll need the informational strings out of a font (need to see what the strings actually say first), but in case I do, this will help. 2016-04-15 10:15:05 -04:00
Pietro Gagliardi 0bc140cd46 Dropped uiDrawTextGravity. That has to do with vertical text, which we can both abstract into a higher level API and can't do yet because DirectWrite simply does not support vertical text on Windows 7 for reasons that escape logical thought. 2016-04-15 00:24:27 -04:00
Pietro Gagliardi 8ac3c53e0f More fontdialog.cpp work. This is gonna kill me... 2016-04-14 22:40:01 -04:00
Pietro Gagliardi d3c4b0cf4d More work on fontdialog.cpp. 2016-04-14 22:25:32 -04:00
Pietro Gagliardi 97d35571c1 Started writing a replacement for the standard ChooseFont() dialog that uses DirectWrite instead of GDI. 2016-04-14 21:35:50 -04:00
Pietro Gagliardi 88e797e2be Split the DirectWrite boilerplate to another C++ file so we can write a new font dialog with it, maybe. 2016-04-14 19:57:58 -04:00
Pietro Gagliardi edd9b2f133 "Implemented" uiFontButton on Windows. 2016-04-14 17:12:13 -04:00
Pietro Gagliardi 042b08f31c Implemented uiFontButton on GTK+. 2016-04-14 15:55:04 -04:00
Pietro Gagliardi 1b61bfd67c More TODOs. 2016-04-14 14:33:20 -04:00
Pietro Gagliardi f1c9b2b15b Made the uiFontButton more robust by making it not show irrelevant controls and not affect other controls. Also sets up things for uiColorButton. 2016-04-14 14:01:33 -04:00
Pietro Gagliardi 307ec746ef Started implementing uiFontButton on OS X. 2016-04-14 13:27:15 -04:00
Pietro Gagliardi 8b6dd1d45f More for the previous commit. 2016-04-14 12:57:09 -04:00
Pietro Gagliardi 423719b21f Started adding uiFontButton. Duplicated Page 9 to Page 10 to test it. 2016-04-14 12:54:37 -04:00
Pietro Gagliardi d3db48d654 More TODOs. 2016-01-28 01:42:12 -05:00
Pietro Gagliardi 7f2194c383 Typo fixes in the previous commit. 2016-01-24 21:50:10 -05:00
Pietro Gagliardi ab0230b428 Added a function for scrolling uiAreas. Implemented on OS X; stubbed elsewhere. 2016-01-24 21:41:34 -05:00
Pietro Gagliardi febb37700a "Fixed" the FreeBSD build. 2016-01-22 13:08:36 -05:00
Pietro Gagliardi 908221f7dd Missed a spot in the previous commit. 2016-01-20 03:14:49 -05:00
Pietro Gagliardi a3344f0341 Two important changes to the Windows build:
1) cvtres is no longer used directly. MSDN says to send the .res files to link.exe; that runs cvtres for us (at least it seems to, accoring to Google results for error LNK1158). It'll also avoid some of the weird warnings in cvtres, like CVT4001.

2) (and more important, but it depended on 1) Command-line switches are now passed using - instead of /. This is because some versions of MinGW are buggy and treat anything that starts with a / as a MSYS filename that needs to be converted to a Windows pathname.

Update #16.
2016-01-19 16:40:00 -05:00
Pietro Gagliardi 5fd3a6fbab Long-awaited TODO: removed the "in terminate:" message. 2016-01-16 19:34:34 -05:00
Pietro Gagliardi cb8323bee6 Decided that yes, for a single line the leading should not be included. 2016-01-16 18:22:27 -05:00
Pietro Gagliardi 32cc648e13 Diagnosed the root cause of an issue in a TODO; still need to fix it. 2016-01-16 16:48:10 -05:00
Pietro Gagliardi eb6e10350d Implemented the multiline stuff on Windows. Oh boy this is so broken everywhere... 2016-01-16 16:42:33 -05:00
Pietro Gagliardi b0621a6b1f Implemented the new multiline text stuff on GTK+. 2016-01-16 15:59:34 -05:00
Pietro Gagliardi 9c6c16be53 Simplified text drawing on OS X by using CTFramesetter exclusively. 2016-01-16 13:34:22 -05:00
Pietro Gagliardi 37f9bfd1b9 More OS X layout work. 2016-01-15 22:48:38 -05:00
Pietro Gagliardi b5292e4e80 More TODOs. 2016-01-15 20:19:56 -05:00
Pietro Gagliardi 4fffe9008c Started implementing the new multiline uiDrawTextLayout logic in the OS X port; fixed some bugs in the test program. 2016-01-15 20:18:53 -05:00
Pietro Gagliardi c0db113367 Started adding support for multiline uiDrawTextLayouts and extracting the extents from them. 2016-01-14 20:02:01 -05:00
Pietro Gagliardi 06fa877058 Updated an error message. 2016-01-14 03:29:08 -05:00
Pietro Gagliardi 2b0de07243 More TODOs. 2016-01-14 02:14:31 -05:00
Pietro Gagliardi 468acd50be More TODOs. 2016-01-13 19:35:31 -05:00
Pietro Gagliardi 049b2256e4 More TODOs. 2016-01-13 16:21:28 -05:00
Pietro Gagliardi 8895b7f227 More TODOs/TODO cleanup. 2016-01-13 16:20:38 -05:00
Pietro Gagliardi 9442ebd53a More TODOs. 2016-01-13 15:59:45 -05:00
Pietro Gagliardi 6394446461 Fixed text rendring on GTK+. 2016-01-13 15:48:39 -05:00
Pietro Gagliardi fa0b3ea8dd Fixed OS X text drawing not being vertically aligned properly. 2016-01-13 15:17:49 -05:00
Pietro Gagliardi 621d75695c More (serious) TODOs. 2016-01-13 14:34:28 -05:00
Pietro Gagliardi 85af3d2a5b More TODOs. 2016-01-13 04:08:01 -05:00
Pietro Gagliardi 6202863faa Added some guides for making sure text measurements are correct. 2016-01-13 04:02:30 -05:00
Pietro Gagliardi d6079f8c50 More TODOs. 2016-01-13 00:56:03 -05:00
Pietro Gagliardi 454fabaf2b Implemented metrics on Windows and fixed Unicode conversion in uiDrawNewTextLayout(). 2016-01-13 00:54:52 -05:00
Pietro Gagliardi 776be61c45 Implemented metrics on Pango. 2016-01-12 23:33:50 -05:00
Pietro Gagliardi d6063394ee Implemented the metrics stuff on OS X and improved the test a bit. 2016-01-12 22:07:24 -05:00
Pietro Gagliardi a082469cf8 Started working on text metrics support. 2016-01-12 21:52:45 -05:00
Pietro Gagliardi 09458c794a Ported the new drawing system to Windows. 2016-01-12 18:14:48 -05:00
Pietro Gagliardi f9b6eba7df Implemented the new font stuff on GTK+. 2016-01-12 16:59:13 -05:00
Pietro Gagliardi 73867119ef Updated the test and fixed compiler errors in darwin/drawtext.m. It seems to work now! Width handling is still not working right, but width handling needs major rewrites because width on Core Text has major sensibility issues... 2016-01-12 01:58:45 -05:00
Pietro Gagliardi 426b133e58 Implemented the new font API on OS X. Now to rewrite the test. 2016-01-12 01:46:28 -05:00
Pietro Gagliardi ae60141497 Decided to split the OS X text drawing stuff into its own file to make it easier to manage. In fact, darwin/draw.m used to be the longest file (by line count) in libui's source code proper (not the longest in the repo)! (Now it's windows/draw.c instead, and that *doesn't* contain text code!) 2016-01-12 01:14:41 -05:00
Pietro Gagliardi ab792dcc66 More Core Text stuff. 2016-01-11 19:34:42 -05:00
Pietro Gagliardi b06bd31ee0 More documentation preparation. 2016-01-11 18:57:27 -05:00
Pietro Gagliardi 7e24debe22 Started planning an Actual Core Text Document. 2016-01-11 16:45:36 -05:00
Pietro Gagliardi 980f5a7419 Some more text API changes. 2016-01-10 21:02:40 -05:00
Pietro Gagliardi 5f1b900dc5 More TODOs. More even bigger TODOs. 2016-01-10 15:35:43 -05:00
Pietro Gagliardi 2342f191f4 More TODOs. Big TODOs. 2016-01-09 20:58:52 -05:00
Pietro Gagliardi 9b1b7ce365 More TODOs. 2016-01-09 18:36:21 -05:00
Pietro Gagliardi 0ec7d91e22 Filled in the text coordinate conversion functions on Windows. 2016-01-09 18:22:51 -05:00
Pietro Gagliardi 29794af67a Filled in text size conversion functions on OS X. 2016-01-09 18:14:06 -05:00
Pietro Gagliardi ca75579135 More exposition. 2016-01-09 18:05:44 -05:00
Pietro Gagliardi 3cc2a06147 Added font matching to the OS X backend. 2016-01-09 17:41:05 -05:00
Pietro Gagliardi dec34670bb Fixed keyboard events not working on OS X. 2016-01-09 15:05:19 -05:00
Pietro Gagliardi 2a80888cb8 Fixed a warning in the test program. 2016-01-09 14:49:44 -05:00
Pietro Gagliardi ef54b99b93 Fixed text rendering on Windows. Woo, it all works so far! 2016-01-09 02:23:01 -05:00
Pietro Gagliardi a826fd7516 Wrote the text drawing code on Windows. Now to build and test. 2016-01-09 01:07:48 -05:00
Pietro Gagliardi 69e5dd42cf More big TODOs. 2016-01-08 19:11:12 -05:00
Pietro Gagliardi 5365453c19 Tried to figure out the traits stuff for myself. I can't quite do that when it has no effect :v 2016-01-08 17:13:31 -05:00
Pietro Gagliardi 11a3fcfad0 Fixed the drawing shenanigans. 2016-01-08 13:51:39 -05:00
Pietro Gagliardi 94883ed620 Kinda sorta fixed the text rendering stuff. 2016-01-08 12:49:52 -05:00
Pietro Gagliardi 4c12934992 Fixed the compiler errors in the previous commit. Things aren't quite right yet. 2016-01-08 10:14:09 -05:00
Pietro Gagliardi e7a68893e2 Filled in the rest of the beginning of the Core Text implementation. 2016-01-08 02:08:26 -05:00
Pietro Gagliardi 9fc92cf96b Started doing the Core Text text code. I am completely lost on text styles. 2016-01-07 21:51:37 -05:00
Pietro Gagliardi ca514d94d1 Set up a proper, formal layout and attirbute system. No attributes right now, but initial font style is in. Implemented it on GTK+. 2016-01-07 18:37:43 -05:00
Pietro Gagliardi 4f2dbe2662 Really fixed the NSMapTable nonsense now. Added a TODO to go through the rest of the code for the same. 2016-01-07 16:01:11 -05:00
Pietro Gagliardi 9cfc133481 "Fixed" the weird crashes and fixed the makefile failures. 2016-01-07 15:43:35 -05:00
Pietro Gagliardi 499a93e32e Completely rewrote the OS X map system to use NSMapTable correctly and hide the details behind more wrapper functions to prevent further mass rewrites; this fixes most of the crashing issues on OS X. The one with package ui still stands... 2016-01-07 14:41:20 -05:00
Pietro Gagliardi f9b940f698 More TODOs. 2016-01-06 20:39:47 -05:00
Pietro Gagliardi 68a3476f35 Fixed the controlgallery example. Reenabled it in make examples. Changed .travis.yml to build the test first. 2016-01-06 19:38:27 -05:00
Pietro Gagliardi 6a15e23897 Set up saner handling of sonames at build time. 2016-01-05 11:51:36 -05:00
Pietro Gagliardi a620e3921e Okay this isn't going to work 2016-01-05 00:37:46 -05:00
Pietro Gagliardi 8672a46545 Okay let's try that again 2016-01-05 00:29:05 -05:00
Pietro Gagliardi 0713e36e57 Let's try adding OS X to the Travis file. 2016-01-05 00:26:52 -05:00
Pietro Gagliardi 84b392d0f9 Quick formatting fix in the README. 2016-01-04 19:03:34 -05:00
Pietro Gagliardi 70c8d075e9 Merge branch 'master' of github.com:andlabs/libui 2016-01-04 19:03:02 -05:00
Pietro Gagliardi 73b0a634a4 Merge pull request #11 from fclairamb/master
Adding travis icon
2016-01-04 19:02:46 -05:00
Florent Clairambault 9f43f4089b Adding travis icon 2016-01-05 00:54:41 +01:00
Pietro Gagliardi 6f10fcaee7 Trivial change: Windows sizing stuff gone. 2016-01-04 16:13:54 -05:00
Pietro Gagliardi c7d7a64373 Removed the ID2D1RenderTarget_GetSize note from the README; it affects MSVC too. 2016-01-04 16:04:16 -05:00
Pietro Gagliardi 319331e0dd More commit stuff. 2016-01-04 16:00:16 -05:00
Pietro Gagliardi 9570981b50 Cleaned up some things related to the previous merge. 2016-01-04 15:52:39 -05:00
Pietro Gagliardi 24f7c2d803 Merge branch 'master' of github.com:andlabs/libui 2016-01-04 15:49:20 -05:00
Pietro Gagliardi b6f433cb13 Merge pull request #10 from fclairamb/master
Makefile changes + Travis file
2016-01-04 15:48:44 -05:00
Pietro Gagliardi 27ece23442 More TODOs. 2016-01-03 15:54:17 -05:00
Pietro Gagliardi dfd2b7c916 More TODOs. 2016-01-03 13:53:55 -05:00
Pietro Gagliardi 9e8e09f262 Added an explicit check for ARC. 2016-01-02 09:22:24 -05:00
Florent Clairambault e24c8f6440 Merge remote-tracking branch 'upstream/master' 2016-01-02 13:27:08 +01:00
Florent Clairambault bdded52f5e Mac Os X install rule: Tiny fix. 2016-01-01 23:20:49 +01:00
Florent Clairambault c204e47b72 Various fixes around makefiles
* $PREFIX is uppercase (I have no idea why I put it lowercase before).
* "install" rules is OS specific and moved to new OS specific files. So that they can be included last.
* "examples" rule defines the list of examples to execute.
* Travis launches the "test" rule.
2016-01-01 23:19:14 +01:00
Pietro Gagliardi 05ab8d07db And added compatibility manifests to the examples too. 2015-12-31 20:12:14 -05:00
Pietro Gagliardi 46aadf62c1 Added a manifest to the test program. 2015-12-31 20:09:20 -05:00
Pietro Gagliardi 5d40eff32a Added Windows 7 compatibility to the manifest. 2015-12-31 19:58:03 -05:00
Florent Clairambault 3152ff0512 Travis: Triggering build 2016-01-01 01:48:13 +01:00
Florent Clairambault cfcbe9859f Tiny warning fix.
Why not switch to -Werror by the way ?
2016-01-01 01:45:32 +01:00
Florent Clairambault 48bf6d2b37 Adding travis file. 2016-01-01 01:43:38 +01:00
Florent Clairambault b795cda79e Makefile: Added examples + install rules. 2016-01-01 01:42:54 +01:00
Pietro Gagliardi c5d4813dec Stubbed out the text drawing functions on Windows too. 2015-12-31 12:30:53 -05:00
Yauhen Kirylau 9c3a8f9a44 chore(readme): add the link to arch linux aur 2015-12-29 01:50:06 +01:00
Pietro Gagliardi 1b3d303cbe More TODOs. 2015-12-27 22:55:41 -05:00
Pietro Gagliardi a1beccd63d Pinpointed the issues with mouseExited:. A TODO for now; this is gonna be murder to figure out :) 2015-12-27 22:19:59 -05:00
Pietro Gagliardi 66ad8066ea Improved the exited debugging. 2015-12-27 17:13:57 -05:00
Pietro Gagliardi 93a9847b59 Added debugging code for mouseExited:. In El Capitan it's not working in scrolled views... 2015-12-27 16:15:18 -05:00
Pietro Gagliardi 0ec70f9111 Removed libgmalloc. That was a mistake; it slows down callbacks tremendously on DEFAULT SETTINGS. 2015-12-27 15:54:53 -05:00
Pietro Gagliardi c31d06c254 Quick change for now: added libgmalloc to the OS X build so I can debug potential memory allocation issues. I think something is wrong in the mouseExited logic... 2015-12-27 15:19:14 -05:00
Pietro Gagliardi 3b916fa749 Stubbed out the text drawing functions on OS X. 2015-12-27 11:32:47 -05:00
Pietro Gagliardi 15bb899770 Vertically condensed Page 9 a bit. 2015-12-24 23:04:07 -05:00
Pietro Gagliardi 6fd945b602 Split the text test onto a separate page, Page 9. 2015-12-24 22:59:00 -05:00
Pietro Gagliardi 353afcd464 Added the Language field to the text styles list. 2015-12-24 22:31:32 -05:00
Pietro Gagliardi 6ef404c2dd Implemented the basic uiDrawText() function on GTK+. It looks like I missed some PangoAttributes; I'll add those in next. 2015-12-24 19:48:57 -05:00
Pietro Gagliardi 280ef464f6 Started work on text rendering. Right now, features match Pango; they will be stripped as needed. Also I never committed test/page8.c; whoops. 2015-12-24 18:05:16 -05:00
Pietro Gagliardi 6a5997cc1a More notes. 2015-12-23 15:22:01 -05:00
Pietro Gagliardi 5698d84cf3 More text rendering stuff. And given how it appears I have to render DirectWrite data into a Direct2D path geometry, I might be a little bit too much in over my head here... 2015-12-23 15:19:40 -05:00
Pietro Gagliardi a9419e0cc4 Oops, I completely overlooked the Core Text Font Manager Reference, which would have told me that CTFontManagerCopyAvailableFontFamilyNames() was what I was looking for. Yay; the font families stuff now works on OS X as well! 2015-12-23 00:58:06 -05:00
Pietro Gagliardi bcc17a4e6d Attempted to write the font enumeration code for OS X. It does not work yet (memory management is borked and duplicate removal does not work, period). 2015-12-22 21:48:26 -05:00
Pietro Gagliardi 9efb452b2e Implemented the font family listing on Windows. 2015-12-22 20:01:53 -05:00
Pietro Gagliardi 5d47fcab5a Implemented the font family enumerator on GTK+. 2015-12-22 19:17:27 -05:00
Pietro Gagliardi 9987c98dcd Began the work to list font families. This is the first of the text rendering work. 2015-12-22 19:01:56 -05:00
Pietro Gagliardi 5267489f0b Now entering Valhalla. 2015-12-22 16:00:51 -05:00
Pietro Gagliardi a1d2c2b9fd Oh that's fucking wonderful, dwrite.h is C++-only. This is gonna make things extra wonderful... 2015-12-22 15:51:16 -05:00
Pietro Gagliardi d05bbe50a8 More TODOs. 2015-12-22 12:52:05 -05:00
Pietro Gagliardi e63f73e240 TODO elaboration. 2015-12-22 01:06:18 -05:00
Pietro Gagliardi 51d7cabfd9 More TODOs. 2015-12-22 01:02:06 -05:00
Pietro Gagliardi 0b68fc6931 More TODOs. 2015-12-22 00:43:48 -05:00
Pietro Gagliardi f04bbe1bdc Laid the foundation for text rendering into uiAreas on Windows. GTK+ and Cocoa backends need no special setup (we can start using Pango and Core Text respectively without extra initialization). Not sure when I'll actually add the APIs to draw text, but hopefully it's soon because I really really really need to start working on what I was actually going to USE this library for, and text rendering is the last major prerequisite. 2015-12-22 00:35:52 -05:00
Pietro Gagliardi 7d77a8c4e7 More TODOs. 2015-12-21 23:33:54 -05:00
Pietro Gagliardi 1919e74783 More TODOs. 2015-12-20 18:51:08 -05:00
Pietro Gagliardi f39b57bd27 TODO updates. 2015-12-19 17:41:54 -05:00
Pietro Gagliardi 92680a549d Oh I know why the green didn't show up; fixed. 2015-12-19 17:32:13 -05:00
Pietro Gagliardi 16f22576ed Reduced the number of tabs on the first page of the outer tab in the test program. This makes the uiArea tabs more readily accessible on all platforms and keeps the initial size of the main window down on OS X. Also fixed the rpath nonsense on the example makefile too. 2015-12-19 16:56:45 -05:00
Pietro Gagliardi 33d4217450 Fixed rpath shenanigans on OS X. 2015-12-19 16:46:04 -05:00
Pietro Gagliardi c095d80098 Implemented mouse tracking on OS X. 2015-12-19 16:35:18 -05:00
Pietro Gagliardi 35f2cc55da Fixed compiler errors. Now to implement mouse tracking. 2015-12-19 16:15:50 -05:00
Pietro Gagliardi a0c3c80393 Finished migrating OS X uiArea to the new scroll system. Now to compile and test. Crossed events come next. 2015-12-19 15:33:54 -05:00
Pietro Gagliardi 8cf437211d Dropped ALL the custom scrolling crap from darwin/area.m. We're going back to NSScrollView baby! 2015-12-19 15:13:44 -05:00
Pietro Gagliardi 85dac9fa80 Oh right they don't show because of ID2D1HwndRenderTarget::Resize(). I still wonder if areas outside the scroll could be scrolled visible... 2015-12-19 14:56:44 -05:00
Pietro Gagliardi b5d257409c Added a green "out of bounds" area to test/page7c.c. For some reason it doesn't show up here... will need to look further. 2015-12-19 14:54:24 -05:00
Pietro Gagliardi af374ed859 Implemented redrawing on scrolling and adjusting scrolling on resizing and actually implemented scrolled drawing correctly on uiArea on Windows. 2015-12-19 14:43:34 -05:00
Pietro Gagliardi a922551b78 More TODOs. 2015-12-19 01:17:06 -05:00
Pietro Gagliardi 0f80d15fc4 Added a test of scrolled drawing. More TODOs. 2015-12-19 01:16:32 -05:00
Pietro Gagliardi 13fa2e213d Took scrolling into account on uiArea with drawing (untested) and mouse events (tested). This is the preliminary work for moving scrolling from pixels to DIPs. But first, a test of scrolled drawing. 2015-12-18 22:06:48 -05:00
Pietro Gagliardi adc72c9d0b Implemented the other areautil.c functions. 2015-12-18 21:38:27 -05:00
Pietro Gagliardi 5e90cbcb93 Started a windows/areautil.c for miscellaneous functions, mostly (completely for now) having to do with coordinates and sizes. Right now it only has renderTargetGetSize(). 2015-12-18 21:15:40 -05:00
Pietro Gagliardi 444a7d3045 Fixed mouse capture behavior. It's not as clean as it could be, but it'll do. 2015-12-18 19:38:21 -05:00
Pietro Gagliardi 4b114f2764 Started the implementation of mouse crossing on Windows. 2015-12-18 18:06:45 -05:00
Pietro Gagliardi ce042eb12a Added an expository comment to windows/area.c. 2015-12-18 15:05:49 -05:00
Pietro Gagliardi 4edcddce14 Fixed the ID2D1RenderTarget::GetSize() madness a *SECOND* time. Urgh. Also removed a now-irrelevant TODO. 2015-12-18 15:04:37 -05:00
Pietro Gagliardi 6d06e15390 More Windows uiArea migration and compiler error fixes. Now to figure out what happened with GetSize again... 2015-12-18 14:21:35 -05:00
Pietro Gagliardi e76b34b670 Split windows/area.c into a bunch of files to make it much more manageable. Also did half of the migration to the new uiArea system. 2015-12-18 12:00:46 -05:00
Pietro Gagliardi fdbaea6b6c Migrated the histogram example to the new uiArea system. 2015-12-17 21:26:55 -05:00
Pietro Gagliardi 2ce0c810f1 Added a test of mouse events in a scrolled uiArea. Removed some dead code from the GTK+ uiArea. Now to make the changes to the Windows and OS X backends! 2015-12-17 21:21:29 -05:00
Pietro Gagliardi 6b2d9920c5 Split out the content of test/page7.c into test/page7a.c so more can be put on page 7. 2015-12-17 21:11:00 -05:00
Pietro Gagliardi cc7dd186e5 Fixed runtime issues with uiArea on GTK+. It works! 2015-12-17 19:59:33 -05:00
Pietro Gagliardi 0cb080d085 Ported over the tests. Now to fix runtime errors! 2015-12-17 19:30:28 -05:00
Pietro Gagliardi 78b714c238 Oh neat, only one compiler error. Now to rewrite the tests. 2015-12-17 19:19:08 -05:00
Pietro Gagliardi e167b08fdb Finished reimplementing the GTK+ uiArea. Now to build. Then to rewrite the tests... 2015-12-17 19:16:30 -05:00
Pietro Gagliardi 8ea3b07aa8 Got rid of the clientWidth and clientHeight variables. 2015-12-17 17:37:58 -05:00
Pietro Gagliardi 473c6c92f0 FINALLY removed areaPrivate from uiArea on GTK+, using uiArea itself for everything. Standardized variable names on that front. Also implemented MouseCrossing() there. 2015-12-17 16:49:59 -05:00
Pietro Gagliardi 1957ff1418 More TODOs. 2015-12-17 16:31:56 -05:00
Pietro Gagliardi ffe9a2db28 Got rid of the GtkScrollable code from GtkDrawingArea for uiArea. Woo! Now we just have to nuke all that from the Cocoa backend and we're good. 2015-12-17 14:48:58 -05:00
Pietro Gagliardi e9247858d4 Forgot a parameter in uiAreaHandler.MouseCrossed(). 2015-12-17 14:20:17 -05:00
Pietro Gagliardi 4e015cf4d6 More parameter updating. 2015-12-17 13:54:54 -05:00
Pietro Gagliardi 12a94404aa Set up a new infrastruture which allows both scrolling and non-scrolling areas AND mouse entered/exited events. 2015-12-17 13:50:07 -05:00
Pietro Gagliardi 4e256dfc95 Fixed some oversights in the GTK+ uiArea code. 2015-12-16 18:09:04 -05:00
Pietro Gagliardi 41f1886b02 Settled the OS X rpath stuff. 2015-12-13 02:28:51 -05:00
Pietro Gagliardi 6bee3f2f71 Fixed a bug in the Mac build. 2015-12-13 02:12:13 -05:00
Pietro Gagliardi 3f9862c472 OUCH. Fixed a MASSIVE bug in the GTK+ implementation of uiWindow: uiWindowSetChild() was DESTROYING the old child, not merely removing it! The other ports don't have this bug. 2015-12-12 15:30:56 -05:00
Pietro Gagliardi 18c5a6fd19 Re-added the Haiku makefiles. 2015-12-11 20:26:26 -05:00
Pietro Gagliardi d05b374a05 Added a makefile for examples. 2015-12-11 20:22:07 -05:00
Pietro Gagliardi 3e0b6fdff4 Re-established the test build. 2015-12-11 20:04:31 -05:00
Pietro Gagliardi e390730e6f Reestablished the Windows build. Also fixed a small bug in windows/area.c. Now to re-establish the test! 2015-12-11 19:49:14 -05:00
Pietro Gagliardi 327abd04b0 Re-established the OS X build. 2015-12-11 18:58:27 -05:00
Pietro Gagliardi c027f30c48 More TODOs. 2015-12-11 18:39:04 -05:00
Pietro Gagliardi acf3b3564e Set up the new Unix build. Now to do the OS X build. 2015-12-11 18:37:15 -05:00
Pietro Gagliardi eb22f253b2 More work on the new build system. I think this will work out fine actually, but I can't test without deploying >:( 2015-12-11 18:28:07 -05:00
Pietro Gagliardi 58d160b0ca More TODOs. 2015-12-10 19:22:16 -05:00
Pietro Gagliardi 49049beb91 Started the new build system, with full documentation. 2015-12-10 19:08:26 -05:00
Pietro Gagliardi 70886e4ade Moved the old build files away. Yes that's right folks, we're redoing the build system *again*! Isn't that *fun*? 2015-12-10 18:49:50 -05:00
Pietro Gagliardi c005203b8a Stubbed uiMultilineEntry on Haiku. Why not. 2015-12-10 15:49:22 -05:00
Pietro Gagliardi 919e5f09cd Double-correction of previous commit. 2015-12-09 15:38:24 -05:00
Pietro Gagliardi 5f530c5bf7 More MinGW stuff. 2015-12-09 15:36:56 -05:00
Pietro Gagliardi be6555d885 More MinGW removal stuff. 2015-12-09 15:31:14 -05:00
Pietro Gagliardi 5e26720f18 Removed $ARCH from the build. 2015-12-09 13:49:13 -05:00
Pietro Gagliardi a29f8ee890 Stupid Markdown 2015-12-09 13:04:27 -05:00
Pietro Gagliardi e620a97573 Updated the README. Going to outright drop MinGW-w64 support next. 2015-12-09 13:03:16 -05:00
Pietro Gagliardi 78868253c5 Removed note about manifest file on Windows. 2015-12-09 09:51:30 -05:00
Pietro Gagliardi 529620eb47 Updated a TODO. 2015-12-09 09:07:00 -05:00
Pietro Gagliardi c5a5038382 Fixed the uiMultilineEntry on OS X so that it now actually displays something. More TODOs. 2015-12-09 09:05:28 -05:00
Pietro Gagliardi 11fe5deb73 More NSTextView work. 2015-12-08 21:09:23 -05:00
Pietro Gagliardi ea6e903069 TRIED TO add uiMultilineEntry on OS X. It does not quite work yet. 2015-12-08 13:06:26 -05:00
Pietro Gagliardi c4d587c075 More TODOs. 2015-12-07 22:50:58 -05:00
Pietro Gagliardi 74783d90cf More TODOs. 2015-12-06 16:54:03 -05:00
Pietro Gagliardi 0307e74e90 Added uiMultilineEntry on Windows. Fixed a misuse of std::condition_variable in the uiQueueMain test program. 2015-12-06 14:38:13 -05:00
Pietro Gagliardi 2705f93305 Added uiMultilineEntry, wrote it on GTK+, and wrote the uiQueueMain() test. It works on Unix. 2015-12-06 01:18:32 -05:00
Pietro Gagliardi 3394142357 Some TODO expansion. This was the active tab on my browser the whole time and I didn't even notice! 2015-12-05 20:37:29 -05:00
Pietro Gagliardi c5eef23930 More TODOs. 2015-12-05 20:31:57 -05:00
Pietro Gagliardi 994d43c00e More TODOs. 2015-12-05 18:42:28 -05:00
Pietro Gagliardi 88f9c7ea19 Quick comment update for previous commit. 2015-12-04 23:49:04 -05:00
Pietro Gagliardi f77955aefb Added uiQueueMain() (basically g_idle_add()) and implemented it on all platforms except Haiku. A test to come. After this we can start rewriting the Go package ui at long last. 2015-12-04 23:42:03 -05:00
Pietro Gagliardi d12974eef1 More TODOs. 2015-12-04 21:11:43 -05:00
Pietro Gagliardi 79e00d3c90 Fixed improper initialization of uiDrawStrokeParams in the histogram example. 2015-12-04 21:10:27 -05:00
Pietro Gagliardi 8084041139 Removed uiAreaHandler.RedrawOnResize(); Direct2D requires us to always redraw on resize (see previous commit). Added windows/amd64 to the example makefiles and updated them to use libui.xxx instead of new.xxx. 2015-12-04 21:04:51 -05:00
Pietro Gagliardi c2100a19be Implemented some changes to uiArea on Windows, thanks to instructions from Rick Brewster. Removing uiAreaHandler.RedrawOnResize() comes next. 2015-12-04 20:45:31 -05:00
Pietro Gagliardi d1c93a9956 Made relayouts on Windows faster by preventing an accidental requeue of a window that's being processed in the event that a layout change changes the minimum size (such as switching tabs). 2015-12-04 19:34:51 -05:00
Pietro Gagliardi fc241bca61 Actually the theme fonts aren't any more useful than what we have now. 2015-12-03 19:36:13 -05:00
Pietro Gagliardi 37271359ab More TODOs. 2015-12-03 19:23:45 -05:00
Pietro Gagliardi be7d9c35f8 More TODOs. 2015-11-30 19:53:44 -05:00
Pietro Gagliardi d9343c0b4b More TODOs. 2015-11-30 09:12:56 -05:00
Pietro Gagliardi 4aa755326e Removed a stray comment. 2015-11-28 16:39:07 -05:00
Pietro Gagliardi bf35167d40 More TODOs. 2015-11-28 16:36:08 -05:00
Pietro Gagliardi a10aed65a1 More TODOs. 2015-11-28 15:39:46 -05:00
Pietro Gagliardi 8adb1a25a2 More TODOs. 2015-11-28 12:16:05 -05:00
Pietro Gagliardi bf6fabef21 Implemented the dialog stuff on OS X. 2015-11-28 12:09:14 -05:00
Pietro Gagliardi 3943c2c65e Implemented the dialog changes on the GTK+ backend. 2015-11-28 11:02:58 -05:00
Pietro Gagliardi 81112fe955 "Implemented" the stddialogs.cpp change on Haiku. 2015-11-28 10:55:24 -05:00
Pietro Gagliardi e6e264408f Implemented dialog parenting on Windows. Eliminated the dialog helper. uiArea still works (and still responds to key events), but IsDialogMessage() isn't being called for the active window anymore... 2015-11-28 10:53:48 -05:00
Pietro Gagliardi 0bcd620a62 Started a change which will allow a parent of the standard dialogs to be specified. 2015-11-27 23:23:54 -05:00
Pietro Gagliardi 7646e8303d Fixed a small bug in the uiArea message filter. 2015-11-27 23:00:57 -05:00
Pietro Gagliardi 09129229fd Fixed assorted MSVC uiArea issues. 2015-11-27 22:44:42 -05:00
Pietro Gagliardi 14887ad7e3 Fixed a logical error in the uiArea message filter. 2015-11-27 21:53:17 -05:00
Pietro Gagliardi 3a5a4557ab Switch uiArea from using a custom message pump to using a message filter for input handling. This allows us to rewrite the dialog system to avoid needing to block ALL windows and set a proper parent window. 2015-11-27 21:45:30 -05:00
Pietro Gagliardi 6bb659de4e More TODOs. 2015-11-27 20:52:56 -05:00
Pietro Gagliardi f5a2759b09 Dropped utarray in favor of our ptrArray. This should get rid of our strdup woes. 2015-11-27 20:38:21 -05:00
Pietro Gagliardi c87cf13d67 Turned off incremental linking. 2015-11-27 20:25:01 -05:00
Pietro Gagliardi 69823eab84 More MSVC build fixes 2015-11-27 20:18:14 -05:00
Pietro Gagliardi 99176a1d10 Disabled compiler warnings for system headers on MSVC. Removed /Wp64; it's a no-op on VS2013 (our minimum supported version). 2015-11-27 20:07:23 -05:00
Pietro Gagliardi d29d36a6cd Fixed assorted build errors in the MSVC build. It works! And MinGW-w64 will need isolation awareness... 2015-11-27 19:59:46 -05:00
Pietro Gagliardi ba55b8ec7a Added a rudimentary MSVC Makefile. It still requires GNU make because nmake isn't powerful enough. I need to fix something in windows/winapi.h before it will work with Microsoft's resource compiler though... 2015-11-27 19:13:53 -05:00
Pietro Gagliardi abd99a325b Integrated the Common Controls 6 manifest into libui.dll. While it does work, themes don't work, and I wonder if it's because of isolation awareness. Time to write an nmakefile! 2015-11-27 13:35:24 -05:00
Pietro Gagliardi 490fa315d1 Added controls to the menued enabled window in the test program to test dialog ownership. 2015-11-27 13:01:12 -05:00
Pietro Gagliardi b8be92bc45 More notes. 2015-11-27 12:35:23 -05:00
Pietro Gagliardi bd354fd651 More TODOs. 2015-11-27 12:21:40 -05:00
Pietro Gagliardi 9153766dc9 Added a checkbox for testing uiArea keystroke ignoring. This will be for migrating the Windows keyboard code to using message filters, so we can clean up dialog handling. 2015-11-27 11:49:06 -05:00
Pietro Gagliardi 923c4c091e Decided not to bother with winforms either. 2015-11-27 10:49:50 -05:00
Pietro Gagliardi 284c96a72a Started migrating this experiment from WPF to WinForms. Maybe this will be more featureful. 2015-11-27 10:05:13 -05:00
Pietro Gagliardi 60becb332e More work. NOW we're getting boring :v 2015-11-26 20:34:21 -05:00
Pietro Gagliardi 36f572078e Started filling in controls. 2015-11-26 19:11:55 -05:00
Pietro Gagliardi 42b0bada64 Stubbed everything else. It works! 2015-11-26 18:27:23 -05:00
Pietro Gagliardi 2eca184d0a Removed the xtests; we are now going to stub the rest of this out. 2015-11-26 16:44:56 -05:00
Pietro Gagliardi 57a13620c8 More TODOs. 2015-11-26 16:42:32 -05:00
Pietro Gagliardi 70205d0248 Added uiCheckbox to the WPF test. 2015-11-26 16:34:34 -05:00
Pietro Gagliardi 77c3e83821 Added uiLabel to WPF. 2015-11-26 13:55:39 -05:00
Pietro Gagliardi 10ec52d8db Added uiTab to the WPF system. 2015-11-26 12:09:12 -05:00
Pietro Gagliardi 7e6c3c0abe Implemented uiBox on WPF. 2015-11-26 01:26:30 -05:00
Pietro Gagliardi 99521f4801 More TODOs. 2015-11-25 23:41:14 -05:00
Pietro Gagliardi a46d0a760c Fixed child handling in WPF uiWindows. 2015-11-25 22:22:12 -05:00
Pietro Gagliardi e279c7b319 Added uiButton to the WPF code. 2015-11-25 22:08:14 -05:00
Pietro Gagliardi 4ec3632920 More WPF uiWindow work. 2015-11-25 20:43:34 -05:00
Pietro Gagliardi 6e88ab611a Fixed most of the various bugs preventing this libui from working. Woo! It even works from Go! 2015-11-25 17:42:25 -05:00
Pietro Gagliardi c529ba86cf Wrote a C version of xtest.go. I need to somehow restore the .net error handler in the Go code... 2015-11-25 17:25:57 -05:00
Pietro Gagliardi e775c3bb6c Removed the original exe/dll and edited some xtest.go stuff. 2015-11-25 17:20:39 -05:00
Pietro Gagliardi 554cd31fa2 First attempt at running WPF libui in Go just to have fun. It fails :( 2015-11-25 16:48:21 -05:00
Pietro Gagliardi 0e0c314bea Implemented uiWindow on WPF. We now have a DLL that builds! 2015-11-25 16:32:39 -05:00
Pietro Gagliardi 3d9aa4ce9a More boilerplate. Okay, now we can get to the good stuff: the controls! 2015-11-25 15:46:57 -05:00
Pietro Gagliardi f93d9a4c91 More WPF foundations/boilerplate work. 2015-11-25 14:38:40 -05:00
Pietro Gagliardi 896beb036d More build stuff. 2015-11-25 13:17:32 -05:00
Pietro Gagliardi a336cdcf4a Started converting to libui. 2015-11-25 12:17:31 -05:00
Pietro Gagliardi 513c1b92ad Fixed some DLL problems. 2015-11-25 12:06:20 -05:00
Pietro Gagliardi b0e5ba2bc7 Figured out something for C files instead. 2015-11-25 11:56:37 -05:00
Pietro Gagliardi 9cd70d294a Attempted to split out the STA code from the rest of the build. This is a mess. MSBuild might not be sufficient here. 2015-11-25 11:22:00 -05:00
Pietro Gagliardi c01c676130 Handled directories in the msbuild project. 2015-11-25 09:48:43 -05:00
Pietro Gagliardi e641ba4000 And fixed up the vcxproj file. 2015-11-25 07:26:48 -05:00
Pietro Gagliardi b8f4febe3c Edited the vcxproj file in Visual Studio. 2015-11-25 07:20:12 -05:00
Pietro Gagliardi 928dbca808 Started rewriting the vcxproj file for editing in Visual Studio directly. 2015-11-25 06:54:19 -05:00
Pietro Gagliardi d2449b6c55 Added an experiment. 2015-11-24 20:09:26 -05:00
Pietro Gagliardi 980b93381b Fixed alpha transparency on Haiku, or so it seems. Assorted other notes too. 2015-11-23 19:12:11 -05:00
Pietro Gagliardi a7aa50ae2c Started implementing uiArea on Haiku. 2015-11-23 18:08:34 -05:00
Pietro Gagliardi 14d2073f28 More Haiku drawing code. 2015-11-23 16:04:36 -05:00
Pietro Gagliardi f7c114cb63 Started writing the Haiku drawing code. 2015-11-23 11:06:00 -05:00
Pietro Gagliardi 62e3259db7 More TODOs. 2015-11-23 01:03:40 -05:00
Pietro Gagliardi 2d6c0ee49e More Haiku work. 2015-11-22 11:00:14 -05:00
Pietro Gagliardi a49b193df4 Even more BLayout fixes. 2015-11-20 14:11:55 -05:00
Pietro Gagliardi 4445e5ee47 More BLayout fixes. 2015-11-20 14:00:36 -05:00
Pietro Gagliardi 43dad53637 Oops, uiTab wasn't set up to use BLayout properly. Fixed. 2015-11-20 13:56:09 -05:00
Pietro Gagliardi 82b960e87e More TODOs. 2015-11-20 13:24:07 -05:00
Pietro Gagliardi 1a70407be2 Wrote up the event handling code for Haiku. 2015-11-20 11:45:04 -05:00
Pietro Gagliardi 48d014e762 More TODOs. 2015-11-20 10:32:26 -05:00
Pietro Gagliardi f052df5784 Removed a TODO (yes, BWindow::QuitRequested() is correct for what we want, according to the Programming BeOS book). 2015-11-20 10:30:07 -05:00
Pietro Gagliardi b23de8794e Implemented uiCheckbox and uiEntry on Haiku. Still no event handling. 2015-11-19 17:26:40 -05:00
Pietro Gagliardi 278c973ae5 uiButton work. No event ties yet. 2015-11-19 17:11:35 -05:00
Pietro Gagliardi 6719275576 Some uiTab work. 2015-11-19 16:57:15 -05:00
Pietro Gagliardi a603386208 Some documentation cleanup. 2015-11-19 13:44:53 -05:00
Pietro Gagliardi df4156033b Split out the code for single-child handling so that uiTab can use it too; started switching uiTab to its proper implementation. 2015-11-19 12:41:58 -05:00
Pietro Gagliardi 9acc6a2f30 Set up uiWindow children. 2015-11-19 10:38:07 -05:00
Pietro Gagliardi 425b1d4fa3 Set uiBox to use its own view; BGroupLayout is NOT a view. 2015-11-19 09:15:23 -05:00
Pietro Gagliardi dbea109414 Stubbed everything else. 2015-11-19 09:01:05 -05:00
Pietro Gagliardi 2e24d2ce5a Stubbed the other controls (and implemented uiLabel) on Haiku. 2015-11-19 08:47:53 -05:00
Pietro Gagliardi 4f1bd2474d Stubbed uiArea on Haiku. 2015-11-18 23:47:20 -05:00
Pietro Gagliardi f7f96f4d8b Added an implementation of uiBox. 2015-11-18 16:16:29 -05:00
Pietro Gagliardi 3bbd4bfeac Gave the uiWindow a background color. This will lead into children. 2015-11-18 15:47:15 -05:00
Pietro Gagliardi c329a721ca More TODOs. 2015-11-18 11:51:54 -05:00
Pietro Gagliardi 86388debb0 Fixed a bug in Haiku's uiWindow. 2015-11-18 11:43:22 -05:00
Pietro Gagliardi 71defd53ce Wrote uiWindow for Haiku. It works! 2015-11-18 11:35:43 -05:00
Pietro Gagliardi 4d3d80736b Fixed stupid STUPID **STUPID** C and C++ language bullshit. 2015-11-17 20:01:01 -05:00
Pietro Gagliardi 794186a5a9 Somehow I never had -pedantic; fixed. 2015-11-17 19:52:05 -05:00
Pietro Gagliardi cfa09ecba0 Wrote some of the boilerplate. Now we can get to the meat of the matter. 2015-11-17 19:33:22 -05:00
Pietro Gagliardi 2a42511c5c Fixed an assortment of C++ and Haiku build errors. 2015-11-17 19:18:55 -05:00
Pietro Gagliardi 5cfea3c0e0 Forgot a file in the uiTable removal. 2015-11-17 13:51:14 -05:00
Pietro Gagliardi e295163653 Settled GCC 4 stuff, I think. 2015-11-17 13:44:57 -05:00
Pietro Gagliardi ff9dcc6d58 Wrote the Haiku allocator and fixed some leftovers in other allocators. 2015-11-17 12:51:51 -05:00
Pietro Gagliardi 07a9b452aa Added some notes. 2015-11-17 12:24:48 -05:00
Pietro Gagliardi 786c0a33d4 More TODOs. 2015-11-17 12:09:51 -05:00
Pietro Gagliardi 486ca161d3 Removed gcc2 support in Haiku. 2015-11-17 11:55:52 -05:00
Pietro Gagliardi c40e80d5a5 Added C++ to the build and started writing the actual Haiku code. I think this isg oing to have to require a GCC 4 hybrid... 2015-11-17 11:49:23 -05:00
Pietro Gagliardi e24bde16ba Entering Valhalla. 2015-11-17 10:46:58 -05:00
Pietro Gagliardi a9316a04b0 Added C++ extern guards. 2015-11-16 10:55:44 -05:00
Pietro Gagliardi 5e29d07d20 Moved all the table stuff out of the way. I need to decide what I'm going to do with it. 2015-11-16 10:52:19 -05:00
Pietro Gagliardi e340f75b78 Broke the very long chain of tabs apart in the test program. 2015-11-02 10:49:04 -05:00
Pietro Gagliardi 5d26b9b059 Finished the uiTable test and fixed errors. 2015-10-19 10:52:36 -04:00
Pietro Gagliardi fa2252e9c6 Started a table test. 2015-10-18 23:00:24 -04:00
Pietro Gagliardi 056db88de0 More uiTable work. I'm not too happy anymore... 2015-10-18 18:55:06 -04:00
Pietro Gagliardi 66cd3542bc Reworked the table model system a bit. 2015-10-18 18:05:38 -04:00
Pietro Gagliardi 4577cb79a1 Started the GTK+ implementation of uiTable and added uiTableSubscriptions. This is a mess already :D 2015-10-18 13:59:38 -04:00
Pietro Gagliardi 60accb0676 Set up the API for tables. 2015-10-18 11:21:56 -04:00
Pietro Gagliardi 858ff1d64f Quick makefile change. 2015-10-17 10:22:43 -04:00
Pietro Gagliardi c9b241a7b6 More makefile work. 2015-10-17 10:20:31 -04:00
Pietro Gagliardi 260a7f4879 More makefile fixes. 2015-10-16 23:33:53 -04:00
Pietro Gagliardi f19d3cd0c7 More makefile work. 2015-10-16 22:49:54 -04:00
Pietro Gagliardi e04e5dc90f Made libui position-independent. 2015-10-16 22:02:56 -04:00
Pietro Gagliardi e6d302f7ab Turned off soname for now. This is confusing as all hell. 2015-10-16 21:39:28 -04:00
Pietro Gagliardi 790edf0df8 Assembled a new make system. Not quite working the way I'd like yet, but definitely a start. 2015-10-16 20:55:09 -04:00
Pietro Gagliardi ab97e26efc Moved all the common stuff in a new folder common/. This is part of the makefile simplification. 2015-10-16 18:31:14 -04:00
Pietro Gagliardi 8b61215052 Set up a _wip folder for WIP stuff. 2015-10-16 18:27:13 -04:00
Pietro Gagliardi 982bc989cd Cleaned up the makefile a bit. 2015-10-16 18:14:05 -04:00
460 changed files with 49998 additions and 12311 deletions

92
.appveyor.yml Normal file
View File

@ -0,0 +1,92 @@
version: 'build #{build}'
environment:
matrix:
- arch: 386
libtype: shared
libfiles: libui.dll libui.lib
compiler: msvc2013
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
- arch: 386
libtype: static
libfiles: libui.lib
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
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
- arch: amd64
libtype: static
libfiles: libui.lib
compiler: mingw
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
platform:
- 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 )
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
after_build:
- set "version=%APPVEYOR_REPO_BRANCH%"
- 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
artifacts:
- path: libui-*.zip
name: libui
- path: examples-*.zip
name: examples
deploy:
provider: GitHub
artifact: libui, examples
auth_token:
secure: li92W7mFAC8HbAVeZN6Ugmo5H1GzKSjr6DXlMniLcCRspKmi2Nz1nlslSa+9sLfo
on:
appveyor_repo_tag: true # deploy on tag push only

131
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,131 @@
# Contributing to libui
libui is an open source project that openly accepts contributions. I appreciate your help!
## Rules for contributing code
While libui is open to contributions, a number of recent, significantly large contributions and uncontributed forks have recently surfaced that do not present themselves in a form that makes it easy for libui to accept them. In order to give your contribution a high chance of being accepted into libui, please keep the following in mind as you prepare your contribution.
### Commit messages and pull request description
libui does not enforce rules about the length or detail that a commit message. I'm not looking for an essay. However, single-word descriptions of nontrivial changes are *not* acceptable. I should be able to get a glimpse of what a commit does from the commit message, even if it's just one sentence to describe a trivial change. (Yes, I know I haven't followed this rule strictly myself, but I try not to break it too.) And a commit message should encompass everything; typically, I make a number of incremental commits toward a feature, so the commit messages don't have to be too long to explain everything.
Your pull request description, on the other hand, must be a summary of the sum total of all the changes made to libui. Don't just drop a pull request on me with a one-line-long elevator pitch of what you added. Describe your proposed API changes, implementation requirements, and any important consequences of your work.
### Code formatting
libui uses K&R C formatting rules for overall code structure: spaces after keywords like `if`, `{` on the same line as a statement with a space, `{` on its own line after a function or method signature (even those inside the class body), no space after the name of a function, etc.
Use hard tabs, NOT spaces, for indentation. I use a proportional-width font and my text editor doesn't set tabs to a multiple of the space width, so I *will* be able to tell. If you use a fixed-width font, I suggest setting a tab width of 4 spaces per tab, but don't put diagrams in comments with hard tabs, because not everyone does this.
Expressions should have a space around binary operators, and use parentheses where it would help humans gather the meaning of an expression, regardless of whether a computer could tell what is correct.
When breaking expressions into multiple lines, always break *after* an operator, such as `,` or `&&`.
There should be a newline between a function's variables and a function's code. After that, you can place newlines to delimit different parts of a function, but don't go crazy.
In the event you are unsure of something, refer to existing libui code for examples. I may wind up fixing minor details later anyway, so don't fret about getting minor details right the first time.
### Naming
libui uses camel-case for naming, with a handful of very specific exceptions (namely GObject method names, where GObject itself enforces the naming convention).
All public API names should begin with `ui` and followed by a capital letter. All public struct field names should begin with a capital letter. This is identical to the visibiilty rules of Go, assuming a package name of `ui`.
Private API names — specifcally those used by more than one source file — should begin with `uipriv` and be followed by a capital letter. This avoids namespace collisions in static libraries.
Static functions and static objects do not have naming restrictions.
Acronyms should **NOT** be mixed-case. `http` for the first word in a camel-case name, `HTTP` for all else, but **NEVER** `Http`. This is possibly the only aspect of the controversial nature of code style that I consider indefensibly stupid.
### API documentation
(TODO I am writing an API documentation tool; once that becomes stable enough I can talk about documenting libui properly. You'll see vestiges of it throughout ui.h, though.)
### Other commenting
(TODO write this part)
### Compatibility
libui takes backward compatibility seriously. Your code should not break the current compatibility requirements. All platforms provide a series of macros, defined in the various `uipriv_*.h` files (or `winapi.hpp` on Windows), that specify the minimum required version. If you find yourself needing to remove these or ignore resultant warnings or errors, you're probably breaking compatibility.
Choosing to drop older versions of Windows, GTK+, and OS X that I could have easily continued to support was not done lightly. If you want to discuss dropping support for an older version of any of these for the benefit of libui, file an issue pleading your case (see below).
GTK+ versions are harder to drop because I am limited by Linux distribution packaging. In general, I will consider bumping GTK+ versions on a new Ubuntu LTS release, choosing the earliest version available on the major distributions at the time of the *previous* Ubuntu LTS release. As of writing, the next milestone will be *after* April 2018, and the target GTK+ version appears to be 3.18, judging by Ubuntu 16.04 LTS alone. This may be bumped back depending on other distros (or it may not be bumped at all), but you may wish to keep this in mind as you write.
(TODO talk about future.c/.cpp/.m files)
As for language compatibility, libui is written in C99. I have no intention of changing this.
As for build system compatibility, libui uses CMake 3.1.0. If you wish to bump the version, file an issue pleading your case (but see below).
**If you do plead your case**, keep in mind that "it's old" is not a sufficient reason to drop things. If you can prove that **virtually no one** uses the minimum version anymore, then that is stronger evidence. The best evidence, however, is that not upgrading will hold libui back in some significant way — but beware that there are some things I won't add to libui itself.
### Windows-specific notes
The Windows backend of libui is written in C++ using C++11.
Despite using C++, please refrain from using the following:
- using C++ in ui_windows.h (this file should still be C compatible)
- smart pointers
- namespaces
- `using namespace`
- ATL, MFC, WTL
The following are not recommended, for consistency with the rest of libui:
- variable declarations anywhere in a function (keep them all at the top)
- `for (int x...` (C++11 foreach syntax is fine, though)
- omitting the `struct` on type names for ordinary structs
The format of a class should be
```c++
class name : public ancestor {
int privateVariable;
// etc.
public:
// public stuff here
};
```
### GTK+-specific notes
Avoid GNU-specific language features. I build with strict C99 conformance.
### OS X-specific notes
Avoid GNU-specific/clang-specific language features. I build with strict C99 conformance.
libui is presently **not** ARC-compliant. Features that require ARC should be avoided for now. I may consider changing this in the future, but it will be a significant change.
To ensure maximum compiler output in the event of a coding error, there should not be any implicit method calls in Objective-C code. For instance, don't do
```objective-c
[[array objectAtIndex:i] method]
```
Instead, cast the result of `objectAtIndex:` to the appropriate type, and then call the method. (TODO learn about, then decide a policy on, soft-generics on things other than `id`)
The format of a class should be
```objective-c
@interface name : parent<protocols> {
// ivars
}
// properties
- (ret)method:(int)arg;
// more methods
@end
@implementation name
- (ret)method:(int)arg
{
// note the lack of semicolon
}
@end
```

141
Compatibility.md Normal file
View File

@ -0,0 +1,141 @@
# Useful things in newer versions
## Windows
### Windows 7
http://channel9.msdn.com/blogs/pdc2008/pc43
TODO look up PDC 2008 talk "new shell user interface"
- new animation and text engine
- ribbon control (didn't this have some additional license?)
- LVITEM.piColFmt
### Windows 8
### Windows 8.1
### Windows 10
## GTK+
TODO what ships with Ubuntu Quantal (12.10)?
### GTK+ 3.6
ships with: Ubuntu Raring (13.04)
- GtkEntry and GtkTextView have input purposes and input hints for external input methods but do not change input themselves
- according to Company, we connect to insert-text for that
- GtkLevelBar
- GtkMenuButton
- **GtkSearchEntry**
### GTK+ 3.8
ships with: Ubuntu Saucy (13.10)
Not many interesting new things to us here, unless you count widget-internal tickers and single-click instead of double-click to select list items (a la KDE)... and oh yeah, also widget opacity.
### GTK+ 3.10
ships with: **Ubuntu Trusty (14.04 LTS)**
<br>GLib version: 2.40
- tab character stops in GtkEntry
- GtkHeaderBar
- intended for titlebar overrides; GtkInfoBar is what I keep thinking GtkHeaderBar is
- **GtkListBox**
- GtkRevealer for smooth animations of disclosure triangles
- GtkSearchBar for custom search popups
- **GtkStack and GtkStackSwitcher**
- titlebar overrides (seems to be the hot new thing)
### GTK+ 3.12
ships with: Ubuntu Utopic (14.10)
<br>GLib version: 2.42
- GtkActionBar (basically like the bottom-of-the-window toolbars in Mac programs)
- gtk_get_locale_direction(), for internationalization
- more control over GtkHeaderBar
- **GtkPopover**
- GtkPopovers on GtkMenuButtons
- GtkStack signaling
- **gtk_tree_path_new_from_indicesv()** (for when we add Table if we have trees too)
### GTK+ 3.14
ships with: **Debian Jessie**, Ubuntu Vivid (15.04)
<br>GLib version: Debian: 2.42, Ubuntu: 2.44
- gestures
- better GtkListbox selection handling
- more style classes (TODO also prior?)
- delayed switch changes on GtkSwitch
### GTK+ 3.16
ships with: Ubuntu Wily (15.10)
<br>GLib version: 2.46
- gtk_clipboard_get_default() (???)
- **GtkGLArea**
- proper xalign and yalign for GtkLabel; should get rid of runtime deprecation warnings
- better control of GtkListBox model-based creation (probably not relevant but)
- GtkModelButton (for GActions; probably not relevant?)
- wide handles on GtkPaned
- GtkPopoverMenu
- IPP paper names in GtkPaperSize (TODO will this be important for printing?)
- multiple matches in GtkSearchEntry (TODO evaluate priority)
- **GtkStackSidebar**
- GTK_STYLE_CLASS_LABEL, GTK_STYLE_CLASS_MONOSPACE, GTK_STYLE_CLASS_STATUSBAR, GTK_STYLE_CLASS_TOUCH_SELECTION, GTK_STYLE_CLASS_WIDE (TODO figure out which of these are useful)
- GtkTextView: extend-selection
- GtkTextView: font fallbacks
### GTK+ 3.18
### GTK+ 3.20
## Cocoa
### Mac OS X 10.8
- Foundation ([full details](https://developer.apple.com/library/mac/releasenotes/Foundation/RN-FoundationOlderNotes/#//apple_ref/doc/uid/TP40008080-TRANSLATED_CHAPTER_965-TRANSLATED_DEST_999B))
- NSDateComponents supports leap months
- NSNumberFormatter and NSDateFormatter default to 10.4 behavior by default (need to explicitly do this on 10.7)
- **NSUserNotification and NSUserNotificationCenter for Growl-style notifications**
- better linguistic triggers for Spanish and Italian
- NSByteCountFormatter
- AppKit ([full details](https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKitOlderNotes/#X10_8Notes))
- view-based NSTableView/NSOutlineView have expansion tooltips
- NSScrollView magnification
- Quick Look events; TODO see if they conflict with keyboard handling in Area
- NSPageController (maybe useful?)
- not useful for package UI, but may be useful for a new library (probably not by me): NSSharingService
- NSOpenPanel and NSSavePanel are now longer NSPanels or NSWindows in sandboxed applications; this may be an issue should anyone dare to enable sandboxing on a program that uses package ui
- NSTextAlternatives
- -[NSOpenGLContext setFullScreen] now ineffective
- +[NSColor underPageBackgroundColor]
### Mac OS X 10.9
- Foundation ([full details](https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/))
- system-provided progress reporting/cancellation support
- NSURLComponents
- **NSCalendar, NSDateFormatter, and NSNumberFormatter are now thread-safe**
- various NSCalendar and NSDateComponents improvements
- AppKit ([full details](https://developer.apple.com/library/mac/releasenotes/AppKit/RN-AppKit/))
- sheet handling is now block-based, queued, and in NSWindow; the delegate-based NSApplication API will still exist, except without the queue
- similar changes to NSAlert
- **return value changes to NSAlert**
- window visibility APIs (occlusion)
- NSApplicationActivationPolicyAccessory
- fullscreen toolbar behavior changes
- status items for multiple menu bars
- better NSSharingService support
- a special accelerated scrolling mode, Responsive Scrolling; won't matter for us since I plan to support the scroll wheel and it won't
- NSScrollView live scrolling notifications
- NSScrollView floating (anchored/non-scrolling) subviews
- better multimonitor support
- better key-value observing for NSOpenPanel/NSSavePanel (might want to look this up to see if we can override some other juicy details... TODO)
- better accessory view key-view handling in NSOpenPanel/NSSavePanel
- NSAppearance
- **-[NSTableView moveRowAtIndex:toIndex:] bug regarding first responders fixed**
- view-specific RTL overrides
### Mac OS X 10.10
### Mac OS X 10.11
* **NSLayoutGuide**

View File

@ -1,66 +0,0 @@
# 22 april 2015
OUTBASE = new
OUTDIR = out
OBJDIR = .obj
IDLFILES = \
$(baseIDLFILES)
xHFILES = \
$(baseHFILES)
OFILES = \
$(baseCFILES:%.c=$(OBJDIR)/%.o) \
$(baseMFILES:%.m=$(OBJDIR)/%.o) \
$(baseRCFILES:%.rc=$(OBJDIR)/%.o)
xCFLAGS = \
-g \
-Wall -Wextra \
-Wno-unused-parameter \
-Wno-switch \
--std=c99 \
$(CFLAGS) \
$(archmflag) \
$(baseCFLAGS)
# windres doesn't support -m
xRCFLAGS = \
$(RCFLAGS) \
$(baseRCFLAGS)
xLDFLAGS = \
-g \
$(LDFLAGS) \
$(archmflag) \
$(baseLDFLAGS)
OUT = $(OUTDIR)/$(OUTBASE)$(baseSUFFIX)
$(OUT): $(OFILES) | $(OUTDIR)/.phony
@$(CC) -o $(OUT) $(OFILES) $(xLDFLAGS)
@echo ====== Linked $(OUT)
.SECONDEXPANSION:
$(OBJDIR)/%.o: %.c $(xHFILES) | $$(dir $$@).phony
@$(CC) -o $@ -c $< $(xCFLAGS)
@echo ====== Compiled $<
$(OBJDIR)/%.o: %.m $(xHFILES) | $$(dir $$@).phony
@$(CC) -o $@ -c $< $(xCFLAGS)
@echo ====== Compiled $<
$(OBJDIR)/%.o: %.rc $(xHFILES) | $$(dir $$@).phony
@$(RC) $(xRCFLAGS) $< $@
@echo ====== Compiled $<
# see http://www.cmcrossroads.com/article/making-directories-gnu-make
%/.phony:
@mkdir -p $(dir $@)
@touch $@
.PRECIOUS: %/.phony
clean:
rm -rf $(OUTDIR) $(OBJDIR) z*
.PHONY: clean

View File

@ -1,51 +0,0 @@
# 22 april 2015
# MAME does this so :/
ifeq ($(OS),Windows_NT)
OS = windows
endif
ifndef OS
UNAME = $(shell uname -s)
ifeq ($(UNAME),Darwin)
OS = darwin
else
OS = unix
endif
endif
include $(OS)/GNUmakeinc.mk
baseHFILES = \
ui.h \
uipriv.h \
ui_$(OS).h \
$(osHFILES)
baseCFILES = \
areaevents.c \
control.c \
matrix.c \
menu.c \
ptrarray.c \
shouldquit.c \
types.c \
$(osCFILES)
baseMFILES = $(osMFILES)
baseRCFILES = $(osRCFILES)
baseCFLAGS = $(osCFLAGS)
baseLDFLAGS = \
-shared \
$(osLDWarnUndefinedFlags) \
$(osLDFLAGS)
baseRCFLAGS = $(osRCFLAGS)
baseSUFFIX = $(osLIBSUFFIX)
include GNUbase.mk
test: $(OUT)
@$(MAKE) -f GNUmaketest.mk osLIB=$(OUT) osEXESUFFIX=$(osEXESUFFIX) CC=$(CC) archmflag=$(archmflag)
.PHONY: test

View File

@ -1,15 +0,0 @@
# 22 april 2015
# should never be invoked directly, only ever from the main makefile
include test/GNUmakeinc.mk
baseHFILES = \
$(testHFILES)
baseCFILES = $(testCFILES)
baseCFLAGS = $(testCFLAGS)
baseLDFLAGS = $(osLIB) $(testLDFLAGS)
baseSUFFIX = $(osEXESUFFIX)
include GNUbase.mk

7
Makefile Normal file
View File

@ -0,0 +1,7 @@
all:
redomod:
rm -f go.*
GO111MODULE= go mod init
GO111MODULE= go mod tidy

113
NEWS.md Normal file
View File

@ -0,0 +1,113 @@
# Old News
* **27 November 2016**
* Decided to split the table stuff into its own branch. It will be developed independently of everything else, along with a few other features.
* **2 November 2016**
* Added two new functions to replace the deleted `uiWindowPosition()` and friends: `uiAreaBeginUserWindowMove()` and `uiAreaBeginUserWindowResize()`. When used in a `uiAreaHandler.Mouse()` event handler, these let you initiate a user-driven mouse move or mouse resize of the window at any point in a uiArea.
* **31 October 2016**
* @krakjoe noticed that I accidentally used thread-unsafe code in uiQueueMain() on Unix. Fixed.
* **24 October 2016**
* `uiWindowSetContentSize()` on Unix no longer needs to call up the GTK+ main loop. As a result, bugs related to strange behavior using that function (and the now-deleted `uiWindowSetPosition()` and `uiWindowCenter()`) should go away. I'll need to go through the bugs to verify as much, though.
* **22 October 2016**
* Due to being unable to guarantee they will work (especially as we move toward capability-driven window systems like Wayland), or being unable to work without hacking that breaks other things, the following functions have been removed: `uiWindowPosition()`, `uiWindowSetPosition()`, `uiWindowCenter()`, and `uiWindowOnPositionChanged()`. Centering may come back at some point in the future, albeit in a possibly restricted form. A function to initiate a user move when a part of a uiArea is clicked will be provided soon.
* **21 October 2016**
* `uiDrawTextWeightUltraBold` is now spelled correctly. Thanks to @krakjoe.
* **18 June 2016**
* Help decide [the design of tables and trees in libui](https://github.com/andlabs/libui/issues/159); the implementation starts within the next few days, if not tomorrow!
* **17 June 2016**
* **CMake 3.1.0 is now required.** This is due to CMake's rapid development pace in the past few years adding things libui needs to build on as many systems as possible. If your OS is supported by libui but its repositories ship with an older version of CMake, you will need to find an updated one somewhere.
* Please help [plan out a better menu API](https://github.com/andlabs/libui/issues/152).
* `uiMainSteps()` no longer takes any arguments and no longer needs to invoke a function to do the work. You still need to call it, but once you do, it will return immediately and you can then get right to your main loop.
* **CMake 3.1.0 is now required.** This is due to CMake's rapid development pace in the past few years adding things libui needs to build on as many systems as possible. If your OS is supported by libui but its repositories ship with an older version of CMake, you will need to find an updated one somewhere.
* Added `uiNewVerticalSeparator()` to complement `uiNewHorizontalSeparator()`.
* **16 June 2016**
* Added `uiWindowContentSize()`, `uiWindowSetContentSize()`, and `uiWindowOnContentSizeChanged()` methods for manipulating uiWindow content sizes. Note the use of "content size"; the size you work with does NOT include window decorations (titlebars, menus, etc.).
* Added `uiWindowFullscreen()` and `uiWindowSetFullscreen()` to allow making fullscreen uiWindows, taking advantage of OS facilities for fullscreen and without changing the screen resolution (!).
* Added `uiWindowBorderless()` and `uiWindowSetBorderless()` for allowing borderless uiWindows.
* Added `uiMainSteps()`. You call this instead of `uiMain()` if you want to run the main loop yourself. You pass in a function that will be called; within that function, you call `uiMainStep()` repeatedly until it returns 0, doing whatever you need to do in the meantime. (This was needed because just having `uiMainStep()` by itself only worked on some systems.)
* Added `uiProgressBarValue()` and allowed passing -1 to `uiProgressBarSetValue()` to make an indeterminate progress bar. Thanks to @emersion.
* **15 June 2016**
* Added `uiFormDelete()`; thanks to @emersion.
* Added `uiWindowPosition()`, `uiWindowSetPosition()`, `uiWindowCenter()`, and `uiWindowOnPositionChanged()`, methods for manipulating uiWindow position.
* **14 June 2016**
* uiDarwinControl now has a `ChildVisibilityChanged()` method and a corresponding `NotifyVisibilityChanged()` function that is called by the default show/hide handlers. This is used to make visibility changes work on OS X; uiBox, uiForm, and uiGrid all respect these now.
* The same has been done on the Windows side as well.
* Hiding and showing controls and padding calculations are now correct on Windows at long last.
* Hiding a control in a uiForm now hides its label on all platforms.
* **13 June 2016**
* `intmax_t` and `uintmax_t` are no longer used for libui API functions; now we use `int`. This should make things much easier for bindings. `int` should be at least 32 bits wide; this should be sufficient for all but the most extreme cases.
* **12 June 2016**
* Added `uiGrid`, a new container control that arranges controls in rows and columns, with stretchy ("expanding") rows, stretchy ("expanding") columns, cells that span rows and columns, and cells whose content is aligned in either direction rather than just filling. It's quite powerful, is it? =P
* **8 June 2016**
* Added `uiForm`, a new container control that arranges controls vertically, with properly aligned labels on each. Have fun!
* **6 June 2016**
* Added `uiRadioButtonsSelected()`, `uiRadioButtonsSetSelected()`, and `uiRadioButtonsOnSelected()` to control selection of a radio button and catch an event when such a thing happens.
* **5 June 2016**
* **Alpha 3.1 is here.** This was a much-needed update to Alpha 3 that changes a few things:
* **The build system is now cmake.** cmake 2.8.11 or higher is needed.
* Static linking is now fully possible.
* MinGW linking is back, but static only.
* Added `uiNewPasswordEntry()`, which creates a new `uiEntry` suitable for entering passwords.
* Added `uiNewSearchEntry()`, which creates a new `uiEntry` suitable for searching. On some systems, the `OnChanged()` event will be slightly delayed and/or combined, to produce a more natural feel when searching.
* **29 May 2016**
* **Alpha 3 is here!** Get it [here](https://github.com/andlabs/libui/releases/tag/alpha3).
* The next packaged release will introduce:
* uiGrid, another way to lay out controls, a la GtkGrid
* uiOpenGLArea, a way to render OpenGL content in a libui uiArea
* uiTable, a data grid control that may or may not have tree facilities (if it does, it will be called uiTree instead)
* a complete, possibly rewritten, drawing and text rendering infrastructure
* Thanks to @pcwalton, we can now statically link libui! Simply do `make STATIC=1` instead of just `make`.
* On Windows you must link both `libui.lib` and `libui.res` AND provide a Common Controls 6 manifest for output static binaries to work properly.
* **28 May 2016**
* As promised, **the minimum system requirements are now OS X 10.8 and GTK+ 3.10 for OS X and Unix, respectively**.
* **26 May 2016**
* Two OS X-specific functions have been added: `uiDarwinMarginAmount()` and `uiDarwinPaddingAmount()`. These return the amount of margins and padding, respectively, to give to a control, and are intended for container implementations. These are suitable for the constant of a NSLayoutConstraint. They both take a pointer parameter that is reserved for future use and should be `NULL`.
* **25 May 2016**
* uiDrawTextLayout attributes are now specified in units of *graphemes* on all platforms. This means characters as seen from a user's perspective, not Unicode codepoints or UTF-8 bytes. So a long string of combining marker codepoints after one codepoint would still count as one grapheme.
* **24 May 2016**
* You can now help choose [a potential new build system for libui](https://github.com/andlabs/libui/issues/62).
* Tomorrow I will decide if OS X 10.7 will also be dropped alongside GTK+ 3.4-3.8 this Saturday. Stay tuned.
* As promised, `uiCombobox` is now split into `uiCombobox` for non-editable comboboxes and `uiEditableCombobox` for editable comboboxes. Mind the function changes as well :)
* There is a new function `uiMainStep()`, which runs one iteration of the main loop. It takes a single boolean argument, indicating whether to wait for an event to occur or not. It returns true if an event was processed (or if no event is available if you don't want to wait) and false if the event loop was told to stop (for instance, `uiQuit()` was called).
* **23 May 2016**
* Fixed surrogate pair drawing on OS X.
* **22 May 2016**
* Two more open questions I'd like your feedback on are available [here](https://github.com/andlabs/libui/issues/48) and [here](https://github.com/andlabs/libui/issues/25).
* Sometime in the next 48 hours (before 23:59 EDT on 24 May 2016) I will split `uiCombobox` into two separate controls, `uiCombobox` and `uiEditableCombobox`, each with slightly different events and "selected item" mechanics. Prepare your existing code.
* Removed `uiControlVerifyDestroy()`; that is now part of `uiFreeControl()` itself.
* Added `uiPi`, a constant for π. This is provided for C and C++ programmers, where there is no standard named constant for π; bindings authors shouldn't need to worry about this.
* Fixed uiMultilineEntry not properly having line breaks on Windows.
* Added `uiNewNonWrappingMultilineEntry()`, which creates a uiMultilineEntry that scrolls horizontally instead of wrapping lines. (This is not documented as being changeable after the fact on Windows, hence it's a creation-time choice.)
* uiAreas on Windows and some internal Direct2D areas now respond to `WM_PRINTCLIENT` properly, which should hopefully increase the quality of screenshots.
* uiDateTimePicker on GTK+ works properly on RTL layouts and no longer disappears off the bottom of the screen if not enough room is available. It will also no longer be marked for localization of the time format (what the separator should be and whether to use 24-hour time), as that information is not provided by the locale system. :(
* Added `uiUserBugCannotSetParentOnToplevel()`, which should be used by implementations of toplevel controls in their `SetParent()` implementations. This will also be the beginning of consolidating common user bug messages into a single place, though this will be one of the only few exported user bug functions.
* uiSpinbox and uiSlider now merely swap their min and max if min ≥ max. They will no longer panic and do nothing, respectively.
* Matrix scaling will no longer leave the matrix in an invalid state on OS X and GTK+.
* `uiMultilineEntrySetText()` and `uiMutlilineEntryAppend()` on GTK+ no longer fire `OnChanged()` events.
* **21 May 2016**
* I will now post announcements and updates here.
* Now that Ubuntu 16.04 LTS is here, no earlier than next Saturday, 28 May 2016 at noon EDT, **I will bump the minimum GTK+ version from 3.4 to 3.10**. This will add a lot of new features that I can now add to libui, such as search-oriented uiEntries, lists of arbitrary control layouts, and more. If you are still running a Linux distribution that doesn't come with 3.10, you will either need to upgrade or use jhbuild to set up a newer version of GTK+ in a private environment.
* You can decide if I should also drop OS X 10.7 [here](https://github.com/andlabs/libui/issues/46).

183
README.md
View File

@ -1,17 +1,188 @@
# libui: a portable GUI library for C # libui: a portable GUI library for C
This README is being written. This README is being written.<br>
[![Build Status, Azure Pipelines](https://dev.azure.com/andlabs/libui/_apis/build/status/andlabs.libui?branchName=master)](https://dev.azure.com/andlabs/libui/_build/latest?definitionId=1&branchName=master)<br>
[![Build Status, AppVeyor](https://ci.appveyor.com/api/projects/status/ouyk78c52mmisa31/branch/master?svg=true)](https://ci.appveyor.com/project/andlabs/libui/branch/master)
## Requirements ## Status
It has come to my attention that I have not been particularly clear about how usable or feature-complete libui is, and that this has fooled many people into expecting more from libui right this moment than I have explicitly promised to make available. I apologize for not doing this sooner.
libui is currently **mid-alpha** software. Much of what is currently present runs stabily enough for the examples and perhaps some small programs to work, but the stability is still a work-in-progress, much of what is already there is not feature-complete, some of it will be buggy on certain platforms, and there's a lot of stuff missing. In short, here's a list of features that I would like to add to libui, but that aren't in yet:
- trees
- clipboard support, including drag and drop
- more and better dialogs
- printing
- accessibility for uiArea and custom controls
- document-based programs
- tighter OS integration (especially for document-based programs), to allow programs to fully feel native, rather than merely look and act native
- better support for standard dialogs and features (search bars, etc.)
- OpenGL support
In addition, [here](https://github.com/andlabs/libui/issues?utf8=%E2%9C%93&q=master+in%3Atitle+is%3Aissue+is%3Aopen) is a list of issues generalizing existing problems.
Furthermore, libui is not properly fully documented yet. This is mainly due to the fact that the API was initially unstable enough so as to result in rewriting documentation multiple times, in addition to me not being happy with really any existing C code documentation tool. That being said, I have started to pin down my ideal code documentation style in parts of `ui.h`, most notably in the uiAttributedString APIs. Over time, I plan on extending this to the rest of the headers. You can also use [the documentation for libui's Go bindings](https://godoc.org/github.com/andlabs/ui) as a reference, though it is somewhat stale and not optimally written.
But libui is not dead; I am working on it whenever I can, and I hope to get it to a point of real quality soon!
## News
*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.
* **10 August 2018**
* **Alpha 4 is finally here.** Everything from Alpha 3.5 and what's listed below is in this release; the two biggest changes are still the new text drawing API and new uiTable control. In between all that is a whole bunch of bugfixes, and hopefully more stability too. Thanks to everybody who helped contribute!
* Alpha 4 should hopefully also include automated binary releases via CI. Thanks to those who helped set that up!
* **8 August 2018**
* Finally introduced an API for loading images, `uiImage`, and a new control, `uiTable`, for displaying tabular data. These provide enough basic functionality for now, but will be improved over time. You can read the documentation for the new features as they are [here](https://github.com/andlabs/libui/blob/f47e1423cf95ad7b1001663f3381b5a819fc67b9/uitable.h). Thanks to everyone who helped get to this point, in particular @bcampbell for the initial Windows code, and to everyone else for their patience!
* **30 May 2018**
* Merged the previous Announcements and Updates section of this README into a single News section, and merged the respective archive files into a single NEWS.md file.
* **16 May 2018**
* Thanks to @parro-it and @msink, libui now has better CI, including AppVeyor for Windows CI, and automated creation of binary releases when I make a tagged release.
* **13 May 2018**
* Added new functions to work with uiDateTimePickers: `uiDateTimePickerTime()`, `uiDateTimePickerSetTime()`, and `uiDateTimePickerOnChanged()`. These operate on standard `<time.h>` `struct tm`s. Thanks @cody271!
* Release builds on Windows with MSVC should be fixed now; thanks @l0calh05t, @slahn, @mischnic, and @zentner-kyle.
* **12 May 2018**
* GTK+ and OS X now have a cleaner build process for static libraries which no longer has intermediate files and differing configurations. As a result, certain issues should no longer be present. New naming rules for internal symbols of libui have also started being drafted; runtime symbols and edge cases still need to be handled (and the rules applied to Windows) before this can become a regular thing.
* **2 May 2018**
* On Windows, you no longer need to carry around a `libui.res` file with static builds. You do need to link in the appropriate manifest file, such as the one in the `windows/` folder (I still need to figure out exactly what is needed apart from the Common Controls v6 dependency, or at least to create a complete-ish template), or at least include it alongside your executables. This also means you should no longer see random cmake errors when building the static libraries.
* **18 April 2018**
* Introduced a new `uiTimer()` function for running code on a timer on the main thread. (Thanks to @cody271.)
* Migrated all code in the `common/` directory to use `uipriv` prefixes for everything that isn't `static`. This is the first step toward fixing static library oddities within libui, allowing libui to truly be safely used as either a static library or a shared library.
* **18 March 2018**
* Introduced an all-new formatted text API that allows you to process formatted text in ways that the old API wouldn't allow. You can read on the whole API [here](https://github.com/andlabs/libui/blob/8944a3fc5528445b9027b1294b6c86bae03eeb89/ui_attrstr.h). There is also a new examples for it: `drawtext`, which shows the whole API at a glance. It doesn't yet support measuring or manipulating text, nor does it currently support functions that would be necessary for things like text editors; all of this will be added back later.
* libui also now uses my [utf library](https://github.com/andlabs/utf) for UTF-8 and UTF-16 processing, to allow consistent behavior across platforms. This usage is not completely propagated throughout libui, but the Windows port uses it in most places now, and eventually this will become what libui will use throughout.
* Also introduced a formal set of contribution guidelines, see `CONTRIBUTING.md` for details. They are still WIP.
* **17 February 2018**
* The longstanding Enter+Escape crashes on Windows have finally been fixed (thanks to @lxn).
* **Alpha 3.5 is now here.** This is a quickie release primiarly intended to deploy the above fix to package ui itself. **It is a partial binary release; sorry!** More new things will come in the next release, which will also introduce semver (so it will be called v0.4.0 instead).
* Alpha 3.5 also includes a new control gallery example. The screenshots below have not been updated yet.
*Old announcements can be found in the NEWS.md file.*
## Runtime Requirements
* Windows: Windows Vista SP2 with Platform Update or newer * Windows: Windows Vista SP2 with Platform Update or newer
** At present, you must provide a manifest file * Unix: GTK+ 3.10 or newer
* Unix: GTK+ 3.4 or newer * Mac OS X: OS X 10.8 or newer
* OS X: OS X 10.7 or newer
## 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.
* 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:
* [Isolation awareness](https://msdn.microsoft.com/en-us/library/aa375197%28v=vs.85%29.aspx), which is how you get themed controls from a DLL without needing a manifest
* Unix: nothing else specific
* Mac OS X: nothing else specific, so long as you can build Cocoa programs
## 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:
```
$ # you must be in the top-level libui directory, otherwise this won't work
$ meson setup build [options]
$ ninja -C build
```
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.)
The most important options are:
* `--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).
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`.
The Meson website and documentation has more in-depth usage instructions.
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.
## 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/
## Documentation ## Documentation
Needs to be written. Consult ui.h and the examples for details for now. Needs to be written. Consult `ui.h` and the examples for details for now.
## Language Bindings
libui was originally written as part of my [package ui for Go](https://github.com/andlabs/ui). Now that libui is separate, package ui has become a binding to libui. As such, package ui is the only official binding.
Other people have made bindings to other languages:
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)
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)
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)
Scala | [scalaui](https://github.com/lolgab/scalaui)
Swift | [libui-swift](https://github.com/sclukey/libui-swift)
## Frequently Asked Questions
### Why does my program start in the background on OS X if I run from the command line?
OS X normally does not start program executables directly; instead, it uses [Launch Services](https://developer.apple.com/reference/coreservices/1658613-launch_services?language=objc) to coordinate the launching of the program between the various parts of the system and the loading of info from an .app bundle. One of these coordination tasks is responsible for bringing a newly launched app into the foreground. This is called "activation".
When you run a binary directly from the Terminal, however, you are running it directly, not through Launch Services. Therefore, the program starts in the background, because no one told it to activate! Now, it turns out [there is an API](https://developer.apple.com/reference/appkit/nsapplication/1428468-activateignoringotherapps) that we can use to force our app to be activated. But if we use it, then we'd be trampling over Launch Services, which already knows whether it should activate or not. Therefore, libui does not step over Launch Services, at the cost of requiring an extra user step if running directly from the command line.
See also [this](https://github.com/andlabs/libui/pull/20#issuecomment-211381971) and [this](http://stackoverflow.com/questions/25318524/what-exactly-should-i-pass-to-nsapp-activateignoringotherapps-to-get-my-appl).
## Contributing
See `CONTRIBUTING.md`.
## Screenshots ## Screenshots

View File

@ -1,2 +0,0 @@
uthash
- stdint code misses MinGW(-w64)

231
TODO.md
View File

@ -1,18 +1,56 @@
- make sure the last line of text layouts include leading
- documentation notes:
- static binaries do not link system libraries, meaning apps still depend on shared GTK+, etc.
- ui*Buttons are NOT compatible with uiButton functions
- more robust layout handling
- uiFormTie() for ensuring multiple uiForms have the same label area widths
- uiSizeGroup for size groups (GtkSizeGroup on GTK+, auto layout constraints on OS X; consider adding after 10.8 is gone)
- windows: should the initial hwndInsertAfter be HWND_BOTTOM for what we want?
- windows: document the rules for controls and containers
- windows: document the minimum size change propagation system
- provisions for controls that cannot be grown? especiailly for windows
- LC_VERSION_MIN_MACOSX has the 10.11 SDK; see if we can knock it down to 10.8 too; OS version is fine
- apply the OS version stuff to the test program and examples too
- what about micro versions (10.8.x)? force 10.8.0?
- go through ALL the objective-c objects we create and make sure we are using the proper ownership (alloc/init and new are owned by us, all class method constructors are autoreleased - thanks mikeash)
- on OS X, edit shortcuts like command-C working require that the menu entries be defined, or so it seems, even for NSAlert
- other platforms?
- make sure all OS X event handlers that use target-action set the action to NULL when the target is unset
- provide a way to get the currently selected uiTab page? set?
- make it so that the windows cntrols only register a resize if their new minimum size is larger than their current size to easen the effect of flicker
- it won't remove that outright, but it'll help
- add an option to the test program to run page7b as an independent test in its own window
- same for page7c
- http://blogs.msdn.com/b/oldnewthing/archive/2004/01/12/57833.aspx provide a DEF file on Windows
- all ports: update state when adding a control to a parent - all ports: update state when adding a control to a parent
- should uiWindowsSizing be computed against the window handle, not the parent? - should uiWindowsSizing be computed against the window handle, not the parent?
- DPI awareness on windows - DPI awareness on windows
- consider calling setAppleMenu: for the application menu; it doesn't seem to make much of a difference but
- http://stackoverflow.com/questions/4543087/applicationwillterminate-and-the-dock-but-wanting-to-cancel-this-action - http://stackoverflow.com/questions/4543087/applicationwillterminate-and-the-dock-but-wanting-to-cancel-this-action
ultimately: ultimately:
- MAYBE readd lifetime handling/destruction blocking - MAYBE readd lifetime handling/destruction blocking
- related? [12:25] <ZeroOne> And the blue outline on those buttons [ALL clicked buttons on Windows 7] won't go away - related? [12:25] <ZeroOne> And the blue outline on those buttons [ALL clicked buttons on Windows 7] won't go away
- I get this too - I get this too
- not anymore
- SWP_NOCOPYBITS to avoid button redraw issues on Windows when not in tab, but only when making resize faster - SWP_NOCOPYBITS to avoid button redraw issues on Windows when not in tab, but only when making resize faster
- secondary side alignment control in uiBox - secondary side alignment control in uiBox
- generate libui.lib and related files
- Windows: don't abort if a cleanup function fails? - Windows: don't abort if a cleanup function fails?
- 32-bit Mac OS X support (requires lots of code changes) - 32-bit Mac OS X support (requires lots of code changes)
@ -30,6 +68,195 @@ notes to self
- explicitly document that uiCheckboxSetChecked() and uiEntrySetText() do not fire uiCheckboxOnToggled() and uiEntryOnChanged(), respectively - explicitly document that uiCheckboxSetChecked() and uiEntrySetText() do not fire uiCheckboxOnToggled() and uiEntryOnChanged(), respectively
- note that if a menu is requested on systems with menubars on windows but no menus are defined, the result is a blank menubar, with whatever that means left up to the OS to decide - note that if a menu is requested on systems with menubars on windows but no menus are defined, the result is a blank menubar, with whatever that means left up to the OS to decide
- note that handling of multiple consecutive separators in menus, leading separators in menus, and trailing separators in menus are all OS-defined - note that handling of multiple consecutive separators in menus, leading separators in menus, and trailing separators in menus are all OS-defined
- note that uiDrawMatrixInvert() does not change the matrix if it fails
- note that the use of strings that are not strictly valid UTF-8 results in undefined behavior
- test RTL - test RTL
- automate RTL - automate RTL
- now that stock items are deprecated, I have to maintain translations of the Cancel, Open, and Save buttons on GTK+ myself (thanks baedert in irc.gimp.net/#gtk+)
- either that or keep using stock items
- http://blogs.msdn.com/b/oldnewthing/archive/2014/02/26/10503148.aspx
- build optimizations
- use http://www.appveyor.com/ to do Windows build CI since people want CI
- consider just having the windows backend in C++
- consider having it all in C++
don't forget LONGTERMs as well
notes
- http://blogs.msdn.com/b/oldnewthing/archive/2004/03/29/101121.aspx on accelerators
- group and tab should act as if they have no child if the child is hidden
on windows
- a way to do recursive main loops
- how do we handle 0 returns from non-recursive uiMainStep() calls that aren't the main loop? (event handlers, for instance)
- should repeated calls to uiMainStep() after uiQuit() return 0 reliably? this will be needed for non-recursive loops
http://stackoverflow.com/questions/38338426/meaning-of-ampersand-in-rc-files/38338841?noredirect=1#comment64093084_38338841
label shortcut keys
- remove whining from source code
[01:41:47] <vrishab> Hi. does pango support "fgalpha". I see that foreground="112233xx" works ( alpha=xx ), but fgalpha is a no-op
[01:52:29] <vrishab> pango_attr_foreground_alpha_new (32767) seems to be called in either case, but only the "foreground" attr works
[01:56:09] lolek (lolek@ip-91-244-230-76.simant.pl) joined the channel
[01:57:48] <vrishab> ok. seems like "foreground" is mandatory attr, 1. "foreground-without-alpha" + "alpha" works 2. "foreground-with-alpha" works. 3. "alpha" alone doesn
[01:57:52] <vrishab> 't work
[01:58:29] <vrishab> Is there a way to just specify alpha on the current foreground color ?
[02:00:23] lolek (lolek@ip-91-244-230-76.simant.pl) left the channel
[02:07:41] mjog (mjog@uniwide-pat-pool-129-94-8-98.gw.unsw.edu.au) left IRC (Quit: mjog)
[02:08:10] seb128 (seb128@53542B83.cm-6-5a.dynamic.ziggo.nl) joined the channel
[02:12:37] <andlabs> huh
[02:12:41] <andlabs> what version of pango?
[02:13:05] <vrishab> the latest .
[02:15:00] <vrishab> 1.40.3
[02:20:46] <andlabs> I'll ahve to keep this in mind then, thanks
[02:20:59] <andlabs> if only there was a cairo-specific attribute for alpha...
FONT LOADING
[00:10:08] <hergertme> andlabs: is there API yet to load from memory? last i checked i only found from file (which we use in builder). https://git.gnome.org/browse/gnome-builder/tree/libide/editor/ide-editor-map-bin.c#n115
[00:13:12] mrmcq2u_ (mrmcq2u@109.79.53.90) joined the channel
[00:14:59] mrmcq2u (mrmcq2u@109.79.73.102) left IRC (Ping timeout: 181 seconds)
[00:15:19] <andlabs> hergertme: no, which is why I was asking =P
[00:15:30] <andlabs> I would have dug down if I could ensure at least something about the backends a GTK+ 3 program uses
[00:15:39] <andlabs> on all platforms except windows and os x
[00:16:11] <hergertme> to the best of my (partially outdated, given pace of foss) knowledge there isn't an api to load from memory
[00:16:28] <hergertme> you can possibly make a tmpdir and put a temp file in there
[00:16:52] <hergertme> and load that as your font dir in your FcConfig, so any PangoFontDescription would point to that one font, no matter what
[00:17:18] <hergertme> (using the API layed out in that link)
[00:18:18] dsr1014__ (dsr1014@c-73-72-102-18.hsd1.il.comcast.net) joined the channel
[00:35:18] simukis_ (simukis@78-60-58-6.static.zebra.lt) left IRC (Quit: simukis_)
[00:35:48] dreamon_ (dreamon@ppp-188-174-49-41.dynamic.mnet-online.de) joined the channel
[00:40:09] samtoday_ (samtoday@114-198-116-132.dyn.iinet.net.au) joined the channel
[00:40:32] mjog (mjog@120.18.225.46) joined the channel
[00:40:38] <andlabs> hergertme: not necessarily fontconfig
[00:40:45] <andlabs> it can be with ft2 or xft I guess
[00:40:55] <andlabs> especially since I want the API NOT to make the font part of the font panel
[00:42:07] <hergertme> what sort of deprecated code are you trying to support?
[00:42:35] <hergertme> both of those are deprecated in pango fwiw
[00:43:06] <hergertme> on Linux im pretty sure we use FC everywhere these days
[00:44:46] <hergertme> (and gtk_widget_set_font_map() is how you get your custom font into a widget without affecting the global font lists, as layed out in that link)
[00:49:14] vasaikar (vasaikar@125.16.97.121) joined the channel
[00:50:14] karlt (karl@2400:e780:801:224:f121:e611:d139:e70e) left IRC (Client exited)
[00:50:49] karlt (karl@2400:e780:801:224:f121:e611:d139:e70e) joined the channel
[00:51:43] PioneerAxon (PioneerAxo@122.171.61.146) left IRC (Ping timeout: 180 seconds)
[00:57:47] PioneerAxon (PioneerAxo@106.201.37.181) joined the channel
[01:03:01] karlt (karl@2400:e780:801:224:f121:e611:d139:e70e) left IRC (Ping timeout: 181 seconds)
[01:05:49] muhannad (muhannad@95.218.26.152) left IRC (Quit: muhannad)
[01:07:51] <andlabs> hergertme: hm
[01:07:54] <andlabs> all right, thanks
[01:08:05] <andlabs> hergertme: fwiw right now my requirement is 3.10
[01:10:47] <hergertme> ah, well you'll probably be missing the neccesary font API on gtk_widget
[01:11:04] <hergertme> but pango should be fine even back as far as https://developer.gnome.org/pango/1.28/PangoFcFontMap.html
[01:11:56] <andlabs> good
[01:12:04] <andlabs> because this is for custom drawing into a DrawingArea
[01:14:12] <hergertme> presumably just create your PangoContext as normal, but call pango_context_set_font_map() with the map you've setup. now, the load a font from a file i dont think was added to FontConfig until later though (not sure what release)
[01:15:53] <hergertme> FcConfigAppFontAddFile() <-- that API
[01:16:30] <hergertme> great, and they don't say what version the API was added in teh docs
function: ide_editor_map_bin_add()
- Mouse ClickLock: do we need to do anything special? *should* we? https://msdn.microsoft.com/en-us/library/windows/desktop/ms724947(v=vs.85).aspx
- consider a uiAnticipateDoubleClick() or uiDoubleClickTime() (for a uiQueueTimer()) or something: https://blogs.msdn.microsoft.com/oldnewthing/20041015-00/?p=37553
- determine whether MSGF_USER is for and if it's correct for our uiArea message filter (if we have one)
- source file encoding and MSVC compiler itself? https://stackoverflow.com/questions/20518040/how-can-i-get-the-directwrite-padwrite-sample-to-work
- also need to worry about object file and output encoding...
- this also names the author of the padwrite sample
- OpenType features TODOs
- https://stackoverflow.com/questions/32545675/what-are-the-default-typography-settings-used-by-idwritetextlayout
- feature/shaping interaction rules for arabic: https://www.microsoft.com/typography/OpenTypeDev/arabic/intro.htm
- other stuff, mostly about UIs and what users expect to be able to set
- https://klim.co.nz/blog/towards-an-ideal-opentype-user-interface/
- https://libregraphicsmeeting.org/2016/designing-for-many-applications-opentype-features-ui/
- https://www.youtube.com/watch?v=wEyDhsH076Y
- https://twitter.com/peter_works
- http://ilovetypography.com/2014/10/22/better-ui-for-better-typography-adobe-petition/
- http://silgraphite.sourceforge.net/ui/studynote.html
- add NXCOMPAT (DEP awareness) to the Windows builds
- and ASLR too? or is that not a linker setting
OS X: embedding an Info.plist into a binary directly
https://www.objc.io/issues/6-build-tools/mach-o-executables/
TODO will this let Dictation work?
TODO investigate ad-hoc codesigning
https://blogs.msdn.microsoft.com/oldnewthing/20040112-00/?p=41083 def files for decoration (I forget if I said this earlier)
TODO ClipCursor() stuff; probably not useful for libui but still
https://blogs.msdn.microsoft.com/oldnewthing/20140102-00/?p=2183
https://blogs.msdn.microsoft.com/oldnewthing/20061117-03/?p=28973
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648383(v=vs.85).aspx
https://cmake.org/Wiki/CMake_Useful_Variables
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined")
On Unix systems, this will make linker report any unresolved symbols from object files (which is quite typical when you compile many targets in CMake projects, but do not bother with linking target dependencies in proper order).
(I used to have something like this back when I used makefiles; did it convert in? I forget)
look into these for the os x port
https://developer.apple.com/documentation/appkit/view_management/nseditor?language=objc
https://developer.apple.com/documentation/appkit/view_management/nseditorregistration?language=objc
for future versions of the os x port
https://developer.apple.com/documentation/appkit/nslayoutguide?language=objc and anchors
https://developer.apple.com/documentation/appkit/nsuserinterfacecompression?language=objc https://developer.apple.com/documentation/appkit/nsuserinterfacecompressionoptions?language=objc
though at some point we'll be able to use NSStackView and NSGridView directly, so...
Cocoa PDFs
https://developer.apple.com/documentation/appkit/nspdfimagerep?language=objc
https://developer.apple.com/documentation/coregraphics?language=objc
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_pagination/osxp_pagination.html#//apple_ref/doc/uid/20001051-119037
https://developer.apple.com/documentation/appkit/nsprintoperation/1529269-pdfoperationwithview?language=objc
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printapps/osxp_printapps.html#//apple_ref/doc/uid/20000861-BAJBFGED
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printingapi/osxp_printingapi.html#//apple_ref/doc/uid/10000083i-CH2-SW2
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printinfo/osxp_printinfo.html#//apple_ref/doc/uid/20000864-BAJBFGED
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_printlayoutpanel/osxp_printlayoutpanel.html#//apple_ref/doc/uid/20000863-BAJBFGED
https://developer.apple.com/documentation/appkit/nspagelayout?language=objc
https://developer.apple.com/documentation/appkit/nsprintinfo?language=objc
https://developer.apple.com/documentation/applicationservices/core_printing?language=objc
https://developer.apple.com/documentation/applicationservices/1463247-pmcreatesession?language=objc
https://developer.apple.com/documentation/applicationservices/pmprintsession?language=objc
https://developer.apple.com/documentation/applicationservices/1460101-pmsessionbegincgdocumentnodialog?language=objc
https://developer.apple.com/documentation/applicationservices/1463416-pmsessionbeginpagenodialog?language=objc
https://developer.apple.com/documentation/applicationservices/1506831-anonymous/kpmdestinationprocesspdf?language=objc
https://developer.apple.com/documentation/applicationservices/1461960-pmcreategenericprinter?language=objc
https://developer.apple.com/documentation/applicationservices/1460101-pmsessionbegincgdocumentnodialog?language=objc
https://developer.apple.com/documentation/applicationservices/1464527-pmsessionenddocumentnodialog?language=objc
https://developer.apple.com/documentation/applicationservices/1461952-pmsessiongetcggraphicscontext?language=objc
https://developer.apple.com/library/content/technotes/tn2248/_index.html
https://developer.apple.com/library/content/samplecode/PMPrinterPrintWithFile/Introduction/Intro.html
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Printing/osxp_aboutprinting/osxp_aboutprt.html
- run os x code with `OBJC_DEBUG_MISSING_POOLS=YES` and other `OBJC_HELP=YES` options
- turn off the autorelease pool to make sure we're not autoreleasing improperly
TODO investigate -Weverything in clang alongside -Wall in MSVC (and in gcc too maybe...)
mac os x accessibility
- https://developer.apple.com/documentation/appkit/nsworkspace/1524656-accessibilitydisplayshoulddiffer?language=objc
- https://developer.apple.com/documentation/appkit/nsworkspace/1526290-accessibilitydisplayshouldincrea?language=objc
- https://developer.apple.com/documentation/appkit/nsworkspace/1533006-accessibilitydisplayshouldreduce?language=objc
uiEntry disabling bugs http://www.cocoabuilder.com/archive/cocoa/215525-nstextfield-bug-can-be.html
uiMultilineEntry disabling https://developer.apple.com/library/content/qa/qa1461/_index.html
more TODOs:
- make no guarantee about buildability of feature branches

BIN
_abort/oldhaiku.tgz Normal file

Binary file not shown.

View File

@ -0,0 +1,90 @@
struct uiWindow {
// constraints
void (*onPositionChanged)(uiWindow *, void *);
void *onPositionChangedData;
BOOL suppressPositionChanged;
// onContentSizeChanged
};
@interface windowDelegateClass : NSObject<NSWindowDelegate> {
// windowShouldClose:
- (void)windowDidMove:(NSNotification *)note;
// windowDidResize:
@end
@implementation windowDelegateClass
// - (BOOL)windowShouldClose:(id)sender
// TODO doesn't happen live
- (void)windowDidMove:(NSNotification *)note
{
uiWindow *w;
w = [self lookupWindow:((NSWindow *) [note object])];
if (!w->suppressPositionChanged)
(*(w->onPositionChanged))(w, w->onPositionChangedData);
}
// - (void)windowDidResize:(NSNotification *)note
// void uiWindowSetTitle(uiWindow *w, const char *title)
void uiWindowPosition(uiWindow *w, int *x, int *y)
{
NSScreen *screen;
NSRect r;
r = [w->window frame];
*x = r.origin.x;
// this is the right screen to use; thanks mikeash in irc.freenode.net/#macdev
// -mainScreen is useless for positioning (it's just the key window's screen)
// and we use -frame, not -visibleFrame, for dealing with absolute positions
screen = (NSScreen *) [[NSScreen screens] objectAtIndex:0];
*y = ([screen frame].size.height - r.origin.y) - r.size.height;
}
void uiWindowSetPosition(uiWindow *w, int x, int y)
{
// -[NSWindow setFrameTopLeftPoint:] is acting weird so...
NSRect r;
NSScreen *screen;
// this fires windowDidMove:
w->suppressPositionChanged = YES;
r = [w->window frame];
r.origin.x = x;
screen = (NSScreen *) [[NSScreen screens] objectAtIndex:0];
r.origin.y = [screen frame].size.height - (y + r.size.height);
[w->window setFrameOrigin:r.origin];
w->suppressPositionChanged = NO;
}
void uiWindowCenter(uiWindow *w)
{
w->suppressPositionChanged = YES;
[w->window center];
w->suppressPositionChanged = NO;
}
void uiWindowOnPositionChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data)
{
w->onPositionChanged = f;
w->onPositionChangedData = data;
}
// void uiWindowContentSize(uiWindow *w, int *width, int *height)
// static int defaultOnClosing(uiWindow *w, void *data)
static void defaultOnPositionContentSizeChanged(uiWindow *w, void *data)
{
// do nothing
}
uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
{
// uiWindowOnClosing(w, defaultOnClosing, NULL);
uiWindowOnPositionChanged(w, defaultOnPositionContentSizeChanged, NULL);
// uiWindowOnContentSizeChanged(w, defaultOnPositionContentSizeChanged, NULL);
}

View File

@ -0,0 +1,65 @@
static uiSpinbox *x, *y;
static void moveX(uiSpinbox *s, void *data)
{
uiWindow *w = uiWindow(data);
int xp, yp;
uiWindowPosition(w, &xp, &yp);
xp = uiSpinboxValue(x);
uiWindowSetPosition(w, xp, yp);
}
static void moveY(uiSpinbox *s, void *data)
{
uiWindow *w = uiWindow(data);
int xp, yp;
uiWindowPosition(w, &xp, &yp);
yp = uiSpinboxValue(y);
uiWindowSetPosition(w, xp, yp);
}
static void updatepos(uiWindow *w)
{
int xp, yp;
uiWindowPosition(w, &xp, &yp);
uiSpinboxSetValue(x, xp);
uiSpinboxSetValue(y, yp);
}
static void center(uiButton *b, void *data)
{
uiWindow *w = uiWindow(data);
uiWindowCenter(w);
updatepos(w);
}
void onMove(uiWindow *w, void *data)
{
printf("move\n");
updatepos(w);
}
uiBox *makePage15(uiWindow *w)
{
hbox = newHorizontalBox();
// TODO if I make this 1 and not add anything else AND not call uiWindowOnPositionChanged(), on OS X the box won't be able to grow vertically
uiBoxAppend(page15, uiControl(hbox), 0);
uiBoxAppend(hbox, uiControl(uiNewLabel("Position")), 0);
x = uiNewSpinbox(INT_MIN, INT_MAX);
uiBoxAppend(hbox, uiControl(x), 1);
y = uiNewSpinbox(INT_MIN, INT_MAX);
uiBoxAppend(hbox, uiControl(y), 1);
button = uiNewButton("Center");
uiBoxAppend(hbox, uiControl(button), 0);
uiSpinboxOnChanged(x, moveX, w);
uiSpinboxOnChanged(y, moveY, w);
uiButtonOnClicked(button, center, w);
uiWindowOnPositionChanged(w, onMove, NULL);
updatepos(w);
}

6
_abort/windowevents/ui.h Normal file
View File

@ -0,0 +1,6 @@
// uiWindowSetTitle
_UI_EXTERN void uiWindowPosition(uiWindow *w, int *x, int *y);
_UI_EXTERN void uiWindowSetPosition(uiWindow *w, int x, int y);
_UI_EXTERN void uiWindowCenter(uiWindow *w);
_UI_EXTERN void uiWindowOnPositionChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data);
// uiWindowContentSize

View File

@ -0,0 +1,97 @@
struct uiWindow {
// void *onClosingData;
void (*onPositionChanged)(uiWindow *, void *);
void *onPositionChangedData;
gboolean changingPosition;
// void (*onContentSizeChanged)(uiWindow *, void *);
};
// static gboolean onClosing(GtkWidget *win, GdkEvent *e, gpointer data)
static gboolean onConfigure(GtkWidget *win, GdkEvent *e, gpointer data)
{
uiWindow *w = uiWindow(data);
// there doesn't seem to be a way to determine if only moving or only resizing is happening :/
if (w->changingPosition)
w->changingPosition = FALSE;
else
(*(w->onPositionChanged))(w, w->onPositionChangedData);
// always continue handling
return FALSE;
}
// static void onSizeAllocate(GtkWidget *widget, GdkRectangle *allocation, gpointer data)
// static int defaultOnClosing(uiWindow *w, void *data)
static void defaultOnPositionContentSizeChanged(uiWindow *w, void *data)
{
// do nothing
}
// static void uiWindowDestroy(uiControl *c)
// void uiWindowSetTitle(uiWindow *w, const char *title)
// TODO allow specifying either as NULL on all platforms
void uiWindowPosition(uiWindow *w, int *x, int *y)
{
gint rx, ry;
gtk_window_get_position(w->window, &rx, &ry);
*x = rx;
*y = ry;
}
void uiWindowSetPosition(uiWindow *w, int x, int y)
{
w->changingPosition = TRUE;
gtk_window_move(w->window, x, y);
// gtk_window_move() is asynchronous
// we need to wait for a configure-event
// thanks to hergertme in irc.gimp.net/#gtk+
while (w->changingPosition)
if (!uiMainStep(1))
break; // stop early if uiQuit() called
}
void uiWindowCenter(uiWindow *w)
{
gint x, y;
GtkAllocation winalloc;
GdkWindow *gdkwin;
GdkScreen *screen;
GdkRectangle workarea;
gtk_widget_get_allocation(w->widget, &winalloc);
gdkwin = gtk_widget_get_window(w->widget);
screen = gdk_window_get_screen(gdkwin);
gdk_screen_get_monitor_workarea(screen,
gdk_screen_get_monitor_at_window(screen, gdkwin),
&workarea);
x = (workarea.width - winalloc.width) / 2;
y = (workarea.height - winalloc.height) / 2;
// TODO move up slightly? see what Mutter or GNOME Shell or GNOME Terminal do(es)?
uiWindowSetPosition(w, x, y);
}
// TODO this and size changed get set during uiWindowDestroy
void uiWindowOnPositionChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data)
{
w->onPositionChanged = f;
w->onPositionChangedData = data;
}
// void uiWindowContentSize(uiWindow *w, int *width, int *height)
uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
{
// g_signal_connect(w->widget, "delete-event", G_CALLBACK(onClosing), w);
g_signal_connect(w->widget, "configure-event", G_CALLBACK(onConfigure), w);
// g_signal_connect(w->childHolderWidget, "size-allocate", G_CALLBACK(onSizeAllocate), w);
// uiWindowOnClosing(w, defaultOnClosing, NULL);
uiWindowOnPositionChanged(w, defaultOnPositionContentSizeChanged, NULL);
// uiWindowOnContentSizeChanged(w, defaultOnPositionContentSizeChanged, NULL);
}

View File

@ -0,0 +1,86 @@
struct uiWindow {
// BOOL hasMenubar;
void (*onPositionChanged)(uiWindow *, void *);
void *onPositionChangedData;
BOOL changingPosition; // to avoid triggering the above when programmatically doing this
// void (*onContentSizeChanged)(uiWindow *, void *);
};
static LRESULT CALLBACK windowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
case WM_WINDOWPOSCHANGED:
if ((wp->flags & SWP_NOMOVE) == 0)
if (!w->changingPosition)
(*(w->onPositionChanged))(w, w->onPositionChangedData);
// and continue anyway
// if ((wp->flags & SWP_NOSIZE) != 0)
}
// static int defaultOnClosing(uiWindow *w, void *data)
static void defaultOnPositionContentSizeChanged(uiWindow *w, void *data)
{
// do nothing
}
// static std::map<uiWindow *, bool> windows;
// void uiWindowSetTitle(uiWindow *w, const char *title)
void uiWindowPosition(uiWindow *w, int *x, int *y)
{
RECT r;
uiWindowsEnsureGetWindowRect(w->hwnd, &r);
*x = r.left;
*y = r.top;
}
void uiWindowSetPosition(uiWindow *w, int x, int y)
{
w->changingPosition = TRUE;
if (SetWindowPos(w->hwnd, NULL, x, y, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER) == 0)
logLastError(L"error moving window");
w->changingPosition = FALSE;
}
// static void windowMonitorRect(HWND hwnd, RECT *r)
// TODO use the work rect instead?
void uiWindowCenter(uiWindow *w)
{
RECT wr, mr;
int x, y;
LONG wwid, mwid;
LONG wht, mht;
uiWindowsEnsureGetWindowRect(w->hwnd, &wr);
windowMonitorRect(w->hwnd, &mr);
wwid = wr.right - wr.left;
mwid = mr.right - mr.left;
x = (mwid - wwid) / 2;
wht = wr.bottom - wr.top;
mht = mr.bottom - mr.top;
y = (mht - wht) / 2;
// y is now evenly divided, however https://msdn.microsoft.com/en-us/library/windows/desktop/dn742502(v=vs.85).aspx says that 45% should go above and 55% should go below
// so just move 5% of the way up
// TODO should this be on the work area?
// TODO is this calculation correct?
y -= y / 20;
uiWindowSetPosition(w, x, y);
}
void uiWindowOnPositionChanged(uiWindow *w, void (*f)(uiWindow *, void *), void *data)
{
w->onPositionChanged = f;
w->onPositionChangedData = data;
}
// void uiWindowContentSize(uiWindow *w, int *width, int *height)
uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar)
{
// uiWindowOnClosing(w, defaultOnClosing, NULL);
uiWindowOnPositionChanged(w, defaultOnPositionContentSizeChanged, NULL);
// uiWindowOnContentSizeChanged(w, defaultOnPositionContentSizeChanged, NULL);
}

1
_doc/areahandler Normal file
View File

@ -0,0 +1 @@
Yes, you keep ownership of the uiAreaHandler. libui only cares about the address you give uiNewArea(); it doesn't copy anything. You can even use the same uiAreaHandler on multiple uiAreas, which is why you get the uiArea as a parameter in each function.

13
_doc/drawtext Normal file
View File

@ -0,0 +1,13 @@
on some unix systems, alpha blending fonts may not be available; this depends on your installed version of pango and is determined at runtime by libui
uiDrawTextLayoutExtents: document that the extent width can be greater than the requested width if the requested width is small enough that only one character can fit
font matching is closest match but the search method is OS defined
weight names in libui do not necessarily line up with their OS names
uiDrawFontHandle() may not return a unique handle per instance

5
_doc/export/coretext Normal file
View File

@ -0,0 +1,5 @@
font features are not provided by the collection and have to be added when asking for a font
it does preserve when going from CTFont to CTFontDescriptor
feature 17 has no flags in the header but can also hold small caps info
if a feature is present, it is ignored; other features will still show up
at least in the case of kLetterCaseTrait and kLowerCaseTrait

750
_doc/export/ctweights Normal file
View File

@ -0,0 +1,750 @@
// pseudo-go
func (f *CTFont) IsRegistered() bool {
n := f.Attribute(kCTFontRegistrationScopeAttribute)
if n == nil {
return false
}
return n.(*CFNumber).Uint32Value() == kCTFontManagerScopeNone
}
// this type is in libFontRegistry.dylib; functions like x_list.Prepend() are called things like x_list_prepend() there
type x_list struct {
Data interface{}
Next *x_list
}
func (x *x_list) Prepend(data interface{}) *x_list {
y := malloc(sizeof (x_list))
if y != nil {
y.data = data
y.next = x
return y
}
return x
}
func (x *x_list) Reverse() *x_list {
if x == nil {
return nil
}
var old, next *x_list
next = nil
for {
old = x
x = old.next
old.next = next
next = old
if x == nil {
break
}
}
return old
}
func (x *x_list) Concat(y *x_list) *x_list {
if x == nil {
return y
}
start := x
z := x
for {
x = z
z = z.next
if z == nil {
break
}
}
x.next = y
return start
}
// based on CoreGraphics dylib's _CGFontCopyName
// note that this is different from the public API function CGFontCopyPostScriptName() (which is font type-independent)
// also note that in reality these keys are strings but the implementation of the function turns them into ints and only uses them as such
const (
kCGFontNameKeyPostScriptName = 0x6
kCGFontNameKeyPreferredSubfamily = 0x11
kCGFontNameKeyFontSubfamily = 0x2
kCGFontNameKeyFullName = 0x4
kCGFontNameKeyPreferredFamily = 0x10
kCGFontNameKeyFontFamily = 0x1
)
func (f *CGFont) CopyName(key int) (string, bool) {
table := f.TableForTag('name')
b := table.Bytes()
n := table.Len()
// this code looks weird, but we're imitating the assembly, or the effective effects thereof
offCount := uint16(0)
offStringOffset := uint16(2)
if n > 1 {
offCount = 2
offStringOffset = 4
}
count := uint16(0)
if int(offCount) <= n {
count = uint16be(b[offCount:offCount + 2])
}
offNameRecord := offStringOffset + 2
stringOffset := uint16(0)
if int(offNameRecord) <= n {
stringOffset = uint16be(b[offStringOffset:offStringOffset + 2])
}
type NameRecord struct {
PlatformID uint16
PlatformSpecificID uint16
LanguageID uint16
NameID uint16
Length uint16
Offset uint16
}
var nameList *x_list
addrStrings := offNameRecords + (12 * count)
if addrStrings != stringOffset {
goto hasLanguageTags
}
pos := offNameRecords
if count == 0 {
// TODO note assembly logic here
} else {
for {
var nr NameRecord
nr.PlatformID = 0
next := pos + 2
if int(next) <= n {
nr.PlatformID = uint16be(b[pos:pos + 2])
pos = next
}
nr.PlatformSpecificID = 0
next = pos + 2
if int(next) <= n {
nr.PlatformSpecificID = uint16be(b[pos:pos + 2])
pos = next
}
nr.LanguageID = 0
next = pos + 2
if int(next) <= n {
nr.LanguageID = uint16be(b[pos:pos + 2])
pos = next
}
nr.NameID = 0
next = pos + 2
if int(next) <= n {
nr.NameID = uint16be(b[pos:pos + 2])
pos = next
}
nr.Length = 0
next = pos + 2
if int(next) <= n {
nr.Length = uint16be(b[pos:pos + 2])
pos = next
}
nr.Offset = 0
next = pos + 2
if int(next) <= n {
nr.Offset = uint16be(b[pos:pos + 2])
pos = next
}
strpos := stringOffset + nr.Offset
if strpos >= n {
// TODO put comment about imitating the assembly comparisons here
} else {
realLen := nr.Length
strend = strpos + nr.Length
if strend > n {
realLen = nr.Length - strpos
strend = strpos + realLen
}
b := malloc(12 + realLen + 1)
if b != nil {
name := (*sfnt_name_t)(b)
name.PlatformID = nr.PlatformID
name.PlatformSpecificID = nr.PlatformSpecificID
name.LanguageID = nr.LanguageID
name.NameID = nr.NameID
name.Length = realLen
memcpy(&(name.Name), b[strpos:strend], realLen)
name.Name[realLen] = 0
nameList = nameList.Prepend(name)
}
}
count--
if count == 0 {
break
}
}
}
nameList = nameList.Reverse()
hasLanguageTags:
add_localized_names := func(platformID uint16, platformSpecificID uint16, to *x_list) *x_list {
out := (*x_list)(nil)
if nameList == nil {
xx TODO logic verbatim etc.
} else {
x := nameList
for {
name := (*sfnt_name_t)(x.data)
if name.PlatformID != platformID {
xx TODO
} else {
if platformSpecificID == 0xFFFF || name.PlatformSpecificID == platformSpecificID {
out = out.Prepend(name)
}
}
x = x.next
if x == nil {
break
}
}
}
out = out.Reverse()
return to.Concat(out)
}
localized := (*x_list)(nil)
localized = add_localized_names(0x1, 0xFFFF, localized)
localized = add_localized_names(0, 0xFFFF, localized)
localized = add_localized_names(0x3, 0xFFFF, localized)
localized = add_localized_names(0x1, 0, localized)
localized = add_localized_names(0x3, 0x9, localized)
localized = add_localized_names(0x3, 0x409, localized)
sysLocale := CFLocaleGetSystem()
}
// based on libFontRegistry.dylib's __ZNK8OS2Table15DetermineWeightERf — OS2Table::DetermineWeight(float&) const
func RegistryDetermineOS2Weight(table *CFData) (float32, bool) {
if table == nil {
return 0, false
}
if table.Len() < 78 {
return 0, false
}
b := table.Bytes()
usWeightClass := uint16be(b[4:6])
if usWeightClass >= 10 {
// do nothing; we are preserving the original asm comparisons
} else {
usWeightClass *= 100
}
/* TODO:
000000000000b37e mov dx, word [rax+4]
000000000000b382 mov cx, dx
000000000000b385 rol cx, 0x8
000000000000b389 movzx esi, cx
000000000000b38c imul ecx, ecx, 100
000000000000b38f cmp esi, 10
000000000000b392 cmovae cx, si
000000000000b396 test dx, dx
000000000000b399 cmove cx, si
what's the function of the last two instructions? */
// note that this is an unsigned comparison, so underflow will result in a number > 998
// the effect is the same as (usWeightClass == 0) || (usWeightClass >= 1000)
if (usWeightClass - 1) > 998 {
// note the - 2 here; the switch cases below reflect that!
// also note that b[0x22] and panose will be unsigned, so underflow will result in a number > 9
panose := b[0x22] - 2
if panose > 9 {
return 0, false
}
switch panose {
case 0:
return float32as(-0.500000, 0xbf000000), true
case 1:
return float32as(-0.400000, 0xbecccccd), true
case 2:
// yes, this returns false; I don't know why
return float32as(-0.300000, 0xbe99999a), false
case 3:
return float32as(-0.230000, 0xbe6b851f), true
case 4:
return float32as(0.230000, 0x3e6b851f), true
case 5:
return float32as(0.250000, 0x3e800000), true
case 6:
return float32as(0.400000, 0x3ecccccd), true
case 7:
return float32as(0.560000, 0x3f0f5c29), true
case 8:
return float32as(0.620000, 0x3f1eb852), true
case 9:
return float32as(0.800000, 0x3f4ccccd), true
}
// should not reach here
}
// let's mimic the assembly here too
// the gotos avoid the massive if nesting
// also note I'm using Go idioms and not saying "else return", imagine those if you must
if usWeightClass > 100 {
if usWeightClass > 200 {
goto do201AndUp
}
return float32as(-0.500000, 0xbf000000), true
}
return float32as(-0.800000, 0xbf4ccccd), true
do201AndUp:
if usWeightClass > 300 {
if usWeightClass > 400 {
goto do401AndUp
}
return float32as(0.000000, 0x0), true
}
return float32as(-0.400000, 0xbecccccd), true
do401AndUp:
if usWeightClass > 500 {
if usWeightClass > 600 {
goto do601AndUp
}
return float32as(0.250000, 0x3e800000), true
}
return float32as(0.230000, 0x3e6b851f), true
do601AndUp:
if usWeightClass > 700 {
if usWeightClass > 800 {
goto do801AndUp
}
return float32as(0.500000, 0x3f000000), true
}
return float32as(0.400000, 0x3ecccccd), true
do801AndUp:
if usWeightClass > 900 {
if usWeightClass > 950 {
return float32(0.800000, 0x3f4ccccd), true
}
return float32(0.750000, 0x3f400000), true
}
return float32as(0.620000, 0x3f1eb852), true
}
// based on libFontRegistry.dylib's __ZN11TFontTraitsC2EP6CGFontRK13TFontMetadata — TFontTraits::TFontTraits(CGFont*, TFontMetadata const&)
func (f *Font) WeightFromFontRegistry32() float32 {
var weight float32
var hasWeight bool = false
cgfont := f.CGFont()
if f.RegistryHasMetadata() {
wv := f.RegistryMetadataValueForKey("MTD_Typeface_Weight_VisualDescriptor")
if wv != nil {
if wn, ok := wv.(string); ok {
// note: uses CFStringCompare(0)
switch wn {
case "reg":
weight = float32as(0.000000, 0x0)
hasWeight = true
case "semi":
weight = float32as(0.300000, 0x3e99999a)
hasWeight = true
case "bold":
weight = float32as(0.400000, 0x3ecccccd)
hasWeight = true
case "light":
weight = float32as(-0.400000, 0xbecccccd)
hasWeight = true
case "med":
weight = float32as(0.230000, 0x3e6b851f)
hasWeight = true
case "heavy":
weight = float32as(0.560000, 0x3f0f5c29)
hasWeight = true
case "black":
weight = float32as(0.620000, 0x3f1eb852)
hasWeight = true
case "thin":
weight = float32as(-0.600000, 0xbf19999a)
hasWeight = true
case "ulight":
weight = float32as(-0.800000, 0xbf4ccccd)
hasWeight = true
}
}
}
}
cgpsname, ok := cgfont.CopyName(kCGFontNameKeyPostScriptName)
if ok {
// note: uses CFStringCompare(0)
switch cgpsname {
case "LucidaGrande",
".LucidaGrandeUI",
".Keyboard":
weight = float32as(0.000000, 0x0)
hasWeight = true
case "STHeiti":
weight = float32as(0.240000, 0x3e75c28f)
hasWeight = true
case "STXihei":
weight = float32as(-0.100000, 0xbdcccccd)
hasWeight = true
case "TimesNewRomanPSMT":
weight = float32as(0.000000, 0x0)
hasWeight = true
}
}
styleGlossaryStrings := []int{
kCGFontNameKeyPreferredSubfamily,
kCGFontNameKeyFontSubfamily,
kCGFontNameKeyFullName,
kCGFontNameKeyPreferredFamily,
kCGFontNameKeyFontFamily,
}
weightNameMap := []struct {
key string
val float32
}{
{ "Ultra Light", float32as(-0.800000f, 0xbf4ccccd) },
{ "Ultra Black", float32as(0.750000f, 0x3f400000) },
{ "Extra Light", float32as(-0.500000f, 0xbf000000) },
{ "UltraBlack", float32as(0.750000f, 0x3f400000) },
{ "ExtraBlack", float32as(0.800000f, 0x3f4ccccd) },
{ "UltraLight", float32as(-0.800000f, 0xbf4ccccd) },
{ "ExtraLight", float32as(-0.500000f, 0xbf000000) },
{ "Ultra Thin", float32as(-0.800000f, 0xbf4ccccd) },
{ "Extra Thin", float32as(-0.800000f, 0xbf4ccccd) },
{ "Heavy Face", float32as(0.560000f, 0x3f0f5c29) },
{ "Semi Light", float32as(-0.200000f, 0xbe4ccccd) },
{ "Extra Bold", float32as(0.500000f, 0x3f000000) },
{ "Ultra Bold", float32as(0.700000f, 0x3f333333) },
{ "HeavyFace", float32as(0.560000f, 0x3f0f5c29) },
{ "ExtraBold", float32as(0.500000f, 0x3f000000) },
{ "UltraBold", float32as(0.700000f, 0x3f333333) },
{ "Ext Black", float32as(0.800000f, 0x3f4ccccd) },
{ "SemiLight", float32as(-0.200000f, 0xbe4ccccd) },
{ "Demi Bold", float32as(0.250000f, 0x3e800000) },
{ "Semi Bold", float32as(0.300000f, 0x3e99999a) },
{ "Ext Light", float32as(-0.500000f, 0xbf000000) },
{ "Ext Bold", float32as(0.500000f, 0x3f000000) },
{ "DemiBold", float32as(0.250000f, 0x3e800000) },
{ "SemiBold", float32as(0.300000f, 0x3e99999a) },
{ "HairLine", float32as(-0.800000f, 0xbf4ccccd) },
{ "Ext Thin", float32as(-0.800000f, 0xbf4ccccd) },
{ "Medium", float32as(0.230000f, 0x3e6b851f) },
{ "Poster", float32as(0.800000f, 0x3f4ccccd) },
{ "Light", float32as(-0.400000f, 0xbecccccd) },
{ "Ultra", float32as(0.500000f, 0x3f000000) },
{ "Heavy", float32as(0.560000f, 0x3f0f5c29) },
{ "Extra", float32as(0.500000f, 0x3f000000) },
{ "Black", float32as(0.620000f, 0x3f1eb852) },
{ "Super", float32as(0.620000f, 0x3f1eb852) },
{ "Obese", float32as(0.850000f, 0x3f59999a) },
{ "Lite", float32as(-0.400000f, 0xbecccccd) },
{ "Book", float32as(-0.230000f, 0xbe6b851f) },
{ "Demi", float32as(0.250000f, 0x3e800000) },
{ "Semi", float32as(0.300000f, 0x3e99999a) },
{ "Thin", float32as(-0.500000f, 0xbf000000) },
{ "Bold", float32as(0.400000f, 0x3ecccccd) },
{ "Nord", float32as(0.800000f, 0x3f4ccccd) },
{ "Fat", float32as(0.750000f, 0x3f400000) },
{ "W1", float32as(-0.230000f, 0xbe6b851f) },
{ "W2", float32as(-0.500000f, 0xbf000000) },
{ "W3", float32as(-0.230000f, 0xbe6b851f) },
{ "W4", float32as(0.000000f, 0x0) },
{ "W5", float32as(0.230000f, 0x3e6b851f) },
{ "W6", float32as(0.300000f, 0x3e99999a) },
{ "W7", float32as(0.440000f, 0x3ee147ae) },
{ "W8", float32as(0.540000f, 0x3f0a3d71) },
{ "W9", float32as(0.620000f, 0x3f1eb852) },
}
for _, key := range styleGlossaryStrings {
if hasWeight {
break
}
str, ok := cgfont.CopyName(key)
if !ok {
continue
}
for _, m := range weightNameMap {
if str.FindWithOptions(m.key, CFRangeMake(0, str.CFStringLength()), kCFCompareCaseInsensitive | kCFCompareBackwards | kCFCompareNonliteral, nil) {
weight = m.val
hasWeight = true
break
}
}
}
if !hasWeight {
os2table := cgfont.TableForTag('OS/2')
weight, hasWeight = RegistryDetermineOS2Weight(os2table)
}
if !hasWeight {
headtable := cgfont.TableForTag('head')
if headtable != nil {
if headtable.Len() >= 54 {
b := headtable.Bytes()
if (b[0x2d] & 1) != 0 {
weight = float32as(0.400000, 0x3ecccccd)
hasWeight = true
}
}
}
}
styleGlossaryAbbreviationKeys := []int{
kCGFontNameKeyPreferredSubfamily,
kCGFontNameKeyFontSubfamily,
}
abbreviatedWeightNameMap := []struct {
key string
val float32
}{
{ "EL", float32as(-0.200000, 0xbe4ccccd) },
{ "EB", float32as(0.500000, 0x3f000000) },
{ "SB", float32as(0.300000, 0x3e99999a) },
{ "UH", float32as(0.800000, 0x3f4ccccd) },
{ "U", float32as(0.700000, 0x3f333333) },
{ "L", float32as(-0.400000, 0xbecccccd) },
{ "H", float32as(0.560000, 0x3f0f5c29) },
{ "B", float32as(0.400000, 0x3ecccccd) },
{ "M", float32as(0.230000, 0x3e6b851f) },
{ "R", float32as(0.000000, 0x0) },
}
if !hasWeight {
for _, key := range styleGlossaryAbbreviationStrings {
str, ok := cgfont.CopyName(key)
if !ok {
continue
}
for _, m := range abbreviatedWeightNameMap {
if str.Compare(m.key, kCFCompareCaseInsensitive) == kCFCompareEqualTo {
weight = m.val
hasWeight = true
break
}
}
if hasWeight {
break
}
}
}
if !hasWeight {
return float32as(0.000000, 0x0)
}
return weight
}
// because Core Text gets registry traits as a CFDictionary, convert the float to a double with CFNumber as that is what actually would be done
func (f *Font) WeightFromFontRegistry() float64 {
return CFNumberWithFloat32(f.WeightFromFontRegistry32()).Float64Value()
}
// based on CoreText dylib's __Z13WeightOfClasst — WeightOfClass(unsigned short)
func CoreText_WeightOfClass(usWeightClass uint16) float64 {
if usWeightClass >= 11 {
// do nothing; we are preserving the original asm comparisons
// and yes, this one is 11, but the one above is 10
} else {
usWeightClass *= 100
}
// figure out what two floats our weight will be between
i := usWeightClass / 100
j := i + 1
if j > 10 {
j = 10
}
b := float64(i * 100)
c := float64(j * 100)
a := float64(0)
if b != c {
a = float64(usWeightClass)
a -= b
c -= b
a /= c
}
scales := []float32{
float32as(-1.000000, 0xbf800000),
float32as(-0.700000, 0xbf333333),
float32as(-0.500000, 0xbf000000),
float32as(-0.230000, 0xbe6b851f),
float32as(0.000000, 0x0),
float32as(0.200000, 0x3e4ccccd),
float32as(0.300000, 0x3e99999a),
float32as(0.400000, 0x3ecccccd),
float32as(0.600000, 0x3f19999a),
float32as(0.800000, 0x3f4ccccd),
float32as(1.000000, 0x3f800000),
}
c = float64(scale[i])
b = float64[scale[j])
return fma(a, b, c)
}
// based on CoreText dylib's __ZL33CreateTraitsByStyleGlossaryStringPK10__CFString — CreateTraitsByStyleGlossaryString(__CFString const*)
func CoreText_WeightByStyleGlossaryString(str string) (weight float64, ok bool) {
str.Fold(kCFCompareCaseInsensitive, nil)
weightNameMap := []struct {
key string
val float32
}{
{ "ultra light", float32as(-0.800000, 0xbf4ccccd) },
{ "ultra black", float32as(0.750000, 0x3f400000) },
{ "extra light", float32as(-0.500000, 0xbf000000) },
{ "ultralight", float32as(-0.800000, 0xbf4ccccd) },
{ "ultrablack", float32as(0.750000, 0x3f400000) },
{ "extrablack", float32as(0.800000, 0x3f4ccccd) },
{ "extralight", float32as(-0.500000, 0xbf000000) }
{ "heavy face", float32as(0.560000, 0x3f0f5c29) },
{ "semi light", float32as(-0.200000, 0xbe4ccccd) },
{ "extra bold", float32as(0.500000, 0x3f000000) },
{ "ultra bold", float32as(0.700000, 0x3f333333) },
{ "heavyface", float32as(0.560000, 0x3f0f5c29) },
{ "extrabold", float32as(0.500000, 0x3f000000) },
{ "ultrabold", float32as(0.700000, 0x3f333333) },
{ "semilight", float32as(-0.200000, 0xbe4ccccd) },
{ "demi bold", float32as(0.250000, 0x3e800000) },
{ "semi bold", float32as(0.300000, 0x3e99999a) },
{ "demibold", float32as(0.250000, 0x3e800000) },
{ "semibold", float32as(0.300000, 0x3e99999a) },
{ "hairline", float32as(-0.700000, 0xbf333333) },
{ "medium", float32as(0.230000, 0x3e6b851f) },
{ "poster", float32as(0.800000, 0x3f4ccccd) },
{ "light", float32as(-0.400000, 0xbecccccd) },
{ "heavy", float32as(0.560000, 0x3f0f5c29) },
{ "extra", float32as(0.500000, 0x3f000000) },
{ "black", float32as(0.620000, 0x3f1eb852) },
{ "super", float32as(0.620000, 0x3f1eb852) },
{ "obese", float32as(0.850000, 0x3f59999a) },
{ "lite", float32as(-0.400000, 0xbecccccd) },
{ "book", float32as(-0.230000, 0xbe6b851f) },
{ "demi", float32as(0.250000, 0x3e800000) },
{ "semi", float32as(0.300000, 0x3e99999a) },
{ "thin", float32as(-0.500000, 0xbf000000) },
{ "bold", float32as(0.400000, 0x3ecccccd) },
{ "nord", float32as(0.800000, 0x3f4ccccd) },
{ "fat", float32as(0.750000, 0x3f400000) },
{ "w1", float32as(-0.700000, 0xbf333333) },
{ "w2", float32as(-0.500000, 0xbf000000) },
{ "w3", float32as(-0.230000, 0xbe6b851f) },
{ "w4", float32as(0.000000, 0x0) },
{ "w5", float32as(0.230000, 0x3e6b851f) },
{ "w6", float32as(0.300000, 0x3e99999a) },
{ "w7", float32as(0.440000, 0x3ee147ae) },
{ "w8", float32as(0.540000, 0x3f0a3d71) },
{ "w9", float32as(0.620000, 0x3f1eb852) },
}
for _, m := range weightNameMap {
if strstr(str, m.key) != nil {
val := CFNumberWithFloat32(m.val)
return val.Float64Value(), true
}
}
return 0, false
}
// based on CoreText dylib's __ZNK9TBaseFont29CreateTraitsValuesPerFontInfoEP12MetadataFlag — TBaseFont::CreateTraitsValuesPerFontInfo(MetadataFlag*) const
func (f *CTFont) Weight() float64 {
if f.IsRegistered() {
return f.WeightFromFontRegistry()
}
weight := float64as(2.0, 0x4000000000000000)
ebx := -1
hasWeight := false
name := f.Name(kCTFontPostScriptNameKey)
if name != nil {
switch *name {
case "LucidaGrande":
weight = float64as(0.000000, 0x0)
hasWeight = true
case ".LucidaGrandeUI":
weight = float64as(0.000000, 0x0)
hasWeight = true
case "STHeiti":
weight = float64as(0.240000, 0x3fceb851eb851eb8)
hasWeight = true
case "STXihei":
weight = float64as(-0.100000, 0xbfb999999999999a)
hasWeight = true
case "TimesNewRomanPSMT":
weight = float64as(0.000000, 0x0)
hasWeight = true
// there is one more hardcoded case, for "Times-Roman", but that will only set the class style, not the weight
}
}
os2table := f.Table('OS/2')
if os2table != nil {
if !hasWeight {
var usWeightClass uint16
valid := false
if os2table.Len() > 77 {
b := os2table.Bytes()
usWeightClass = uint16be(b[4:6])
if usWeightClass > 1000 {
weight = 0
hasWeight = false
} else {
valid = true
}
} else {
usWeightClass = 0
valid = true
}
if valid {
weight = CoreText_WeightOfClass(usWeightClass)
hasWeight = true
}
}
}
styleGlossaryNames := []string{
kCTFontSubFamilyNameKey,
kCTFontFullNameKey,
kCTFontFamilyNameKey,
}
for _, key := range styleGlossaryNames {
name := f.Name(key)
if name == nil {
continue
}
candidate, ok := CoreText_WeightByStyleGlossaryString(*name)
if !ok {
continue
}
if !hasWeight {
weight = candidate
hasWeight = true
}
}
if hasWeight {
return weight
}
return 0
}
func (f *Font) ShouldEnableBoldSymbolicTrait() bool {
if f.IsRegistered() {
return f.ShouldEnableBoldSymbolicTraitFromRegistry()
}
no := f.Weight() <= float64as(0.239000, 0x3fce978d4fdf3b64)
return !no
}

View File

@ -0,0 +1,149 @@
-0.100000 0xbdcccccd registered postscript name "STXihei"
-0.100000 0xbfb999999999999a unregistered postscript name "STXihei"
-0.200000 0xbe4ccccd registered subfamily abbr "EL"
-0.200000 0xbe4ccccd "Semi Light"
-0.200000 0xbe4ccccd "SemiLight"
-0.200000 0xbe4ccccd "semi light"
-0.200000 0xbe4ccccd "semilight"
-0.230000 0xbe6b851f "Book"
-0.230000 0xbe6b851f "W1"
-0.230000 0xbe6b851f "W3"
-0.230000 0xbe6b851f "book"
-0.230000 0xbe6b851f "w3"
-0.230000 0xbe6b851f panose 5
-0.400000 0xbecccccd registered subfamily abbr "L"
-0.400000 0xbecccccd "Light"
-0.400000 0xbecccccd "Lite"
-0.400000 0xbecccccd "light"
-0.400000 0xbecccccd "light"
-0.400000 0xbecccccd "lite"
-0.400000 0xbecccccd registered OS2 weights 3, 201 - 300
-0.400000 0xbecccccd panose 3
-0.500000 0xbf000000 "Ext Light"
-0.500000 0xbf000000 "Extra Light"
-0.500000 0xbf000000 "ExtraLight"
-0.500000 0xbf000000 "Thin"
-0.500000 0xbf000000 "W2"
-0.500000 0xbf000000 "extra light"
-0.500000 0xbf000000 "extralight"
-0.500000 0xbf000000 "thin"
-0.500000 0xbf000000 "w2"
-0.500000 0xbf000000 registered OS2 weights 2, 101 - 200
-0.500000 0xbf000000 panose 2
-0.600000 0xbf19999a "thin"
-0.700000 0xbf333333 "hairline"
-0.700000 0xbf333333 "w1"
-0.800000 0xbf4ccccd "Ext Thin"
-0.800000 0xbf4ccccd "Extra Thin"
-0.800000 0xbf4ccccd "HairLine"
-0.800000 0xbf4ccccd "Ultra Light"
-0.800000 0xbf4ccccd "Ultra Thin"
-0.800000 0xbf4ccccd "UltraLight"
-0.800000 0xbf4ccccd "ulight"
-0.800000 0xbf4ccccd "ultra light"
-0.800000 0xbf4ccccd "ultralight"
-0.800000 0xbf4ccccd registered OS2 weights 1, 10 - 100
0.000000 0x0 registered postscript name ".Keyboard"
0.000000 0x0 registered postscript name ".LucidaGrandeUI"
0.000000 0x0 unregistered postscript name ".LucidaGrandeUI"
0.000000 0x0 registered postscript name "LucidaGrande"
0.000000 0x0 unregistered postscript name "LucidaGrande"
0.000000 0x0 registered subfamily abbr "R"
0.000000 0x0 registered postscript name "TimesNewRomanPSMT"
0.000000 0x0 unregistered postscript name "TimesNewRomanPSMT"
0.000000 0x0 "W4"
0.000000 0x0 "reg"
0.000000 0x0 "w4"
0.000000 0x0 registered OS2 weights 4, 301 - 400
0.000000 0x0 default
0.230000 0x3e6b851f registered OS2 weights 5, 401 - 500
0.230000 0x3e6b851f registered subfamily abbr "M"
0.230000 0x3e6b851f "Medium"
0.230000 0x3e6b851f "W5"
0.230000 0x3e6b851f "med"
0.230000 0x3e6b851f "medium"
0.230000 0x3e6b851f "w5"
0.230000 0x3e6b851f panose 6
0.240000 0x3e75c28f registered postscript name "STHeiti"
0.240000 0x3fceb851eb851eb8 unregistered postscript name "STHeiti"
0.250000 0x3e800000 "Demi Bold"
0.250000 0x3e800000 "Demi"
0.250000 0x3e800000 "DemiBold"
0.250000 0x3e800000 "demi bold"
0.250000 0x3e800000 "demi"
0.250000 0x3e800000 "demibold"
0.250000 0x3e800000 registered OS2 weights 6, 501 - 600
0.250000 0x3e800000 panose 7
0.300000 0x3e99999a registered subfamily abbr "SB"
0.300000 0x3e99999a "Semi Bold"
0.300000 0x3e99999a "Semi"
0.300000 0x3e99999a "SemiBold"
0.300000 0x3e99999a "W6"
0.300000 0x3e99999a "semi bold"
0.300000 0x3e99999a "semi"
0.300000 0x3e99999a "semi"
0.300000 0x3e99999a "semibold"
0.300000 0x3e99999a "w6"
0.400000 0x3ecccccd registered subfamily abbr "B"
0.400000 0x3ecccccd "Bold"
0.400000 0x3ecccccd "bold"
0.400000 0x3ecccccd "bold"
0.400000 0x3ecccccd 'head'[0x2D] & 1
0.400000 0x3ecccccd registered OS2 weights 7, 601 - 700
0.400000 0x3ecccccd panose 8
0.440000 0x3ee147ae "W7"
0.440000 0x3ee147ae "w7"
0.500000 0x3f000000 registered subfamily abbr "EB"
0.500000 0x3f000000 "Ext Bold"
0.500000 0x3f000000 "Extra Bold"
0.500000 0x3f000000 "Extra"
0.500000 0x3f000000 "ExtraBold"
0.500000 0x3f000000 "Ultra"
0.500000 0x3f000000 "extra bold"
0.500000 0x3f000000 "extra"
0.500000 0x3f000000 "extrabold"
0.500000 0x3f000000 registered OS2 weights 8, 701 - 800
0.540000 0x3f0a3d71 "W8"
0.540000 0x3f0a3d71 "w8"
0.560000 0x3f0f5c29 registered subfamily abbr "H"
0.560000 0x3f0f5c29 "Heavy Face"
0.560000 0x3f0f5c29 "Heavy"
0.560000 0x3f0f5c29 "HeavyFace"
0.560000 0x3f0f5c29 "heavy face"
0.560000 0x3f0f5c29 "heavy"
0.560000 0x3f0f5c29 "heavy"
0.560000 0x3f0f5c29 "heavyface"
0.560000 0x3f0f5c29 panose 9
0.620000 0x3f1eb852 "Black"
0.620000 0x3f1eb852 "Super"
0.620000 0x3f1eb852 "W9"
0.620000 0x3f1eb852 "black"
0.620000 0x3f1eb852 "black"
0.620000 0x3f1eb852 "super"
0.620000 0x3f1eb852 "w9"
0.620000 0x3f1eb852 registered OS2 weights 9, 801 - 900
0.620000 0x3f1eb852 panose 10
0.700000 0x3f333333 registered subfamily abbr "U"
0.700000 0x3f333333 "Ultra Bold"
0.700000 0x3f333333 "UltraBold"
0.700000 0x3f333333 "ultra bold"
0.700000 0x3f333333 "ultrabold"
0.750000 0x3f400000 "Fat"
0.750000 0x3f400000 "Ultra Black"
0.750000 0x3f400000 "UltraBlack"
0.750000 0x3f400000 "fat"
0.750000 0x3f400000 "ultra black"
0.750000 0x3f400000 "ultrablack"
0.750000 0x3f400000 registered OS2 weights 901 - 950
0.800000 0x3f4ccccd "Ext Black"
0.800000 0x3f4ccccd "ExtraBlack"
0.800000 0x3f4ccccd "Nord"
0.800000 0x3f4ccccd "Poster"
0.800000 0x3f4ccccd registered subfamily abbr "UH"
0.800000 0x3f4ccccd "extrablack"
0.800000 0x3f4ccccd "nord"
0.800000 0x3f4ccccd "poster"
0.800000 0x3f4ccccd registered OS2 weights 951 - 999
0.800000 0x3f4ccccd panose 11
0.850000 0x3f59999a "Obese"
0.850000 0x3f59999a "obese"

View File

@ -0,0 +1,146 @@
-0.100000
postscript name "STXihei" (which, according to http://www.typophile.com/node/93813, means "ST Hei Light", and so we can assume it's the Light version of STHeiti, which I think is Medium though is given Regular status below because meh)
-0.200000
subfamily abbreviation "EL" (???????????)
style string contains "Semi Light"
style string contains "SemiLight"
-0.230000
style string contains "Book"
style string contains "W1" (registered fonts only; probably a typo and -0.7 was expected instead)
style string contains "W3"
panose 5
-0.400000
subfamily abbreviation "L"
style string contains "Light"
style string contains "Lite"
ATSD style "light"
OS2 weights 3, 201 - 300
panose 3
-0.500000
style string contains "Ext Light"
style string contains "Extra Light"
style string contains "ExtraLight"
style string contains "Thin"
style string contains "W2"
OS2 weights 2, 101 - 200
panose 2
-0.600000
ATSD style "thin"
-0.700000
style string contains "hairline"
style string contains "w1"
-0.800000
style string contains "Ext Thin"
style string contains "Extra Thin"
style string contains "HairLine"
style string contains "Ultra Light"
style string contains "Ultra Thin"
style string contains "UltraLight"
ATSD style "ulight"
OS2 weights 1, 10 - 100
0.000000
ostscript name ".Keyboard"
postscript name ".LucidaGrandeUI"
postscript name "LucidaGrande"
subfamily abbreviation "R"
postscript name "TimesNewRomanPSMT"
style string contains "W4"
ATSD style "reg"
OS2 weights 4, 301 - 400
default
0.230000
OS2 weights 5, 401 - 500
subfamily abbreviation "M"
style string contains "Medium"
style string contains "W5"
ATSD style "med"
panose 6
0.240000
postscript name "STHeiti"
0.250000
style string contains "Demi Bold"
style string contains "Demi"
style string contains "DemiBold"
OS2 weights 6, 501 - 600
panose 7
0.300000
subfamily abbreviation "SB"
style string contains "Semi Bold"
style string contains "Semi"
style string contains "SemiBold"
style string contains "W6"
ATSD style "semi"
0.400000
subfamily abbreviation "B"
style string contains "Bold"
ATSD style "bold"
('head' table byte 0x2D) & 1 != 0
OS2 weights 7, 601 - 700
panose 8
0.440000
style string contains "W7"
0.500000
subfamily abbreviation "EB"
style string contains "Ext Bold"
style string contains "Extra Bold"
style string contains "Extra"
style string contains "ExtraBold"
style string contains "Ultra"
OS2 weights 8, 701 - 800
0.540000
style string contains "W8"
0.560000
subfamily abbreviation "H"
style string contains "Heavy Face"
style string contains "Heavy"
style string contains "HeavyFace"
ATSD style "heavy"
panose 9
0.620000
style string contains "Black"
style string contains "Super"
style string contains "W9"
ATSD style "black"
OS2 weights 9, 801 - 900
panose 10
0.700000
subfamily abbreviation "U"
style string contains "Ultra Bold"
style string contains "UltraBold"
0.750000
style string contains "Fat"
style string contains "Ultra Black"
style string contains "UltraBlack"
OS2 weights 901 - 950
0.800000
style string contains "Ext Black"
style string contains "ExtraBlack"
style string contains "Nord"
style string contains "Poster"
subfamily abbreviation "UH"
OS2 weights 951 - 999
panose 11
0.850000
style string contains "Obese"

View File

@ -0,0 +1,149 @@
-0.100000 0xbdcccccd "STXihei"
-0.100000 0xbfb999999999999a "STXihei"
-0.200000 0xbe4ccccd "EL"
-0.200000 0xbe4ccccd "Semi Light"
-0.200000 0xbe4ccccd "SemiLight"
-0.200000 0xbe4ccccd "semi light"
-0.200000 0xbe4ccccd "semilight"
-0.230000 0xbe6b851f "Book"
-0.230000 0xbe6b851f "W1"
-0.230000 0xbe6b851f "W3"
-0.230000 0xbe6b851f "book"
-0.230000 0xbe6b851f "w3"
-0.230000 0xbe6b851f panose 5
-0.400000 0xbecccccd "L"
-0.400000 0xbecccccd "Light"
-0.400000 0xbecccccd "Lite"
-0.400000 0xbecccccd "light"
-0.400000 0xbecccccd "light"
-0.400000 0xbecccccd "lite"
-0.400000 0xbecccccd 3, 201 - 300
-0.400000 0xbecccccd panose 3
-0.500000 0xbf000000 "Ext Light"
-0.500000 0xbf000000 "Extra Light"
-0.500000 0xbf000000 "ExtraLight"
-0.500000 0xbf000000 "Thin"
-0.500000 0xbf000000 "W2"
-0.500000 0xbf000000 "extra light"
-0.500000 0xbf000000 "extralight"
-0.500000 0xbf000000 "thin"
-0.500000 0xbf000000 "w2"
-0.500000 0xbf000000 2, 101 - 200
-0.500000 0xbf000000 panose 2
-0.600000 0xbf19999a "thin"
-0.700000 0xbf333333 "hairline"
-0.700000 0xbf333333 "w1"
-0.800000 0xbf4ccccd "Ext Thin"
-0.800000 0xbf4ccccd "Extra Thin"
-0.800000 0xbf4ccccd "HairLine"
-0.800000 0xbf4ccccd "Ultra Light"
-0.800000 0xbf4ccccd "Ultra Thin"
-0.800000 0xbf4ccccd "UltraLight"
-0.800000 0xbf4ccccd "ulight"
-0.800000 0xbf4ccccd "ultra light"
-0.800000 0xbf4ccccd "ultralight"
-0.800000 0xbf4ccccd 1, 10 - 100
0.000000 0x0 ".Keyboard"
0.000000 0x0 ".LucidaGrandeUI"
0.000000 0x0 ".LucidaGrandeUI"
0.000000 0x0 "LucidaGrande"
0.000000 0x0 "LucidaGrande"
0.000000 0x0 "R"
0.000000 0x0 "TimesNewRomanPSMT"
0.000000 0x0 "TimesNewRomanPSMT"
0.000000 0x0 "W4"
0.000000 0x0 "reg"
0.000000 0x0 "w4"
0.000000 0x0 4, 301 - 400
0.000000 0x0 default
0.230000 0x3e6b851f 5, 401 - 500
0.230000 0x3e6b851f "M"
0.230000 0x3e6b851f "Medium"
0.230000 0x3e6b851f "W5"
0.230000 0x3e6b851f "med"
0.230000 0x3e6b851f "medium"
0.230000 0x3e6b851f "w5"
0.230000 0x3e6b851f panose 6
0.240000 0x3e75c28f "STHeiti"
0.240000 0x3fceb851eb851eb8 "STHeiti"
0.250000 0x3e800000 "Demi Bold"
0.250000 0x3e800000 "Demi"
0.250000 0x3e800000 "DemiBold"
0.250000 0x3e800000 "demi bold"
0.250000 0x3e800000 "demi"
0.250000 0x3e800000 "demibold"
0.250000 0x3e800000 6, 501 - 600
0.250000 0x3e800000 panose 7
0.300000 0x3e99999a "SB"
0.300000 0x3e99999a "Semi Bold"
0.300000 0x3e99999a "Semi"
0.300000 0x3e99999a "SemiBold"
0.300000 0x3e99999a "W6"
0.300000 0x3e99999a "semi bold"
0.300000 0x3e99999a "semi"
0.300000 0x3e99999a "semi"
0.300000 0x3e99999a "semibold"
0.300000 0x3e99999a "w6"
0.400000 0x3ecccccd "B"
0.400000 0x3ecccccd "Bold"
0.400000 0x3ecccccd "bold"
0.400000 0x3ecccccd "bold"
0.400000 0x3ecccccd 'head'[0x2D] & 1
0.400000 0x3ecccccd 7, 601 - 700
0.400000 0x3ecccccd panose 8
0.440000 0x3ee147ae "W7"
0.440000 0x3ee147ae "w7"
0.500000 0x3f000000 "EB"
0.500000 0x3f000000 "Ext Bold"
0.500000 0x3f000000 "Extra Bold"
0.500000 0x3f000000 "Extra"
0.500000 0x3f000000 "ExtraBold"
0.500000 0x3f000000 "Ultra"
0.500000 0x3f000000 "extra bold"
0.500000 0x3f000000 "extra"
0.500000 0x3f000000 "extrabold"
0.500000 0x3f000000 8, 701 - 800
0.540000 0x3f0a3d71 "W8"
0.540000 0x3f0a3d71 "w8"
0.560000 0x3f0f5c29 "H"
0.560000 0x3f0f5c29 "Heavy Face"
0.560000 0x3f0f5c29 "Heavy"
0.560000 0x3f0f5c29 "HeavyFace"
0.560000 0x3f0f5c29 "heavy face"
0.560000 0x3f0f5c29 "heavy"
0.560000 0x3f0f5c29 "heavy"
0.560000 0x3f0f5c29 "heavyface"
0.560000 0x3f0f5c29 panose 9
0.620000 0x3f1eb852 "Black"
0.620000 0x3f1eb852 "Super"
0.620000 0x3f1eb852 "W9"
0.620000 0x3f1eb852 "black"
0.620000 0x3f1eb852 "black"
0.620000 0x3f1eb852 "super"
0.620000 0x3f1eb852 "w9"
0.620000 0x3f1eb852 9, 801 - 900
0.620000 0x3f1eb852 panose 10
0.700000 0x3f333333 "U"
0.700000 0x3f333333 "Ultra Bold"
0.700000 0x3f333333 "UltraBold"
0.700000 0x3f333333 "ultra bold"
0.700000 0x3f333333 "ultrabold"
0.750000 0x3f400000 "Fat"
0.750000 0x3f400000 "Ultra Black"
0.750000 0x3f400000 "UltraBlack"
0.750000 0x3f400000 "fat"
0.750000 0x3f400000 "ultra black"
0.750000 0x3f400000 "ultrablack"
0.750000 0x3f400000 901 - 950
0.800000 0x3f4ccccd "Ext Black"
0.800000 0x3f4ccccd "ExtraBlack"
0.800000 0x3f4ccccd "Nord"
0.800000 0x3f4ccccd "Poster"
0.800000 0x3f4ccccd "UH"
0.800000 0x3f4ccccd "extrablack"
0.800000 0x3f4ccccd "nord"
0.800000 0x3f4ccccd "poster"
0.800000 0x3f4ccccd 951 - 999
0.800000 0x3f4ccccd panose 11
0.850000 0x3f59999a "Obese"
0.850000 0x3f59999a "obese"

149
_doc/export/ctweightsraw Normal file
View File

@ -0,0 +1,149 @@
0.000000 0x0 "reg"
0.300000 0x3e99999a "semi"
0.400000 0x3ecccccd "bold"
-0.400000 0xbecccccd "light"
0.230000 0x3e6b851f "med"
0.560000 0x3f0f5c29 "heavy"
0.620000 0x3f1eb852 "black"
-0.600000 0xbf19999a "thin"
-0.800000 0xbf4ccccd "ulight"
0.000000 0x0 "LucidaGrande"
0.000000 0x0 ".LucidaGrandeUI"
0.000000 0x0 ".Keyboard"
0.240000 0x3e75c28f "STHeiti"
-0.100000 0xbdcccccd "STXihei"
0.000000 0x0 "TimesNewRomanPSMT"
-0.800000 0xbf4ccccd "Ultra Light"
0.750000 0x3f400000 "Ultra Black"
-0.500000 0xbf000000 "Extra Light"
0.750000 0x3f400000 "UltraBlack"
0.800000 0x3f4ccccd "ExtraBlack"
-0.800000 0xbf4ccccd "UltraLight"
-0.500000 0xbf000000 "ExtraLight"
-0.800000 0xbf4ccccd "Ultra Thin"
-0.800000 0xbf4ccccd "Extra Thin"
0.560000 0x3f0f5c29 "Heavy Face"
-0.200000 0xbe4ccccd "Semi Light"
0.500000 0x3f000000 "Extra Bold"
0.700000 0x3f333333 "Ultra Bold"
0.560000 0x3f0f5c29 "HeavyFace"
0.500000 0x3f000000 "ExtraBold"
0.700000 0x3f333333 "UltraBold"
0.800000 0x3f4ccccd "Ext Black"
-0.200000 0xbe4ccccd "SemiLight"
0.250000 0x3e800000 "Demi Bold"
0.300000 0x3e99999a "Semi Bold"
-0.500000 0xbf000000 "Ext Light"
0.500000 0x3f000000 "Ext Bold"
0.250000 0x3e800000 "DemiBold"
0.300000 0x3e99999a "SemiBold"
-0.800000 0xbf4ccccd "HairLine"
-0.800000 0xbf4ccccd "Ext Thin"
0.230000 0x3e6b851f "Medium"
0.800000 0x3f4ccccd "Poster"
-0.400000 0xbecccccd "Light"
0.500000 0x3f000000 "Ultra"
0.560000 0x3f0f5c29 "Heavy"
0.500000 0x3f000000 "Extra"
0.620000 0x3f1eb852 "Black"
0.620000 0x3f1eb852 "Super"
0.850000 0x3f59999a "Obese"
-0.400000 0xbecccccd "Lite"
-0.230000 0xbe6b851f "Book"
0.250000 0x3e800000 "Demi"
0.300000 0x3e99999a "Semi"
-0.500000 0xbf000000 "Thin"
0.400000 0x3ecccccd "Bold"
0.800000 0x3f4ccccd "Nord"
0.750000 0x3f400000 "Fat"
-0.230000 0xbe6b851f "W1"
-0.500000 0xbf000000 "W2"
-0.230000 0xbe6b851f "W3"
0.000000 0x0 "W4"
0.230000 0x3e6b851f "W5"
0.300000 0x3e99999a "W6"
0.440000 0x3ee147ae "W7"
0.540000 0x3f0a3d71 "W8"
0.620000 0x3f1eb852 "W9"
-0.800000 0xbf4ccccd 1, 10 - 100
-0.500000 0xbf000000 2, 101 - 200
-0.400000 0xbecccccd 3, 201 - 300
0.000000 0x0 4, 301 - 400
0.230000 0x3e6b851f 5, 401 - 500
0.250000 0x3e800000 6, 501 - 600
0.400000 0x3ecccccd 7, 601 - 700
0.500000 0x3f000000 8, 701 - 800
0.620000 0x3f1eb852 9, 801 - 900
0.750000 0x3f400000 901 - 950
0.800000 0x3f4ccccd 951 - 999
-0.500000 0xbf000000 panose 2
-0.400000 0xbecccccd panose 3
-0.230000 0xbe6b851f panose 5
0.230000 0x3e6b851f panose 6
0.250000 0x3e800000 panose 7
0.400000 0x3ecccccd panose 8
0.560000 0x3f0f5c29 panose 9
0.620000 0x3f1eb852 panose 10
0.800000 0x3f4ccccd panose 11
0.400000 0x3ecccccd 'head'[0x2D] & 1
-0.200000 0xbe4ccccd "EL"
0.500000 0x3f000000 "EB"
0.300000 0x3e99999a "SB"
0.800000 0x3f4ccccd "UH"
0.700000 0x3f333333 "U"
-0.400000 0xbecccccd "L"
0.560000 0x3f0f5c29 "H"
0.400000 0x3ecccccd "B"
0.230000 0x3e6b851f "M"
0.000000 0x0 "R"
0.000000 0x0 default
0.000000 0x0 "LucidaGrande"
0.000000 0x0 ".LucidaGrandeUI"
0.240000 0x3fceb851eb851eb8 "STHeiti"
-0.100000 0xbfb999999999999a "STXihei"
0.000000 0x0 "TimesNewRomanPSMT"
-0.800000 0xbf4ccccd "ultra light"
0.750000 0x3f400000 "ultra black"
-0.500000 0xbf000000 "extra light"
-0.800000 0xbf4ccccd "ultralight"
0.750000 0x3f400000 "ultrablack"
0.800000 0x3f4ccccd "extrablack"
-0.500000 0xbf000000 "extralight"
0.560000 0x3f0f5c29 "heavy face"
-0.200000 0xbe4ccccd "semi light"
0.500000 0x3f000000 "extra bold"
0.700000 0x3f333333 "ultra bold"
0.560000 0x3f0f5c29 "heavyface"
0.500000 0x3f000000 "extrabold"
0.700000 0x3f333333 "ultrabold"
-0.200000 0xbe4ccccd "semilight"
0.250000 0x3e800000 "demi bold"
0.300000 0x3e99999a "semi bold"
0.250000 0x3e800000 "demibold"
0.300000 0x3e99999a "semibold"
-0.700000 0xbf333333 "hairline"
0.230000 0x3e6b851f "medium"
0.800000 0x3f4ccccd "poster"
-0.400000 0xbecccccd "light"
0.560000 0x3f0f5c29 "heavy"
0.500000 0x3f000000 "extra"
0.620000 0x3f1eb852 "black"
0.620000 0x3f1eb852 "super"
0.850000 0x3f59999a "obese"
-0.400000 0xbecccccd "lite"
-0.230000 0xbe6b851f "book"
0.250000 0x3e800000 "demi"
0.300000 0x3e99999a "semi"
-0.500000 0xbf000000 "thin"
0.400000 0x3ecccccd "bold"
0.800000 0x3f4ccccd "nord"
0.750000 0x3f400000 "fat"
-0.700000 0xbf333333 "w1"
-0.500000 0xbf000000 "w2"
-0.230000 0xbe6b851f "w3"
0.000000 0x0 "w4"
0.230000 0x3e6b851f "w5"
0.300000 0x3e99999a "w6"
0.440000 0x3ee147ae "w7"
0.540000 0x3f0a3d71 "w8"
0.620000 0x3f1eb852 "w9"

247
_doc/export/ctweightvalues Normal file
View File

@ -0,0 +1,247 @@
registered font, preexisting metadata weight
"reg": float32as(0.000000, 0x0)
"semi": float32as(0.300000, 0x3e99999a)
"bold": float32as(0.400000, 0x3ecccccd)
"light": float32as(-0.400000, 0xbecccccd)
"med": float32as(0.230000, 0x3e6b851f)
"heavy": float32as(0.560000, 0x3f0f5c29)
"black": float32as(0.620000, 0x3f1eb852)
"thin": float32as(-0.600000, 0xbf19999a)
"ulight": float32as(-0.800000, 0xbf4ccccd)
registered font, postscript name (probably only for TrueType and OpenType) special cases, overrides the above
"LucidaGrande": float32as(0.000000, 0x0)
".LucidaGrandeUI": float32as(0.000000, 0x0)
".Keyboard": float32as(0.000000, 0x0)
"STHeiti": float32as(0.240000, 0x3e75c28f)
"STXihei": float32as(-0.100000, 0xbdcccccd)
"TimesNewRomanPSMT": float32as(0.000000, 0x0)
registered font, style glossary strings, tried in this order (possibly TrueType and OpenType only): preferred subfamily, subfamily, full name, preferred family, family; case-insensitive search, reverse search, "nonliteral" (kCFCompareNonliteral)
"Ultra Light": float32as(-0.800000, 0xbf4ccccd)
"Ultra Black": float32as(0.750000, 0x3f400000)
"Extra Light": float32as(-0.500000, 0xbf000000)
"UltraBlack": float32as(0.750000, 0x3f400000)
"ExtraBlack": float32as(0.800000, 0x3f4ccccd)
"UltraLight": float32as(-0.800000, 0xbf4ccccd)
"ExtraLight": float32as(-0.500000, 0xbf000000)
"Ultra Thin": float32as(-0.800000, 0xbf4ccccd)
"Extra Thin": float32as(-0.800000, 0xbf4ccccd)
"Heavy Face": float32as(0.560000, 0x3f0f5c29)
"Semi Light": float32as(-0.200000, 0xbe4ccccd)
"Extra Bold": float32as(0.500000, 0x3f000000)
"Ultra Bold": float32as(0.700000, 0x3f333333)
"HeavyFace": float32as(0.560000, 0x3f0f5c29)
"ExtraBold": float32as(0.500000, 0x3f000000)
"UltraBold": float32as(0.700000, 0x3f333333)
"Ext Black": float32as(0.800000, 0x3f4ccccd)
"SemiLight": float32as(-0.200000, 0xbe4ccccd)
"Demi Bold": float32as(0.250000, 0x3e800000)
"Semi Bold": float32as(0.300000, 0x3e99999a)
"Ext Light": float32as(-0.500000, 0xbf000000)
"Ext Bold": float32as(0.500000, 0x3f000000)
"DemiBold": float32as(0.250000, 0x3e800000)
"SemiBold": float32as(0.300000, 0x3e99999a)
"HairLine": float32as(-0.800000, 0xbf4ccccd)
"Ext Thin": float32as(-0.800000, 0xbf4ccccd)
"Medium": float32as(0.230000, 0x3e6b851f)
"Poster": float32as(0.800000, 0x3f4ccccd)
"Light": float32as(-0.400000, 0xbecccccd)
"Ultra": float32as(0.500000, 0x3f000000)
"Heavy": float32as(0.560000, 0x3f0f5c29)
"Extra": float32as(0.500000, 0x3f000000)
"Black": float32as(0.620000, 0x3f1eb852)
"Super": float32as(0.620000, 0x3f1eb852)
"Obese": float32as(0.850000, 0x3f59999a)
"Lite": float32as(-0.400000, 0xbecccccd)
"Book": float32as(-0.230000, 0xbe6b851f)
"Demi": float32as(0.250000, 0x3e800000)
"Semi": float32as(0.300000, 0x3e99999a)
"Thin": float32as(-0.500000, 0xbf000000)
"Bold": float32as(0.400000, 0x3ecccccd)
"Nord": float32as(0.800000, 0x3f4ccccd)
"Fat": float32as(0.750000, 0x3f400000)
"W1": float32as(-0.230000, 0xbe6b851f)
"W2": float32as(-0.500000, 0xbf000000)
"W3": float32as(-0.230000, 0xbe6b851f)
"W4": float32as(0.000000, 0x0)
"W5": float32as(0.230000, 0x3e6b851f)
"W6": float32as(0.300000, 0x3e99999a)
"W7": float32as(0.440000, 0x3ee147ae)
"W8": float32as(0.540000, 0x3f0a3d71)
"W9": float32as(0.620000, 0x3f1eb852)
registered font, OS2 weights; table length >= 78
1, 10 - 100: float32as(-0.800000, 0xbf4ccccd)
2, 101 - 200: float32as(-0.500000, 0xbf000000)
3, 201 - 300: float32as(-0.400000, 0xbecccccd)
4, 301 - 400: float32as(0.000000, 0x0)
5, 401 - 500: float32as(0.230000, 0x3e6b851f)
6, 501 - 600: float32as(0.250000, 0x3e800000)
7, 601 - 700: float32as(0.400000, 0x3ecccccd)
8, 701 - 800: float32as(0.500000, 0x3f000000)
9, 801 - 900: float32as(0.620000, 0x3f1eb852)
901 - 950: float32as(0.750000, 0x3f400000)
951 - 999: float32as(0.800000, 0x3f4ccccd)
0, 1000: panose
panose 2: float32as(-0.500000, 0xbf000000)
panose 3: float32as(-0.400000, 0xbecccccd)
panose 4: !!!! see note should be float32as(-0.300000, 0xbe99999a) but is treated as invalid instead due to returning false instead of true
panose 5: float32as(-0.230000, 0xbe6b851f)
panose 6: float32as(0.230000, 0x3e6b851f)
panose 7: float32as(0.250000, 0x3e800000)
panose 8: float32as(0.400000, 0x3ecccccd)
panose 9: float32as(0.560000, 0x3f0f5c29)
panose 10: float32as(0.620000, 0x3f1eb852)
panose 11: float32as(0.800000, 0x3f4ccccd)
registered font, head table, low bit of byte 0x2D
'head'[0x2D] & 1: float32as(0.400000, 0x3ecccccd)
registered font, abbreviated weight glossary, checks for (possibly in TrueType and OpenType only) in order: preferred subfamily, family; case-insensitive strict comparison
"EL": float32as(-0.200000, 0xbe4ccccd)
"EB": float32as(0.500000, 0x3f000000)
"SB": float32as(0.300000, 0x3e99999a)
"UH": float32as(0.800000, 0x3f4ccccd)
"U": float32as(0.700000, 0x3f333333)
"L": float32as(-0.400000, 0xbecccccd)
"H": float32as(0.560000, 0x3f0f5c29)
"B": float32as(0.400000, 0x3ecccccd)
"M": float32as(0.230000, 0x3e6b851f)
"R": float32as(0.000000, 0x0)
registered font
default: float32as(0.000000, 0x0)
// based on CoreText dylib's __Z13WeightOfClasst — WeightOfClass(unsigned short)
func CoreText_WeightOfClass(usWeightClass uint16) float64 {
if usWeightClass >= 11 {
// do nothing; we are preserving the original asm comparisons
// and yes, this one is 11, but the one above is 10
} else {
usWeightClass *= 100
}
// figure out what two floats our weight will be between
i := usWeightClass / 100
j := i + 1
if j > 10 {
j = 10
}
b := float64(i * 100)
c := float64(j * 100)
a := float64(0)
if b != c {
a = float64(usWeightClass)
a -= b
c -= b
a /= c
}
scales := []float32{
float32as(-1.000000, 0xbf800000),
float32as(-0.700000, 0xbf333333),
float32as(-0.500000, 0xbf000000),
float32as(-0.230000, 0xbe6b851f),
float32as(0.000000, 0x0),
float32as(0.200000, 0x3e4ccccd),
float32as(0.300000, 0x3e99999a),
float32as(0.400000, 0x3ecccccd),
float32as(0.600000, 0x3f19999a),
float32as(0.800000, 0x3f4ccccd),
float32as(1.000000, 0x3f800000),
}
c = float64(scale[i])
b = float64[scale[j])
return fma(a, b, c)
}
unregistered font: kCTFontPostScriptNameKey defaults
"LucidaGrande": float64as(0.000000, 0x0)
".LucidaGrandeUI": float64as(0.000000, 0x0)
"STHeiti": float64as(0.240000, 0x3fceb851eb851eb8)
"STXihei": float64as(-0.100000, 0xbfb999999999999a)
"TimesNewRomanPSMT": float64as(0.000000, 0x0)
os2table := f.Table('OS/2')
if os2table != nil {
if !hasWeight {
var usWeightClass uint16
valid := false
if os2table.Len() > 77 {
b := os2table.Bytes()
usWeightClass = uint16be(b[4:6])
if usWeightClass > 1000 {
weight = 0
hasWeight = false
} else {
valid = true
}
} else {
usWeightClass = 0
valid = true
}
if valid {
weight = CoreText_WeightOfClass(usWeightClass)
hasWeight = true
}
}
}
unregistered font, style glossary, checks against kCTFontSubFamilyNameKey, kCTFontFullNameKey, kCTFontFamilyNameKey; case-insensitive (folded by Unicode rules) strstr()
"ultra light": float32as(-0.800000, 0xbf4ccccd)
"ultra black": float32as(0.750000, 0x3f400000)
"extra light": float32as(-0.500000, 0xbf000000)
"ultralight": float32as(-0.800000, 0xbf4ccccd)
"ultrablack": float32as(0.750000, 0x3f400000)
"extrablack": float32as(0.800000, 0x3f4ccccd)
"extralight": float32as(-0.500000, 0xbf000000)
"heavy face": float32as(0.560000, 0x3f0f5c29)
"semi light": float32as(-0.200000, 0xbe4ccccd)
"extra bold": float32as(0.500000, 0x3f000000)
"ultra bold": float32as(0.700000, 0x3f333333)
"heavyface": float32as(0.560000, 0x3f0f5c29)
"extrabold": float32as(0.500000, 0x3f000000)
"ultrabold": float32as(0.700000, 0x3f333333)
"semilight": float32as(-0.200000, 0xbe4ccccd)
"demi bold": float32as(0.250000, 0x3e800000)
"semi bold": float32as(0.300000, 0x3e99999a)
"demibold": float32as(0.250000, 0x3e800000)
"semibold": float32as(0.300000, 0x3e99999a)
"hairline": float32as(-0.700000, 0xbf333333)
"medium": float32as(0.230000, 0x3e6b851f)
"poster": float32as(0.800000, 0x3f4ccccd)
"light": float32as(-0.400000, 0xbecccccd)
"heavy": float32as(0.560000, 0x3f0f5c29)
"extra": float32as(0.500000, 0x3f000000)
"black": float32as(0.620000, 0x3f1eb852)
"super": float32as(0.620000, 0x3f1eb852)
"obese": float32as(0.850000, 0x3f59999a)
"lite": float32as(-0.400000, 0xbecccccd)
"book": float32as(-0.230000, 0xbe6b851f)
"demi": float32as(0.250000, 0x3e800000)
"semi": float32as(0.300000, 0x3e99999a)
"thin": float32as(-0.500000, 0xbf000000)
"bold": float32as(0.400000, 0x3ecccccd)
"nord": float32as(0.800000, 0x3f4ccccd)
"fat": float32as(0.750000, 0x3f400000)
"w1": float32as(-0.700000, 0xbf333333)
"w2": float32as(-0.500000, 0xbf000000)
"w3": float32as(-0.230000, 0xbe6b851f)
"w4": float32as(0.000000, 0x0)
"w5": float32as(0.230000, 0x3e6b851f)
"w6": float32as(0.300000, 0x3e99999a)
"w7": float32as(0.440000, 0x3ee147ae)
"w8": float32as(0.540000, 0x3f0a3d71)
"w9": float32as(0.620000, 0x3f1eb852)
func (f *Font) ShouldEnableBoldSymbolicTrait() bool {
if f.IsRegistered() {
return f.ShouldEnableBoldSymbolicTraitFromRegistry()
}
no := f.Weight() <= float64as(0.239000, 0x3fce978d4fdf3b64)
return !no
}

160
_doc/export/ctwidths Normal file
View File

@ -0,0 +1,160 @@
xx pseudo-go
func (f *CTFont) RegistryWidth32() float32 {
metadata visual descriptors
{ "med", float32as(0.000000, 0x0) },
{ "cond", float32as(-0.200000, 0xbe4ccccd) },
{ "ext", float32as(0.200000, 0x3e4ccccd) },
style dictionary
{ "Extra Compressed", float32as(-0.700000, 0xbf333333) },
{ "Ultra Compressed", float32as(-0.700000, 0xbf333333) },
{ "Ultra Condensed", float32as(-0.700000, 0xbf333333) },
{ "Extra Condensed", float32as(-0.500000, 0xbf000000) },
{ "Extra Extended", float32as(0.400000, 0x3ecccccd) },
{ "Ext Compressed", float32as(-0.700000, 0xbf333333) },
{ "Ultra Expanded", float32as(0.800000, 0x3f4ccccd) },
{ "Ultra Extended", float32as(0.800000, 0x3f4ccccd) },
{ "Extra Expanded", float32as(0.400000, 0x3ecccccd) },
xx TODO this is weird, but correct...
{ "Semi Condensed", float32as(-0.700000, 0xbf333333) },
{ "Semi Condensed", float32as(-0.100000, 0xbdcccccd) },
xx end TODO
{ "Ext Condensed", float32as(-0.500000, 0xbf000000) },
{ "SemiCondensed", float32as(-0.100000, 0xbdcccccd) },
{ "ExtraExpanded", float32as(0.400000, 0x3ecccccd) },
{ "Semi Expanded", float32as(0.100000, 0x3dcccccd) },
{ "Semi Extended", float32as(0.100000, 0x3dcccccd) },
{ "Ext Expanded", float32as(0.400000, 0x3ecccccd) },
{ "Ext Extended", float32as(0.400000, 0x3ecccccd) },
{ "SemiExpanded", float32as(0.100000, 0x3dcccccd) },
{ "Extra Narrow", float32as(-0.500000, 0xbf000000) },
{ "ExtraNarrow", float32as(-0.500000, 0xbf000000) },
{ "Extra Wide", float32as(0.800000, 0x3f4ccccd) },
{ "Ultra Cond", float32as(-0.700000, 0xbf333333) },
{ "Compressed", float32as(-0.500000, 0xbf000000) },
{ "Extra Cond", float32as(-0.500000, 0xbf000000) },
{ "Semi Cond", float32as(-0.100000, 0xbdcccccd) },
{ "Condensed", float32as(-0.200000, 0xbe4ccccd) },
{ "ExtraWide", float32as(0.800000, 0x3f4ccccd) },
{ "Extended", float32as(0.200000, 0x3e4ccccd) },
{ "Expanded", float32as(0.200000, 0x3e4ccccd) },
{ "Ext Cond", float32as(-0.500000, 0xbf000000) },
{ "Narrow", float32as(-0.400000 , 0xbecccccd) },
{ "Compact", float32as(-0.400000, 0xbecccccd) },
{ "Cond", float32as(-0.200000, 0xbe4ccccd) },
{ "Wide", float32as(0.600000, 0x3f19999a) },
{ "Thin", float32as(-0.700000, 0xbf333333) },
get os2 table
if os2table.Len() >= 78 {
usWidthClass := uint16be(b[6:8]) - 1
xx this handles the case where the original usWidthClass == 0
if usWidthClass > 8 {
panose := b[0x23] - 2
if panose > 6 {
xx TODO
} else {
switch panose {
case 0, 1, 2:
width = float32as(0.000000, 0x0)
case 3:
width = float32as(0.200000, 0x3e4ccccd)
case 4:
width = float32as(-0.200000, 0xbe4ccccd)
case 5:
width = float32as(0.400000, 0x3ecccccd)
case 6:
width = float32as(-0.400000, 0xbecccccd)
}
}
}
switch usWidthClass {
case 0:
width = float32as(-0.700000, 0xbf333333)
case 1:
width = float32as(-0.500000, 0xbf000000)
case 2:
width = float32as(-0.200000, 0xbe4ccccd)
case 3:
width = float32as(-0.100000, 0xbdcccccd)
case 4:
width = float32as(0.000000, 0x0)
case 5:
width = float32as(0.100000, 0x3dcccccd)
case 6:
width = float32as(0.400000, 0x3ecccccd)
case 7:
width = float32as(0.600000, 0x3f19999a)
case 8:
width = float32as(0.800000, 0x3f4ccccd)
}
}
headtable := f.CopyTable('head')
if headtable != nil {
if headtable.Len() >= 54 {
x := b[0x2d]
if (x & 0x20) != 0 {
width = float32as(-0.200000, 0xbe4ccccd)
} else if (x & 0x40) != 0 {
width = float32as(0.200000, 0x3e4ccccd)
}
}
}
xx and if all else fails
return float32as(0.000000, 0x0)
}
func (f *CTFont) Width() float64 {
if f.IsRegistered() {
return f.RegistryWidth()
}
width := 0.0
hasWidth := false
if there is an OS2 table {
var usWidthClass uint16
valid := false
if it's 78 bytes or more {
usWidthClass = uint16be(table[6:8])
if usWeightClass <= 10 {
valid = true
} else {
valid = false
}
} else {
usWidthClass = 0
valid = true
}
if valid {
ten := float64as(10.000000, 0x4024000000000000)
negPointFive := float64as(-0.500000, 0xbfe0000000000000)
width = (float64(usWidthClass) div ten) + negPointFive
hasWidth = true
}
}
then there's the style glossary strings comparison:
{ "semi condensed", float32as(-0.100000, 0xbdcccccd) },
{ "extra expanded", float32as(0.400000, 0x3ecccccd) },
{ "semicondensed", float32as(-0.100000, 0xbdcccccd) },
{ "extraexpanded", float32as(0.400000, 0x3ecccccd) },
{ "semi expanded", float32as(0.100000, 0x3dcccccd) },
{ "semiexpanded", float32as(0.100000, 0x3dcccccd) },
{ "extra narrow", float32as(-0.500000, 0xbf000000) },
{ "extranarrow", float32as(-0.500000, 0xbf000000) },
{ "extra wide", float32as(0.800000, 0x3f4ccccd) },
{ "condensed", float32as(-0.200000, 0xbe4ccccd) },
{ "extrawide", float32as(0.800000, 0x3f4ccccd) },
{ "extended", float32as(0.200000, 0x3e4ccccd) },
{ "expanded", float32as(0.200000, 0x3e4ccccd) },
{ "narrow", float32as(-0.400000, 0xbecccccd) },
{ "wide", float32as(0.600000, 0x3f19999a) },
{ "thin", float32as(-0.700000, 0xbf333333) },
otherwise just return float64as(0.000000, 0x0)
}

View File

@ -0,0 +1,77 @@
-0.100000
style string contains "Semi Cond"
style string contains "Semi Condensed"; unregistered fonts only (see below)
style string contains "SemiCondensed"
OS2 width 4
-0.200000
('head' table byte 0x2d) & 0x20 != 0
ATSD style "cond"
panose 6
style string contains "Cond"
style string contains "Condensed"
OS2 width 3
-0.400000
panose 8
style string contains "Compact"
style string contains "Narrow"
-0.500000
style string contains "Compressed"
style string contains "Ext Cond"
style string contains "Ext Condensed"
style string contains "Extra Cond"
style string contains "Extra Condensed"
style string contains "Extra Narrow"
style string contains "ExtraNarrow"
OS2 width 2
-0.700000
style string contains "Ext Compressed"
style string contains "Extra Compressed"
style string contains "Semi Condensed" (this is probably a typo, since another "Semi Condensed" with a value of -0.1 follows this in the table it comes from); registered fonts only
style string contains "Thin"
style string contains "Ultra Compressed"
style string contains "Ultra Cond"
style string contains "Ultra Condensed"
OS2 width 1
0.000000
default
ATSD style "med"
panose 2, 3, 4
OS2 width 5
0.100000
style string contains "Semi Expanded"
style string contains "Semi Extended"
style string contains "SemiExpanded"
OS2 width 6
0.200000
('head' table byte 0x2d) & 0x40 != 0
ATSD style "ext"
panose 5
style string contains "Expanded"
style string contains "Extended"
0.400000
panose 7
style string contains "Ext Expanded"
style string contains "Ext Extended"
style string contains "Extra Expanded"
style string contains "Extra Extended"
style string contains "ExtraExpanded"
OS2 width 7
0.600000
style string contains "Wide"
OS2 width 8
0.800000
style string contains "Extra Wide"
style string contains "ExtraWide"
style string contains "Ultra Expanded"
style string contains "Ultra Extended"
OS2 width 9

View File

@ -0,0 +1,73 @@
-0.100000 0xbdcccccd registered "Semi Cond"
-0.100000 0xbdcccccd registered "Semi Condensed"
-0.100000 0xbdcccccd registered "SemiCondensed"
-0.100000 0xbdcccccd registered OS2 4
-0.100000 0xbdcccccd unregistered "semi condensed"
-0.100000 0xbdcccccd unregistered "semicondensed"
-0.200000 0xbe4ccccd head[0x2d] & 0x20
-0.200000 0xbe4ccccd metadata "cond"
-0.200000 0xbe4ccccd panose 6
-0.200000 0xbe4ccccd registered "Cond"
-0.200000 0xbe4ccccd registered "Condensed"
-0.200000 0xbe4ccccd registered OS2 3
-0.200000 0xbe4ccccd unregistered "condensed"
-0.400000 0xbecccccd panose 8
-0.400000 0xbecccccd registered "Compact"
-0.400000 0xbecccccd registered "Narrow"
-0.400000 0xbecccccd unregistered "narrow"
-0.500000 0xbf000000 registered "Compressed"
-0.500000 0xbf000000 registered "Ext Cond"
-0.500000 0xbf000000 registered "Ext Condensed"
-0.500000 0xbf000000 registered "Extra Cond"
-0.500000 0xbf000000 registered "Extra Condensed"
-0.500000 0xbf000000 registered "Extra Narrow"
-0.500000 0xbf000000 registered "ExtraNarrow"
-0.500000 0xbf000000 registered OS2 2
-0.500000 0xbf000000 unregistered "extra narrow"
-0.500000 0xbf000000 unregistered "extranarrow"
-0.700000 0xbf333333 registered "Ext Compressed"
-0.700000 0xbf333333 registered "Extra Compressed"
-0.700000 0xbf333333 registered "Semi Condensed"
-0.700000 0xbf333333 registered "Thin"
-0.700000 0xbf333333 registered "Ultra Compressed"
-0.700000 0xbf333333 registered "Ultra Cond"
-0.700000 0xbf333333 registered "Ultra Condensed"
-0.700000 0xbf333333 registered OS2 1
-0.700000 0xbf333333 unregistered "thin"
0.000000 0x0 default
0.000000 0x0 metadata "med"
0.000000 0x0 panose 2, 3, 4
0.000000 0x0 registered OS2 5
0.000000 0x0 registered default
0.100000 0x3dcccccd registered "Semi Expanded"
0.100000 0x3dcccccd registered "Semi Extended"
0.100000 0x3dcccccd registered "SemiExpanded"
0.100000 0x3dcccccd registered OS2 6
0.100000 0x3dcccccd unregistered "semi expanded"
0.100000 0x3dcccccd unregistered "semiexpanded"
0.200000 0x3e4ccccd head[0x2d] & 0x40
0.200000 0x3e4ccccd metadata "ext"
0.200000 0x3e4ccccd panose 5
0.200000 0x3e4ccccd registered "Expanded"
0.200000 0x3e4ccccd registered "Extended"
0.200000 0x3e4ccccd unregistered "expanded"
0.200000 0x3e4ccccd unregistered "extended"
0.400000 0x3ecccccd panose 7
0.400000 0x3ecccccd registered "Ext Expanded"
0.400000 0x3ecccccd registered "Ext Extended"
0.400000 0x3ecccccd registered "Extra Expanded"
0.400000 0x3ecccccd registered "Extra Extended"
0.400000 0x3ecccccd registered "ExtraExpanded"
0.400000 0x3ecccccd registered OS2 7
0.400000 0x3ecccccd unregistered "extra expanded"
0.400000 0x3ecccccd unregistered "extraexpanded"
0.600000 0x3f19999a registered "Wide"
0.600000 0x3f19999a registered OS2 8
0.600000 0x3f19999a unregistered "wide"
0.800000 0x3f4ccccd registered "Extra Wide"
0.800000 0x3f4ccccd registered "ExtraWide"
0.800000 0x3f4ccccd registered "Ultra Expanded"
0.800000 0x3f4ccccd registered "Ultra Extended"
0.800000 0x3f4ccccd registered OS2 9
0.800000 0x3f4ccccd unregistered "extra wide"
0.800000 0x3f4ccccd unregistered "extrawide"

112
_doc/export/ctwidthvalues Normal file
View File

@ -0,0 +1,112 @@
metadata "med": float32as(0.000000, 0x0)
metadata "cond": float32as(-0.200000, 0xbe4ccccd)
metadata "ext": float32as(0.200000, 0x3e4ccccd)
registered "Extra Compressed": float32as(-0.700000, 0xbf333333)
registered "Ultra Compressed": float32as(-0.700000, 0xbf333333)
registered "Ultra Condensed": float32as(-0.700000, 0xbf333333)
registered "Extra Condensed": float32as(-0.500000, 0xbf000000)
registered "Extra Extended": float32as(0.400000, 0x3ecccccd)
registered "Ext Compressed": float32as(-0.700000, 0xbf333333)
registered "Ultra Expanded": float32as(0.800000, 0x3f4ccccd)
registered "Ultra Extended": float32as(0.800000, 0x3f4ccccd)
registered "Extra Expanded": float32as(0.400000, 0x3ecccccd)
registered "Semi Condensed": float32as(-0.700000, 0xbf333333)
registered "Semi Condensed": float32as(-0.100000, 0xbdcccccd)
registered "Ext Condensed": float32as(-0.500000, 0xbf000000)
registered "SemiCondensed": float32as(-0.100000, 0xbdcccccd)
registered "ExtraExpanded": float32as(0.400000, 0x3ecccccd)
registered "Semi Expanded": float32as(0.100000, 0x3dcccccd)
registered "Semi Extended": float32as(0.100000, 0x3dcccccd)
registered "Ext Expanded": float32as(0.400000, 0x3ecccccd)
registered "Ext Extended": float32as(0.400000, 0x3ecccccd)
registered "SemiExpanded": float32as(0.100000, 0x3dcccccd)
registered "Extra Narrow": float32as(-0.500000, 0xbf000000)
registered "ExtraNarrow": float32as(-0.500000, 0xbf000000)
registered "Extra Wide": float32as(0.800000, 0x3f4ccccd)
registered "Ultra Cond": float32as(-0.700000, 0xbf333333)
registered "Compressed": float32as(-0.500000, 0xbf000000)
registered "Extra Cond": float32as(-0.500000, 0xbf000000)
registered "Semi Cond": float32as(-0.100000, 0xbdcccccd)
registered "Condensed": float32as(-0.200000, 0xbe4ccccd)
registered "ExtraWide": float32as(0.800000, 0x3f4ccccd)
registered "Extended": float32as(0.200000, 0x3e4ccccd)
registered "Expanded": float32as(0.200000, 0x3e4ccccd)
registered "Ext Cond": float32as(-0.500000, 0xbf000000)
registered "Narrow": float32as(-0.400000 , 0xbecccccd)
registered "Compact": float32as(-0.400000, 0xbecccccd)
registered "Cond": float32as(-0.200000, 0xbe4ccccd)
registered "Wide": float32as(0.600000, 0x3f19999a)
registered "Thin": float32as(-0.700000, 0xbf333333)
panose 2, 3, 4: float32as(0.000000, 0x0)
panose 5: float32as(0.200000, 0x3e4ccccd)
panose 6: float32as(-0.200000, 0xbe4ccccd)
panose 7: float32as(0.400000, 0x3ecccccd)
panose 8: float32as(-0.400000, 0xbecccccd)
registered OS2 1: float32as(-0.700000, 0xbf333333)
registered OS2 2: float32as(-0.500000, 0xbf000000)
registered OS2 3: float32as(-0.200000, 0xbe4ccccd)
registered OS2 4: float32as(-0.100000, 0xbdcccccd)
registered OS2 5: float32as(0.000000, 0x0)
registered OS2 6: float32as(0.100000, 0x3dcccccd)
registered OS2 7: float32as(0.400000, 0x3ecccccd)
registered OS2 8: float32as(0.600000, 0x3f19999a)
registered OS2 9: float32as(0.800000, 0x3f4ccccd)
head[0x2d] & 0x20: float32as(-0.200000, 0xbe4ccccd)
head[0x2d] & 0x40: float32as(0.200000, 0x3e4ccccd)
registered default: float32as(0.000000, 0x0)
func (f *CTFont) Width() float64 {
if f.IsRegistered() {
return f.RegistryWidth()
}
width := 0.0
hasWidth := false
if there is an OS2 table {
var usWidthClass uint16
valid := false
if it's 78 bytes or more {
usWidthClass = uint16be(table[6:8])
if usWeightClass <= 10 {
valid = true
} else {
valid = false
}
} else {
usWidthClass = 0
valid = true
}
if valid {
ten := float64as(10.000000, 0x4024000000000000)
negPointFive := float64as(-0.500000, 0xbfe0000000000000)
width = (float64(usWidthClass) div ten) + negPointFive
hasWidth = true
}
}
then there's the style glossary strings comparison:
unregistered "semi condensed": float32as(-0.100000, 0xbdcccccd)
unregistered "extra expanded": float32as(0.400000, 0x3ecccccd)
unregistered "semicondensed": float32as(-0.100000, 0xbdcccccd)
unregistered "extraexpanded": float32as(0.400000, 0x3ecccccd)
unregistered "semi expanded": float32as(0.100000, 0x3dcccccd)
unregistered "semiexpanded": float32as(0.100000, 0x3dcccccd)
unregistered "extra narrow": float32as(-0.500000, 0xbf000000)
unregistered "extranarrow": float32as(-0.500000, 0xbf000000)
unregistered "extra wide": float32as(0.800000, 0x3f4ccccd)
unregistered "condensed": float32as(-0.200000, 0xbe4ccccd)
unregistered "extrawide": float32as(0.800000, 0x3f4ccccd)
unregistered "extended": float32as(0.200000, 0x3e4ccccd)
unregistered "expanded": float32as(0.200000, 0x3e4ccccd)
unregistered "narrow": float32as(-0.400000, 0xbecccccd)
unregistered "wide": float32as(0.600000, 0x3f19999a)
unregistered "thin": float32as(-0.700000, 0xbf333333)
default: float64as(0.000000, 0x0)

73
_doc/export/fvar.swift Normal file
View File

@ -0,0 +1,73 @@
// 2 november 2017
import Cocoa
import CoreText
func fourccString(_ k: FourCharCode) -> String {
var c: [UInt8] = [0, 0, 0, 0]
c[0] = UInt8((k >> 24) & 0xFF)
c[1] = UInt8((k >> 16) & 0xFF)
c[2] = UInt8((k >> 8) & 0xFF)
c[3] = UInt8(k & 0xFF)
return String(bytes: c, encoding: .utf8)!
}
var weightMin: Double = 0
var weightMax: Double = 0
var weightDef: Double = 0
var weightVals: [String: Double] = [:]
let attrs: [String: String] = [
kCTFontFamilyNameAttribute as String: "Skia",
]
let bd = CTFontDescriptorCreateWithAttributes(attrs as CFDictionary)
let matches = CTFontDescriptorCreateMatchingFontDescriptors(bd, nil) as! [CTFontDescriptor]
let mfont = CTFontCreateWithFontDescriptor(matches[0], 0.0, nil)
let master = CTFontCopyVariationAxes(mfont) as! [NSDictionary]
master.forEach { d in
print("axis {")
d.forEach { k, v in
if (k as! String) == (kCTFontVariationAxisIdentifierKey as String) {
let c = v as! FourCharCode
print("\t\(k) \(fourccString(c))")
} else {
print("\t\(k) \(v)")
}
}
print("}")
if (d[kCTFontVariationAxisNameKey] as! String) == "Weight" {
weightMin = d[kCTFontVariationAxisMinimumValueKey] as! Double
weightMax = d[kCTFontVariationAxisMaximumValueKey] as! Double
weightDef = d[kCTFontVariationAxisDefaultValueKey] as! Double
}
}
print("")
matches.forEach { d in
let f = CTFontDescriptorCopyAttribute(d, kCTFontVariationAttribute) as! [FourCharCode: Double]
let n = CTFontDescriptorCopyAttribute(d, kCTFontStyleNameAttribute) as! String
print("\(n) {")
f.forEach { k, v in
print("\t\(fourccString(k)) \(v)")
}
print("}")
weightVals[n] = weightDef
if let v = f[2003265652] {
weightVals[n] = v
}
}
print("")
weightVals.forEach { k, v in
let basicScaled = (v - weightMin) / (weightMax - weightMin)
print("\(k) basic scaled = \(basicScaled) (OS2 \(UInt16(basicScaled * 1000)))")
// https://www.microsoft.com/typography/otspec/otvaroverview.htm#CSN
var opentypeScaled: Double = 0
if v < weightDef {
opentypeScaled = -((weightDef - v) / (weightDef - weightMin))
} else if v > weightDef {
opentypeScaled = (v - weightDef) / (weightMax - weightDef)
}
print("\(k) opentype scaled = \(opentypeScaled)")
}
print("")
print("\(String(describing: CTFontDescriptorCreateMatchingFontDescriptors(CTFontDescriptorCreateCopyWithVariation(matches[0], FourCharCode(2003265652) as CFNumber, CGFloat(weightMax)), Set([kCTFontVariationAttribute as String]) as CFSet)))")
print("")
print("\(CTFontCopyTable(mfont, CTFontTableTag(kCTFontTableAvar), []) != nil)")

View File

@ -0,0 +1,58 @@
// 2 november 2017
package main
import (
"fmt"
)
type fixed1616 uint32
type fixed214 uint16
func fixed1616To214(f fixed1616) fixed214 {
f += 0x00000002
g := int32(f) >> 2
return fixed214(uint32(g) & 0xFFFF)
}
func (f fixed1616) In214Range() bool {
base := int16((f >> 16) & 0xFFFF)
return base >= -2 && base < 2
}
func (f fixed1616) String() string {
base := int16((f >> 16) & 0xFFFF)
frac := float64(f & 0xFFFF) / 65536
res := float64(base) + frac
return fmt.Sprintf("%f 0x%08X", res, uint32(f))
}
func (f fixed214) String() string {
base := []int16{
0,
1,
-2,
-1,
}[(f & 0xC000) >> 14]
frac := float64(f & 0x3FFF) / 16384
res := float64(base) + frac
return fmt.Sprintf("%f 0x%04X", res, uint16(f))
}
func main() {
fmt.Println(fixed214(0x7fff))
fmt.Println(fixed214(0x8000))
fmt.Println(fixed214(0x4000))
fmt.Println(fixed214(0xc000))
fmt.Println(fixed214(0x7000))
fmt.Println(fixed214(0x0000))
fmt.Println(fixed214(0x0001))
fmt.Println(fixed214(0xffff))
fmt.Println()
for i := uint64(0x00000000); i <= 0xFFFFFFFF; i++ {
j := fixed1616(i)
if !j.In214Range() { continue }
fmt.Println(j, "->", fixed1616To214(j))
}
}

View File

@ -0,0 +1,8 @@
# 21 october 2017
gawk '
BEGIN { FS = "\t+" }
!/float..as/ { next }
{ i = 0; if ($1 == "") i++ }
(NF-i) != 2 { next }
{ print }
' "$@"

View File

@ -0,0 +1,10 @@
# 21 october 2017
gawk '
{
gsub(/float..as\(/, "")
gsub(/,/, "", $(NF - 1))
gsub(/\)$/, "")
split($0, parts, /:/)
print $(NF - 1) "\t" $NF "\t" parts[1]
}
' "$@"

View File

@ -0,0 +1,3 @@
# 21 october 2017
sort -t$'\t' -k1,1 -k2,2 "$@" |
column -t -s$'\t'

View File

@ -0,0 +1,3 @@
// 22 october 2017
extern int realMain(void);
int main(void) { return realMain(); }

View File

@ -0,0 +1,11 @@
unregistered OS2 0: float64as(-0.5, 0xbfe0000000000000)
unregistered OS2 1: float64as(-0.4, 0xbfd999999999999a)
unregistered OS2 2: float64as(-0.3, 0xbfd3333333333333)
unregistered OS2 3: float64as(-0.2, 0xbfc999999999999a)
unregistered OS2 4: float64as(-0.1, 0xbfb9999999999998)
unregistered OS2 5: float64as(0, 0x0000000000000000)
unregistered OS2 6: float64as(0.1, 0x3fb9999999999998)
unregistered OS2 7: float64as(0.2, 0x3fc9999999999998)
unregistered OS2 8: float64as(0.3, 0x3fd3333333333334)
unregistered OS2 9: float64as(0.4, 0x3fd999999999999a)
unregistered OS2 10: float64as(0.5, 0x3fe0000000000000)

View File

@ -0,0 +1,11 @@
-0.1 0xbfb9999999999998 unregistered OS2 4
-0.2 0xbfc999999999999a unregistered OS2 3
-0.3 0xbfd3333333333333 unregistered OS2 2
-0.4 0xbfd999999999999a unregistered OS2 1
-0.5 0xbfe0000000000000 unregistered OS2 0
0 0x0000000000000000 unregistered OS2 5
0.1 0x3fb9999999999998 unregistered OS2 6
0.2 0x3fc9999999999998 unregistered OS2 7
0.3 0x3fd3333333333334 unregistered OS2 8
0.4 0x3fd999999999999a unregistered OS2 9
0.5 0x3fe0000000000000 unregistered OS2 10

51
_doc/export/writewidths.s Normal file
View File

@ -0,0 +1,51 @@
# 22 october 2017
# clang -o writewidths writewidths.c writewidths.s -g -Wall -Wextra -pedantic -g
# thanks to:
# - http://www.idryman.org/blog/2014/12/02/writing-64-bit-assembly-on-mac-os-x/
# - https://developer.apple.com/library/content/documentation/DeveloperTools/Reference/Assembler/060-i386_Addressing_Modes_and_Assembler_Instructions/i386_intructions.html#//apple_ref/doc/uid/TP30000825-TPXREF101
# - https://stackoverflow.com/questions/46309041/trivial-macos-assembly-64-bit-program-has-incorrect-stack-alignment
# - https://www.google.com/search?q=macos+implement+main+in+assembly+-nasm&oq=macos+implement+main+in+assembly+-nasm&gs_l=psy-ab.3...12877.13839.0.13988.6.6.0.0.0.0.117.407.4j1.5.0....0...1.1.64.psy-ab..1.0.0....0.et6MkokjvwA
# - https://stackoverflow.com/questions/2529185/what-are-cfi-directives-in-gnu-assembler-gas-used-for
.section __DATA,__data
double10:
.quad 0x4024000000000000
doubleNeg05:
.quad 0xbfe0000000000000
fmt:
.asciz "unregistered OS2 %ld:\tfloat64as(%g, 0x%016lx)\n"
.section __TEXT,__text
.globl _realMain
_realMain:
pushq %rbp
movq %rsp, %rbp
addq $8, %rsp
xorq %rcx, %rcx
loop:
pushq %rcx
# the code from core text
movzwl %cx, %ecx
xorps %xmm0, %xmm0
cvtsi2sdl %ecx, %xmm0
divsd double10(%rip), %xmm0
addsd doubleNeg05(%rip), %xmm0
# end core text code
popq %rcx
pushq %rcx
movd %xmm0, %rdx
movzwq %cx, %rsi
leaq fmt(%rip), %rdi
callq _printf
popq %rcx
incw %cx
cmpw $10, %cx
jbe loop
xorq %rax, %rax
subq $8, %rsp
popq %rbp
ret

1
_doc/form Normal file
View File

@ -0,0 +1 @@
hiding a control also hides its label

1
_doc/main Normal file
View File

@ -0,0 +1 @@
after uiQuit or if uiShouldQuit returns nonzero, uiQueueMain's effect is undefined

1
_doc/mainsteps Normal file
View File

@ -0,0 +1 @@
the function passed to mainsteps must not return until uiQuit itself has been called; otherwise the results are undefined

View File

@ -0,0 +1,136 @@
// 25 june 2018
#include <gtk/gtk.h>
GtkWidget *mainwin;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *startProgress;
GtkWidget *startTable;
GtkWidget *progressbar;
GtkWidget *scrolledWindow;
GtkListStore *model;
GtkWidget *treeview;
GtkWidget *hbox2;
static gboolean pulseProgress(gpointer data)
{
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressbar));
return TRUE;
}
static void onStartProgressClicked(GtkButton *button, gpointer data)
{
gtk_widget_set_sensitive(startProgress, FALSE);
g_timeout_add(100, pulseProgress, NULL);
}
gboolean pbarStarted = FALSE;
gint pbarValue;
static void pbarDataFunc(GtkTreeViewColumn *col, GtkCellRenderer *r, GtkTreeModel *m, GtkTreeIter *iter, gpointer data)
{
if (!pbarStarted) {
g_object_set(r,
"pulse", -1,
"value", 0,
NULL);
return;
}
pbarValue++;
if (pbarValue == G_MAXINT)
pbarValue = 1;
g_object_set(r, "pulse", pbarValue, NULL);
}
static gboolean pulseTable(gpointer data)
{
GtkTreePath *path;
GtkTreeIter iter;
path = gtk_tree_path_new_from_indices(0, -1);
gtk_tree_model_get_iter(GTK_TREE_MODEL(model), &iter, path);
gtk_tree_model_row_changed(GTK_TREE_MODEL(model), path, &iter);
gtk_tree_path_free(path);
return TRUE;
}
static void onStartTableClicked(GtkButton *button, gpointer data)
{
pbarStarted = TRUE;
pbarValue = 0;
gtk_widget_set_sensitive(startTable, FALSE);
g_timeout_add(100, pulseTable, NULL);
}
static gboolean onClosing(GtkWidget *win, GdkEvent *e, gpointer data)
{
gtk_main_quit();
return FALSE;
}
int main(void)
{
GtkTreeIter iter;
GtkTreeViewColumn *col;
GtkCellRenderer *r;
gtk_init(NULL, NULL);
mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(mainwin, "delete-event", G_CALLBACK(onClosing), NULL);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 12);
gtk_container_set_border_width(GTK_CONTAINER(vbox), 12);
gtk_container_add(GTK_CONTAINER(mainwin), vbox);
hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_halign(hbox, GTK_ALIGN_CENTER);
gtk_container_add(GTK_CONTAINER(vbox), hbox);
startProgress = gtk_button_new_with_label("Start Progress Bar");
g_signal_connect(startProgress, "clicked", G_CALLBACK(onStartProgressClicked), NULL);
gtk_container_add(GTK_CONTAINER(hbox), startProgress);
startTable = gtk_button_new_with_label("Start Table Cell Renderer");
g_signal_connect(startTable, "clicked", G_CALLBACK(onStartTableClicked), NULL);
gtk_container_add(GTK_CONTAINER(hbox), startTable);
progressbar = gtk_progress_bar_new();
gtk_container_add(GTK_CONTAINER(vbox), progressbar);
scrolledWindow = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledWindow), GTK_SHADOW_IN);
gtk_widget_set_vexpand(scrolledWindow, TRUE);
gtk_container_add(GTK_CONTAINER(vbox), scrolledWindow);
model = gtk_list_store_new(1, G_TYPE_INT);
gtk_list_store_append(model, &iter);
gtk_list_store_set(model, &iter,
0, 0,
-1);
treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
gtk_container_add(GTK_CONTAINER(scrolledWindow), treeview);
col = gtk_tree_view_column_new();
gtk_tree_view_column_set_resizable(col, TRUE);
gtk_tree_view_column_set_title(col, "Column");
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), col);
r = gtk_cell_renderer_progress_new();
gtk_tree_view_column_pack_start(col, r, TRUE);
gtk_tree_view_column_set_cell_data_func(col, r, pbarDataFunc, NULL, NULL);
hbox2 = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_halign(hbox2, GTK_ALIGN_CENTER);
gtk_container_add(GTK_CONTAINER(vbox), hbox2);
gtk_container_add(GTK_CONTAINER(hbox2), gtk_button_new_with_label("These buttons"));
gtk_container_add(GTK_CONTAINER(hbox2), gtk_button_new_with_label("do nothing"));
gtk_container_add(GTK_CONTAINER(hbox2), gtk_button_new_with_label("when clicked"));
gtk_widget_show_all(mainwin);
gtk_main();
return 0;
}

View File

@ -0,0 +1,907 @@
// 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;
}

View File

@ -0,0 +1,676 @@
// 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;
}

41
_doc/names.md Normal file
View File

@ -0,0 +1,41 @@
TODO clean this up
TODO note that you -fvisibility=hidden means nothing in static libraries, hence this (confirmed on OS X)
In general, all names that begin with "ui" and are followed by a capital letter and all names htat begin with "uipriv" and are followed by a capita lletter are reserved by libui. This applies even in C++, where name mangling may affect the actual names in the object file.
# Reserved names; for users
All reserved names in libui are defined by a prefix followed by any uppercase letter in ASCII. The bullet lists before list those prefixes.
Global-scope identifiers of any form (variables, constant names, functions, structure names, union names, C++ class names, enum type names, enum value names, C++ namespace names, GObject class and interface struct names, and Objective-C class and protocol name identifiers) and macro names:
- `ui`
- `uipriv`
GObject and Objective-C class, interface, and protocol name strings, in the form they take in their respective runtime memory (e.g. when passed to `g_type_from_name()` and `NSClassFromString()`, respectively):
- `uipriv`
Objective-C method names:
- `initWithUipriv`
- `initWithFrame:uipriv` (TODO probably worth removing)
- `uipriv`
- `isUipriv` (for compatibility with KVO and `@property` statements)
- `setUipriv` (for compatibility with KVO and `@property` statements)
Objective-C ivar names:
- `uipriv`
- `_uipriv` (for compatibility with KVO and `@property` statements)
Objective-C property names:
- `uipriv`
TODO GObject macros (in libui's source code), properties, and signals
# Developer notes
TODO

1
_doc/slider Normal file
View File

@ -0,0 +1 @@
if min >= max then they are swapped

1
_doc/spinbox Normal file
View File

@ -0,0 +1 @@
if min >= max then they are swapped

2
_doc/static Normal file
View File

@ -0,0 +1,2 @@
comctl6
libui.res

3
_doc/windowmovesize Normal file
View File

@ -0,0 +1,3 @@
you should never need to use these functions
they are provided only for the cases when ABSOLUTELY NECESSARY
the operating system may ignore your requests, for instance, if you are giving it invalid numbers or a size too small to fit; this is all system-defined

1
_doc/winstatic Normal file
View File

@ -0,0 +1 @@
libui uses resources starting at 29000

View File

@ -0,0 +1,190 @@
_UI_ENUM(uiAttribute) {
uiAttributeFamily,
uiAttributeSize, // use Double
uiAttributeWeight,
uiAttributeItalic,
uiAttributeStretch,
uiAttributeColor, // use R, G, B, A
uiAttributeBackground, // use R, G, B, A
// TODO kerning amount
// OS X: kCTKernAttributeName
// > 0: farther (TODO from advance or standard kerning?)
// == 0: no kerning
// < 0: closer (TODO same)
// undefined: standard kerning
// Pango: pango_attr_letter_spacing_new()
// parameter meaning unspecified
// Windows: requires Platform Update, SetLetterSpacing()
// parameter meaning unspecified
uiAttributeUnderline, // enum uiDrawUnderlineStyle
// TODO what is the color in the case we don't specify it, black or the text color?
uiAttributeUnderlineColor, // enum uiDrawUnderlineColor
// TODO kCTSuperscriptAttributeName vs below
// all it does is set the below attribute so
// TODO kCTBaselineClassAttributeName, kCTBaselineInfoAttributeName, kCTBaselineReferenceInfoAttributeName
// TODO strikethroughs? (pango yes, directwrite yes, os x no)
// TODO baseline offsets? (pango yes)
// TODO size scales? (pango yes)
// TODO fallbacks (pango: enable or disable)
// TODO document that this will also enable language-specific font features (TODO on DirectWrite too?)
// TODO document that this should be strict BCP 47 form (A-Z, a-z, 0-9, and -) for maximum compatibility
uiAttributeLanguage, // BCP 47 string
// These attributes represent typographic features. Each feature
// is a separate attribute, to make composition easier. The
// availability of for each attribute are defined by the font; the
// default values are defined by the font and/or by the OS.
//
// A note about features whose parameter is an enumeration:
// OS X defines typographic features using the AAT specification
// and converts to OpenType internally when needed, whereas
// other platforms use OpenType directly. OpenType is less
// precise about what each enumeration value means than AAT
// is, so enumeration values do not necessarily represent what
// OS X expects with all fonts. In cases where they do, libui
// provides an enumeration type to use. Otherwise, the AAT
// enumeration values are provided in comments for
// documentation purposes.
// TODO kAllTypographicFeaturesType
// AAT calls these "common ligatures"
uiAttributeStandardLigatures, // 0 = off, 1 = on
uiAttributeRequiredLigatures, // 0 = off, 1 = on
// AAT calls these "rare ligatures"
uiAttributeDiscretionaryLigatures, // 0 = off, 1 = on
uiAttributeContextualLigatures, // 0 = off, 1 = on
uiAttributeHistoricalLigatures, // 0 = off, 1 = on
// TODO uiAttributeCursiveConnection, // 0 = none, 1 = some, 2 = all
uiAttributeUnicase, // 0 = off, 1 = on
// TODO uiAttributeLinguisticRearrangement, // 0 = off, 1 = on
// TODO rename this
uiAttributeNumberSpacings, // enum uiAttributeNumberSpacing
// TODO kSmartSwashType, falt and jalt
// TODO kDiacriticsType
uiAttributeSuperscripts, // enum uiAttributeSuperscript
uiAttributeFractionForms, // enum uiAttributeFractionForm
uiAttributeSlashedZero, // 0 = off, 1 = on
uiAttributeMathematicalGreek, // 0 = off, 1 = on
// AAT defines the following values:
// 0 = none
// 1 = dingbats
// 2 = pi characters
// 3 = fleurons
// 4 = decorative borders
// 5 = international symbols
// 6 = mathematical symbols
// OpenType says alphanumeric characters must(? TODO) have one form each and the bullet character U+2022 (•) can have many
uiAttributeOrnamentalForms, // an integer from 0 to a font-specified upper bound
// TODO provide a function to get the upper bound?
// AAT calls this "character alternatives" and defines the
// following values:
// 0 = none
// OpenType calls this "access all alternates".
// TODO doesn't OpenType do the same about 0?
uiAttributeSpecificCharacterForm, // an integer from 0 to a font-specified upper bound
// TODO provide a function to get the upper bound?
uiAttributeTitlingCapitalForms, // 0 = off, 1 = on
// AAT calls these "character shapes"
uiAttributeHanCharacterForms, // enum uiAttributeHanCharacterForm
// OpenType calls these "old-style"
uiAttributeLowercaseNumbers, // 0 = off, 1 = on
// TODO kTextSpacingType
// see kKanaSpacingType below
uiAttributeHanjaToHangul, // 0 = off, 1 = on
// AAT defines the following values:
// 0 = none
// 1 = box
// 2 = rounded box
// 3 = circle
// 4 = inverted circle
// 5 = parentheses
// 6 = period
// 7 = roman numeral
// 8 = diamond
// 9 = inverted box
// 10 = inverted rounded box
// TODO rename to AnnotatedForms?
uiAttributeAnnotatedGlyphForms, // an integer from 0 to a font-specified upper bound
// TODO provide a function to get the upper bound?
// TODO kKanaSpacingType
// TODO kIdeographicSpacingType
// can they be provided independently of kTextSpacingType? Core Text doesn't seem to
// TODO kUnicodeDecompositionType
uiAttributeRubyKanaForms, // 0 = off, 1 = on
// TODO kCJKVerticalRomanPlacementType
// this is 'valt' in OpenType but I don't know if I want to make it selectable or not
uiAttributeCJKRomansToItalics, // 0 = off, 1 = on
// AAT calls this "case-sensitive layout"
uiAttributeCaseSensitiveForms, // 0 = off, 1 = on
// AAT: this is called "case-sensitive spacing"
uiAttributeCapitalSpacing, // 0 = off, 1 = on
uiAttributeAlternateHorizontalKana, // 0 = off, 1 = on
uiAttributeAlternateVerticalKana, // 0 = off, 1 = on
// TODO "Alternate"? unify all this
// TODO document that these are guaranteed to be consecutive
uiAttributeStylisticAlternate1, // 0 = off, 1 = on
uiAttributeStylisticAlternate2, // 0 = off, 1 = on
uiAttributeStylisticAlternate3, // 0 = off, 1 = on
uiAttributeStylisticAlternate4, // 0 = off, 1 = on
uiAttributeStylisticAlternate5, // 0 = off, 1 = on
uiAttributeStylisticAlternate6, // 0 = off, 1 = on
uiAttributeStylisticAlternate7, // 0 = off, 1 = on
uiAttributeStylisticAlternate8, // 0 = off, 1 = on
uiAttributeStylisticAlternate9, // 0 = off, 1 = on
uiAttributeStylisticAlternate10, // 0 = off, 1 = on
uiAttributeStylisticAlternate11, // 0 = off, 1 = on
uiAttributeStylisticAlternate12, // 0 = off, 1 = on
uiAttributeStylisticAlternate13, // 0 = off, 1 = on
uiAttributeStylisticAlternate14, // 0 = off, 1 = on
uiAttributeStylisticAlternate15, // 0 = off, 1 = on
uiAttributeStylisticAlternate16, // 0 = off, 1 = on
uiAttributeStylisticAlternate17, // 0 = off, 1 = on
uiAttributeStylisticAlternate18, // 0 = off, 1 = on
uiAttributeStylisticAlternate19, // 0 = off, 1 = on
uiAttributeStylisticAlternate20, // 0 = off, 1 = on
uiAttributeContextualAlternates, // 0 = off, 1 = on
uiAttributeSwashes, // 0 = off, 1 = on
uiAttributeContextualSwashes, // 0 = off, 1 = on
uiAttributeLowercaseCapForms, // enum uiAttributeCapForm
uiAttributeUppercaseCapForms, // enum uiAttributeCapForm
// TODO kCJKRomanSpacingType
// TODO uiAttributeSystem, (this might not be doable with DirectWrite)
// TODO uiAttributeCustom,
};

View File

@ -0,0 +1 @@
Removed because proper support on OS X doesn't come until 10.9 unless we use a font with an ltag table; none of the fonts I have come with ltag tables (none of the fonts on OS X do, or at least don't come with a sr entry in their ltag table, and OpenType has replaced ltag with what appears to be custom sub-tables of the GPOS and GSUB tables.)

View File

@ -0,0 +1,19 @@
struct fontParams {
uiDrawFontDescriptor desc;
uint16_t featureTypes[maxFeatures];
uint16_t featureSelectors[maxFeatures];
size_t nFeatures;
const char *language;
};
// locale identifiers are specified as BCP 47: https://developer.apple.com/reference/corefoundation/cflocale?language=objc
case uiAttributeLanguage:
// LONGTERM FUTURE when we move to 10.9, switch to using kCTLanguageAttributeName
ensureFontInRange(p, start, end);
adjustFontInRange(p, start, end, ^(struct fontParams *fp) {
fp->language = (const char *) (spec->Value);
});
break;
desc = fontdescAppendFeatures(desc, fp->featureTypes, fp->featureSelectors, fp->nFeatures, fp->language);

View File

@ -0,0 +1,9 @@
PangoLanguage *lang;
// language strings are specified as BCP 47: https://developer.gnome.org/pango/1.30/pango-Scripts-and-Languages.html#pango-language-from-string https://www.ietf.org/rfc/rfc3066.txt
case uiAttributeLanguage:
lang = pango_language_from_string((const char *) (spec->Value));
addattr(p, start, end,
pango_attr_language_new(lang));
// lang *cannot* be freed
break;

View File

@ -0,0 +1,10 @@
WCHAR *localeName;
// locale names are specified as BCP 47: https://msdn.microsoft.com/en-us/library/windows/desktop/dd373814(v=vs.85).aspx https://www.ietf.org/rfc/rfc4646.txt
case uiAttributeLanguage:
localeName = toUTF16((char *) (spec->Value));
hr = p->layout->SetLocaleName(localeName, range);
if (hr != S_OK)
logHRESULT(L"error applying locale name attribute", hr);
uiFree(localeName);
break;

View File

@ -0,0 +1,2 @@
case uiAttributeLanguage:
return asciiStringsEqualCaseFold((char *) (attr->spec.Value), (char *) (spec->Value));

View File

@ -0,0 +1,27 @@
before "or any combination of the above"
// thanks to https://twitter.com/codeman38/status/831924064012886017
next = "\xD0\xB1\xD0\xB3\xD0\xB4\xD0\xBF\xD1\x82";
uiAttributedStringAppendUnattributed(attrstr, "multiple languages (compare ");
start = uiAttributedStringLen(attrstr);
end = start + strlen(next);
uiAttributedStringAppendUnattributed(attrstr, next);
spec.Type = uiAttributeItalic;
spec.Value = uiDrawTextItalicItalic;
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
spec.Type = uiAttributeLanguage;
spec.Value = (uintptr_t) "ru";
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
uiAttributedStringAppendUnattributed(attrstr, " to ");
start = uiAttributedStringLen(attrstr);
end = start + strlen(next);
uiAttributedStringAppendUnattributed(attrstr, next);
spec.Type = uiAttributeItalic;
spec.Value = uiDrawTextItalicItalic;
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
spec.Type = uiAttributeLanguage;
spec.Value = (uintptr_t) "sr";
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
uiAttributedStringAppendUnattributed(attrstr, " \xE2\x80\x94 may require changing the font)");
uiAttributedStringAppendUnattributed(attrstr, ", ");

View File

@ -0,0 +1,112 @@
// note: this doesn't work for languages; we have to parse the ltag table
// fortunately features that aren't supported are simply ignored, so we can copy them all in
// LONGTERM FUTURE when we switch to 10.9, the language parameter won't be needed anymore
// LONGTERM FUTURE and on 10.10 we can use OpenType tags directly!
CTFontDescriptorRef fontdescAppendFeatures(CTFontDescriptorRef desc, const uint16_t *types, const uint16_t *selectors, size_t n, const char *language)
{
CTFontDescriptorRef new;
CFMutableArrayRef outerArray;
CFDictionaryRef innerDict;
CFNumberRef numType, numSelector;
const void *keys[2], *values[2];
size_t i;
CFArrayRef languages;
CFIndex il, nl;
CFStringRef curlang;
char d[2];
outerArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
if (outerArray == NULL) {
// TODO
}
keys[0] = kCTFontFeatureTypeIdentifierKey;
keys[1] = kCTFontFeatureSelectorIdentifierKey;
for (i = 0; i < n; i++) {
numType = CFNumberCreate(NULL, kCFNumberSInt16Type,
(const SInt16 *) (types + i));
numSelector = CFNumberCreate(NULL, kCFNumberSInt16Type,
(const SInt16 *) (selectors + i));
values[0] = numType;
values[1] = numSelector;
innerDict = CFDictionaryCreate(NULL,
keys, values, 2,
// TODO are these correct?
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (innerDict == NULL) {
// TODO
}
CFArrayAppendValue(outerArray, innerDict);
CFRelease(innerDict);
CFRelease(numSelector);
CFRelease(numType);
}
// now we have to take care of the language
if (language != NULL) {
languages = CTFontDescriptorCopyAttribute(desc, kCTFontLanguagesAttribute);
if (languages != NULL) {
nl = CFArrayGetCount(languages);
d[0] = language[0];
if (d[0] >= 'A' && d[0] <= 'Z')
d[0] += 'a' - 'A';
d[1] = language[1];
if (d[1] >= 'A' && d[1] <= 'Z')
d[1] += 'a' - 'A';
for (il = 0; il < nl; il++) {
char c[2];
curlang = (CFStringRef) CFArrayGetValueAtIndex(languages, il);
// TODO check for failure
CFStringGetBytes(curlang, CFRangeMake(0, 2),
kCFStringEncodingUTF8, 0, false,
(UInt8 *) c, 2, NULL);
if (c[0] >= 'A' && c[0] <= 'Z')
c[0] += 'a' - 'A';
if (c[1] >= 'A' && c[1] <= 'Z')
c[1] += 'a' - 'A';
if (c[0] == d[0] && c[1] == d[1])
break;
}
if (il != nl) {
uint16_t typ;
typ = kLanguageTagType;
il++;
numType = CFNumberCreate(NULL, kCFNumberSInt16Type,
(const SInt16 *) (&typ));
numSelector = CFNumberCreate(NULL, kCFNumberCFIndexType,
&il);
values[0] = numType;
values[1] = numSelector;
innerDict = CFDictionaryCreate(NULL,
keys, values, 2,
// TODO are these correct?
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (innerDict == NULL) {
// TODO
}
CFArrayAppendValue(outerArray, innerDict);
CFRelease(innerDict);
CFRelease(numSelector);
CFRelease(numType);
}
CFRelease(languages);
}
}
keys[0] = kCTFontFeatureSettingsAttribute;
values[0] = outerArray;
innerDict = CFDictionaryCreate(NULL,
keys, values, 1,
// TODO are these correct?
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFRelease(outerArray);
new = CTFontDescriptorCreateCopyWithAttributes(desc, innerDict);
CFRelease(desc);
CFRelease(innerDict);
return new;
}

View File

@ -0,0 +1,5 @@
after UnderlineColor, before feature tags
// TODO document that this will also enable language-specific font features (TODO on DirectWrite too?)
// TODO document that this should be strict BCP 47 form (A-Z, a-z, 0-9, and -) for maximum compatibility
uiAttributeLanguage, // BCP 47 string

View File

@ -0,0 +1,25 @@
= attributed strings
attribute lengths are rounded to complete unicode codepoints
zero-length attributes are elided
consecutive attributes of the same type and value are merged
overlapping attributes of different types do not split each other
overlapping attributes of the same type but different values do split
empty string is allowed
empty string cannot have attributes
font family names are case-insensitive both in attributes and in descriptors
attributes are unique throughout a Unicode codepoint, not just to UTF-8 bytes
define what "it is an error" means in the case of uiFreeAttribute() and all uiAttributeValue() functions and constructors
does uiAttributeFamily() return a normalized string
should uiNewAttributeBackground() be renamed to uiNewAttributeBackgroundColor() and likewise for the type constant
should underline colors just ignore non-custom component arguments
should any color getter function accept a NULL pointer
what should uiAttributeUnderlineColor() do if the color type isn't Custom but the other pointers are non-NULL
should uiOpenTypeFeaturesGet() accept a NULL value pointer
what happens if uiOpenTypeFeaturesForEach() is given a NULl function pointer
should FeaturesAttribute be changed to OpenTypeFeaturesAttribute and likewise for the type enum
should uiNewFeaturesAttribute() accept NULL
should uiNewFamilyAttribute() accept NULL
it is an error in ForEach too
invalid values for uiDrawTextAlign
empty text layouts have one line
TODO figure out what to do if any field (particularly the font family name) in uiFontDescriptor is unset

View File

@ -0,0 +1,115 @@
// 27 february 2018
#ifndef TODO_TEST
#error TODO this is where libui itself goes
#endif
#include <inttypes.h>
#include "testing.h"
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef struct uiOpenTypeFeatures uiOpenTypeFeatures;
typedef int uiForEach;
enum { uiForEachContinue, uiForEachStop };
typedef uiForEach (*uiOpenTypeFeaturesForEachFunc)(const uiOpenTypeFeatures *otf, char a, char b, char c, char d, uint32_t value, void *data);
#define uiprivNew(x) ((x *) malloc(sizeof (x)))
#define uiprivAlloc(x,y) malloc(x)
#define uiprivRealloc(x,y,z) realloc(x,y)
#define uiprivFree free
#include "opentype.c"
static void freeOpenType(void *otf)
{
uiFreeOpenTypeFeatures((uiOpenTypeFeatures *) otf);
}
testingTest(OpenTypeFeaturesAddGet)
{
uiOpenTypeFeatures *otf;
int got;
uint32_t value;
otf = uiNewOpenTypeFeatures();
testingTDefer(t, freeOpenType, otf);
uiOpenTypeFeaturesAdd(otf, 'a', 'b', 'c', 'd', 12345);
got = uiOpenTypeFeaturesGet(otf, 'a', 'b', 'c', 'd', &value);
if (!got)
testingTErrorf(t, "uiOpenTypeFeaturesGet() failed to get feature we added");
else if (value != 12345)
testingTErrorf(t, "feature abcd: got %" PRIu32 ", want 12345", value);
}
testingTest(OpenTypeFeaturesRemove)
{
uiOpenTypeFeatures *otf;
uint32_t value;
otf = uiNewOpenTypeFeatures();
testingTDefer(t, freeOpenType, otf);
uiOpenTypeFeaturesAdd(otf, 'a', 'b', 'c', 'd', 12345);
uiOpenTypeFeaturesRemove(otf, 'a', 'b', 'c', 'd');
if (uiOpenTypeFeaturesGet(otf, 'a', 'b', 'c', 'd', &value))
testingTErrorf(t, "uiOpenTypeFeaturesGet() succeeded in getting deleted feature; value %" PRIu32, value);
}
testingTest(OpenTypeFeaturesCloneAdd)
{
uiOpenTypeFeatures *otf, *otf2;
uint32_t value;
otf = uiNewOpenTypeFeatures();
testingTDefer(t, freeOpenType, otf);
uiOpenTypeFeaturesAdd(otf, 'a', 'b', 'c', 'd', 12345);
otf2 = uiOpenTypeFeaturesClone(otf);
testingTDefer(t, freeOpenType, otf2);
uiOpenTypeFeaturesAdd(otf2, 'q', 'w', 'e', 'r', 56789);
if (uiOpenTypeFeaturesGet(otf, 'q', 'w', 'e', 'r', &value))
testingTErrorf(t, "uiOpenTypeFeaturesGet() on original succeeded in getting feature added to clone; value %" PRIu32, value);
}
testingTest(OpenTypeFeaturesCloneModify)
{
uiOpenTypeFeatures *otf, *otf2;
uint32_t value;
otf = uiNewOpenTypeFeatures();
testingTDefer(t, freeOpenType, otf);
uiOpenTypeFeaturesAdd(otf, 'a', 'b', 'c', 'd', 12345);
otf2 = uiOpenTypeFeaturesClone(otf);
testingTDefer(t, freeOpenType, otf2);
uiOpenTypeFeaturesAdd(otf2, 'a', 'b', 'c', 'd', 56789);
uiOpenTypeFeaturesGet(otf, 'a', 'b', 'c', 'd', &value);
if (value != 12345)
testingTErrorf(t, "uiOpenTypeFeaturesGet() on original: got %" PRIu32 ", want 12345", value);
uiOpenTypeFeaturesGet(otf2, 'a', 'b', 'c', 'd', &value);
if (value != 56789)
testingTErrorf(t, "uiOpenTypeFeaturesGet() on clone: got %" PRIu32 ", want 56789", value);
}
testingTest(OpenTypeFeaturesCloneRemove)
{
uiOpenTypeFeatures *otf, *otf2;
uint32_t value;
otf = uiNewOpenTypeFeatures();
testingTDefer(t, freeOpenType, otf);
uiOpenTypeFeaturesAdd(otf, 'a', 'b', 'c', 'd', 12345);
otf2 = uiOpenTypeFeaturesClone(otf);
testingTDefer(t, freeOpenType, otf2);
uiOpenTypeFeaturesRemove(otf2, 'a', 'b', 'c', 'd');
if (uiOpenTypeFeaturesGet(otf2, 'a', 'b', 'c', 'd', &value))
testingTErrorf(t, "uiOpenTypeFeaturesGet() on clone succeeded in getting feature removed from clone; value %" PRIu32, value);
if (!uiOpenTypeFeaturesGet(otf, 'a', 'b', 'c', 'd', &value))
testingTErrorf(t, "uiOpenTypeFeaturesGet() on original failed to get feature removed from clone");
}
int main(void)
{
return testingMain();
}

137
_future/unittest/testing.h Normal file
View File

@ -0,0 +1,137 @@
// 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
#include <stdarg.h>
#undef testingprivBadLanguageVersion
#ifdef __cplusplus
// TODO https://stackoverflow.com/questions/2324658/how-to-determine-the-version-of-the-c-standard-used-by-the-compiler implies this won't do with C++0x-era compilers, and https://wiki.apache.org/stdcxx/C++0xCompilerSupport doesn't talk about va_copy() so a simple version check for the C99 preprocessor may be wrong...
// TODO what if __cplusplus is blank (maybe only in that case, since IIRC C++98 requires __cplusplus to have a value)?
#if __cplusplus < 201103L
#define testingprivBadLanguageVersion
#endif
#elif !defined(__STDC_VERSION__)
#define testingprivBadLanguageVersion
#elif __STDC_VERSION__ < 199901L
#define testingprivBadLanguageVersion
#endif
#ifdef testingprivBadLanguageVersion
#error sorry, TODO requires either C99 or C++11; cannot continue
#endif
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
#define testingprivMkScaffold(name) \
static inline void testingprivScaffold ## name(testingT *t) \
{ \
bool failedNow = false, skippedNow = false; \
try { name(t); } \
catch (testingprivFailNowException e) { failedNow = true; } \
catch (testingprivSkipNowException e) { skippedNow = true; } \
/* TODO see if we should catch other exceptions too */ \
/* don't call these in the catch blocks as they call longjmp() */ \
if (failedNow) testingprivTDoFailNow(t); \
if (skippedNow) testingprivTDoSkipNow(t); \
}
#else
#define testingprivMkScaffold(name) \
static inline void testingprivScaffold ## name(testingT *t) { name(t); }
#endif
// references:
// - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h
// - https://gitlab.gnome.org/GNOME/glib/blob/master/gio/glib-compile-resources.c
// - https://msdn.microsoft.com/en-us/library/bb918180.aspx
#if defined(__cplusplus)
#define testingprivMkCtor(name, reg) \
static reg ## Class testingprivCtor ## name(#name, testingprivScaffold ## name);
#elif defined(__GNUC__)
#define testingprivMkCtor(name, reg) \
__attribute__((constructor)) static void testingprivCtor ## name(void) { reg(#name, testingprivScaffold ## name); }
#elif defined(_MSC_VER)
#define testingprivMkCtorPrototype(name, reg) \
static int name(void) testingprivCtor ## name(void) { reg(#name, testingprivScaffold ## name); return 0; } \
__pragma(section(".CRT$XCU",read)) \
__declspec(allocate(".CRT$XCU")) static int (*testingprivCtorPtr ## name)(void) = testingprivCtor ## name;
#elif defined(__SUNPRO_C)
#define testingprivMkCtor(name, reg) \
_Pragma("init(testingprivCtor" #name ")") static void testingprivCtor ## name(void) { reg(#name, testingprivScaffold ## name); }
#else
#error unknown compiler for making constructors in C; cannot continue
#endif
#define testingTest(Name) \
void Test ## Name(testingT *t); \
testingprivMkScaffold(Test ## Name) \
testingprivMkCtor(Test ## Name, testingprivRegisterTest) \
void Test ## Name(testingT *t)
extern int testingMain(void);
typedef struct testingT testingT;
#define testingTLogf(t, ...) \
testingprivExpand(testingprivTLogfThen((void), t, __VA_ARGS__))
#define testingTLogvf(t, format, ap) \
testingprivTLogvfThen((void), t, format, ap)
#define testingTErrorf(t, ...) \
testingprivExpand(testingprivTLogfThen(testingTFail, t, __VA_ARGS__))
#define testingTErrorvf(t, format, ap) \
testingprivTLogvfThen(testingTFail, t, format, ap)
#define testingTFatalf(t, ...) \
testingprivExpand(testingprivTLogfThen(testingTFailNow, t, __VA_ARGS__))
#define testingTFatalvf(t, format, ap) \
testingprivTLogvfThen(testingTFailNow, t, format, ap)
#define testingTSkipf(t, ...) \
testingprivExpand(testingprivTLogfThen(testingTSkipNow, t, __VA_ARGS__))
#define testingTSkipvf(t, format, ap) \
testingprivTLogvfThen(testingTSkipNow, t, format, ap)
extern void testingTFail(testingT *t);
#ifdef __cplusplus
#define testingTFailNow(t) (throw testingprivFailNowException())
#define testingTSkipNow(t) (throw testingprivSkipNowException())
#else
#define testingTFailNow(t) (testingprivTDoFailNow(t))
#define testingTSkipNow(t) (testingprivTDoSkipNow(t))
#endif
// TODO should the defered function also have t passed to it?
extern void testingTDefer(testingT *t, void (*f)(void *data), void *data);
// TODO IEEE 754 helpers
// references:
// - https://www.sourceware.org/ml/libc-alpha/2009-04/msg00005.html
// - https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
// - https://stackoverflow.com/questions/5085533/is-a-c-preprocessor-identical-to-a-c-preprocessor
// TODO should __LINE__ arguments use intmax_t or uintmax_t instead of int?
extern void testingprivRegisterTest(const char *, void (*)(testingT *));
// see https://stackoverflow.com/questions/32399191/va-args-expansion-using-msvc
#define testingprivExpand(x) x
#define testingprivTLogfThen(then, t, ...) ((testingprivTLogfFull(t, __FILE__, __LINE__, __VA_ARGS__)), (then(t)))
#define testingprivTLogvfThen(then, t, format, ap) ((testingprivTLogvfFull(t, __FILE__, __LINE__, format, ap)), (then(t)))
extern void testingprivTLogfFull(testingT *, const char *, int, const char *, ...);
extern void testingprivTLogvfFull(testingT *, const char *, int, const char *, va_list);
extern void testingprivTDoFailNow(testingT *);
extern void testingprivTDoSkipNow(testingT *);
#ifdef __cplusplus
}
namespace {
class testingprivFailNowException {};
class testingprivSkipNowException {};
class testingprivRegisterTestClass {
public:
testingprivRegisterTestClass(const char *name, void (*f)(testingT *)) { testingprivRegisterTest(name, f); }
};
}
#endif
#endif

View File

@ -0,0 +1,144 @@
// 27 february 2018
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
#include "testing.h"
#define testingprivNew(T) ((T *) malloc(sizeof (T)))
struct defer {
void (*f)(void *);
void *data;
struct defer *next;
};
struct testingT {
const char *name;
void (*f)(testingT *);
int failed;
int skipped;
jmp_buf returnNowBuf;
struct defer *defers;
int defersRun;
testingT *next;
};
static testingT *tests = NULL;
void testingprivRegisterTest(const char *name, void (*f)(testingT *))
{
testingT *t;
t = testingprivNew(testingT);
t->name = name;
t->f = f;
t->failed = 0;
t->skipped = 0;
t->defers = NULL;
t->defersRun = 0;
// TODO add in the order called
t->next = tests;
tests = t;
}
static void runDefers(testingT *t)
{
struct defer *d;
if (t->defersRun)
return;
t->defersRun = 1;
for (d = t->defers; d != NULL; d = d->next)
(*(d->f))(d->data);
}
int testingMain(void)
{
testingT *t;
int anyFailed;
const char *status;
// TODO see if this should run if all tests are skipped
if (tests == NULL) {
fprintf(stderr, "warning: no tests to run\n");
// imitate Go here (TODO confirm this)
return 0;
}
anyFailed = 0;
for (t = tests; t != NULL; t = t->next) {
printf("=== RUN %s\n", t->name);
if (setjmp(t->returnNowBuf) == 0)
(*(t->f))(t);
runDefers(t);
status = "PASS";
if (t->failed) {
status = "FAIL";
anyFailed = 1;
} else if (t->skipped)
// note that failed overrides skipped
status = "SKIP";
printf("--- %s: %s (%s)\n", status, t->name, "TODO");
}
if (anyFailed) {
printf("FAIL\n");
return 1;
}
printf("PASS\n");
return 0;
}
void testingprivTLogfFull(testingT *t, const char *file, int line, const char *format, ...)
{
va_list ap;
va_start(ap, format);
testingprivTLogvfFull(t, file, line, format, ap);
va_end(ap);
}
void testingprivTLogvfFull(testingT *t, const char *file, int line, const char *format, va_list ap)
{
// TODO extract filename from file
printf("\t%s:%d: ", file, line);
// TODO split into lines separated by \n\t\t and trimming trailing empty lines
vprintf(format, ap);
printf("\n");
}
void testingTFail(testingT *t)
{
t->failed = 1;
}
static void returnNow(testingT *t)
{
// run defers before calling longjmp() just to be safe
runDefers(t);
longjmp(t->returnNowBuf, 1);
}
void testingprivTDoFailNow(testingT *t)
{
testingTFail(t);
returnNow(t);
}
void testingprivTDoSkipNow(testingT *t)
{
t->skipped = 1;
returnNow(t);
}
void testingTDefer(testingT *t, void (*f)(void *data), void *data)
{
struct defer *d;
d = testingprivNew(struct defer);
d->f = f;
d->data = data;
// add to the head of the list so defers are run in reverse order of how they were added
d->next = t->defers;
t->defers = d;
}

View File

@ -0,0 +1,19 @@
Proper vertical text support in uiDrawTextLayout was removed because DirectWrite doesn't add this until Windows 8.1 (unless I drop IDWriteTextLayout and do the script analysis myself; TODO consider this possibility).
On OS X, setting the vertical forms attribute stacks non-vertical scripts in vertical text (rotates each individual glyph) with Core Text, whereas everything else — including Cocoa's text system — rotates entire non-vertical strings. Not sure what to do about this except manually detect which characters to apply the attribute to:
http://www.unicode.org/notes/tn22/RobustVerticalLayout.pdf
http://www.unicode.org/Public/vertical/revision-17/VerticalOrientation-17.txt
In addition, with Core Text, the vertical forms attribute vertically centers the vertical glyphs on the bhorizontal baseline, rather than flush with the text. Using the baseline class attribute doesn't seem to work.
TODO investigate kCJKVerticalRomanPlacementType
If readded, this will need to be a layout-wide setting, not a per-character setting. Pango works right this way; the current Pango code doesn't seem to work.
More links:
https://www.w3.org/TR/2012/NOTE-jlreq-20120403/#line-composition
https://www.w3.org/TR/REC-CSS2/notes.html
TODO indicate where in the attributes.c file that block of code should go (or drop it entirely for the reasons listed above)
TODO same for ui.h
TODO vertical carets

View File

@ -0,0 +1,19 @@
case uiAttributeVerticalForms:
if (spec->Value != 0) {
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanTrue);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassRoman);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassIdeographicCentered);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassIdeographicLow);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassIdeographicHigh);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassHanging);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassMath);
} else {
CFAttributedStringSetAttribute(p->mas, range, kCTVerticalFormsAttributeName, kCFBooleanFalse);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassRoman);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassIdeographicCentered);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassIdeographicLow);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassIdeographicHigh);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassHanging);
// CFAttributedStringSetAttribute(p->mas, range, kCTBaselineClassAttributeName, kCTBaselineClassMath);
}
break;

View File

@ -0,0 +1,9 @@
PangoGravity gravity;
case uiAttributeVerticalForms:
gravity = PANGO_GRAVITY_SOUTH;
if (spec->Value != 0)
gravity = PANGO_GRAVITY_EAST;
addattr(p, start, end,
pango_attr_gravity_new(gravity));
break;

View File

@ -0,0 +1,15 @@
uint32_t vertval;
case uiAttributeVerticalForms:
// LONGTERM 8 and/or 8.1 add other methods for vertical text
op.p = p;
op.start = start;
op.end = end;
vertval = 0;
if (spec->Value != 0)
vertval = 1;
doOpenType("vert", vertval, &op);
doOpenType("vrt2", vertval, &op);
doOpenType("vkrn", vertval, &op);
doOpenType("vrtr", vertval, &op);
break;

View File

@ -0,0 +1,2 @@
case uiAttributeVerticalForms:
return boolsEqual(attr, spec);

View File

@ -0,0 +1,18 @@
next = "vertical glyph forms";
start = uiAttributedStringLen(attrstr);
end = start + strlen(next);
uiAttributedStringAppendUnattributed(attrstr, next);
spec.Type = uiAttributeVerticalForms;
spec.Value = 1;
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
uiAttributedStringAppendUnattributed(attrstr, " (which you can draw rotated for proper vertical text; for instance, ");
next = "\xE3\x81\x82\xE3\x81\x84\xE3\x81\x86\xE3\x81\x88\xE3\x81\x8A";
start = uiAttributedStringLen(attrstr);
end = start + strlen(next);
uiAttributedStringAppendUnattributed(attrstr, next);
spec.Type = uiAttributeVerticalForms;
spec.Value = 1;
uiAttributedStringSetAttribute(attrstr, &spec, start, end);
uiAttributedStringAppendUnattributed(attrstr, ")");
uiAttributedStringAppendUnattributed(attrstr, ", ");

View File

@ -0,0 +1,2 @@
// TODO rename to uiAttributeVertical?
uiAttributeVerticalForms, // 0 = off, 1 = on

25
_notes/OS2 Normal file
View File

@ -0,0 +1,25 @@
https://twitter.com/OS2World/status/983822011389620224
Hi. I recommend you today to start with OS/2 Warp 4.52 or ArcaOS ( The tools are almost the same of Warp 3). EDM/2 is a good place to start: http://www.edm2.com
https://twitter.com/OS2World/status/983822594465034240
There is also an RPM with OS/2 Software (https://www.arcanoae.com/resources/downloadables/arca-noae-package-manager/ …), and you can get from it some parts of the OS/2 Toolkit. If you want to develop drivers you require the OS/2 Device Driver Kit. (that is more complex). You can also develop in Qt4 and compile things with gcc.
http://www.edm2.com/index.php/Main_Page
https://www.arcanoae.com/resources/downloadables/arca-noae-package-manager/
http://www.edm2.com/index.php/IBM_OS/2_Toolkit_Documentation
https://www.os2world.com/forum/index.php?topic=953.0
https://www.google.com/search?client=firefox-b-1&ei=QIPPWurPLs7OwAK65K24BA&q=%22OS%2F2+Toolkit%22+site%3Aamazon.com&oq=%22OS%2F2+Toolkit%22+site%3AAmazon.com&gs_l=psy-ab.3...160814.161293.0.161540.2.2.0.0.0.0.128.252.0j2.2.0....0...1c.1.64.psy-ab..0.0.0....0.itT9Og6hC5c
http://www.edm2.com/index.php/List_of_Presentation_Manager_Articles
https://www.ecsoft2.org/
http://www.edm2.com/index.php/Cairo
http://www.edm2.com/index.php/Doodle
http://www.edm2.com/index.php/Workplace_Shell_Toolkit
http://wpstk.netlabs.org/en/site/index.xml
https://en.wikipedia.org/wiki/Workplace_Shell
https://www.google.com/search?q=OS2+alphablending&ie=utf-8&oe=utf-8&client=firefox-b-1
http://www.edm2.com/index.php/List_of_Multimedia_Articles
alphablending:
http://www.osnews.com/story/369/Review-eComStation-OS2-1.0/page3/
http://halfos.ru/documentation/33-os2-api-documentation/67-opengl-os2-developer-reference-guide.html
http://www.altools.com/ALTools/ALSee/ALSee-Image-Viewer.aspx
http://www.os2voice.org/vnewsarc/bn2007122.html
http://www.mozillazine.org/talkback.html?article=194
https://books.google.com/books?id=9cpU5uYCzq4C&pg=PA202&lpg=PA202&dq=%22OS/2%22+alphablending&source=bl&ots=uatEop2jAL&sig=HAa_ofQSKsk6-8tBR6YZ6MRJG_0&hl=en&sa=X&ved=0ahUKEwiDq5HukLbaAhUk8IMKHR7aCw4Q6AEIWTAI#v=onepage&q=%22OS%2F2%22%20alphablending&f=false

76
_notes/azure-pipelines Normal file
View File

@ -0,0 +1,76 @@
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
_notes/caretWidths Normal file
View File

@ -0,0 +1 @@
UWP has this (TODO check its implementation to see if it matches ours) https://docs.microsoft.com/en-us/uwp/api/windows.ui.viewmanagement.uisettings#Windows_UI_ViewManagement_UISettings_CaretWidth

1
_notes/cplusplus Normal file
View File

@ -0,0 +1 @@
https://blogs.msdn.microsoft.com/oldnewthing/20181226-00/?p=100565

6
_notes/darwinAutoLayout Normal file
View File

@ -0,0 +1,6 @@
https://developer.apple.com/library/mac/documentation/AppKit/Reference/NSLayoutConstraint_Class/
https://developer.apple.com/documentation/uikit/nslayoutconstraint?language=objc
https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AutolayoutPG/ProgrammaticallyCreatingConstraints.html#//apple_ref/doc/uid/TP40010853-CH16-SW1
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/ProgrammaticallyCreatingConstraints.html#//apple_ref/doc/uid/TP40010853-CH16-SW1 (Listing 13-3)
https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithScrollViews.html#//apple_ref/doc/uid/TP40010853-CH24-SW1
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithScrollViews.html#//apple_ref/doc/uid/TP40010853-CH24-SW1 ("IMPORTANT Your layout must fully define..." large box)

View File

@ -0,0 +1,8 @@
https://www.google.com/search?q=nsalert+error+icon&client=firefox-b&tbm=isch&source=iu&ictx=1&fir=2iRctS5fJByN0M%253A%252Cw324MTzjHa1bAM%252C_&usg=__x3wpwdNN1L8VI2kHtkKAXFMtpj4%3D&sa=X&ved=0ahUKEwjJzpjN2qDZAhVjw1kKHfOHDoQQ9QEIMTAB#imgrc=2iRctS5fJByN0M:
http://0xced.blogspot.com/2009/11/clalert-nsalert-done-right.html
https://gist.github.com/0xced/228140
http://editra.org/uploads/code/artmac.html
http://mirror.informatimago.com/next/developer.apple.com/documentation/Carbon/Reference/IconServices/index.html
http://www.cocoabuilder.com/archive/cocoa/15427-iconref-to-nsimage.html
https://github.com/lukakerr/Swift-NSUserNotificationPrivate
https://stackoverflow.com/questions/32943220/the-sidebar-icon-image-name-in-osx

2
_notes/dialogs Normal file
View File

@ -0,0 +1,2 @@
https://github.com/kusti8/proton-native/issues/47#issuecomment-373068947
https://blogs.kde.org/2009/03/26/how-crash-almost-every-qtkde-application-and-how-fix-it-0

1
_notes/highDPI Normal file
View File

@ -0,0 +1 @@
High DPI Displays | Qt 5.5 http://doc.qt.io/qt-5/highdpi.html bottom of page(?)

16
_notes/i18n Normal file
View File

@ -0,0 +1,16 @@
https://msdn.microsoft.com/en-us/library/windows/desktop/dd319079(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd318103(v=vs.85).aspx
https://stackoverflow.com/questions/4663855/is-there-a-repository-for-localized-common-text-in-winforms
https://stackoverflow.com/questions/2502375/find-localized-windows-strings
https://docs.microsoft.com/en-us/windows-hardware/customize/mobile/mcsf/create-a-resource-only-dll-for-localized-strings
https://msdn.microsoft.com/en-us/library/windows/desktop/ee845043(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/cc194807.aspx
https://www.codeproject.com/Articles/10542/Easily-Load-and-Format-Strings-from-the-String-Tab
https://www.codeproject.com/Tips/431045/The-inner-working-of-FindResource-and-LoadString-W
https://mihai-nita.net/2007/05/03/how-to-localize-an-rc-file/
https://www.microsoft.com/en-us/language
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

View File

@ -0,0 +1,23 @@
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

213
_notes/misc Normal file
View File

@ -0,0 +1,213 @@
windows data types, "open specifications" on msdn https://msdn.microsoft.com/en-us/library/cc230321.aspx
(I usually use https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx for windows data types)
windows platform update for windows 7
https://msdn.microsoft.com/en-us/library/windows/desktop/jj863687(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/hh802478(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/hh802480(v=vs.85).aspx
DWM, header bars, toolbars
https://stackoverflow.com/questions/41106347/why-is-my-dwmextendframeintoclientaread-window-not-drawing-the-dwm-borders/41125616#41125616
https://developer.gnome.org/hig/stable/header-bars.html.en
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/OSXHIGuidelines/WindowTitleBarToolbar.html#//apple_ref/doc/uid/20000957-CH39-SW1
https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/OSXHIGuidelines/ControlsAll.html#//apple_ref/doc/uid/20000957-CH46-SW2
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787329(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787334(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787337(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/cc835034(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787345(v=vs.85).aspx
rendering
https://www.youtube.com/watch?v=UUfXWzp0-DU
text input on windows
https://blogs.msdn.microsoft.com/oldnewthing/20121025-00/?p=6253
https://www.google.com/search?q=translatemessage+site%3Ahttp%3A%2F%2Farchives.miloush.net%2Fmichkap%2Farchive%2F&ie=utf-8&oe=utf-8
http://archives.miloush.net/michkap/archive/2008/04/22/8415843.html
http://archives.miloush.net/michkap/archive/2007/03/25/1948887.html
http://archives.miloush.net/michkap/archive/2006/09/10/748775.html
http://archives.miloush.net/michkap/archive/2004/11/27/270931.html
https://stackoverflow.com/questions/41334851/since-translatemessage-returns-nonzero-unconditionally-how-can-i-tell-either
http://stackoverflow.com/questions/41334851/since-translatemessage-returns-nonzero-unconditionally-how-can-i-tell-either?noredirect=1#comment70107257_41334851
text layouts
https://developer.apple.com/reference/coretext/2110184-ctframe?language=objc
https://msdn.microsoft.com/en-us/library/windows/desktop/dd368203(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd368205(v=vs.85).aspx
https://developer.gnome.org/pango/1.30/pango-Layout-Objects.html#pango-layout-set-font-description
https://developer.gnome.org/pango/1.30/pango-Fonts.html#PangoWeight-enum
https://git.gnome.org/browse/pango/tree/pango/pangocoretext-fontmap.c (code for small caps)
https://bugzilla.gnome.org/show_bug.cgi?id=766148
https://developer.apple.com/documentation/coretext/ctline?preferredLanguage=occ
https://developer.apple.com/reference/coretext/1508876-ctlinegetstringindexforposition?language=objc
https://developer.apple.com/library/content/documentation/StringsTextFonts/Conceptual/CoreText_Programming/Introduction/Introduction.html#//apple_ref/doc/uid/TP40005533-CH1-SW1
https://developer.apple.com/reference/coretext/2110184-ctframe?language=objc
https://developer.apple.com/reference/coretext/2168885-ctline?language=objc
https://developer.apple.com/library/content/documentation/StringsTextFonts/Conceptual/CoreText_Programming/LayoutOperations/LayoutOperations.html
http://asciiwwdc.com/2013/sessions/205
https://developer.apple.com/reference/coretext/1511332-ctlinegetboundswithoptions?language=objc
https://stackoverflow.com/questions/19709751/ctlinegetboundswithoptions-what-does-the-returned-frame-origin-y-value-mean?rq=1
https://imgur.com/a/lqhzC
https://imgur.com/a/hYeOL
https://www.google.com/search?q=ctline+%22paragraph+spacing%22&ie=utf-8&oe=utf-8
http://stackoverflow.com/questions/8010615/how-do-i-determine-the-of-a-ctline-following-a-ctline
https://imgur.com/a/dlpm2
https://stackoverflow.com/questions/41601845/am-i-missing-something-in-core-text-that-will-let-me-see-which-line-a-certain-po
https://www.google.com/search?q=%22core+text%22+%22combining+character%22&oq=%22core+text%22+%22combining+character%22&gs_l=serp.3...2526898.2528158.0.2528485.21.10.0.0.0.0.216.997.5j3j1.9.0....0...1c.1.64.serp..12.8.904...33i21k1j33i160k1.J69jsB9g0N0
https://github.com/macvim-dev/macvim/issues/400#issuecomment-274292877
https://bugs.webkit.org/show_bug.cgi?id=68287
https://trac.webkit.org/changeset/95391
https://trac.webkit.org/changeset/95391/trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp
http://stackoverflow.com/questions/41857213/is-there-any-way-i-can-get-precise-metrics-line-ascent-line-descent-etc-of
http://pawlan.com/monica/articles/texttutorial/int.html
enter in entry fields, possibly other text layout issues, possibly keyboard shortcuts
https://developer.gnome.org/gtk3/3.10/GtkEntry.html "activate" signal
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-10/gtk/gtkentry.c (not sure where)
https://developer.gnome.org/gtk3/3.10/GtkTextView.html signals section of contents
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-10/gtk/gtktextview.c (not sure where; closed before I could find out again though gitlab might wreck it anyway)
https://developer.gnome.org/gtk3/3.10/gtk3-Bindings.html
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-10/gtk/gtkwidget.c (not sure where)
https://gitlab.gnome.org/GNOME/gtk/blob/gtk-3-10/gtk/gtkbindings.c (not sure where)
https://gitlab.gnome.org/GNOME/gnome-builder/tree/master/libide/keybindings/ide-keybindings.c 404; TODO find the original cgit link in the chat logs to see what hergertme wanted me to see
https://gitlab.gnome.org/GNOME/gnome-builder/tree/master/libide/sourceview/ide-source-view.c likewise
https://gitlab.gnome.org/GNOME/gnome-builder/tree/master/libide/sourceview/ide-source-view-mode.c#n323 likewise
rgb int->float conversion
https://stackoverflow.com/questions/41348339/how-to-convert-rgb-to-hexadecimal-using-gtk?noredirect=1#comment69903262_41348339
windows fonts, hi-dpi
https://stackoverflow.com/questions/41448320/dlgtemplateex-and-ds-shellfont-what-about-point-size
windows default fonts
https://stackoverflow.com/questions/41505151/how-to-draw-text-with-the-default-ui-font-in-directwrite#41505750
uwp stuff
https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/inking-controls
https://msdn.microsoft.com/en-us/windows/uwp/controls-and-patterns/master-details
cmake stuff
https://public.kitware.com/pipermail/cmake/2010-January/034669.html
https://cmake.org/cmake/help/v3.0/command/string.html
https://cmake.org/pipermail/cmake/2003-April/003599.html
opentype features and locales
https://www.microsoft.com/typography/otspec/featurelist.htm
https://en.wikipedia.org/wiki/List_of_typographic_features
https://www.microsoft.com/typography/otspec160/scripttags.htm
https://msdn.microsoft.com/en-us/library/windows/desktop/dd371503(v=vs.85).aspx
gspell (TODO figure out what I wanted from this; possibly spelling checking)
https://git.gnome.org/browse/gspell/tree/gspell/gspell-inline-checker-text-buffer.c
https://git.gnome.org/browse/gtk+/tree/gtk/gtktextview.c?h=gtk-3-10
other assorted notes on text
https://mail.gnome.org/archives/gtk-devel-list/2016-March/msg00037.html
https://mail.gnome.org/archives/gtk-devel-list/2016-June/msg00007.html
https://blogs.msdn.microsoft.com/tsfaware/
https://stackoverflow.com/questions/40453186/what-is-the-correct-modern-way-to-handle-arbitrary-text-input-in-a-custom-contr
https://www.microsoft.com/typography/fonts/family.aspx
windows ribbon
https://twitter.com/_Ninji/status/814918189708668929 (C08rw9TWgAMpLkC.jpg:large)
https://developer.apple.com/library/content/samplecode/CocoaTipsAndTricks/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010039 BlurryView and StaticObjcMethods in particular
printing https://developer.apple.com/library/content/samplecode/PMPrinterPrintWithFile/Introduction/Intro.html#//apple_ref/doc/uid/DTS10003958
auto layout https://developer.apple.com/library/content/releasenotes/UserExperience/RNAutomaticLayout/index.html#//apple_ref/doc/uid/TP40010631
other stuff, mostly custom draw on windows
https://github.com/pauldotknopf/WindowsSDK7-Samples/blob/master/multimedia/DirectWrite/ChooseFont/ChooseFont.cpp at ChooseFontDialog::OnFontSizeNameEdit() definition
https://developer.gnome.org/gtk3/3.10/GtkColorButton.html
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775951(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775951(v=vs.85).aspx between BS_LEFTTEXT and BS_RADIOBUTTON
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775923(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775923(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775802(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775802(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761837(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761837(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761847(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb761847(v=vs.85).aspx description + parameters
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775483(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775483(v=vs.85).aspx dwItemSpec parameter
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775951(v=vs.85).aspx#BS_NOTIFY
https://msdn.microsoft.com/en-us/library/windows/desktop/bb775951(v=vs.85).aspx#BS_NOTIFY BS_NOTIFY to BS_RIGHT
http://stackoverflow.com/questions/17678261/how-to-change-color-of-a-button-while-keeping-buttons-functions-in-win32
https://msdn.microsoft.com/en-us/library/windows/desktop/ff919569(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ff919569(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ff919573(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ff919573(v=vs.85).aspx switch (pnm->hdr.code){
http://stackoverflow.com/questions/36756094/will-the-device-context-of-a-child-window-have-the-same-text-metrics-and-text-ex
actually I think most if not all of these were from when I was trying to implement uiColorButton on Windows, so I'm not sure if I still need these, but meh...
more miscellaneous
https://blogs.msdn.microsoft.com/oldnewthing/20160328-00/?p=93204 from "One is virtual memory" to "occured to them that their"
https://blogs.msdn.microsoft.com/oldnewthing/20160331-00/?p=93231
https://msdn.microsoft.com/en-us/library/windows/desktop/aa373631(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648395(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648395(v=vs.85).aspx
https://blogs.msdn.microsoft.com/oldnewthing/20101118-00/?p=12253#comment-875273 "MTA implies poor service and fare hikes."
from #gtk+
[18:06:48] <zorcon> if i am doing an animation that needs to be updated at every duration(say every 50ms), should i use get_frame_time() from the frameclock to do that? (from add_tick_callback())
[18:12:47] <~Company> zorcon: yes
windows stuff: mostly aero tricks, sdk version macro notes, ribbon stuff, scrollbar stuff too
https://tools.stefankueng.com/SendMessage.html
https://sourceforge.net/p/sendmessage/code/HEAD/tree/trunk/src/SendMessage.vcxproj
https://sourceforge.net/p/sendmessage/code/HEAD/tree/trunk/src/stdafx.h
https://sourceforge.net/p/sendmessage/code/HEAD/tree/trunk/src/MainDlg.h
https://sourceforge.net/u/steveking/profile/
https://github.com/stefankueng/BowPad/tree/master/src + sourceforge original
https://github.com/stefankueng/sktoolslib/blob/master/AeroControls.cpp + sourceforge original
https://tools.stefankueng.com/BowPad.html
https://www.codeproject.com/Articles/1084/Custom-Scrollbar-Library-version-1-1#_articleTop
https://www.google.com/search?client=firefox-b-1&biw=1080&bih=600&ei=gUHRWsrdMYayggf30bfoAw&q=%22aerocontrols.h%22&oq=%22aerocontrols.h%22&gs_l=psy-ab.3..35i39k1l6.1816.3367.0.3413.4.2.0.0.0.0.0.0..1.0....0...1c.1.64.psy-ab..3.1.211.6...211.0Ppw_OREAk0
https://searchcode.com/codesearch/view/7295148/
https://github.com/TortoiseGit/tortoisesvn/blob/master/src/Utils/MiscUI/AeroBaseDlg.h
https://github.com/TortoiseGit/tortoisesvn/blob/master/src/Utils/MiscUI/AeroControls.cpp
https://github.com/gavioto/stexbar/blob/master/Misc/FileTool/src/CleanVerifyDlg.h
windows ribbon colors and dwm customization
https://github.com/stefankueng/BowPad/blob/master/src/MainWindow.cpp
https://msdn.microsoft.com/en-us/library/windows/desktop/dd940487(v=vs.85).aspx
https://github.com/yohei-yoshihara/GameOfLife3D/blob/master/GameOfLife3DLib/gameoflife3d/Ribbon.cpp
https://msdn.microsoft.com/en-us/library/windows/desktop/dd940404(v=vs.85).aspx
https://github.com/stefankueng/sktoolslib/blob/master/AeroColors.cpp
https://gist.github.com/emoacht/bfa852ccc16bdb5465bd
https://stackoverflow.com/questions/4258295/aero-how-to-draw-solid-opaque-colors-on-glass
https://github.com/ComponentFactory/Krypton
https://www.codeproject.com/Articles/620045/Custom-Controls-in-Win-API-Visual-Styles
https://blogs.msdn.microsoft.com/wpf/2010/11/30/systemcolors-reference/
https://stackoverflow.com/questions/25639621/check-when-a-user-changes-windows-glass-brush-theme-color
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969513(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969527(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd388198(v=vs.85).aspx
I hope the MFC ribbon can have customizable colors too, otherwise I'll have to do some serious image processing...
windows debugging
https://msdn.microsoft.com/en-us/library/windows/desktop/hh780351(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ff476881(v=vs.85).aspx#Debug
https://msdn.microsoft.com/en-us/library/windows/desktop/hh780343(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dn457937(v=vs.85).aspx
more OS2 stuff
https://www.google.com/search?q=%22ibm+graphics+development+toolkit%22&ie=utf-8&oe=utf-8&client=firefox-b-1
https://www.google.com/search?q=%22os%2F2+graphics+development+toolkit%22&ie=utf-8&oe=utf-8&client=firefox-b-1
http://www.edm2.com/index.php/IBM_OS/2_Developer%27s_Packages
[17:48:52] <Chloe> andlabs: I got splitView and NSWindow size restoration working btw
[17:49:09] <Chloe> andlabs: see https://github.com/eintw1ck/mail/blob/master/Sources/mail/MainViewController.swift for splitView
old stuff
font1.gif (GIF Image, 424 × 475 pixels) http://www.functionx.com/win32/controls/dlgboxes/font1.gif
Inskcapes Hidden Little Feature: Mesh Gradients | OCS-Mag http://www.ocsmag.com/2016/02/27/inskcapes-hidden-little-feature-mesh-gradients/ (near "When youre 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

9
_notes/rebarstuff Normal file
View File

@ -0,0 +1,9 @@
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

4
_notes/tableNotes Normal file
View File

@ -0,0 +1,4 @@
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSOutlineViewDataSource_Protocol/index.html#//apple_ref/occ/intfm/NSOutlineViewDataSource/outlineView:child:ofItem:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSOutlineViewDelegate_Protocol/index.html#//apple_ref/occ/intfm/NSOutlineViewDelegate/outlineView:didAddRowView:forRow:
https://developer.apple.com/documentation/appkit/nsoutlineviewdelegate/1528320-outlineview?language=objc
https://github.com/mity/mctrl/blob/master/mctrl/treelist.c around treelist_set_subitem()

3
_notes/textSelections Normal file
View File

@ -0,0 +1,3 @@
http://www.catch22.net/tuts/transparent-text
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724371(v=vs.85).aspx
TODO which color did I want from this list

3
_notes/winARM64 Normal file
View File

@ -0,0 +1,3 @@
http://www.os2museum.com/wp/windows-10-arm64-on-qemu/
https://docs.microsoft.com/en-us/windows/uwp/porting/apps-on-arm
http://pete.akeo.ie/2017/05/compiling-desktop-arm-applications-with.html

21
_notes/windowsHighDPI Normal file
View File

@ -0,0 +1,21 @@
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/mt744321(v=vs.85).aspx
!!!! http://stackoverflow.com/questions/41917279/do-child-windows-have-the-same-dpi-as-their-parents-in-a-per-monitor-aware-appli
https://msdn.microsoft.com/en-us/library/windows/desktop/mt843498(v=vs.85).aspx
https://msdn.microsoft.com/library/windows/desktop/mt791579(v=vs.85).aspx
https://blogs.windows.com/buildingapps/2017/04/04/high-dpi-scaling-improvements-desktop-applications-windows-10-creators-update/
https://channel9.msdn.com/Events/Windows/Windows-Developer-Day-Creators-Update/High-DPI-Improvements-for-Desktop-Developers
https://social.msdn.microsoft.com/Forums/vstudio/en-US/31d2a89f-3518-403e-b1e4-bbe37ac1b0f0/per-monitor-high-dpi-awareness-wmdpichanged?forum=vcgeneral
https://stackoverflow.com/questions/36864894/scaling-the-non-client-area-title-bar-menu-bar-for-per-monitor-high-dpi-suppo/37624363
https://stackoverflow.com/questions/41448320/dlgtemplateex-and-ds-shellfont-what-about-point-size
http://stackoverflow.com/questions/41917279/do-child-windows-have-the-same-dpi-as-their-parents-in-a-per-monitor-aware-appli
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)
https://msdn.microsoft.com/en-us/library/windows/desktop/dn469266(v=vs.85).aspx#appendix_c_common_high_dpi_issues
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

7
_notes/windowsPrinting Normal file
View File

@ -0,0 +1,7 @@
https://msdn.microsoft.com/en-us/library/windows/desktop/ff686805(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dn495653(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/hh448422(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd316975(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd372919(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ee264335(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/dd145198(v=vs.85).aspx

46
_notes/windowsUWPGlass Normal file
View File

@ -0,0 +1,46 @@
https://twitter.com/omgubuntu/status/962765197109841922
https://github.com/DominicMaas/SoundByte/blob/master/SoundByte.UWP/Resources/Brushes.xaml
https://docs.microsoft.com/en-us/windows/uwp/design/style/acrylic
https://www.google.com/search?q=uwp+acrylic+winapi&ie=utf-8&oe=utf-8&client=firefox-b-1
https://stackoverflow.com/questions/43931709/acrylic-material-in-win32-app
https://stackoverflow.com/questions/44000217/mimicking-acrylic-in-a-win32-app
https://stackoverflow.com/questions/43699256/how-to-use-acrylic-accent-in-windows-10-creators-update
https://stackoverflow.com/questions/39135834/how-to-call-uwp-api-from-converted-win32-app-desktop-app-converter
https://stackoverflow.com/questions/32724187/how-do-you-set-the-glass-blend-colour-on-windows-10
https://channel9.msdn.com/Events/Build/2017/B8034
https://www.reddit.com/r/Windows10/comments/7lzyzc/since_the_taskbar_is_still_win32_and_it_can_have/
https://thenextweb.com/microsoft/2017/05/15/microsoft-fluent-design-system-breaking-windows-10s-new-look/
https://github.com/bbougot/AcrylicWPF
http://vhanla.codigobit.info/2015/07/enable-windows-10-aero-glass-aka-blur.html
http://undoc.airesoft.co.uk/user32.dll/SetWindowCompositionAttribute.php
http://undoc.airesoft.co.uk/user32.dll/GetWindowCompositionAttribute.php
https://msdn.microsoft.com/en-us/library/windows/desktop/aa969530(v=vs.85).aspx
https://github.com/bbougot/AcrylicWPF/blob/master/MainWindow.xaml.cs
https://www.google.com/search?q=%22WCA_ACCENT_POLICY%22&client=firefox-b-1&source=lnt&tbs=cdr%3A1%2Ccd_min%3A1%2F1%2F2001%2Ccd_max%3A12%2F31%2F2013&tbm=
https://github.com/sgothel/jogl/blob/master/src/nativewindow/native/win32/WindowsDWM.c
http://www.brandonfa.lk/win8/win8_devrel_head_x86/uxtheme.h
http://www.brandonfa.lk/win8/
https://github.com/gamozolabs/pdblister
https://github.com/wbenny/pdbex
https://github.com/wbenny/pdbex/releases
https://stackoverflow.com/questions/44000217/mimicking-acrylic-in-a-win32-app
https://github.com/riverar/sample-win32-acrylicblur
https://github.com/riverar/sample-win10-aeroglass
https://guerra24blog.wordpress.com/2017/12/20/windows-10-use-acrylic-in-win32-apps/
https://news.ycombinator.com/item?id=14432951
https://gist.github.com/ethanhs/0e157e4003812e99bf5bc7cb6f73459f ACCENTPOLICY
https://github.com/TranslucentTB/Tools
https://withinrafael.com/2015/07/08/adding-the-aero-glass-blur-to-your-windows-10-apps/
https://withinrafael.com/2018/02/01/adding-acrylic-blur-to-your-windows-10-apps-redstone-4-desktop-apps/
diversion: DwmEnableBlurBehindWindow {
https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/nf-dwmapi-dwmenableblurbehindwindow
https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/ns-dwmapi-_dwm_blurbehind
https://docs.microsoft.com/en-us/windows/desktop/api/dwmapi/nf-dwmapi-dwmenableblurbehindwindow
http://www.danielmoth.com/Blog/Vista-Glass-Answers-And-DwmEnableBlurBehindWindow.aspx
http://www.danielmoth.com/Blog/Glass-In-C-An-Alternative-Approach.aspx
http://www.danielmoth.com/Blog/Vista-Glass-In-C.aspx
http://www.danielmoth.com/Blog/Glass-In-C-An-Alternative-Approach.aspx
https://weblogs.asp.net/kennykerr/Windows-Vista-for-Developers-_1320_-Part-3-_1320_-The-Desktop-Window-Manager
}

6
_notes/winflags Normal file
View File

@ -0,0 +1,6 @@
# 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

View File

@ -0,0 +1,92 @@
// 10 february 2017
#include "../ui.h"
#include "uipriv.h"
// TODO this doesn't handle the case where nLines == 0
// TODO this should never happen even if there are no characters??
// TODO figure out how to make this work on GTK+
void uiDrawCaret(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t pos, int *line)
{
double xoff;
uiDrawTextLayoutLineMetrics m;
struct caretDrawParams cdp;
uiDrawPath *path;
uiDrawBrush brush;
if (*line < 0)
*line = 0;
if (*line > (uiDrawTextLayoutNumLines(layout) - 1))
*line = (uiDrawTextLayoutNumLines(layout) - 1);
// TODO cap pos
xoff = uiDrawTextLayoutByteLocationInLine(layout, pos, *line);
while (xoff < 0) {
size_t start, end;
uiDrawTextLayoutLineByteRange(layout, *line, &start, &end);
if (end < pos) // too far up
(*line)++;
else
(*line)--;
xoff = uiDrawTextLayoutByteLocationInLine(layout, pos, *line);
}
uiDrawTextLayoutLineGetMetrics(layout, *line, &m);
caretDrawParams(c, m.Height, &cdp);
uiDrawSave(c);
path = uiDrawNewPath(uiDrawFillModeWinding);
uiDrawPathAddRectangle(path,
// TODO add m.X?
x + xoff - cdp.xoff, y + m.Y,
cdp.width, m.Height);
uiDrawPathEnd(path);
brush.Type = uiDrawBrushTypeSolid;
brush.R = cdp.r;
brush.G = cdp.g;
brush.B = cdp.b;
brush.A = cdp.a;
uiDrawFill(c, path, &brush);
uiDrawFreePath(path);
uiDrawRestore(c);
}
void drawTextBackground(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t start, size_t end, uiDrawBrush *brush, int isSelection)
{
int line, nLines;
size_t lstart, lend;
double layoutwid, layoutht;
uiDrawTextLayoutExtents(layout, &layoutwid, &layoutht);
nLines = uiDrawTextLayoutNumLines(layout);
for (line = 0; line < nLines; line++) {
uiDrawTextLayoutLineByteRange(layout, line, &lstart, &lend);
if (start >= lstart && start < lend)
break;
}
while (end - start > 0) {
uiDrawTextLayoutLineMetrics m;
double startx, endx;
uiDrawPath *path;
uiDrawTextLayoutLineByteRange(layout, line, &lstart, &lend);
if (lend > end) // don't cross lines
lend = end;
startx = uiDrawTextLayoutByteLocationInLine(layout, start, line);
// TODO explain this; note the use of start with lend
endx = layoutwid;
if (!isSelection || end <= lend)
endx = uiDrawTextLayoutByteLocationInLine(layout, lend, line);
uiDrawTextLayoutLineGetMetrics(layout, line, &m);
path = uiDrawNewPath(uiDrawFillModeWinding);
uiDrawPathAddRectangle(path,
x + startx, y + m.Y,
endx - startx, m.Height);
uiDrawPathEnd(path);
uiDrawFill(c, path, brush);
uiDrawFreePath(path);
line++;
start = lend;
}
}

View File

@ -0,0 +1,15 @@
// TODO split these into a separate header file?
// drawtext.c
struct caretDrawParams {
double r;
double g;
double b;
double a;
double xoff;
double width;
};
extern void caretDrawParams(uiDrawContext *c, double height, struct caretDrawParams *p);
extern void drawTextBackground(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t start, size_t end, uiDrawBrush *brush, int isSelection);

View File

@ -0,0 +1,347 @@
// 2 january 2017
#import "uipriv_darwin.h"
#import "draw.h"
@interface lineInfo : NSObject
@property NSRange glyphRange;
@property NSRange characterRange;
@property NSRect lineRect;
@property NSRect lineUsedRect;
@property NSRect glyphBoundingRect;
@property CGFloat baselineOffset;
@property double ascent;
@property double descent;
@property double leading;
@end
@implementation lineInfo
@end
struct uiDrawTextLayout {
// NSTextStorage is subclassed from NSMutableAttributedString
NSTextStorage *attrstr;
NSTextContainer *container;
NSLayoutManager *layoutManager;
// the width as passed into uiDrawTextLayout constructors
double width;
#if 0 /* TODO */
// the *actual* size of the frame
// note: technically, metrics returned from frame are relative to CGPathGetPathBoundingBox(tl->path)
// however, from what I can gather, for a path created by CGPathCreateWithRect(), like we do (with a NULL transform), CGPathGetPathBoundingBox() seems to just return the standardized form of the rect used to create the path
// (this I confirmed through experimentation)
// so we can just use tl->size for adjustments
// we don't need to adjust coordinates by any origin since our rect origin is (0, 0)
CGSize size;
#endif
NSMutableArray<lineInfo *> *lineInfo;
// for converting CFAttributedString indices to byte offsets
size_t *u16tou8;
size_t nu16tou8; // TODO I don't like the casing of this name
};
static NSFont *fontdescToNSFont(uiDrawFontDescriptor *fd)
{
NSFontDescriptor *desc;
NSFont *font;
desc = fontdescToNSFontDescriptor(fd);
font = [NSFont fontWithDescriptor:desc size:fd->Size];
[desc release];
return font;
}
static NSTextStorage *attrstrToTextStorage(uiAttributedString *s, uiDrawFontDescriptor *defaultFont)
{
NSString *nsstr;
NSMutableDictionary *defaultAttrs;
NSTextStorage *attrstr;
nsstr = [[NSString alloc] initWithCharacters:attrstrUTF16(s)
length:attrstrUTF16Len(s)];
defaultAttrs = [NSMutableDictionary new];
[defaultAttrs setObject:fontdescToNSFont(defaultFont)
forKey:NSFontAttributeName];
attrstr = [[NSTextStorage alloc] initWithString:nsstr
attributes:defaultAttrs];
[defaultAttrs release];
[nsstr release];
[attrstr beginEditing];
// TODO copy in the attributes
[attrstr endEditing];
return attrstr;
}
// TODO fine-tune all the properties
uiDrawTextLayout *uiDrawNewTextLayout(uiAttributedString *s, uiDrawFontDescriptor *defaultFont, double width)
{
uiDrawTextLayout *tl;
CGFloat cgwidth;
// TODO correct type?
NSUInteger index;
tl = uiNew(uiDrawTextLayout);
tl->attrstr = attrstrToTextStorage(s, defaultFont);
tl->width = width;
// TODO the documentation on the size property implies this might not be necessary?
cgwidth = (CGFloat) width;
if (cgwidth < 0)
cgwidth = CGFLOAT_MAX;
// TODO rename to tl->textContainer
tl->container = [[NSTextContainer alloc] initWithSize:NSMakeSize(cgwidth, CGFLOAT_MAX)];
// TODO pull the reference for this
[tl->container setLineFragmentPadding:0];
tl->layoutManager = [[NSLayoutManager alloc] init];
[tl->layoutManager setTypesetterBehavior:NSTypesetterLatestBehavior];
[tl->layoutManager addTextContainer:tl->container];
[tl->attrstr addLayoutManager:tl->layoutManager];
// and force a re-layout (TODO get source
[tl->layoutManager glyphRangeForTextContainer:tl->container];
// TODO equivalent of CTFrameProgression for RTL/LTR?
// now collect line information; see https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/TextLayout/Tasks/CountLines.html
tl->lineInfo = [NSMutableArray<lineInfo *> new];
index = 0;
while (index < [tl->layoutManager numberOfGlyphs]) {
NSRange glyphRange;
__block lineInfo *li;
li = [lineInfo new];
li.lineRect = [tl->layoutManager lineFragmentRectForGlyphAtIndex:index effectiveRange:&glyphRange];
li.glyphRange = glyphRange;
li.characterRange = [tl->layoutManager characterRangeForGlyphRange:li.glyphRange actualGlyphRange:NULL];
li.lineUsedRect = [tl->layoutManager lineFragmentUsedRectForGlyphAtIndex:index effectiveRange:NULL];
li.glyphBoundingRect = [tl->layoutManager boundingRectForGlyphRange:li.glyphRange inTextContainer:tl->container];
// and this is from http://www.cocoabuilder.com/archive/cocoa/308568-how-to-get-baseline-info.html and http://www.cocoabuilder.com/archive/cocoa/199283-height-and-location-of-text-within-line-in-nslayoutmanager-ignoring-spacing.html
li.baselineOffset = [[tl->layoutManager typesetter] baselineOffsetInLayoutManager:tl->layoutManager glyphIndex:index];
li.ascent = 0;
li.descent = 0;
li.leading = 0;
// imitate what AppKit actually does (or seems to)
[tl->attrstr enumerateAttributesInRange:li.characterRange options:0 usingBlock:^(NSDictionary<NSString *,id> *attrs, NSRange range, BOOL *stop) {
NSFont *f;
NSRect boundingRect;
double v, realAscent, realDescent, realLeading;
BOOL skipAdjust, doAdjust;
f = (NSFont *) [attrs objectForKey:NSFontAttributeName];
if (f == nil) {
f = [NSFont fontWithName:@"Helvetica" size:12.0];
if (f == nil)
f = [NSFont systemFontOfSize:12.0];
}
boundingRect = [f boundingRectForFont];
realAscent = [f ascender];
realDescent = -[f descender];
realLeading = [f leading];
skipAdjust = NO;
doAdjust = NO;
if (NSMaxY(boundingRect) <= realAscent) {
// ascent entirely within bounding box
// don't do anything if there's leading; I'm guessing it's a combination of both of the reasons to skip below... (least sure of this one)
if (realLeading != 0)
skipAdjust = YES;
// does the descent slip outside the bounding box?
if (-realDescent <= NSMinY(boundingRect))
// yes I guess we should assume accents don't collide with the previous line's descent, though I'm not as sure of that as I am about the else clause below...
skipAdjust = YES;
} else {
// ascent outside bounding box ascent does not include accents
// only skip adjustment if there isn't leading (apparently some fonts use the previous line's leading for accents? :/ )
if (realLeading != 0)
skipAdjust = YES;
}
if (!skipAdjust) {
UniChar ch = 0xC0;
CGGlyph glyph;
// there does not seem to be an AppKit API for this...
if (CTFontGetGlyphsForCharacters((CTFontRef) f, &ch, &glyph, 1) != false) {
NSRect bbox;
bbox = [f boundingRectForGlyph:glyph];
if (NSMaxY(bbox) > realAscent)
doAdjust = YES;
if (-realDescent > NSMinY(bbox))
doAdjust = YES;
}
}
// TODO vertical
v = [f ascender];
// TODO get this one back out
if (doAdjust)
v += 0.2 * ([f ascender] + [f descender]);
//v = floor(v + 0.5);
if (li.ascent < v)
li.ascent = v;
v = -[f descender];// floor(-[f descender] + 0.5);
if (li.descent < v)
li.descent = v;
v = [f leading];//floor([f leading] + 0.5);
if (li.leading < v)
li.leading = v;
}];
li.ascent = floor(li.ascent + 0.5);
li.descent = floor(li.descent + 0.5);
li.leading = floor(li.leading + 0.5);
[tl->lineInfo addObject:li];
[li release];
index = glyphRange.location + glyphRange.length;
}
// and finally copy the UTF-16 to UTF-8 index conversion table
tl->u16tou8 = attrstrCopyUTF16ToUTF8(s, &(tl->nu16tou8));
return tl;
}
void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
{
uiFree(tl->u16tou8);
[tl->lineInfo release];
[tl->layoutManager release];
[tl->container release];
[tl->attrstr release];
uiFree(tl);
}
// TODO document that (x,y) is the top-left corner of the *entire frame*
void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
{
NSGraphicsContext *gc;
CGContextFlush(c->c); // just to be safe
[NSGraphicsContext saveGraphicsState];
gc = [NSGraphicsContext graphicsContextWithGraphicsPort:c->c flipped:YES];
[NSGraphicsContext setCurrentContext:gc];
// TODO is this the right point?
// TODO does this draw with the proper default styles?
[tl->layoutManager drawGlyphsForGlyphRange:[tl->layoutManager glyphRangeForTextContainer:tl->container]
atPoint:NSMakePoint(x, y)];
[gc flushGraphics]; // just to be safe
[NSGraphicsContext restoreGraphicsState];
// TODO release gc?
}
// TODO update all of these {
// TODO document that the width and height of a layout is not necessarily the sum of the widths and heights of its constituent lines; this is definitely untrue on OS X, where lines are placed in such a way that the distance between baselines is always integral
// TODO width doesn't include trailing whitespace...
// TODO figure out how paragraph spacing should play into this
// }
void uiDrawTextLayoutExtents(uiDrawTextLayout *tl, double *width, double *height)
{
NSRect r;
// see https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/TextLayout/Tasks/StringHeight.html
r = [tl->layoutManager usedRectForTextContainer:tl->container];
*width = r.size.width;
*height = r.size.height;
}
int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl)
{
return [tl->lineInfo count];
}
void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end)
{
lineInfo *li;
li = (lineInfo *) [tl->lineInfo objectAtIndex:line];
*start = tl->u16tou8[li.characterRange.location];
*end = tl->u16tou8[li.characterRange.location + li.characterRange.length];
}
void uiDrawTextLayoutLineGetMetrics(uiDrawTextLayout *tl, int line, uiDrawTextLayoutLineMetrics *m)
{
lineInfo *li;
li = (lineInfo *) [tl->lineInfo objectAtIndex:line];
m->X = li.lineRect.origin.x;
m->Y = li.lineRect.origin.y;
// if we use li.lineRect here we get the whole line, not just the part with stuff in it
m->Width = li.lineUsedRect.size.width;
m->Height = li.lineRect.size.height;
// TODO is this correct?
m->BaselineY = (m->Y + m->Height) - li.baselineOffset;
m->Ascent = li.ascent;
m->Descent = li.descent;
m->Leading = li.leading;
// TODO
m->ParagraphSpacingBefore = 0;
m->LineHeightSpace = 0;
m->LineSpacing = 0;
m->ParagraphSpacing = 0;
}
void uiDrawTextLayoutHitTest(uiDrawTextLayout *tl, double x, double y, uiDrawTextLayoutHitTestResult *result)
{
#if 0 /* TODO */
CFIndex i;
CTLineRef line;
CFIndex pos;
if (y >= 0) {
for (i = 0; i < tl->nLines; i++) {
double ltop, lbottom;
ltop = tl->lineMetrics[i].Y;
lbottom = ltop + tl->lineMetrics[i].Height;
if (y >= ltop && y < lbottom)
break;
}
result->YPosition = uiDrawTextLayoutHitTestPositionInside;
if (i == tl->nLines) {
i--;
result->YPosition = uiDrawTextLayoutHitTestPositionAfter;
}
} else {
i = 0;
result->YPosition = uiDrawTextLayoutHitTestPositionBefore;
}
result->Line = i;
result->XPosition = uiDrawTextLayoutHitTestPositionInside;
if (x < tl->lineMetrics[i].X) {
result->XPosition = uiDrawTextLayoutHitTestPositionBefore;
// and forcibly return the first character
x = tl->lineMetrics[i].X;
} else if (x > (tl->lineMetrics[i].X + tl->lineMetrics[i].Width)) {
result->XPosition = uiDrawTextLayoutHitTestPositionAfter;
// and forcibly return the last character
x = tl->lineMetrics[i].X + tl->lineMetrics[i].Width;
}
line = (CTLineRef) CFArrayGetValueAtIndex(tl->lines, i);
// TODO copy the part from the docs about this point
pos = CTLineGetStringIndexForPosition(line, CGPointMake(x, 0));
if (pos == kCFNotFound) {
// TODO
}
result->Pos = tl->u16tou8[pos];
#endif
}
void uiDrawTextLayoutByteRangeToRectangle(uiDrawTextLayout *tl, size_t start, size_t end, uiDrawTextLayoutByteRangeRectangle *r)
{
}

View File

@ -0,0 +1,223 @@
// 3 january 2017
#import "uipriv_darwin.h"
// Stupidity: Core Text requires an **exact match for the entire traits dictionary**, otherwise it will **drop ALL the traits**.
// This seems to be true for every function in Core Text that advertises that it performs font matching; I can confirm at the time of writing this is the case for
// - CTFontDescriptorCreateMatchingFontDescriptors() (though the conditions here seem odd)
// - CTFontCreateWithFontDescriptor()
// - CTFontCreateCopyWithAttributes()
// And as a bonus prize, this also applies to Cocoa's NSFontDescriptor methods as well!
// We have to implement the closest match ourselves.
// This needs to be done early in the matching process; in particular, we have to do this before adding any features (such as small caps), because the matching descriptors won't have those.
struct closeness {
NSUInteger index;
double weight;
double italic;
double stretch;
double distance;
};
static double doubleAttr(NSDictionary *traits, NSString *attr)
{
NSNumber *n;
n = (NSNumber *) [traits objectForKey:attr];
return [n doubleValue];
}
struct italicCloseness {
double normal;
double oblique;
double italic;
};
// remember that in closeness, 0 means exact
// in this case, since we define the range, we use 0.5 to mean "close enough" (oblique for italic and italic for oblique) and 1 to mean "not a match"
static const struct italicCloseness italicClosenesses[] = {
[uiDrawTextItalicNormal] = { 0, 1, 1 },
[uiDrawTextItalicOblique] = { 1, 0, 0.5 },
[uiDrawTextItalicItalic] = { 1, 0.5, 0 },
};
// Italics are hard because Core Text does NOT distinguish between italic and oblique.
// All Core Text provides is a slant value and the italic bit of the symbolic traits mask.
// However, Core Text does seem to guarantee (from experimentation; see below) that the slant will be nonzero if and only if the italic bit is set, so we don't need to use the slant value.
// Core Text also seems to guarantee that if a font lists itself as Italic or Oblique by name (font subfamily name, font style name, whatever), it will also have that bit set, so testing this bit does cover all fonts that name themselves as Italic and Oblique. (Again, this is from the below experimentation.)
// TODO there is still one catch that might matter from a user's POV: the reverse is not true the italic bit can be set even if the style of the font face/subfamily/style isn't named as Italic (for example, script typefaces like Adobe's Palace Script MT Std); I don't know what to do about this... I know how to start: find a script font that has an italic form (Adobe's Palace Script MT Std does not; only Regular and Semibold)
// TODO see if the above applies to Cocoa as well
static double italicCloseness(NSFontDescriptor *desc, NSDictionary *traits, uiDrawTextItalic italic)
{
const struct italicCloseness *ic = &(italicClosenesses[italic]);
NSNumber *num;
NSFontSymbolicTraits symbolic;
NSString *styleName;
NSRange range;
BOOL isOblique;
num = (NSNumber *) [traits objectForKey:NSFontSymbolicTrait];
// TODO this should really be a uint32_t-specific one
symbolic = (NSFontSymbolicTraits) [num unsignedIntegerValue];
if ((symbolic & NSFontItalicTrait) == 0)
return ic->normal;
// Okay, now we know it's either Italic or Oblique
// Pango's Core Text code just does a g_strrstr() (backwards case-sensitive search) for "Oblique" in the font's style name (see https://git.gnome.org/browse/pango/tree/pango/pangocoretext-fontmap.c); let's do that too I guess
// note that NSFontFaceAttribute is the Cocoa equivalent of the style name
isOblique = NO; // default value
styleName = (NSString *) [desc objectForKey:NSFontFaceAttribute];
// TODO is styleName guaranteed?
// TODO NSLiteralSearch?
range = [styleName rangeOfString:@"Oblique" options:NSCaseInsensitiveSearch];
if (range.location != NSNotFound)
return ic->oblique;
return ic->italic;
}
static NSFontDescriptor *matchTraits(NSFontDescriptor *against, double targetWeight, uiDrawTextItalic targetItalic, double targetStretch)
{
NSArray<NSFontDescriptor *> *matching;
NSUInteger i, n;
struct closeness *closeness;
NSFontDescriptor *current;
NSFontDescriptor *out;
matching = [against matchingFontDescriptorsWithMandatoryKeys:nil];
if (matching == nil)
// no matches; give the original back and hope for the best
return against;
n = [matching count];
if (n == 0) {
// likewise
//TODO [matching release];
return against;
}
closeness = (struct closeness *) uiAlloc(n * sizeof (struct closeness), "struct closeness[]");
for (i = 0; i < n; i++) {
NSDictionary *traits;
closeness[i].index = i;
current = (NSFontDescriptor *) [matching objectAtIndex:i];
traits = (NSDictionary *) [current objectForKey:NSFontTraitsAttribute];
if (traits == nil) {
// couldn't get traits; be safe by ranking it lowest
// LONGTERM figure out what the longest possible distances are
closeness[i].weight = 3;
closeness[i].italic = 2;
closeness[i].stretch = 3;
continue;
}
closeness[i].weight = doubleAttr(traits, NSFontWeightTrait) - targetWeight;
closeness[i].italic = italicCloseness(current, traits, targetItalic);
closeness[i].stretch = doubleAttr(traits, NSFontWidthTrait) - targetStretch;
// TODO release traits?
}
// now figure out the 3-space difference between the three and sort by that
// TODO merge this loop with the previous loop?
for (i = 0; i < n; i++) {
double weight, italic, stretch;
weight = closeness[i].weight;
weight *= weight;
italic = closeness[i].italic;
italic *= italic;
stretch = closeness[i].stretch;
stretch *= stretch;
closeness[i].distance = sqrt(weight + italic + stretch);
}
qsort_b(closeness, n, sizeof (struct closeness), ^(const void *aa, const void *bb) {
const struct closeness *a = (const struct closeness *) aa;
const struct closeness *b = (const struct closeness *) bb;
// via http://www.gnu.org/software/libc/manual/html_node/Comparison-Functions.html#Comparison-Functions
// LONGTERM is this really the best way? isn't it the same as if (*a < *b) return -1; if (*a > *b) return 1; return 0; ?
return (a->distance > b->distance) - (a->distance < b->distance);
});
// and the first element of the sorted array is what we want
out = (NSFontDescriptor *) [matching objectAtIndex:closeness[0].index];
// TODO is this correct?
[out retain]; // get rule
// release everything
uiFree(closeness);
//TODO [matching release];
// and release the original descriptor since we no longer need it
[against release];
return out;
}
// since uiDrawTextWeight effectively corresponds to OS/2 weights (which roughly correspond to GDI, Pango, and DirectWrite weights, and to a lesser(? TODO) degree, CSS weights), let's just do what Core Text does with OS/2 weights
// TODO this will not be correct for system fonts, which use cached values that have no relation to the OS/2 weights; we need to figure out how to reconcile these
// for more information, see https://bugzilla.gnome.org/show_bug.cgi?id=766148 and TODO_put_blog_post_here_once_I_write_it (TODO keep this line when resolving the above TODO)
static const double weightsToCTWeights[] = {
-1.0, // 0..99
-0.7, // 100..199
-0.5, // 200..299
-0.23, // 300..399
0.0, // 400..499
0.2, // 500..599
0.3, // 600..699
0.4, // 700..799
0.6, // 800..899
0.8, // 900..999
1.0, // 1000
};
static double weightToCTWeight(uiDrawTextWeight weight)
{
int weightClass;
double ctclass;
double rest, weightFloor, nextFloor;
if (weight <= 0)
return -1.0;
if (weight >= 1000)
return 1.0;
weightClass = weight / 100;
rest = (double) weight;
weightFloor = (double) (weightClass * 100);
nextFloor = (double) ((weightClass + 1) * 100);
rest = (rest - weightFloor) / (nextFloor - weightFloor);
ctclass = weightsToCTWeights[weightClass];
return fma(rest,
weightsToCTWeights[weightClass + 1] - ctclass,
ctclass);
}
// based on what Core Text says about actual fonts (system fonts, system fonts in another folder to avoid using cached values, Adobe Font Folio 11, Google Fonts archive, fonts in Windows 7/8.1/10)
static const double stretchesToCTWidths[] = {
[uiDrawTextStretchUltraCondensed] = -0.400000,
[uiDrawTextStretchExtraCondensed] = -0.300000,
[uiDrawTextStretchCondensed] = -0.200000,
[uiDrawTextStretchSemiCondensed] = -0.100000,
[uiDrawTextStretchNormal] = 0.000000,
[uiDrawTextStretchSemiExpanded] = 0.100000,
[uiDrawTextStretchExpanded] = 0.200000,
[uiDrawTextStretchExtraExpanded] = 0.300000,
// this one isn't present in any of the fonts I tested, but it follows naturally from the pattern of the rest, so... (TODO verify by checking the font files directly)
[uiDrawTextStretchUltraExpanded] = 0.400000,
};
NSFontDescriptor *fontdescToNSFontDescriptor(uiDrawFontDescriptor *fd)
{
NSMutableDictionary *attrs;
NSFontDescriptor *basedesc;
attrs = [NSMutableDictionary new];
[attrs setObject:[NSString stringWithUTF8String:fd->Family]
forKey:NSFontFamilyAttribute];
[attrs setObject:[NSNumber numberWithDouble:fd->Size]
forKey:NSFontSizeAttribute];
basedesc = [[NSFontDescriptor alloc] initWithFontAttributes:attrs];
[attrs release];
return matchTraits(basedesc,
weightToCTWeight(fd->Weight),
fd->Italic,
stretchesToCTWidths[fd->Stretch]);
}

View File

@ -0,0 +1,268 @@
// 6 september 2015
#import "uipriv_darwin.h"
// TODO double-check that we are properly handling allocation failures (or just toll free bridge from cocoa)
struct uiDrawFontFamilies {
CFArrayRef fonts;
};
uiDrawFontFamilies *uiDrawListFontFamilies(void)
{
uiDrawFontFamilies *ff;
ff = uiNew(uiDrawFontFamilies);
ff->fonts = CTFontManagerCopyAvailableFontFamilyNames();
if (ff->fonts == NULL)
implbug("error getting available font names (no reason specified) (TODO)");
return ff;
}
int uiDrawFontFamiliesNumFamilies(uiDrawFontFamilies *ff)
{
return CFArrayGetCount(ff->fonts);
}
char *uiDrawFontFamiliesFamily(uiDrawFontFamilies *ff, int n)
{
CFStringRef familystr;
char *family;
familystr = (CFStringRef) CFArrayGetValueAtIndex(ff->fonts, n);
// toll-free bridge
family = uiDarwinNSStringToText((NSString *) familystr);
// Get Rule means we do not free familystr
return family;
}
void uiDrawFreeFontFamilies(uiDrawFontFamilies *ff)
{
CFRelease(ff->fonts);
uiFree(ff);
}
struct uiDrawTextFont {
CTFontRef f;
};
uiDrawTextFont *mkTextFont(CTFontRef f, BOOL retain)
{
uiDrawTextFont *font;
font = uiNew(uiDrawTextFont);
font->f = f;
if (retain)
CFRetain(font->f);
return font;
}
uiDrawTextFont *mkTextFontFromNSFont(NSFont *f)
{
// toll-free bridging; we do retain, though
return mkTextFont((CTFontRef) f, YES);
}
static CFMutableDictionaryRef newAttrList(void)
{
CFMutableDictionaryRef attr;
attr = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
if (attr == NULL)
complain("error creating attribute dictionary in newAttrList()()");
return attr;
}
static void addFontFamilyAttr(CFMutableDictionaryRef attr, const char *family)
{
CFStringRef cfstr;
cfstr = CFStringCreateWithCString(NULL, family, kCFStringEncodingUTF8);
if (cfstr == NULL)
complain("error creating font family name CFStringRef in addFontFamilyAttr()");
CFDictionaryAddValue(attr, kCTFontFamilyNameAttribute, cfstr);
CFRelease(cfstr); // dictionary holds its own reference
}
static void addFontSizeAttr(CFMutableDictionaryRef attr, double size)
{
CFNumberRef n;
n = CFNumberCreate(NULL, kCFNumberDoubleType, &size);
CFDictionaryAddValue(attr, kCTFontSizeAttribute, n);
CFRelease(n);
}
#if 0
TODO
// See http://stackoverflow.com/questions/4810409/does-coretext-support-small-caps/4811371#4811371 and https://git.gnome.org/browse/pango/tree/pango/pangocoretext-fontmap.c for what these do
// And fortunately, unlike the traits (see below), unmatched features are simply ignored without affecting the other features :D
static void addFontSmallCapsAttr(CFMutableDictionaryRef attr)
{
CFMutableArrayRef outerArray;
CFMutableDictionaryRef innerDict;
CFNumberRef numType, numSelector;
int num;
outerArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
if (outerArray == NULL)
complain("error creating outer CFArray for adding small caps attributes in addFontSmallCapsAttr()");
// Apple's headers say these are deprecated, but a few fonts still rely on them
num = kLetterCaseType;
numType = CFNumberCreate(NULL, kCFNumberIntType, &num);
num = kSmallCapsSelector;
numSelector = CFNumberCreate(NULL, kCFNumberIntType, &num);
innerDict = newAttrList();
CFDictionaryAddValue(innerDict, kCTFontFeatureTypeIdentifierKey, numType);
CFRelease(numType);
CFDictionaryAddValue(innerDict, kCTFontFeatureSelectorIdentifierKey, numSelector);
CFRelease(numSelector);
CFArrayAppendValue(outerArray, innerDict);
CFRelease(innerDict); // and likewise for CFArray
// these are the non-deprecated versions of the above; some fonts have these instead
num = kLowerCaseType;
numType = CFNumberCreate(NULL, kCFNumberIntType, &num);
num = kLowerCaseSmallCapsSelector;
numSelector = CFNumberCreate(NULL, kCFNumberIntType, &num);
innerDict = newAttrList();
CFDictionaryAddValue(innerDict, kCTFontFeatureTypeIdentifierKey, numType);
CFRelease(numType);
CFDictionaryAddValue(innerDict, kCTFontFeatureSelectorIdentifierKey, numSelector);
CFRelease(numSelector);
CFArrayAppendValue(outerArray, innerDict);
CFRelease(innerDict); // and likewise for CFArray
CFDictionaryAddValue(attr, kCTFontFeatureSettingsAttribute, outerArray);
CFRelease(outerArray);
}
#endif
#if 0
// Named constants for these were NOT added until 10.11, and even then they were added as external symbols instead of macros, so we can't use them directly :(
// kode54 got these for me before I had access to El Capitan; thanks to him.
#define ourNSFontWeightUltraLight -0.800000
#define ourNSFontWeightThin -0.600000
#define ourNSFontWeightLight -0.400000
#define ourNSFontWeightRegular 0.000000
#define ourNSFontWeightMedium 0.230000
#define ourNSFontWeightSemibold 0.300000
#define ourNSFontWeightBold 0.400000
#define ourNSFontWeightHeavy 0.560000
#define ourNSFontWeightBlack 0.620000
#endif
// Now remember what I said earlier about having to add the small caps traits after calling the above? This gets a dictionary back so we can do so.
CFMutableDictionaryRef extractAttributes(CTFontDescriptorRef desc)
{
CFDictionaryRef dict;
CFMutableDictionaryRef mdict;
dict = CTFontDescriptorCopyAttributes(desc);
// this might not be mutable, so make a mutable copy
mdict = CFDictionaryCreateMutableCopy(NULL, 0, dict);
CFRelease(dict);
return mdict;
}
uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc)
{
CTFontRef f;
CFMutableDictionaryRef attr;
CTFontDescriptorRef cfdesc;
attr = newAttrList();
addFontFamilyAttr(attr, desc->Family);
addFontSizeAttr(attr, desc->Size);
// now we have to do the traits matching, so create a descriptor, match the traits, and then get the attributes back
cfdesc = CTFontDescriptorCreateWithAttributes(attr);
// TODO release attr?
cfdesc = matchTraits(cfdesc, desc->Weight, desc->Italic, desc->Stretch);
// specify the initial size again just to be safe
f = CTFontCreateWithFontDescriptor(cfdesc, desc->Size, NULL);
// TODO release cfdesc?
return mkTextFont(f, NO); // we hold the initial reference; no need to retain again
}
void uiDrawFreeTextFont(uiDrawTextFont *font)
{
CFRelease(font->f);
uiFree(font);
}
uintptr_t uiDrawTextFontHandle(uiDrawTextFont *font)
{
return (uintptr_t) (font->f);
}
void uiDrawTextFontDescribe(uiDrawTextFont *font, uiDrawTextFontDescriptor *desc)
{
// TODO
}
// text sizes and user space points are identical:
// - https://developer.apple.com/library/mac/documentation/TextFonts/Conceptual/CocoaTextArchitecture/TypoFeatures/TextSystemFeatures.html#//apple_ref/doc/uid/TP40009459-CH6-51627-BBCCHIFF text points are 72 per inch
// - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html#//apple_ref/doc/uid/TP40003290-CH204-SW5 user space points are 72 per inch
void uiDrawTextFontGetMetrics(uiDrawTextFont *font, uiDrawTextFontMetrics *metrics)
{
metrics->Ascent = CTFontGetAscent(font->f);
metrics->Descent = CTFontGetDescent(font->f);
metrics->Leading = CTFontGetLeading(font->f);
metrics->UnderlinePos = CTFontGetUnderlinePosition(font->f);
metrics->UnderlineThickness = CTFontGetUnderlineThickness(font->f);
}
// LONGTERM allow line separation and leading to be factored into a wrapping text layout
// TODO reconcile differences in character wrapping on platforms
void uiDrawTextLayoutExtents(uiDrawTextLayout *layout, double *width, double *height)
{
struct framesetter fs;
mkFramesetter(layout, &fs);
*width = fs.extents.width;
*height = fs.extents.height;
freeFramesetter(&fs);
}
// LONGTERM provide an equivalent to CTLineGetTypographicBounds() on uiDrawTextLayout?
// LONGTERM keep this for later features and documentation purposes
#if 0
// LONGTERM provide a way to get the image bounds as a separate function later
bounds = CTLineGetImageBounds(line, c);
// though CTLineGetImageBounds() returns CGRectNull on error, it also returns CGRectNull on an empty string, so we can't reasonably check for error
// CGContextSetTextPosition() positions at the baseline in the case of CTLineDraw(); we need the top-left corner instead
CTLineGetTypographicBounds(line, &yoff, NULL, NULL);
// remember that we're flipped, so we subtract
y -= yoff;
CGContextSetTextPosition(c, x, y);
#endif
#if 0
void uiDrawTextLayoutSetColor(uiDrawTextLayout *layout, int startChar, int endChar, double r, double g, double b, double a)
{
CGColorSpaceRef colorspace;
CGFloat components[4];
CGColorRef color;
// for consistency with windows, use sRGB
colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
components[0] = r;
components[1] = g;
components[2] = b;
components[3] = a;
color = CGColorCreate(colorspace, components);
CGColorSpaceRelease(colorspace);
CFAttributedStringSetAttribute(layout->mas,
rangeToCFRange(),
kCTForegroundColorAttributeName,
color);
CGColorRelease(color); // TODO safe?
}
#endif

View File

@ -0,0 +1,314 @@
// 2 january 2017
#import "uipriv_darwin.h"
#import "draw.h"
// TODO on an empty string nLines == 0
// we must prevent this somehow
// TODO in general, every function could be more robust, but we cannot have a situation where there are zero lines
// TODO what happens to extents if only whitespace?
struct uiDrawTextLayout {
CFAttributedStringRef attrstr;
// the width as passed into uiDrawTextLayout constructors
double width;
CTFramesetterRef framesetter;
// the *actual* size of the frame
// note: technically, metrics returned from frame are relative to CGPathGetPathBoundingBox(tl->path)
// however, from what I can gather, for a path created by CGPathCreateWithRect(), like we do (with a NULL transform), CGPathGetPathBoundingBox() seems to just return the standardized form of the rect used to create the path
// (this I confirmed through experimentation)
// so we can just use tl->size for adjustments
// we don't need to adjust coordinates by any origin since our rect origin is (0, 0)
CGSize size;
CGPathRef path;
CTFrameRef frame;
CFArrayRef lines;
CFIndex nLines;
// we compute this once when first creating the layout
uiDrawTextLayoutLineMetrics *lineMetrics;
NSArray *backgroundBlocks;
// for converting CFAttributedString indices from/to byte offsets
size_t *u8tou16;
size_t nUTF8;
size_t *u16tou8;
size_t nUTF16;
};
// TODO document that lines may or may not overlap because ours do in the case of multiple combining characters
static uiDrawTextLayoutLineMetrics *computeLineMetrics(CTFrameRef frame, CGSize size)
{
uiDrawTextLayoutLineMetrics *metrics;
CFArrayRef lines;
CTLineRef line;
CFIndex i, n;
CGFloat ypos;
CGRect bounds, boundsNoLeading;
CGFloat ascent, descent, leading;
CGPoint *origins;
lines = CTFrameGetLines(frame);
n = CFArrayGetCount(lines);
metrics = (uiDrawTextLayoutLineMetrics *) uiAlloc(n * sizeof (uiDrawTextLayoutLineMetrics), "uiDrawTextLayoutLineMetrics[] (text layout)");
origins = (CGPoint *) uiAlloc(n * sizeof (CGPoint), "CGPoint[] (text layout)");
CTFrameGetLineOrigins(frame, CFRangeMake(0, n), origins);
ypos = size.height;
for (i = 0; i < n; i++) {
line = (CTLineRef) CFArrayGetValueAtIndex(lines, i);
bounds = CTLineGetBoundsWithOptions(line, 0);
boundsNoLeading = CTLineGetBoundsWithOptions(line, kCTLineBoundsExcludeTypographicLeading);
// this is equivalent to boundsNoLeading.size.height + boundsNoLeading.origin.y (manually verified)
ascent = bounds.size.height + bounds.origin.y;
descent = -boundsNoLeading.origin.y;
leading = -bounds.origin.y - descent;
// Core Text always rounds these up for paragraph style calculations; there is a flag to control it but it's inaccessible (and this behavior is turned off for old versions of iPhoto)
ascent = floor(ascent + 0.5);
descent = floor(descent + 0.5);
if (leading > 0)
leading = floor(leading + 0.5);
metrics[i].X = origins[i].x;
metrics[i].Y = origins[i].y - descent - leading;
metrics[i].Width = bounds.size.width;
metrics[i].Height = ascent + descent + leading;
metrics[i].BaselineY = origins[i].y;
metrics[i].Ascent = ascent;
metrics[i].Descent = descent;
metrics[i].Leading = leading;
// TODO
metrics[i].ParagraphSpacingBefore = 0;
metrics[i].LineHeightSpace = 0;
metrics[i].LineSpacing = 0;
metrics[i].ParagraphSpacing = 0;
// and finally advance to the next line
ypos += metrics[i].Height;
}
// okay, but now all these metrics are unflipped
// we need to flip them
for (i = 0; i < n; i++) {
metrics[i].Y = size.height - metrics[i].Y;
// go from bottom-left corner to top-left
metrics[i].Y -= metrics[i].Height;
metrics[i].BaselineY = size.height - metrics[i].BaselineY;
}
uiFree(origins);
return metrics;
}
uiDrawTextLayout *uiDrawNewTextLayout(uiDrawTextLayoutParams *p)
{
uiDrawTextLayout *tl;
CGFloat cgwidth;
CFRange range, unused;
CGRect rect;
tl = uiNew(uiDrawTextLayout);
tl->attrstr = attrstrToCoreFoundation(p, &(tl->backgroundBlocks));
range.location = 0;
range.length = CFAttributedStringGetLength(tl->attrstr);
tl->width = p->Width;
// TODO kCTParagraphStyleSpecifierMaximumLineSpacing, kCTParagraphStyleSpecifierMinimumLineSpacing, kCTParagraphStyleSpecifierLineSpacingAdjustment for line spacing
tl->framesetter = CTFramesetterCreateWithAttributedString(tl->attrstr);
if (tl->framesetter == NULL) {
// TODO
}
cgwidth = (CGFloat) (tl->width);
if (cgwidth < 0)
cgwidth = CGFLOAT_MAX;
tl->size = CTFramesetterSuggestFrameSizeWithConstraints(tl->framesetter,
range,
// TODO kCTFramePathWidthAttributeName?
NULL,
CGSizeMake(cgwidth, CGFLOAT_MAX),
&unused); // not documented as accepting NULL (TODO really?)
rect.origin = CGPointZero;
rect.size = tl->size;
tl->path = CGPathCreateWithRect(rect, NULL);
tl->frame = CTFramesetterCreateFrame(tl->framesetter,
range,
tl->path,
// TODO kCTFramePathWidthAttributeName?
NULL);
if (tl->frame == NULL) {
// TODO
}
tl->lines = CTFrameGetLines(tl->frame);
tl->nLines = CFArrayGetCount(tl->lines);
tl->lineMetrics = computeLineMetrics(tl->frame, tl->size);
// and finally copy the UTF-8/UTF-16 conversion tables
tl->u8tou16 = attrstrCopyUTF8ToUTF16(p->String, &(tl->nUTF8));
tl->u16tou8 = attrstrCopyUTF16ToUTF8(p->String, &(tl->nUTF16));
return tl;
}
void uiDrawFreeTextLayout(uiDrawTextLayout *tl)
{
uiFree(tl->u16tou8);
uiFree(tl->u8tou16);
[tl->backgroundBlocks release];
uiFree(tl->lineMetrics);
CFRelease(tl->frame);
CFRelease(tl->path);
CFRelease(tl->framesetter);
CFRelease(tl->attrstr);
uiFree(tl);
}
// TODO document that (x,y) is the top-left corner of the *entire frame*
void uiDrawText(uiDrawContext *c, uiDrawTextLayout *tl, double x, double y)
{
backgroundBlock b;
CGAffineTransform textMatrix;
CGContextSaveGState(c->c);
// save the text matrix because it's not part of the graphics state
textMatrix = CGContextGetTextMatrix(c->c);
for (b in tl->backgroundBlocks)
b(c, tl, x, y);
// Core Text doesn't draw onto a flipped view correctly; we have to pretend it was unflipped
// see the iOS bits of the first example at https://developer.apple.com/library/mac/documentation/StringsTextFonts/Conceptual/CoreText_Programming/LayoutOperations/LayoutOperations.html#//apple_ref/doc/uid/TP40005533-CH12-SW1 (iOS is naturally flipped)
// TODO how is this affected by a non-identity CTM?
CGContextTranslateCTM(c->c, 0, c->height);
CGContextScaleCTM(c->c, 1.0, -1.0);
CGContextSetTextMatrix(c->c, CGAffineTransformIdentity);
// wait, that's not enough; we need to offset y values to account for our new flipping
// TODO explain this calculation
y = c->height - tl->size.height - y;
// CTFrameDraw() draws in the path we specified when creating the frame
// this means that in our usage, CTFrameDraw() will draw at (0,0)
// so move the origin to be at (x,y) instead
// TODO are the signs correct?
CGContextTranslateCTM(c->c, x, y);
CTFrameDraw(tl->frame, c->c);
CGContextSetTextMatrix(c->c, textMatrix);
CGContextRestoreGState(c->c);
}
// TODO document that the width and height of a layout is not necessarily the sum of the widths and heights of its constituent lines
// TODO width doesn't include trailing whitespace...
// TODO figure out how paragraph spacing should play into this
void uiDrawTextLayoutExtents(uiDrawTextLayout *tl, double *width, double *height)
{
*width = tl->size.width;
*height = tl->size.height;
}
int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl)
{
return tl->nLines;
}
void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end)
{
CTLineRef lr;
CFRange range;
lr = (CTLineRef) CFArrayGetValueAtIndex(tl->lines, line);
range = CTLineGetStringRange(lr);
*start = tl->u16tou8[range.location];
*end = tl->u16tou8[range.location + range.length];
}
void uiDrawTextLayoutLineGetMetrics(uiDrawTextLayout *tl, int line, uiDrawTextLayoutLineMetrics *m)
{
*m = tl->lineMetrics[line];
}
// in the case of overlapping lines, we read lines first to last and use their bottommost point (Y + Height) to determine where the next line should start for hit-testing
// TODO should we document this?
void uiDrawTextLayoutHitTest(uiDrawTextLayout *tl, double x, double y, size_t *pos, int *line)
{
int i;
CTLineRef ln;
CFIndex p;
for (i = 0; i < tl->nLines; i++) {
double ltop, lbottom;
ltop = tl->lineMetrics[i].Y;
lbottom = ltop + tl->lineMetrics[i].Height;
// y will already >= ltop at this point since the past lbottom should == (or at least >=, see above) ltop
if (y < lbottom)
break;
}
if (i == tl->nLines)
i--;
*line = i;
ln = (CTLineRef) CFArrayGetValueAtIndex(tl->lines, i);
// note: according to the docs, we pass a y of 0 for this since the is the baseline of that line (the point is relative to the line)
// note: x is relative to the line origin
x -= tl->lineMetrics[*line].X;
p = CTLineGetStringIndexForPosition(ln, CGPointMake(x, 0));
if (p == kCFNotFound) {
// TODO
}
*pos = tl->u16tou8[p];
}
double uiDrawTextLayoutByteLocationInLine(uiDrawTextLayout *tl, size_t pos, int line)
{
CTLineRef lr;
CFRange range;
pos = tl->u8tou16[pos];
if (line < 0 || line >= tl->nLines)
return -1;
lr = (CTLineRef) CFArrayGetValueAtIndex(tl->lines, line);
range = CTLineGetStringRange(lr);
// note: >, not >=, because the position at end is valid!
if (pos < range.location || pos > (range.location + range.length))
return -1;
// no point in checking the return; we already validated everything and 0 is a valid return for the first index :/
// note: the result is relative to the line origin (TODO find documentation to support this)
// TODO document that these functions do this
return CTLineGetOffsetForStringIndex(lr, pos, NULL) + tl->lineMetrics[line].X;
}
void caretDrawParams(uiDrawContext *c, double height, struct caretDrawParams *p)
{
NSColor *cc;
CGFloat cr, cg, cb, ca;
// Interface Builder sets this as the insertion point color for a NSTextView by default
cc = [NSColor controlTextColor];
// the given color may not be an RGBA color, which will cause the -getRed:green:blue:alpha: call to throw an exception
cc = [cc colorUsingColorSpace:[NSColorSpace sRGBColorSpace]];
[cc getRed:&cr green:&cg blue:&cb alpha:&ca];
p->r = cr;
p->g = cg;
p->b = cb;
p->a = ca;
// both cc and the controlTextColor it was made from will be autoreleased since they aren't new or init calls
// TODO disabled carets have some blending applied...
// okay there doesn't seem to be any defined metrics for these, argh...
p->width = 1;
p->xoff = 0;
}

View File

@ -0,0 +1,60 @@
darwin
int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl)
{
return CFArrayGetCount([tl->forLines lines]);
}
void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end)
{
CTLineRef lr;
CFRange range;
lr = (CTLineRef) CFArrayGetValueAtIndex([tl->forLines lines], line);
range = CTLineGetStringRange(lr);
*start = tl->u16tou8[range.location];
if (tl->empty)
*end = *start;
else
*end = tl->u16tou8[range.location + range.length];
}
unix
int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl)
{
return pango_layout_get_line_count(tl->layout);
}
void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end)
{
PangoLayoutLine *pll;
pll = pango_layout_get_line_readonly(tl->layout, line);
*start = pll->start_index;
*end = pll->start_index + pll->length;
// TODO unref pll?
}
windows
int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl)
{
return 0;
#if 0
TODO
return tl->nLines;
#endif
}
// DirectWrite doesn't provide a direct way to do this, so we have to do this manually
// TODO does that comment still apply here or to the code at the top of this file?
void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end)
{
#if 0
TODO
*start = tl->lineInfo[line].startPos;
*start = tl->u16tou8[*start];
*end = tl->lineInfo[line].endPos - tl->lineInfo[line].newlineCount;
*end = tl->u16tou8[*end];
#endif
}

View File

@ -0,0 +1,72 @@
typedef struct uiDrawTextLayoutLineMetrics uiDrawTextLayoutLineMetrics;
// Height will equal ParagraphSpacingBefore + LineHeightSpace + Ascent + Descent + Leading + LineSpacing + ParagraphSpacing.
// The above values are listed in vertical order, from top to bottom.
// Ascent + Descent + Leading will give you the typographic bounds
// of the text. BaselineY is the boundary between Ascent and Descent.
// X, Y, and BaselineY are all in the layout's coordinate system, so the
// start point of the baseline will be at (X, BaselineY). All values are
// nonnegative.
struct uiDrawTextLayoutLineMetrics {
// This describes the overall bounding box of the line.
double X;
double Y;
double Width;
double Height;
// This describes the typographic bounds of the line.
double BaselineY;
double Ascent;
double Descent;
double Leading;
// This describes any additional whitespace.
// TODO come up with better names for these.
double ParagraphSpacingBefore;
double LineHeightSpace;
double LineSpacing;
double ParagraphSpacing;
// TODO trailing whitespace?
};
// uiDrawTextLayoutNumLines() returns the number of lines in tl.
// This number will always be greater than or equal to 1; a text
// layout with no text only has one line.
_UI_EXTERN int uiDrawTextLayoutNumLines(uiDrawTextLayout *tl);
// uiDrawTextLayoutLineByteRange() returns the byte indices of the
// text that falls into the given line of tl as [start, end).
_UI_EXTERN void uiDrawTextLayoutLineByteRange(uiDrawTextLayout *tl, int line, size_t *start, size_t *end);
_UI_EXTERN void uiDrawTextLayoutLineGetMetrics(uiDrawTextLayout *tl, int line, uiDrawTextLayoutLineMetrics *m);
// TODO rewrite this documentation
// uiDrawTextLayoutHitTest() returns the byte offset and line closest
// to the given point. The point is relative to the top-left of the layout.
// If the point is outside the layout itself, the closest point is chosen;
// this allows the function to be used for cursor positioning with the
// mouse. Do keep the returned line in mind if used in this way; the
// user might click on the end of a line, at which point the cursor
// might be at the trailing edge of the last grapheme on the line
// (subject to the operating system's APIs).
_UI_EXTERN void uiDrawTextLayoutHitTest(uiDrawTextLayout *tl, double x, double y, size_t *pos, int *line);
// uiDrawTextLayoutByteLocationInLine() returns the point offset
// into the given line that the given byte position stands. This is
// relative to the line's X position (as returned by
// uiDrawTextLayoutLineGetMetrics()), which in turn is relative to
// the top-left of the layout. This function can be used for cursor
// positioning: if start and end are the start and end of the line
// (as returned by uiDrawTextLayoutLineByteRange()), you will get
// the correct offset, even if pos is at the end of the line. If pos is not
// in the range [start, end], a negative value will be returned,
// indicating you need to move the cursor to another line.
// TODO make sure this works right for right-aligned and center-aligned lines and justified lines and RTL text
_UI_EXTERN double uiDrawTextLayoutByteLocationInLine(uiDrawTextLayout *tl, size_t pos, int line);
_UI_EXTERN void uiDrawCaret(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t pos, int *line);
// TODO allow blinking
// TODO allow secondary carets

Some files were not shown because too many files have changed in this diff Show More