Fixed problems using the "argument" parameter in commands.

This commit is contained in:
David Capello 2009-07-27 03:03:19 +00:00
parent 5b543a995b
commit c384b6c19b
6 changed files with 10 additions and 11 deletions

View File

@ -35,7 +35,6 @@ static bool cmd_change_image_type_enabled(const char *argument)
const CurrentSpriteReader sprite;
return
sprite != NULL &&
argument != NULL &&
((ustrcmp(argument, "rgb") == 0 && sprite->imgtype != IMAGE_RGB) ||
(ustrcmp(argument, "grayscale") == 0 && sprite->imgtype != IMAGE_GRAYSCALE) ||
(ustrncmp(argument, "indexed", 7) == 0 && sprite->imgtype != IMAGE_INDEXED));

View File

@ -55,7 +55,7 @@ static void cmd_eyedropper_tool_execute(const char *argument)
if (color_type(color) != COLOR_TYPE_MASK) {
/* set the color of the color-bar */
if (argument != NULL && ustrcmp(argument, "background") == 0)
if (ustrcmp(argument, "background") == 0)
colorbar_set_bg_color(app_get_colorbar(), color);
else
colorbar_set_fg_color(app_get_colorbar(), color);

View File

@ -37,10 +37,10 @@
static bool cmd_flip_enabled(const char *argument)
{
assert(argument);
const CurrentSpriteReader sprite;
return
sprite != NULL &&
argument != NULL;
sprite != NULL;
}
static void cmd_flip_execute(const char *argument)

View File

@ -145,13 +145,13 @@ static void cmd_open_file_execute(const char *argument)
Console console;
jstring filename;
/* interactive */
if (!argument) {
// interactive
if (ustrlen(argument) == 0) {
char exts[4096];
get_readable_extensions(exts, sizeof(exts));
filename = ase_file_selector(_("Open Sprite"), "", exts);
}
/* load the file specified in the argument */
// load the file specified in the argument
else {
filename = argument;
}

View File

@ -33,7 +33,7 @@
static bool cmd_select_file_enabled(const char *argument)
{
/* with argument, the argument specified the ID of the GfxObj */
if (argument) {
if (ustrlen(argument) > 0) {
int sprite_id = ustrtol(argument, NULL, 10);
GfxObj *gfxobj = gfxobj_find(sprite_id);
return gfxobj && gfxobj->type == GFXOBJ_SPRITE;
@ -47,7 +47,7 @@ static bool cmd_select_file_checked(const char *argument)
{
const CurrentSpriteReader sprite;
if (argument) {
if (ustrlen(argument) > 0) {
int sprite_id = ustrtol(argument, NULL, 10);
GfxObj *gfxobj = gfxobj_find(sprite_id);
return
@ -62,7 +62,7 @@ static void cmd_select_file_execute(const char *argument)
{
UIContext* context = UIContext::instance();
if (argument) {
if (ustrlen(argument) > 0) {
int sprite_id = ustrtol(argument, NULL, 10);
GfxObj* gfxobj = gfxobj_find(sprite_id);
assert(gfxobj != NULL);

View File

@ -1068,7 +1068,7 @@ static bool editor_msg_proc(JWidget widget, JMessage msg)
else if (editor->alt_pressed) {
Command *command = command_get_by_name(CMD_EYEDROPPER_TOOL);
if (command_is_enabled(command, NULL))
command_execute(command, msg->mouse.right ? "background": NULL);
command_execute(command, msg->mouse.right ? "background": "");
return TRUE;
}
/* draw */