It has likely become unneccessary by recent fix for the common part.
Also backported a fix for uppercase issue from sdl2.0 branch (Define Windows native
function for mbstowcs/wcstombs).
When reading label text (on non-Windows, at least), fscanf("%lc")
was being used. It seemed to be skipping the initial space,
causing strings to be shifted left one, and end up with garbage
bytes at the far right.
Fixes https://sourceforge.net/p/tuxpaint/bugs/247/ I hope!
"Apply Label" mode of Label tool can be activated/deactivated,
though it doesn't currently do the work yet.
Also
* Modularized routine to select a Label (via click or [Enter] key):
`select_label_node()`
* Starting routine for applying a Label to the canvas
(via click or [Enter] key): `apply_label_node()`
* Modularized routine for repositioning the on-screen keyboard based on
where we're typing: `reposition_onscreen_keyboard()`
Seems likely that I broke some things.
Starting work towards
https://sourceforge.net/p/tuxpaint/feature-requests/213/
The ability to 'apply' a label to the canvas, making it permanent
(as if added using the "Text" tool instead).
Removed unused "label rotate" option's code (and hence addressed
a bug we didn't relalize when choosing the "Label" tool while in
in "--nostampcontrols" mode; the unused "rotate" button would appear).
Show tips when choosing brushes, to remind the user when they
are animated, and or rotational/directional.
Show tips when brush spacing is changed, specifying the approximate
spacing. Output is fuzzy, to avoid being overly technical (e.g., it
will never say "2 345/1000 times as big as" or "1/103 the size of")
Under Xcode with clang, Mark Kim was getting an error:
src/tuxpaint.c:23125:44: error: use of undeclared identifier 'i'
SDL_MapRGB(img_color_btns[i]->format,
^
Oddly, I was not getting errors no matter what nonsense I put
in there (e.g., changing "->format" to "->formatXYZ"), under
"gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)"
Forgot to wrap the color mixer's tip text printf() format string
in gettext(), which caused the static part of the text
("Your color is...") to not be translated. h/t to Shin-ichi for
pointing it out.
Say a color is a mix of 5 red, 4 blue, and 1 black.
It will show "5/10 (1/2) red, 4/10 (2/5) blue, 1/10 black."
Also, when adding multiple contributions of only one color (so far),
it will say, e.g., "entirely (3/3) red".
Rather than having a "current color" and averaging it with
the newly-added color, averaging the entire set of colors each time.
Before, if you added R + Y + B, you'd get a different color
than R + B + Y, or Y + B + R, etc.
Now, it starts fresh every time and averages the hues (when applicable),
saturations, and values of each color that's been added to the mix.
R + Y + B (combined in any order) currently always comes out a brownish
orange, as expected.
Show the color proportions (e.g., "entirely red", or "1/2 yellow and 1/2 green",
or "1/5 red, 2/5 blue, and 2/5 black") in the Tux tips area. Show the full
instructions again when the color is reset with the clear button.
(Also, label clear (trash) button with the word "Clear".)
Adjust HSV values for Red/Yellow/Blue. When drawing color,
drop V value very slightly (so white appears off-white).
Undo & Redo now have black icons/text if available, else grey.
Tweaks to icon. Further modularized how color button rendering works,
so it can handle selector (pipette) and mixer overlay icons.
Mixer function is basically identical to color picker (rainbow palette)
as a placeholder. WORK IN PROGRESS.
Also, modularize color picker's & color selector's method of
generating a fresh version of their active/inactive buttons,
after a color has been chosen by their tool.
A keyboard shortcut is now available for picking colors from
the canvas more quickly. Hold either (left or right) [Ctrl] key
while clicking, and the color selector option will appear.
Release the mouse button over a color on the canvas to choose it
(or outside the canvas to abort).
Closes https://sourceforge.net/p/tuxpaint/feature-requests/209/
Also,
* Don't play 'bubble' paint sound when color picker or selector
are aborted (e.g., via their "Back" buttons).
* Replace many instances of "NUM_COLOR - 1" and "NUM_COLOR - 2"
(which correspond to color chose via picker (palette) and
selector (canvas), respectively) with #define's that
represent them. (Avoid magic numbers.)
The pick-a-color-from-the-canvas color selection feature
(the option in the color palette showing a pipette icon)
has been extended to support an immediate mode (return on
"mouse-up" event, don't show a "Back" button, and don't animate
the appearance of the color dialog at the bottom),
which will be used by a forthcoming feature that will offer
a keyboard shortcut to bring up this color selection option.
+ Stamps are scaled before they are colorized or tinted,
to increase performance.
+ The current stamp (in its current form: size, orientation,
and color) is cached, so it may be applied to the canvas
many times without having to re-render.
(No longer scaling and tinting every time you click.)
Closes https://sourceforge.net/p/tuxpaint/bugs/147/
(h/t Andre Anckaert)
No longer restricted to "the same as other UI buttons"
(e.g., 48x48 default) or "1/4th that size" (e.g., 24x24).
Will scale, allowing for larger buttons when appropriate.
h/t Anat Caspi for pointing out the continuing issue.
Closes https://sourceforge.net/p/tuxpaint/feature-requests/212/
* Rotating brush angle is now a double, not an int
* Don't draw once on click; require some motion
(does not affect directional brushes, which include
a "no movement" shape in the middle of the brush bitmap)
Following warnings still remain so far.
src/tuxpaint.c:199:2: warning: #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR" [-Wcpp]
199 | #warning "Attempting to define strcasestr(); if errors, build with -DHAVE_STRCASESTR"
| ^~~~~~~
src/parse.gperf: In function 'parse_one_option':
src/parse.gperf:306:45: warning: argument to 'sizeof' in 'memcpy' call is the same pointer type 'char *' as the destination; expected 'char' or an explicit length [-Wsizeof-pointer-memaccess]
306 | memcpy(offset+(char*)tmpcfg, &opt, sizeof(char*)); /* FIXME: This causes a warning; should it be 'sizeof(char)', or do we need to have the warning suppressed? -bjk 2021.10.14 */
| ^~~~
src/dirwalk.c: In function 'tp_ftw':
src/dirwalk.c:348:2: warning: #warning Failed to see DT_UNKNOWN [-Wcpp]
348 | #warning Failed to see DT_UNKNOWN
| ^~~~~~~
src/get_fname.c: In function 'get_fname':
src/get_fname.c💯3: warning: 'dir' may be used uninitialized in this function [-Wmaybe-uninitialized]
100 | snprintf(f, sizeof(f),
| ^~~~~~~~~~~~~~~~~~~~~~
101 | "%s%c%s",
| ~~~~~~~~~
102 | dir, (*name) ? '/' : '\0', /* Some mkdir()'s don't like trailing slashes */
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103 | name);
| ~~~~~
magic/src/cartoon.c:178:99: warning: unused parameter 'last' [-Wunused-parameter]
178 | static void do_cartoon(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
| ~~~~~~~~~~~~~~^~~~
When assembling UTF-8 in render_text_w() (to send to SDL_Pango),
we assumed `wchar_t` could encompass the entirety of Unicode
(up to U+10FFFF); however, on Windows `wchar_t` is only 16-bits,
meaning the test for characters <= U+FFFF was always true.
This reworks the if/elseif/else block, via some "#ifndef WIN32"
tests, to avoid this warning.
In the end, we need to replace our internal use of `wchar_t`
with something 32-bit, to allow for higher Unicode code points
(e.g., to support Emoji via the Text and Label tools).
Additonally, some work will need to be done to ensure that
text stored as Labels within saved Tux Paint images (PNGs) continued
to work correctly, and could be traded between platforms.
(Untested, but right now I assume a picture drawn on Linux where
`wchar_t` is 32-bit would break if you attempt to load it on Windows,
and possibly vice-versa?)
See https://sourceforge.net/p/tuxpaint/feature-requests/210/