mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Removed modules/tools2.c because scripting is gone.
This commit is contained in:
parent
d181b9f215
commit
b3e52a24e0
@ -1,226 +0,0 @@
|
||||
/* ASE - Allegro Sprite Editor
|
||||
* Copyright (C) 2001-2008 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "core/app.h"
|
||||
#include "core/cfg.h"
|
||||
#include "core/color.h"
|
||||
#include "modules/sprites.h"
|
||||
#include "modules/tools.h"
|
||||
#include "raster/brush.h"
|
||||
#include "raster/sprite.h"
|
||||
|
||||
/* string = "brush_type brush_size brush_angle"
|
||||
brush_type: circle, square, line (default=circle)
|
||||
brush_size: 1-32 (default=1)
|
||||
brush_angle: 0-180 (default=0)
|
||||
*/
|
||||
void SetBrush(const char *string)
|
||||
{
|
||||
int type = BRUSH_CIRCLE;
|
||||
int size = 1;
|
||||
int angle = 0;
|
||||
char *copy = jstrdup(string);
|
||||
char *tok;
|
||||
int count;
|
||||
|
||||
for (tok=strtok(copy, " "), count=0; tok;
|
||||
tok=strtok(NULL, " "), count++) {
|
||||
switch (count) {
|
||||
|
||||
case 0:
|
||||
if (strcmp(tok, "circle") == 0)
|
||||
type = BRUSH_CIRCLE;
|
||||
else if (strcmp(tok, "square") == 0)
|
||||
type = BRUSH_SQUARE;
|
||||
else if (strcmp(tok, "line") == 0)
|
||||
type = BRUSH_LINE;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
size = strtol(tok, NULL, 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
angle = strtol(tok, NULL, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
set_brush_type(type);
|
||||
set_brush_size(MID(1, size, 32));
|
||||
set_brush_angle(MID(0, angle, 180));
|
||||
|
||||
jfree(copy);
|
||||
}
|
||||
|
||||
/* string = "tool_name x,y x,y x,y ..."
|
||||
tool_name: marker, dots, pencil, brush, floodfill, spray, line,
|
||||
rectangle, ellipse
|
||||
uses the current FG color
|
||||
*/
|
||||
void ToolTrace(const char *string, const char *_color)
|
||||
{
|
||||
Sprite *sprite = current_sprite;
|
||||
|
||||
if (sprite) {
|
||||
Tool *old_current_tool = current_tool;
|
||||
char *copy = jstrdup(string);
|
||||
char *tok;
|
||||
int count;
|
||||
int npoints = 0;
|
||||
int *x = NULL;
|
||||
int *y = NULL;
|
||||
color_t color = string_to_color(_color);
|
||||
|
||||
for (tok=strtok(copy, " "), count=0; tok;
|
||||
tok=strtok(NULL, " "), count++) {
|
||||
switch (count) {
|
||||
case 0:
|
||||
select_tool(tok);
|
||||
break;
|
||||
default: {
|
||||
int u, v;
|
||||
char *s;
|
||||
|
||||
u = (int)strtod(tok, &s);
|
||||
if (s && *s == ',') {
|
||||
v = (int)strtod(s+1, &s);
|
||||
|
||||
npoints++;
|
||||
x = jrealloc(x, sizeof(int)*npoints);
|
||||
y = jrealloc(y, sizeof(int)*npoints);
|
||||
x[npoints-1] = u;
|
||||
y[npoints-1] = v;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npoints > 0) {
|
||||
/* TODO */
|
||||
assert(FALSE);
|
||||
/* do_tool_points(sprite, current_tool, color, npoints, x, y); */
|
||||
jfree(x);
|
||||
jfree(y);
|
||||
}
|
||||
|
||||
select_tool(old_current_tool->name);
|
||||
|
||||
jfree(copy);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************/
|
||||
/* Reset/Restore Configuration */
|
||||
|
||||
static int cfg_tools_brush_type;
|
||||
static int cfg_tools_brush_size;
|
||||
static int cfg_tools_brush_angle;
|
||||
static int cfg_tools_glass_dirty;
|
||||
static int cfg_tools_spray_width;
|
||||
static int cfg_tools_air_speed;
|
||||
static bool cfg_tools_filled;
|
||||
static bool cfg_tools_tiled;
|
||||
static bool cfg_tools_grid_use;
|
||||
static bool cfg_tools_grid_view;
|
||||
static JRect cfg_tools_grid_rect = NULL;
|
||||
static bool cfg_tools_onionskin;
|
||||
static int cfg_jpeg_smooth;
|
||||
static int cfg_jpeg_quality;
|
||||
static int cfg_jpeg_method;
|
||||
|
||||
void ResetConfig(void)
|
||||
{
|
||||
JRect rect;
|
||||
|
||||
/* brush */
|
||||
cfg_tools_brush_type = get_brush_type();
|
||||
cfg_tools_brush_size = get_brush_size();
|
||||
cfg_tools_brush_angle = get_brush_angle();
|
||||
cfg_tools_glass_dirty = get_glass_dirty();
|
||||
cfg_tools_spray_width = get_spray_width();
|
||||
cfg_tools_air_speed = get_air_speed();
|
||||
cfg_tools_filled = get_filled_mode();
|
||||
cfg_tools_tiled = get_tiled_mode();
|
||||
cfg_tools_grid_use = get_use_grid();
|
||||
cfg_tools_grid_view = get_view_grid();
|
||||
|
||||
if (cfg_tools_grid_rect)
|
||||
jrect_free(cfg_tools_grid_rect);
|
||||
cfg_tools_grid_rect = get_grid();
|
||||
|
||||
cfg_tools_onionskin = get_onionskin();
|
||||
|
||||
set_brush_type(BRUSH_CIRCLE);
|
||||
set_brush_size(1);
|
||||
set_brush_angle(0);
|
||||
set_cursor_color(color_mask());
|
||||
set_glass_dirty(128);
|
||||
set_spray_width(16);
|
||||
set_air_speed(75);
|
||||
set_filled_mode(FALSE);
|
||||
set_tiled_mode(FALSE);
|
||||
set_use_grid(FALSE);
|
||||
set_view_grid(FALSE);
|
||||
rect = jrect_new(0, 0, 16, 16);
|
||||
set_grid(rect);
|
||||
jrect_free(rect);
|
||||
set_onionskin(FALSE);
|
||||
|
||||
/* jpeg options */
|
||||
cfg_jpeg_smooth = get_config_int("JPEG", "Smooth", 0);
|
||||
cfg_jpeg_quality = get_config_int("JPEG", "Quality", 100);
|
||||
cfg_jpeg_method = get_config_int("JPEG", "Method", 0);
|
||||
|
||||
set_config_int("JPEG", "Smooth", 0);
|
||||
set_config_int("JPEG", "Quality", 100);
|
||||
set_config_int("JPEG", "Method", 0);
|
||||
}
|
||||
|
||||
void RestoreConfig(void)
|
||||
{
|
||||
/* brush */
|
||||
set_brush_type(cfg_tools_brush_type);
|
||||
set_brush_size(cfg_tools_brush_size);
|
||||
set_brush_angle(cfg_tools_brush_angle);
|
||||
set_glass_dirty(cfg_tools_glass_dirty);
|
||||
set_spray_width(cfg_tools_spray_width);
|
||||
set_air_speed(cfg_tools_air_speed);
|
||||
set_filled_mode(cfg_tools_filled);
|
||||
set_tiled_mode(cfg_tools_tiled);
|
||||
set_use_grid(cfg_tools_grid_use);
|
||||
set_view_grid(cfg_tools_grid_view);
|
||||
|
||||
set_grid(cfg_tools_grid_rect);
|
||||
jrect_free(cfg_tools_grid_rect);
|
||||
cfg_tools_grid_rect = NULL;
|
||||
|
||||
set_onionskin(cfg_tools_onionskin);
|
||||
|
||||
/* jpeg options */
|
||||
set_config_int("JPEG", "Smooth", cfg_jpeg_smooth);
|
||||
set_config_int("JPEG", "Quality", cfg_jpeg_quality);
|
||||
set_config_int("JPEG", "Method", cfg_jpeg_method);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
/* ASE - Allegro Sprite Editor
|
||||
* Copyright (C) 2001-2008 David A. Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#error no
|
||||
|
||||
#ifndef MODULES_TOOLS2_H
|
||||
#define MODULES_TOOLS2_H
|
||||
|
||||
void SetBrush(const char *string);
|
||||
void ToolTrace(const char *string, const char *color);
|
||||
|
||||
void ResetConfig(void);
|
||||
void RestoreConfig(void);
|
||||
|
||||
#endif /* MODULES_TOOLS2_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user