Added Octagon shape. (Also means shape tool selector needed to scroll

in 640x480, which has been done, too.)
This commit is contained in:
William Kendrick 2007-07-27 02:22:24 +00:00
parent ebf2a8a6bd
commit 10881623cf
5 changed files with 87 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

View file

@ -19,10 +19,14 @@ $Id$
+ New images can be given solid background colors
(which the 'Eraser' tool erases to)
* Tool Improvements:
------------------
* Added a 'color picker' entry to the color palette; allows choosing
from over 50,000 colors. Used by drawing and Magic tools, as well
as the new 'New' dialog.
* Added an Octagon shape to the 'Shapes' tool.
* Documentation Imrpovements:
---------------------------
* Improved --usage output.

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - July 17, 2007
June 14, 2002 - July 26, 2007
$Id$
*/
@ -47,6 +47,8 @@ enum
SHAPE_PENTAGON_FILL,
SHAPE_RHOMBUS,
SHAPE_RHOMBUS_FILL,
SHAPE_OCTAGON,
SHAPE_OCTAGON_FILL,
NUM_SHAPES
};
@ -67,7 +69,9 @@ const int shape_sides[NUM_SHAPES] = {
5, /* Pentagon */
5, /* Pentagon */
4, /* Rhombus */
4 /* Rhombus */
4, /* Rhombus */
8, /* Octagon */
8 /* Octagon */
};
@ -87,7 +91,9 @@ const int shape_locked[NUM_SHAPES] = {
0, /* Pentagon */
0, /* Pentagon */
0, /* Rhombus */
0 /* Rhombus */
0, /* Rhombus */
1, /* Octagon */
1 /* Octagon */
};
@ -107,7 +113,9 @@ const int shape_filled[NUM_SHAPES] = {
0, /* Pentagon */
1, /* Pentagon */
0, /* Rhombus */
1 /* Rhombus */
1, /* Rhombus */
0, /* Octagon */
1 /* Octagon */
};
@ -128,7 +136,9 @@ const int shape_init_ang[NUM_SHAPES] = {
162, /* Pentagon */
162, /* Pentagon */
0, /* Rhombus */
0 /* Rhombus */
0, /* Rhombus */
22, /* Octagon */
22 /* Octagon */
};
@ -148,7 +158,9 @@ const int shape_no_rotate[NUM_SHAPES] = {
0, /* Pentagon */
0, /* Pentagon */
0, /* Rhombus */
0 /* Rhombus */
0, /* Rhombus */
0, /* Octagon */
0 /* Octagon */
};
@ -181,7 +193,11 @@ const char *const shape_names[NUM_SHAPES] = {
// Rhombus shape tool (4 sides, not at right angles)
gettext_noop("Rhombus"),
gettext_noop("Rhombus")
gettext_noop("Rhombus"),
// Octagon shape tool (8 sides)
gettext_noop("Octagon"),
gettext_noop("Octagon")
};
@ -218,7 +234,13 @@ const char *const shape_tips[NUM_SHAPES] = {
gettext_noop
("A rhombus has four equal sides, and opposite sides are parallel."),
gettext_noop
("A rhombus has four equal sides, and opposite sides are parallel.")
("A rhombus has four equal sides, and opposite sides are parallel."),
// Description of an octagon
gettext_noop
("An octagon has eight equal sides."),
gettext_noop
("An octagon has eight equal sides.")
};
@ -238,5 +260,7 @@ const char *const shape_img_fnames[NUM_SHAPES] = {
DATA_PREFIX "images/shapes/pentagon.png",
DATA_PREFIX "images/shapes/pentagon_f.png",
DATA_PREFIX "images/shapes/diamond.png",
DATA_PREFIX "images/shapes/diamond_f.png"
DATA_PREFIX "images/shapes/diamond_f.png",
DATA_PREFIX "images/shapes/octagon.png",
DATA_PREFIX "images/shapes/octagon_f.png"
};

View file

@ -8375,23 +8375,60 @@ static void draw_stamps(void)
static void draw_shapes(void)
{
int i;
int i, shape, max, off_y;
SDL_Rect dest;
draw_image_title(TITLE_SHAPES, r_ttoolopt);
for (i = 0; i < 14 + TOOLOFFSET; i++)
if (NUM_SHAPES > 14 + TOOLOFFSET)
{
off_y = 24;
max = 12 + TOOLOFFSET;
dest.x = WINDOW_WIDTH - 96;
dest.y = 40;
if (shape_scroll > 0)
{
SDL_BlitSurface(img_scroll_up, NULL, screen, &dest);
}
else
{
SDL_BlitSurface(img_scroll_up_off, NULL, screen, &dest);
}
dest.x = WINDOW_WIDTH - 96;
dest.y = 40 + 24 + ((6 + TOOLOFFSET / 2) * 48);
if (shape_scroll < NUM_SHAPES - 12 - TOOLOFFSET)
{
SDL_BlitSurface(img_scroll_down, NULL, screen, &dest);
}
else
{
SDL_BlitSurface(img_scroll_down_off, NULL, screen, &dest);
}
}
else
{
off_y = 0;
max = 14 + TOOLOFFSET;
}
for (shape = shape_scroll; shape < shape_scroll + max; shape++)
{
i = shape - shape_scroll;
dest.x = ((i % 2) * 48) + WINDOW_WIDTH - 96;
dest.y = ((i / 2) * 48) + 40;
dest.y = ((i / 2) * 48) + 40 + off_y;
if (i == cur_shape)
if (shape == cur_shape)
{
SDL_BlitSurface(img_btn_down, NULL, screen, &dest);
}
else if (i < NUM_SHAPES)
else if (shape < NUM_SHAPES)
{
SDL_BlitSurface(img_btn_up, NULL, screen, &dest);
}
@ -8401,18 +8438,19 @@ static void draw_shapes(void)
}
if (i < NUM_SHAPES)
if (shape < NUM_SHAPES)
{
dest.x = ((i % 2) * 48) + 4 + WINDOW_WIDTH - 96;
dest.y = ((i / 2) * 48) + 40 + 4;
dest.y = ((i / 2) * 48) + 40 + 4 + off_y;
SDL_BlitSurface(img_shapes[i], NULL, screen, &dest);
SDL_BlitSurface(img_shapes[shape], NULL, screen, &dest);
dest.x = ((i % 2) * 48) + 4 + WINDOW_WIDTH - 96 +
(40 - img_shape_names[i]->w) / 2;
dest.y = ((i / 2) * 48) + 40 + 4 + (44 - img_shape_names[i]->h);
(40 - img_shape_names[shape]->w) / 2;
dest.y = ((i / 2) * 48) + 40 + 4 +
(44 - img_shape_names[shape]->h) + off_y;
SDL_BlitSurface(img_shape_names[i], NULL, screen, &dest);
SDL_BlitSurface(img_shape_names[shape], NULL, screen, &dest);
}
}
}