From 5a45d1ec2368fc07ac04a8d2a6cf0e697bd9fe9d Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 6 May 2014 00:08:43 -0300 Subject: [PATCH] Remove the number of colors entry field from "New Sprite" dialog This field is disabled, and the program isn't ready to support less than 256 colors in Indexed mode, so it's better if we remove this field to avoid confusion. --- data/widgets/new_sprite.xml | 8 ++++---- src/app/commands/cmd_new_file.cpp | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/data/widgets/new_sprite.xml b/data/widgets/new_sprite.xml index ec655b155..af4b19e59 100644 --- a/data/widgets/new_sprite.xml +++ b/data/widgets/new_sprite.xml @@ -15,11 +15,11 @@ - - - - + diff --git a/src/app/commands/cmd_new_file.cpp b/src/app/commands/cmd_new_file.cpp index 42bb87367..777adbdc8 100644 --- a/src/app/commands/cmd_new_file.cpp +++ b/src/app/commands/cmd_new_file.cpp @@ -76,7 +76,7 @@ NewFileCommand::NewFileCommand() void NewFileCommand::onExecute(Context* context) { PixelFormat format; - int w, h, bg, ncolors; + int w, h, bg, ncolors = raster::Palette::MaxColors; char buf[1024]; app::Color bg_table[] = { app::Color::fromMask(), @@ -93,7 +93,7 @@ void NewFileCommand::onExecute(Context* context) Widget* radio1 = app::find_widget(window, "radio1"); Widget* radio2 = app::find_widget(window, "radio2"); Widget* radio3 = app::find_widget(window, "radio3"); - Widget* colors = app::find_widget(window, "colors"); + // Widget* colors = app::find_widget(window, "colors"); ListBox* bg_box = app::find_widget(window, "bg_box"); Widget* ok = app::find_widget(window, "ok_button"); @@ -106,7 +106,7 @@ void NewFileCommand::onExecute(Context* context) w = get_config_int("NewSprite", "Width", 320); h = get_config_int("NewSprite", "Height", 240); bg = get_config_int("NewSprite", "Background", 4); // Default = Background color - ncolors = get_config_int("NewSprite", "Colors", 256); + // ncolors = get_config_int("NewSprite", "Colors", 256); // If the clipboard contains an image, we can show the size of the // clipboard as default image size. @@ -118,7 +118,7 @@ void NewFileCommand::onExecute(Context* context) width->setTextf("%d", MAX(1, w)); height->setTextf("%d", MAX(1, h)); - colors->setTextf("%d", MID(2, ncolors, 256)); + // colors->setTextf("%d", MID(2, ncolors, 256)); // Select image-type switch (format) { @@ -143,7 +143,7 @@ void NewFileCommand::onExecute(Context* context) w = width->getTextInt(); h = height->getTextInt(); - ncolors = colors->getTextInt(); + // ncolors = colors->getTextInt(); bg = bg_box->getSelectedIndex(); w = MID(1, w, 65535); @@ -190,7 +190,8 @@ void NewFileCommand::onExecute(Context* context) layerImage->configureAsBackground(); Image* image = sprite->getStock()->getImage(layerImage->getCel(FrameNumber(0))->getImage()); - raster::clear_image(image, color_utils::color_for_image(color, format)); + raster::clear_image(image, + color_utils::color_for_image(color, format, -1)); } }