Commit graph

1132 commits

Author SHA1 Message Date
Bill Kendrick
4d9bd3945d Ensure buttonsize + window size sufficiently tall
Need space for 5 buttons' worth of height, for situations such as

 * Stamps
   1. up/down scroll arrows (1 button height, total)
   2. actually show some stamps
   3. left/right paging buttons
   4. flip/mirror toggles
   5. scale 'slider'

 * Label
   1. up/down scroll arrows (1 button height, total)
   2. actually show some fonts
   3. label picker button
   4. bold/italic toggles
   5. shrink/grow font size buttons
2021-01-26 22:47:36 -08:00
Pere Pujal i Carabantes
41e4e80e4b Bottom scroll button, set arrow cursor when scrolling by clicking button. 2021-01-26 23:49:54 +01:00
Bill Kendrick
39b69643bd Avoid leaving XOR outline after Eraser drag 2021-01-24 16:49:00 -08:00
Pere Pujal i Carabantes
046baeb85b Adding scroll to the erasers, mainly copying/adapting code from draw_brushes().
Also adapt the mouse cursor code.
2021-01-24 16:31:37 +01:00
Pere Pujal i Carabantes
3326db5f13 Tweaking stamp sizer position. 2021-01-21 00:06:50 +01:00
Bill Kendrick
d103172ee9 Abort if window + button size is a bad combo
Abort if the requested combination of window size and
button size would result in no buttons being visible in the UI.
2021-01-19 00:14:44 -08:00
Pere Pujal i Carabantes
5946a0fa71 Better text on scaled buttons. 2021-01-18 23:38:08 +01:00
Bill Kendrick
8529786356 Doc'ing (WIP) larger-UI-buttons in CHANGES.txt
Need fuller description, updating OPTIONS, more testing
and tweaking, etc.
2021-01-18 11:40:05 -08:00
Pere Pujal i Carabantes
2faf78fd21 Merging the resize buttons work. 2021-01-18 14:32:51 +01:00
Mark Kim
7727b995c5 Minimize CPU/energy usage
We received a report of Tux Paint generating too much heat on a MacBook
Pro (15-inch, 2017 running macOS Mojave 10.14.6).  The bug report
included a screenshot of Activity Monitor's Energy Tab showing Tux Paint
having an Enegy Impact of "23.4" and Avg Energy Impact of "3.94".

Although we weren't able to reproduce the same conditions exactly, we
did observe Tux Paint having an Energy Impact level of around ~15 even
when idle on both macOS Yosemite 10.10.5 and Big Sur 11.1.  Energy
Impact leve of ~25 when in use was not uncommon, and spiked to ~55.  The
MacBook Air used for testing (11-inch, Early 2014) did not become hot
"to the touch" as was originally reported, but it did become noticibly
warm.

An investigation found the cause to be in two places:

1. Tux Paint's main loop runs fairly tightly, yielding only a minimum
   time slice to the kernel after each iteration using SDL_Delay(1)
   (1 millisecond).  This has been increasd to 10 millisecond to give
   more slice back to the kernel.  Increasing the 1ms yield to 10ms
   should be only minimally noticible as Tux Paint is primarily a human
   interaction software and human eyes perceive responses < ~100ms as
   immediate, giving us over 90ms to accomplish what we need to after
   each iteration as opposed to the previous 99ms.

2. Enabling SDL's timer subsystem (SDL_INIT_TIMER), even when not used
   actively, has a high impact on the energy impact.  Some testing
   showed the timer subsystem, though supposedly a part of SDL_Delay() and
   SDL_GetTicks(), is not required to be enabled to use those functions.
   It does require to be enabled, however, to use SDL_AddTimer() which
   is only used in Tux Paint when scrolling.  Tux Paint therefore has
   been modified to enable the timer subsystem only when scrolling
   starts and disable it when not scrolling.

The solution to #2 is not an ideal approach but it did provide a quick
solution to the user having the problem.  Issue #2 should get resolved
naturally when we upgrade to SDL2 where the timer subsystem does not
appear to have the energy impact issue.
2021-01-16 21:01:21 -05:00
Pere Pujal i Carabantes
01bfcb5846 Merge branch 'master' of ssh://git.code.sf.net/p/tuxpaint/tuxpaint 2021-01-16 01:21:50 +01:00
Bill Kendrick
c97932606f mkdir exportdir's parent, if necessary
Tux Paint's export features will fail if the parent
of the export directory didn't exist.  e.g., using the
default (either via XDG or hard-coded fallback) of
"~/Pictures/TuxPaint/", Tux Paint could not export if
"~/Pictures/" didn't exist yet.  It will now try to
mkdir it as well.  h/t Tim Dickson

Updated OPTIONS documents to explain this.

Also, documenting --exportdir in manpage (was missing!)
2021-01-13 22:48:29 -08:00
Pere Pujal i Carabantes
b0caacde09 Better handle of text in buttons. 2020-12-16 19:10:08 +01:00
Pere Pujal i Carabantes
f29bf895fa Forgot to scale too the erasers, doing now. 2020-12-12 00:42:13 +01:00
Pere Pujal i Carabantes
934f3aed26 Merge branch 'master' of ssh://git.code.sf.net/p/tuxpaint/tuxpaint 2020-12-11 23:53:37 +01:00
Bill Kendrick
71152d1369 Bump latest mod. date in docs and tuxpaint.c 2020-11-21 14:27:26 -08:00
Bill Kendrick
032c89a65e Fix: struct dirent has no "d_type" on MinGW/MSYS2
I found current git tree does not compile on Windows because
struct dirent has no member "d_type" on MinGW/MSYS2.
(TOYAMA Shin-ich via Tuxpaint-devel list)
2020-11-21 14:26:08 -08:00
dolphin6k
968de6f0ea Enabled compiling on John Popplewell's build environment (for Windows 2000 & XP) 2020-11-15 13:47:29 +09:00
Bill Kendrick
a36dcee321 Mend personal Template loading bug in New dialog
Mended bug where a personal Template could not be loaded
due to how we tracked which entry in the "New" dialog
was the first template image.

Also, don't track directories when searching for Starters and
Templates (e.g., ".", "..", and ".thumbs"), since it's just
a waste of time/space.
2020-11-13 20:36:35 -08:00
Bill Kendrick
5a1a80ff69 Correct locked shapes' rotation after corner drag
When using the new (on 0.9.25) corner-drag option for creating
a new shape, "shape-locked" (1:1 aspect ratio) shapes -- square
and octagon -- would only rotate in a few positions, based on the
angle of ther vertices.

Corrected this, with no apparent adverse effect on other shapes,
in either drag mode (classic "from-center", and new "from-corner").

Also, removed extranous whitespace before EOLs in src/tuxpaint.c.
2020-11-10 09:54:50 -08:00
Bill Kendrick
f024a95a96 Avoid bogusly trying to mkdir sysdir in savedir
While we weren't attempting to save thumbnail PNG files of the
starter and templates that are scanned in the system-wide Tux Paint
directory, we WERE trying to incorrectly `mkdir` such directories
within the user's personal directory.
(e.g., "/home/kendrick/.tuxpaint//usr/local/share/tuxpaint/templates")

Mended.
2020-10-15 22:33:03 -07:00
Pere Pujal i Carabantes
8c8852c8db More on scaling the size of buttons. Also in dialogs like Open, color picker... 2020-10-15 04:19:06 +02:00
Pere Pujal i Carabantes
7121c75c78 Option 'buttonsize' to change the size of the buttons. 2020-09-28 13:35:18 +02:00
Pere Pujal i Carabantes
82881a65f4 Not resizing buttons if not needed. First letters of text were under resized stamp sound buttons. 2020-09-25 08:58:23 +02:00
Pere Pujal i Carabantes
8a6ecec9ec Big changes to allow resizing the buttons of the interface.
Still to do:
Let the user choose the size of the buttons via config file and command line
Investigate why some of the magic icons displays all black.
2020-09-11 01:17:43 +02:00
Bill Kendrick
40033c7632 Shapes rotation improvement with centered too
Avoid shapes flipping upside-down during rotation step,
when stretching from right-to-left -- also when using the
original, center-based shape stretching mode.
2020-08-30 00:03:32 -07:00
Bill Kendrick
93f05af10d Ensure easy rotation of corner-stretched shapes
If corner-stretched shape is pulled to the left, make sure the
rotation step works properly.
2020-08-28 21:51:51 -07:00
Bill Kendrick
b88c8a9030 Refresh full canvas after drawing shape
Ensure that shape gets completely drawn and XOR outline gets
removed.
2020-08-28 21:27:04 -07:00
Bill Kendrick
61998e4d00 Larger OSK on larger windows; larger OSK font
On-screen keyboard (visible when the feature is enabled, while
using the "Text" and "Label" tools) now appears with larger
(48x48 pixel, vs 24x24 pixel) buttons, when Tux Paint's window
(or fullscreen) size is large enough to fit them with the
chosen layout.
(h/t Anat & Aviv, who suggested it to help with users of
eye-tracking systems)

Also, on-screen keyboard buttons use a slightly larger font
(16pt vs 12pt, previously seen on the small keyboard;
32pt on the large keyboard).
2020-08-25 22:00:43 -07:00
dolphin6k
a2822142e6 Ooops! Mistook the logic for using result from liq_quantize_image() 2020-08-17 17:29:00 +09:00
dolphin6k
bfaca2c2cf Compile on libimagequant older than version 2.8.0 2020-08-17 17:20:05 +09:00
Bill Kendrick
0a853b280c "Eraser" tool now draws smoothly connected strokes 2020-08-16 12:31:53 -07:00
Bill Kendrick
a79a76f4c3 New, smaller sizes available in "Eraser" tool
(h/t Jackson Bray for the suggestion)

Also, slight improvements to how circular eraser size calculations
are handled, to allow for radius down to ERASER_MIN of 5.
2020-08-16 12:15:55 -07:00
dolphin6k
31fa1af9a5 Get export directory for Windows 2020-08-16 17:00:58 +09:00
Bill Kendrick
d2d9b98291 Wrapping up "shapes from corner" option
Works well, or at least well enough, for our current batch of
shapes.
2020-08-15 16:20:51 -07:00
Bill Kendrick
f734d21fa4 Shapes from corner getting closer
Circle & ellipse working well.  Square and rectangle not, yet.
2020-08-15 15:08:19 -07:00
Bill Kendrick
c89daa1b37 Starting work to sort out corner-based shapes
Need to sleep on it and figure out the math.
2020-08-15 01:25:00 -07:00
Bill Kendrick
1bf15f2d27 Rename shape_*_x/y variables
Variables for pointer positions while drawing a shape were
center-centric ("shape_ctr_x/y" and "shape_outer_x/y").
Renamed them to be more general.
2020-08-15 00:58:44 -07:00
Bill Kendrick
2159f8616b WIP: Shape controls -- center vs corner
Adding control buttons to the Shapes tool, allowing for shapes
to be drawn from the center (as before) or from a corner
(more like other paint packages).  The controls do nothing
at this time, but are visible and can be clicked.  This is a
work in progress.

The controls may be removed using a configuration option.
2020-08-15 00:55:31 -07:00
Bill Kendrick
c13c543cfe Wrap up GIF export; support speed
Different speed settings in slideshow dialog affect the speed
of the exported GIF.
2020-07-29 22:09:10 -07:00
Bill Kendrick
43edf9fe3e Animated GIF export basics working
Tux Paint can export an animated GIF to the export directory
(e.g., ~/Pictures/TuxPaint) from the Open->Slideshow dialog.

To do -- GIF's animated speed should be based on speed slider
in Slideshow dialog.

To do -- Document this new feature (and single image (PNG) export)
in the README documentation.
2020-07-27 00:29:53 -07:00
Bill Kendrick
ac755bf26c Removing loaddesc() debugging
Things look fine here. Not actually finding languages in i18n,
it seems!
2020-07-26 16:52:05 -07:00
Bill Kendrick
42512a67b0 Don't use extern for num_wished_langs
WORK IN PROGRESS -- Attempting to mend an issue where stamp descriptions
are not loading.

Also, making things safer when a problem occurs.

Using gcc 9.3.0 compiler, this was happening in 0.9.25 during
development, but also affected 0.9.24 and 0.9.23, which worked
fine under earlier versions of gcc.
2020-07-26 16:42:12 -07:00
Bill Kendrick
e50a0ef84c Improved safety when copying things into strings
Created "safe_" variations of 'strncpy()', 'strncat()',
and 'snprintf()', to ensure a truncated source string doesn't
leave the destination buffer without a NUL termination character.

Replaced all calls (in "tuxpaint.c" only, so far) to the standard
functions with calls to the new safer versions.

Replaced most calls to plain 'strcpy()', 'strcat()' and
'sprintf()' (which can cause buffer overruns) with the new functions.
2020-07-26 16:13:53 -07:00
Bill Kendrick
56591258ff Ensure export takes 1 second (filename uniqueness) 2020-07-26 14:25:59 -07:00
Bill Kendrick
b0a2b4dacc Completed single image export function
From "Open" dialog, select an image (single click, or use
arrow keys / etc., to highlight the image), then select the
"Export" button at the lower right.

The image will be saved in the export directory.  By default
this will be based on the config found via the XDG_CONFIG_HOME
environment variable, which is scanned for a "XDG_PICTURES_DIR"
setting.  If none is found, "Pictures" in the directory specified
by the HOME env. var. will be used.  In both cases, a new
"TuxPaint" subdirectory will be created, and exports will be placed
there.

The export location may be overridden using the "--exportdir"
command-line option or "exportdir" config file option
(e.g., "--exportdir /path/to/dir" or "exportdir=/path/to/dir",
respectively).  In this case, the directory is assumed to preexist,
and no "TuxPaint" subdirectory will be made.

There's currently no way to disable the export feature altogether.
If there's demand, we can add it as a simplification option.

Finally, this feature simply copies the PNG file (but no extra
data files) from Tux Paint's "saved" directory to the export dir.

Closes https://sourceforge.net/p/tuxpaint/feature-requests/192/
2020-07-26 14:10:03 -07:00
Bill Kendrick
28b28d583e Wrap up GIF export UI
GIF export button now jumps to a process that iterates through the
chosen saved images, loading each (but not yet saving as a GIF).
It then returns to the Open->Slideshow dialog, and displays a
pop-up dialog that shows a success/fail message.

Also, adding an icon for a regular static image "Export" option,
to be added to the main Open dialog.
2020-07-26 11:46:12 -07:00
Bill Kendrick
7aa91af319 Make sure 'exportdir' from config file is utilized 2020-07-25 22:36:20 -07:00
Bill Kendrick
1617a0ad77 Remove debug+exit from last commit
Oops, Tux Paint just exited immediately, as part of my debug
testing. :)  Removed that.
2020-07-25 16:46:49 -07:00
Bill Kendrick
f8cce36435 Further work on animated GIF export: XDG Pictures
Using XDG's user dir settings to determine where pictures are
stored for a user (e.g., "~/Pictures" -- used as a fallback).
May be overridden using "--exportdir".

Also, while I was updating some docs, replace references to
"Mac OS X" with "macOS", the new name of that OS these days.
2020-07-25 16:45:17 -07:00