From 2159f8616bfab55f995516e2dcd7d7a56d0e84d9 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sat, 15 Aug 2020 00:55:31 -0700 Subject: [PATCH] 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. --- data/images/ui/shapes_center.png | Bin 0 -> 4990 bytes data/images/ui/shapes_corner.png | Bin 0 -> 4285 bytes docs/CHANGES.txt | 7 ++ docs/en/OPTIONS.txt | 10 ++- docs/en/html/OPTIONS.html | 15 +++- src/manpage/tuxpaint.1 | 14 +++- src/parse.gperf | 1 + src/parse.h | 1 + src/shapes.h | 24 +++++- src/tools.h | 6 +- src/tuxpaint-completion.bash | 3 +- src/tuxpaint.c | 135 ++++++++++++++++++++++--------- 12 files changed, 168 insertions(+), 48 deletions(-) create mode 100644 data/images/ui/shapes_center.png create mode 100644 data/images/ui/shapes_corner.png diff --git a/data/images/ui/shapes_center.png b/data/images/ui/shapes_center.png new file mode 100644 index 0000000000000000000000000000000000000000..6ff8ac632fb08df2ab41ece5fd4d75f84128a0e3 GIT binary patch literal 4990 zcmZvgcQ71KyT;X3R>|ru$|})RR7r^$h_SG+NY&Mp^zTpZ`(h>p-0v1^ zW@}hj59Ixz#t3~YZ&p`#m)8!CwyX$WS6fzFABWdiSUxM&Fp~^+HnKm9JbQ#kVcT_G z5)zr)&k2Y5SHCxney?fB)d?qze8GKicXLv3x4|-0G3=Yj7Flrmh4Y=(U|hw*XX#-0 z?%v7u7pDAghleFMx7{151C8b`)=P`eY8cTjmlvOgMp};r0UG|S<~6dzn@CITx>^=W zlTI#OCvxO3xrL+mYkn^;$Jvy-%zAJ0_+OsvUn`!CnTYogOptxf)f;Eq^b{R^;tB^> z>`LBAPJj28au!P-L42&v`n;VwQewBHB>1%QOySC*JJa3}a2 z6ZZ-3FuAr)Qf41+0-7A;h6oJT%H=UPWd6m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J@90v1cb%Kk=jW? z%fZDc!AR73op;PZ`73Yav+wrL{T7C-+R3erP38rUf zqq=)q^Bz)U#Lh+So&+0{d5ubn+Z6xwk(XZ+2qx2qG|*#sAH`EtDj!fMvwT1+U~k5e zRSr=U9?%pXOh$@y*US)CoS?|_#M{4puW9vzOlffox*;2-DTmVaZc(?j40kg*@2l^Y zuO5N?^RRe5nZMtEEQ!RYEh%HlwFz~qOfgM$5?)(K56w?L5VwW~{59jHtjpW=IqEJ_ zl{o}vG`45HlrQtMJAAcTg8P#?7aSu^QL^b;;>}t9d`9NMj+mn(^c~I@o0bdciyxMy z0{}$@ucIQbtdu%Cx}wBPB?%U`(cx1$hGWi+-%}7Oczyqom3f`Lahl+O5gbCoyLXf; zcDh_ANG3iXrceod2D?iyoT}vqW|~6HWJ+cV6-bZlos=(YibExS`9GSuv8?M5^#%i_ zb8Fy_geL&7{J3}8+GAsfVp-)aj_}pP>ONRqnW@-9{j%nbfL8&q?^-;lAa-o#T z18TQ9UaCTc57effLT%^3EKv>~fy6L)PfyZ7Wq4d;4OvYX>lOCa4yFVH=DZc;K}G-A zXk|G$h8(YBD-`!a8{tg4Vq~LmuP}r{Q{pF41Me1l4~}0IxFgwHX&r&H354((H{FYm{2EDu5Fr za@`PL+nw%opkrX2Z-IS-L&AgX`UmD+HhG zsZ!u4b)rpG>87DuwRk%%zp6~{-OcXGa{V}nKzu$*P=~Y6%>@Hgy`LPGy0VT^je=#^ Fe*o}KZ^Hlp literal 0 HcmV?d00001 diff --git a/data/images/ui/shapes_corner.png b/data/images/ui/shapes_corner.png new file mode 100644 index 0000000000000000000000000000000000000000..a9d5e89ca782f09cf142e35324d018b9500b32e4 GIT binary patch literal 4285 zcmZvfRa6vQ+lFW8Mg)PO8wMQ#=^E*DVCax;B%~Xpk!Fy5B^?^+Zcsv`X6TTvK~kk9 zKHh_GegDC~_Ij>o?`!RoeekTc?^w8oGAR)q5dZ)nRaH^Ye&{?8#YBMjK(l3&jT_{L25a-aL%B%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X-Ij`1P0QN0?J4cH%a3hEzqronp6V`{(wLIF zv=lGvSSr6>=rW1N?K;!?aP-=EW9?I!zsdwb7%G@K^4vRHyz!rgKV%Fq3}mH+qi{}o zE?CQF?dqvN)HmbKuYmG)h$Iy3hZSC3Hz%gNg3F@gp(odO>@3#{ltVTCaUtjZznt`o z^QGN`Bx-K&!tic6s-SsuAu0Oz;O2L6hxt~2OXu&*sg_XG-x)MSTQFD~GO9l-W#48M z@Ln)^Q5rg=h-i7$p|gdsviV!hnGc*jx_+SnbQBp|->v1gi;`+|p5x~3{Pcc5c4n-` z2T7cLw)2)b0$S2iE-u-qA=11T&@ZPMEnj$0d__Vk9`tRQa9|nbBP2)W7Q2zBaOA*whZSFM(aMkEaky$n~4ziBJD@@H3D=p==%M z(@vXyjLIuwh`}3@x|k?xXOOpx$>f=7Tfk@XOT2~46T^K1@!vlFBz@$XZ*WA+_4bh^ zixc-+O+TRb+t<3M2W;pOio; zH8uBK3c0m?G_o>PA2aTx8PCnw;Ro{(EPVJgLD+aUyuKReJ~0Ac8^1y4!pOF3L%>)H z%WUzy^aFS~!q{0|=Mk6>HJ4Xy<8@`7B9XOrPav>->1re&Jx|&#Xzi9mjI)gBUBPB21R<*N+CfVobwBJY!ff{m0y38P0(+^2b|3gyb57<==# zof7{e!~uSu6zQ;l<7y!&WyXk|0`r=P;AZobb0zah2ou_lG` z6Fp=Q>wf(g|M&*u^14~+D`I(n7u)Q8p%_FjTSiJa0Z2GaD=dn(iVn;**~olxLN0zs z)n?<7-uJC8lvh_JiTQ>+#MgS`4fMLc9w3{CM*~z9 LH597lEW-Z-zULYp literal 0 HcmV?d00001 diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 704272619..6f4bee972 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -27,6 +27,13 @@ $Id$ * The "--exportdir" option can be used to override the default location (but a "TuxPaint" subdir. will NOT be placed there). + * Shape controls: -- WORK IN PROGRESS + * Draw shapes from the center (as in previous versions of Tux Paint) + or from a corner (similar to the default mode of most other + graphics tools). + * The controls to modify the drawing behavior can be removed, + for simplification of Tux Paint's interface (for younger users). + * Ports & Building ---------------- * Corrections for Haiku not opening saved files. diff --git a/docs/en/OPTIONS.txt b/docs/en/OPTIONS.txt index 30f3cc4a6..d59d7befc 100644 --- a/docs/en/OPTIONS.txt +++ b/docs/en/OPTIONS.txt @@ -6,7 +6,7 @@ Options Documentation Copyright (c) 2002-2020 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - July 27, 2020 + August 14, 2020 ---------------------------------------------------------------------- @@ -358,6 +358,12 @@ Windows Users controls, and only provides the default functionality (usually paint-mode). + noshapecontrols=yes + Disable the control buttons shown when using the Shapes tool + that allow changing how shapes are drawn — centered around the + initial mouse click, or with a corner at the initial mouse + click. + nolabel=yes Disables the Label tool: the tool that allows text entry which can be edited later. @@ -1018,6 +1024,7 @@ Windows Users --nostamps --nostampcontrols --nomagiccontrols + --noshapecontrols --nolabel --newcolorslast --mouse-accessibility @@ -1091,6 +1098,7 @@ Windows Users --stamps --stampcontrols --magiccontrols + --shapecontrols --label --newcolorsfirst --nosysfonts diff --git a/docs/en/html/OPTIONS.html b/docs/en/html/OPTIONS.html index 90cf1f468..43d4819f1 100644 --- a/docs/en/html/OPTIONS.html +++ b/docs/en/html/OPTIONS.html @@ -32,7 +32,7 @@

- July 27, 2020 + August 14, 2020

@@ -742,6 +742,17 @@ default functionality (usually paint-mode). +
+ noshapecontrols=yes +
+ +
+ Disable the control buttons shown when using the Shapes + tool that allow changing how shapes are drawn — + centered around the initial mouse click, or with a corner + at the initial mouse click. +
+
nolabel=yes
@@ -3090,6 +3101,7 @@ --nostamps
--nostampcontrols
--nomagiccontrols
+ --noshapecontrols
--nolabel
--newcolorslast
--mouse-accessibility
@@ -3170,6 +3182,7 @@ --stamps
--stampcontrols
--magiccontrols
+ --shapecontrols
--label
--newcolorsfirst
--nosysfonts
diff --git a/src/manpage/tuxpaint.1 b/src/manpage/tuxpaint.1 index a7bb9f4a6..bd0b9444c 100644 --- a/src/manpage/tuxpaint.1 +++ b/src/manpage/tuxpaint.1 @@ -1,5 +1,5 @@ -.\" tuxpaint.1 - 2020.06.22 -.TH TUXPAINT 1 "22 June 2020" "0.9.25" "Tux Paint" +.\" tuxpaint.1 - 2020.08.15 +.TH TUXPAINT 1 "15 August 2020" "0.9.25" "Tux Paint" .SH NAME tuxpaint -- "Tux Paint", a drawing program for young children. @@ -61,6 +61,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children. .br [\-\-nomagiccontrols] .br +[\-\-noshapecontrols] +.br [\-\-nolabel] .br [\-\-newcolorslast] @@ -191,6 +193,8 @@ tuxpaint -- "Tux Paint", a drawing program for young children. .br [\-\-magiccontrols] .br +[\-\-shapecontrols] +.br [\-\-label] .br [\-\-newcolorsfirst] @@ -418,6 +422,12 @@ controlling whether a Magic tool is used like a paint brush, or if it affects the entire image at once. (Note: Not all Magic tools will be controllable.) +.TP 8 +.B \-\-noshapecontrols \-\-shapecontrols +Disable or enable (default) buttons to change the Shape tool's behavior -- +shapes expanding from the center, or from a corner, where the mouse is +initially clicked. + .TP 8 .B \-\-nolabel \-\-label Disable or enable (default) the \fILabel\fP tool, which lets you create diff --git a/src/parse.gperf b/src/parse.gperf index 5a9dab0bf..38056240e 100644 --- a/src/parse.gperf +++ b/src/parse.gperf @@ -124,6 +124,7 @@ lang, MULTI(parsertmp_lang) locale, MULTI(parsertmp_locale) lockfile, POSBOOL(ok_to_use_lockfile) magiccontrols, NEGBOOL(disable_magic_controls) +shapecontrols, NEGBOOL(disable_shape_controls) mirrorstamps, POSBOOL(mirrorstamps) mixedcase, NEGBOOL(only_uppercase) mouse, NEGBOOL(keymouse) diff --git a/src/parse.h b/src/parse.h index cc9bb7351..be6c4cebd 100644 --- a/src/parse.h +++ b/src/parse.h @@ -15,6 +15,7 @@ struct cfginfo const char *datadir; const char *disable_label; const char *disable_magic_controls; + const char *disable_shape_controls; const char *disable_print; const char *disable_quit; const char *disable_save; diff --git a/src/shapes.h b/src/shapes.h index e89f29d6d..537af70f0 100644 --- a/src/shapes.h +++ b/src/shapes.h @@ -4,7 +4,7 @@ For Tux Paint List of available shapes. - Copyright (c) 2002-2007 by Bill Kendrick and others + Copyright (c) 2002-2020 by Bill Kendrick and others bill@newbreedsoftware.com http://www.tuxpaint.org/ @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - July 26, 2007 + June 14, 2002 - August 15, 2020 $Id$ */ @@ -352,3 +352,23 @@ const char *const shape_img_fnames[NUM_SHAPES] = { DATA_PREFIX "images/shapes/star5p.png", DATA_PREFIX "images/shapes/star5p_f.png" }; + + +/* Shape controls */ + +enum +{ + SHAPEMODE_CENTER, + SHAPEMODE_CORNER, + NUM_SHAPEMODES +}; + +const char *const shapemode_img_fnames[NUM_SHAPEMODES] = { + DATA_PREFIX "images/ui/shapes_center.png", + DATA_PREFIX "images/ui/shapes_corner.png" +}; + +const char *const shapemode_tips[NUM_SHAPES] = { + gettext_noop("Draw shapes from the center."), + gettext_noop("Draw shapes from a corner."), +}; diff --git a/src/tools.h b/src/tools.h index 99d55c1cd..b6c932ca3 100644 --- a/src/tools.h +++ b/src/tools.h @@ -19,11 +19,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - Copyright (c) 2002-2019 by Bill Kendrick + Copyright (c) 2002-2020 by Bill Kendrick bill@newbreedsoftware.com http://www.tuxpaint.org/ - June 14, 2002 - September 12, 2019 + June 14, 2002 - August 15, 2020 $Id$ */ @@ -122,7 +122,7 @@ const char *const tool_tips[NUM_TOOLS] = { // Shape tool instructions gettext_noop - ("Pick a shape. Click to pick the center, drag, then let go when it is the size you want. Move around to rotate it, and click to draw it."), + ("Pick a shape. Click to start drawing, drag, and let go when it is the size you want. Move around to rotate it, and click to draw it."), // Text tool instructions gettext_noop diff --git a/src/tuxpaint-completion.bash b/src/tuxpaint-completion.bash index ed92611f0..a94de92d4 100644 --- a/src/tuxpaint-completion.bash +++ b/src/tuxpaint-completion.bash @@ -3,7 +3,7 @@ # Bill Kendrick ; http://www.tuxpaint.org/ # Based on inkscape's completion file, by allali@univ-mlv.fr # -# Last modified 2020-07-25 +# Last modified 2020-08-15 # # $Id$ @@ -50,6 +50,7 @@ _tuxpaint() --sysfonts --nosysfonts \ --nostampcontrols --stampcontrols \ --nomagiccontrols --magiccontrols \ + --noshapecontrols --shapecontrols \ --mirrorstamps --dontmirrorstamps \ --stampsize=0 --stampsize=1 \ --stampsize=2 --stampsize=3 \ diff --git a/src/tuxpaint.c b/src/tuxpaint.c index a2c2b7f2c..aef0ff38b 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - July 29, 2020 + June 14, 2002 - August 14, 2020 */ @@ -55,8 +55,6 @@ #define VIDEO_BPP 32 /* might be fastest, if conversion funcs removed */ #endif -/* #define CORNER_SHAPES *//* need major work! */ - /* Method for printing images: */ #define PRINTMETHOD_PS /* Direct to PostScript */ @@ -1226,6 +1224,9 @@ static int simple_shapes; static int only_uppercase; static int disable_magic_controls; +static int disable_shape_controls; + +static int shape_mode = SHAPEMODE_CENTER; static int starter_mirrored; static int starter_flipped; @@ -1446,6 +1447,7 @@ static SDL_Surface *img_scroll_up, *img_scroll_down; static SDL_Surface *img_scroll_up_off, *img_scroll_down_off; static SDL_Surface *img_grow, *img_shrink; static SDL_Surface *img_magic_paint, *img_magic_fullscreen; +static SDL_Surface *img_shapes_corner, *img_shapes_center; static SDL_Surface *img_bold, *img_italic; static SDL_Surface *img_label, *img_label_select; static SDL_Surface *img_color_picker, *img_color_picker_thumb, *img_paintwell, *img_color_sel; @@ -3511,6 +3513,15 @@ static void mainloop(void) } } + else if (cur_tool == TOOL_SHAPES) + { + if (!disable_shape_controls) + { + gd_controls.rows = 1; + gd_controls.cols = 2; + } + } + /* number of whole or partial rows that will be needed (can make this per-tool if variable columns needed) */ num_rows_needed = (num_things + gd_items.cols - 1) / gd_items.cols; @@ -3717,6 +3728,17 @@ static void mainloop(void) } /* FIXME: Sfx */ } + else if (cur_tool == TOOL_SHAPES) + { + /* Shape controls! */ + shape_mode = which; + draw_shapes(); + update_screen_rect(&r_toolopt); + draw_tux_text(TUX_GREAT, shapemode_tips[shape_mode], 1); + playsound(screen, 0, SND_CLICK, 0, SNDPOS_RIGHT, SNDDIST_NEAR); + update_screen_rect(&r_tuxarea); + toolopt_changed = 0; + } else if (cur_tool == TOOL_TEXT) { /* Text controls! */ @@ -4137,8 +4159,8 @@ static void mainloop(void) update_canvas(0, 0, canvas->w, canvas->h); } - - draw_tux_text(TUX_GREAT, shape_tips[cur_shape], 1); + if (toolopt_changed) + draw_tux_text(TUX_GREAT, shape_tips[cur_shape], 1); if (do_draw) draw_shapes(); @@ -4731,6 +4753,14 @@ static void mainloop(void) gd_controls.cols = 2; } } + else if (cur_tool == TOOL_SHAPES) + { + if (!disable_shape_controls) + { + gd_controls.rows = 1; + gd_controls.cols = 2; + } + } /* number of whole or partial rows that will be needed (can make this per-tool if variable columns needed) */ @@ -5167,6 +5197,8 @@ static void mainloop(void) max = 10; if (cur_tool == TOOL_MAGIC && !disable_magic_controls) max = 12; + if (cur_tool == TOOL_SHAPES && !disable_shape_controls) + max = 12; if (num_things > max + TOOLOFFSET) @@ -6512,6 +6544,7 @@ void show_usage(int exitcode) " [--stamps | --nostamps]\n" " [--nostampcontrols | --stampcontrols]\n" " [--nomagiccontrols | --magiccontrols]\n" + " [--noshapecontrols | --shapecontrols]\n" " [--nolabel | --label]\n" " [--newcolorsfirst | --newcolorslast]\n" "\n" @@ -8280,7 +8313,7 @@ static void draw_magic(void) } - /* Draw text controls: */ + /* Draw magic controls: */ if (!disable_magic_controls) { @@ -9126,17 +9159,20 @@ static void draw_stamps(void) /* Draw the shape selector: */ static void draw_shapes(void) { - int i, shape, max, off_y; + int i, shape, max, off_y, most; SDL_Rect dest; draw_image_title(TITLE_SHAPES, r_ttoolopt); + most = 12; + if (disable_shape_controls) + most = 14; - if (NUM_SHAPES > 14 + TOOLOFFSET) + if (NUM_SHAPES > most + TOOLOFFSET) { off_y = 24; - max = 12 + TOOLOFFSET; + max = (most - 2) + TOOLOFFSET; dest.x = WINDOW_WIDTH - 96; dest.y = 40; @@ -9151,9 +9187,9 @@ static void draw_shapes(void) } dest.x = WINDOW_WIDTH - 96; - dest.y = 40 + 24 + ((6 + TOOLOFFSET / 2) * 48); + dest.y = 40 + 24 + ((((most - 2) / 2) + TOOLOFFSET / 2) * 48); - if (shape_scroll < NUM_SHAPES - 12 - TOOLOFFSET) + if (shape_scroll < NUM_SHAPES - (most - 2) - TOOLOFFSET) { SDL_BlitSurface(img_scroll_down, NULL, screen, &dest); } @@ -9165,7 +9201,7 @@ static void draw_shapes(void) else { off_y = 0; - max = 14 + TOOLOFFSET; + max = most + TOOLOFFSET; } for (shape = shape_scroll; shape < shape_scroll + max; shape++) @@ -9202,6 +9238,48 @@ static void draw_shapes(void) SDL_BlitSurface(img_shape_names[shape], NULL, screen, &dest); } } + + /* Draw magic controls: */ + + if (!disable_shape_controls) + { + SDL_Surface *button_color; + + /* Show shape-from-center button: */ + + if (shape_mode == SHAPEMODE_CENTER) + button_color = img_btn_down; + else + button_color = img_btn_up; + + dest.x = WINDOW_WIDTH - 96; + dest.y = 40 + ((6 + TOOLOFFSET / 2) * 48); + + SDL_BlitSurface(button_color, NULL, screen, &dest); + + dest.x = WINDOW_WIDTH - 96 + (48 - img_shapes_center->w) / 2; + dest.y = (40 + ((6 + TOOLOFFSET / 2) * 48) + (48 - img_shapes_center->h) / 2); + + SDL_BlitSurface(img_shapes_center, NULL, screen, &dest); + + + /* Show shape-from-corner button: */ + + if (shape_mode == SHAPEMODE_CORNER) + button_color = img_btn_down; + else + button_color = img_btn_up; + + dest.x = WINDOW_WIDTH - 48; + dest.y = 40 + ((6 + TOOLOFFSET / 2) * 48); + + SDL_BlitSurface(button_color, NULL, screen, &dest); + + dest.x = WINDOW_WIDTH - 48 + (48 - img_shapes_corner->w) / 2; + dest.y = (40 + ((6 + TOOLOFFSET / 2) * 48) + (48 - img_shapes_corner->h) / 2); + + SDL_BlitSurface(img_shapes_corner, NULL, screen, &dest); + } } @@ -12510,6 +12588,9 @@ static void cleanup(void) free_surface(&img_magic_paint); free_surface(&img_magic_fullscreen); + free_surface(&img_shapes_center); + free_surface(&img_shapes_corner); + free_surface(&img_bold); free_surface(&img_italic); @@ -12751,32 +12832,6 @@ static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush) old_brush = 0; -#ifdef CORNER_SHAPES - int tmp = 0; - - if (cx > ox) - { - tmp = cx; - cx = ox; - ox = tmp; - } - - if (cy > oy) - { - tmp = cy; - cy = oy; - oy = tmp; - } - - x1 = cx; - x2 = ox; - y1 = cy; - y2 = oy; - - cx += ((x2 - x1) / 2); - cy += ((y2 - y1) / 2); -#endif - rx = abs(ox - cx); ry = abs(oy - cy); @@ -22813,6 +22868,7 @@ static void setup_config(char *argv[]) SETBOOL(autosave_on_quit); SETBOOL(disable_label); SETBOOL(disable_magic_controls); + SETBOOL(disable_shape_controls); SETBOOL(disable_print); SETBOOL(disable_quit); SETBOOL(disable_save); @@ -24208,6 +24264,9 @@ static void setup(void) img_magic_paint = loadimage(DATA_PREFIX "images/ui/magic_paint.png"); img_magic_fullscreen = loadimage(DATA_PREFIX "images/ui/magic_fullscreen.png"); + img_shapes_center = loadimage(DATA_PREFIX "images/ui/shapes_center.png"); + img_shapes_corner = loadimage(DATA_PREFIX "images/ui/shapes_corner.png"); + img_bold = loadimage(DATA_PREFIX "images/ui/bold.png"); img_italic = loadimage(DATA_PREFIX "images/ui/italic.png");