Commit graph

2313 commits

Author SHA1 Message Date
Bill Kendrick
7313f269ac Show tips & play sound effects w/ Label selector
Closes https://sourceforge.net/p/tuxpaint/bugs/245/
2022-02-07 23:57:36 -08:00
Mark Kim
9994847ea3 small macOS cleanup
- Need to use __MACOS__ instead of __APPLE__ when #including "macos.h".
- Need to include "platform.h" for this to work.
2022-02-06 21:26:21 -05:00
Mark Kim
e1ecf80e26 Fix random crashes in Korean, Japanese, and some other languages
Occasionally running Tux Paint in Korean, Japanese, and possibly other
languages would cause Tux Paint to crash.  This commit fixes it.

This bug was previously mentioned as the possible cause of these
previously reported crashes, though they were determined to be
unrelated:

  https://sourceforge.net/p/tuxpaint/mailman/message/37364981/
  https://sourceforge.net/p/tuxpaint/mailman/message/37376574/

The cause of the crash turned out to be in the function that loads the
input method map (*.im).  Some languages that use more than one
keystroke to produce one unicode character use this mapfile to track, in
a state machine, what keys have been pressed and what unicode character
should be output.  This state machine's memory is increased dynamically
as needed when the input method map file is loaded.  There was a line of
code that references the old memory that could have moved by the memory
increase.  This line of code has been moved to prior to the memory
increase to avoid accessing memory that may have moved.
2022-02-06 21:02:06 -05:00
Mark Kim
c9e195549f macOS system language detection.
It appears the system language detection doesn't work on [some versions
of?] macOS.  Fixed.

Strangely, querying the Cocoa API for the system locale on a system in
US with the preferred language set to Korean produces the invalid locale
"ko-US" instead of the expected "ko-KR".  This behavior of returning the
language with a invalid region qualifier for the language appears to
happen only with languages where macOS does not have regional variants
(this issue does not seem to occur with Canadian English, en-CA, for
example.)  A fuzzy matching locale function has been added to handle
this issue.
2022-02-06 20:26:50 -05:00
Mark Kim
c2ab6d461c merge macos.c and macos.m, update ios.*
* Merged macos.c into macos.m.
* Updated ios.h and ios.c to be compatible with the macos.* changes.
* Renamed ios.c to ios.m.
2022-02-06 11:29:19 -05:00
Mark Kim
d697d3faca better korean translations 2022-02-06 11:21:01 -05:00
Mark Kim
ab2d76d0b9 Update some Korean translations 2022-02-06 08:23:20 -05:00
Bill Kendrick
e7d81ef63f Clean up some compile-time warnings/errors
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)"
2022-02-05 16:59:59 -08:00
Bill Kendrick
4dbaa0b320 Doc'ing and POT-izing macOS menu translation
h/t Mark Kim (for https://sourceforge.net/p/tuxpaint/bugs/183/)
2022-02-05 16:42:02 -08:00
Mark Kim
7aa000b68a Tux Paint for macOS can localize menus (feature request #183)
Tux Paint for macOS can now localize the macOS menubar.  Translation
files (*.po) will be required for the actual translations to show.
2022-02-05 18:40:36 -05:00
Mark Kim
aa4c72d4ed macOS path handling is more robust
When looking up paths of fonts, preferences, etc., macOS searches two
places, the system paths and the user paths under $HOME.

This change handles rare scenario where HOME is not set.  If HOME is not
set, now the application just searches the system path twice instead of
searching the system path followed by going into an undefined behavior
(possibly segfault.)
2022-02-05 12:12:37 -05:00
dolphin6k
8ece611f8c Corrected Japanese translation for color mixer. 2022-02-04 17:08:20 +09:00
Bill Kendrick
ab01926c27 Oops, left some debug printf() in there 2022-02-03 23:03:02 -08:00
Bill Kendrick
5203c16d34 Forgot to gettext() color mixer tip text fmt str
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.
2022-02-03 22:42:19 -08:00
dolphin6k
61d8f8cee0 Japanese translation for color mixer. 2022-02-04 11:15:47 +09:00
dolphin6k
4c42cf8daa Updated Japanese translation 2022-02-04 08:55:32 +09:00
dolphin6k
c965c2fad2 Pass the full path of locale directory to bindtextdomain().
Workaround to the issue that gettext() can not find translation files
after the update of MinGW/MSYS2 in January 2022.
2022-02-02 22:34:30 +09:00
Bill Kendrick
e46226cfcc Refresh POT/PO after more Color Mixer coding 2022-01-28 02:17:26 -08:00
Bill Kendrick
964416f476 Color mixer: Showing simplified fractions, too
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".
2022-01-28 02:16:33 -08:00
Bill Kendrick
c50fddd604 Color mixer: Undo/Redo seems to be working! 2022-01-28 01:32:29 -08:00
Bill Kendrick
4ae07338bf Color mixer: Break color average calculation out
Needs to be a function that we can also call on Undo & Redo
actions.
2022-01-28 01:00:36 -08:00
Bill Kendrick
3e28289db2 Color mixer: WIP: Undo/Redo feature 2022-01-28 00:55:23 -08:00
Bill Kendrick
336c7cc342 Color mixer: Some better Red/Yellow/Blue primaries
Using HSV values of some subtractive CMYK colors.
2022-01-28 00:24:27 -08:00
Bill Kendrick
a8beb74abe Color mixer: Mixing colors properly
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.
2022-01-27 23:56:56 -08:00
Bill Kendrick
42ca74df86 Update POT/PO to add new Color Mixer UI elements 2022-01-27 22:54:50 -08:00
Bill Kendrick
4d93bd3177 Color mixer: Display color proportions as you mix
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".)
2022-01-27 22:37:13 -08:00
Bill Kendrick
150e524867 Color mixer: Undo/Redo appear properly; color tweaks
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.
2022-01-27 21:25:04 -08:00
Bill Kendrick
268d063f71 Color Mixer: Show Undo/Redo & handle cursor shape
Undo/Redo don't do anything yet. Other buttons now cause mouse
to change to 'hand' (vs 'arrow') shape when hovering over them.
2022-01-27 21:07:19 -08:00
Bill Kendrick
793ee8fd50 Color mixer working okay now!
I'd like to add undo/redo, and the trash button needs a label,
but it's usable!
2022-01-27 02:39:46 -08:00
Bill Kendrick
92499d9a70 WIP More work on color mixer
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.
2022-01-27 00:08:56 -08:00
Bill Kendrick
db7a8c0124 WIP Starting to make a color mixer tool
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.
2022-01-26 22:43:06 -08:00
Bill Kendrick
83d316a166 Ctrl+click to pick colors immediately
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.)
2022-01-26 01:07:11 -08:00
Bill Kendrick
269f0cfe3a Rigging up do_color_sel() to offer immediate mode
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.
2022-01-26 00:20:14 -08:00
Bill Kendrick
e0d7e0728b Show "pipette"-shaped pointer when selecting colors 2022-01-25 23:57:31 -08:00
Bill Kendrick
6735340566 Stamp performance improvements
+ 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)
2022-01-25 22:21:55 -08:00
Bill Kendrick
3518433808 Better onscreen keyboard button sizing
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/
2022-01-25 00:52:14 -08:00
Bill Kendrick
be7d33fa23 Mend broken star shape fill
Was missing some array elements (but no warnings!?)
h/t Shin-ichi for catching it
2022-01-21 01:38:25 -08:00
Bill Kendrick
251259ab13 PO/POT update after adding shape + aspect ratio tip 2022-01-21 01:33:45 -08:00
Bill Kendrick
16e7cb1f59 Showing aspect ratio of shapes when stretching them
...in the Tux tips area
2022-01-21 01:33:23 -08:00
Bill Kendrick
9f5769855b PO/POT update after adding heptagon 2022-01-21 00:34:33 -08:00
Bill Kendrick
71c2404838 Added heptagon (7-sided) shape
Also, using floats more, allowing for proper heptagon support, as
well as a non-skewed starting angle for octagons (22.5 degrees).
2022-01-21 00:34:10 -08:00
Bill Kendrick
1050e74336 PO/POT refresh after adding hexagon shape tool 2022-01-21 00:02:44 -08:00
Bill Kendrick
e210f5592c Add "hexagon" to shapes tool
How'd we last so long without one!?
2022-01-21 00:01:50 -08:00
Mark Kim
c239e849cb Correct comment 2022-01-20 20:46:18 -05:00
Mark Kim
3b03467d62 On macOS use the CMD key wherever CTRL is used on other OS 2022-01-20 20:44:07 -05:00
Bill Kendrick
e8446d2902 Brush spacing controls work 2022-01-20 00:09:03 -08:00
Bill Kendrick
ccfe3bc074 FIXME about hand cursor over selector controls 2022-01-19 02:12:59 -08:00
Bill Kendrick
29eec0dcb7 Brush spacing ctrl proper position when no scrollbar
(e.g., when running in ~860px tall window with 32px buttonsize)
2022-01-19 02:04:47 -08:00
Bill Kendrick
145c35a95d Get brush selector down-scroll to grok brush spacing 2022-01-19 01:46:44 -08:00
Bill Kendrick
0b18aac985 Decided how brush spacing choice relates to spacing
Max option in the spacing widget will correspond to 2x the maximum
dimension of the brush.
2022-01-19 01:30:08 -08:00