Minor changes: remove unnecessary dependencies with allegro.h

This commit is contained in:
David Capello 2014-09-21 11:59:39 -03:00
parent e133c341ff
commit 5d3d96d2d9
22 changed files with 54 additions and 84 deletions

View File

@ -35,13 +35,13 @@
#include "app/ui/main_window.h"
#include "app/util/filetoks.h"
#include "base/bind.h"
#include "base/path.h"
#include "ui/ui.h"
#include "tinyxml.h"
#include <allegro/file.h>
#include <allegro/unicode.h>
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
namespace app {
@ -251,7 +251,9 @@ bool AppMenus::rebuildRecentList()
params.set("filename", filename);
menuitem = new AppMenuItem(get_filename(filename), cmd_open_file, &params);
menuitem = new AppMenuItem(
base::get_file_name(filename).c_str(),
cmd_open_file, &params);
submenu->addChild(menuitem);
}
}
@ -389,8 +391,9 @@ void AppMenus::applyShortcutToMenuitemsWithCommand(Menu* menu, Command *command,
Command* mi_command = menuitem->getCommand();
Params* mi_params = menuitem->getParams();
if (mi_command &&
ustricmp(mi_command->short_name(), command->short_name()) == 0 &&
if ((mi_command) &&
(base::string_to_lower(mi_command->short_name()) ==
base::string_to_lower(command->short_name())) &&
((mi_params && *mi_params == *params) ||
(Params() == *params))) {
// Set the accelerator to be shown in this menu-item

View File

@ -36,8 +36,6 @@
#include "raster/stock.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;

View File

@ -32,8 +32,6 @@
#include "raster/image.h"
#include "raster/sprite.h"
#include <allegro/unicode.h>
namespace app {
class ChangePixelFormatCommand : public Command {

View File

@ -30,8 +30,6 @@
#include "raster/sprite.h"
#include "ui/window.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;
@ -124,7 +122,7 @@ protected:
void onLoadParams(Params* params) override
{
std::string frame = params->get("frame");
if (!frame.empty()) m_frame = ustrtol(frame.c_str(), NULL, 10);
if (!frame.empty()) m_frame = strtol(frame.c_str(), NULL, 10);
else m_frame = 0;
}

View File

@ -33,8 +33,6 @@
#include "app/ui_context.h"
#include "ui/window.h"
#include <allegro/unicode.h>
namespace app {
using namespace ui;
@ -89,12 +87,11 @@ protected:
void onExecute(Context* context)
{
IDocumentSettings* docSettings = context->settings()->getDocumentSettings(context->activeDocument());
char buf[512];
docSettings->setSnapToGrid(docSettings->getSnapToGrid() ? false: true);
usprintf(buf, "Snap to grid: %s",
(docSettings->getSnapToGrid() ? "On": "Off"));
char buf[512];
sprintf(buf, "Snap to grid: %s",
(docSettings->getSnapToGrid() ? "On": "Off"));
StatusBar::instance()->setStatusText(250, buf);
}

View File

@ -48,8 +48,6 @@
#include "raster/stock.h"
#include "ui/ui.h"
#include <allegro/color.h>
namespace app {
using namespace ui;

View File

@ -47,9 +47,6 @@
#include "generated_new_sprite.h"
#include <allegro/config.h>
#include <allegro/unicode.h>
using namespace ui;
namespace app {
@ -194,7 +191,7 @@ void NewFileCommand::onExecute(Context* context)
// Show the sprite to the user
base::UniquePtr<Document> doc(new Document(sprite));
sprite.release();
usprintf(buf, "Sprite-%04d", ++_sprite_counter);
sprintf(buf, "Sprite-%04d", ++_sprite_counter);
doc->setFilename(buf);
doc->setContext(context);
doc.release();

View File

@ -35,7 +35,6 @@
#include "app/ui/editor/editor.h"
#include "app/ui/main_window.h"
#include "app/ui/mini_editor.h"
#include "raster/conversion_alleg.h"
#include "raster/image.h"
#include "raster/palette.h"
#include "raster/sprite.h"

View File

@ -40,8 +40,6 @@
#include "raster/stock.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
namespace app {
class RotateCommand : public Command {
@ -193,7 +191,7 @@ void RotateCommand::onLoadParams(Params* params)
m_flipMask = (target == "mask");
if (params->has_param("angle")) {
m_angle = ustrtol(params->get("angle").c_str(), NULL, 10);
m_angle = strtol(params->get("angle").c_str(), NULL, 10);
}
}

View File

@ -20,12 +20,12 @@
#include "config.h"
#endif
#include <allegro/file.h>
#include "app/commands/command.h"
#include "app/context_access.h"
#include "app/file_selector.h"
#include "app/util/msk_file.h"
#include "base/fs.h"
#include "base/path.h"
#include "raster/mask.h"
#include "raster/sprite.h"
#include "ui/alert.h"
@ -66,11 +66,11 @@ void SaveMaskCommand::onExecute(Context* context)
if (filename.empty())
return;
/* does the file exist? */
if (exists(filename.c_str())) {
// Does the file exist?
if (base::is_file(filename.c_str())) {
/* ask if the user wants overwrite the file? */
ret = ui::Alert::show("Warning<<File exists, overwrite it?<<%s||&Yes||&No||&Cancel",
get_filename(filename.c_str()));
base::get_file_name(filename).c_str());
}
else
break;

View File

@ -36,7 +36,6 @@
#include "raster/sprite.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
#include <cstdio>
namespace app {
@ -113,10 +112,10 @@ void SpritePropertiesCommand::onExecute(Context* context)
type->setText(imgtype_text.c_str());
// Sprite size (width and height)
usprintf(buf, "%dx%d (%s)",
sprite->width(),
sprite->height(),
base::get_pretty_memory_size(sprite->getMemSize()).c_str());
sprintf(buf, "%dx%d (%s)",
sprite->width(),
sprite->height(),
base::get_pretty_memory_size(sprite->getMemSize()).c_str());
size->setText(buf);

View File

@ -42,8 +42,6 @@
#include "raster/stock.h"
#include "ui/ui.h"
#include <allegro/unicode.h>
#define PERC_FORMAT "%.1f"
namespace app {

View File

@ -20,8 +20,6 @@
#include "config.h"
#endif
#include <allegro/unicode.h>
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/color_bar.h"

View File

@ -20,16 +20,15 @@
#include "config.h"
#endif
/* #include <stdio.h> */
#include <allegro/unicode.h>
#include <exception>
#include <string.h>
#include "ui/ui.h"
#include "app/commands/commands.h"
#include "app/commands/command.h"
#include "app/commands/commands.h"
#include "app/console.h"
#include "base/string.h"
#include "ui/ui.h"
#include <cstring>
#include <exception>
namespace app {
@ -58,10 +57,8 @@ CommandsModule::~CommandsModule()
{
ASSERT(m_instance == this);
for (CommandsList::iterator
it = m_commands.begin(); it != m_commands.end(); ++it) {
delete *it;
}
for (Command* cmd : m_commands)
delete cmd;
m_commands.clear();
m_instance = NULL;
@ -78,10 +75,10 @@ Command* CommandsModule::getCommandByName(const char* name)
if (!name)
return NULL;
for (CommandsList::iterator
it = m_commands.begin(); it != m_commands.end(); ++it) {
if (ustricmp((*it)->short_name(), name) == 0)
return *it;
std::string lname = base::string_to_lower(name);
for (Command* cmd : m_commands) {
if (base::string_to_lower(cmd->short_name()) == lname)
return cmd;
}
return NULL;

View File

@ -23,13 +23,12 @@
#include "app/data_recovery.h"
#include "app/backup.h"
#include "app/document.h"
#include "app/ini_file.h"
#include "app/ui_context.h"
#include "base/fs.h"
#include "base/path.h"
#include "base/temp_dir.h"
#include "app/document.h"
#include "app/ui_context.h"
#include <allegro.h>
namespace app {

View File

@ -29,8 +29,6 @@
#include "base/file_handle.h"
#include "raster/raster.h"
#include <allegro/color.h>
namespace app {
using namespace base;

View File

@ -29,8 +29,7 @@
#include "base/file_handle.h"
#include "raster/raster.h"
#include <allegro/color.h>
#include <stdio.h>
#include <cstdio>
namespace app {

View File

@ -30,8 +30,6 @@
#include "base/file_handle.h"
#include "raster/raster.h"
#include <allegro/color.h>
namespace app {
using namespace base;

View File

@ -29,8 +29,6 @@
#include "base/file_handle.h"
#include "raster/raster.h"
#include <allegro/color.h>
namespace app {
using namespace base;

View File

@ -30,8 +30,6 @@
#include "base/file_handle.h"
#include "raster/raster.h"
#include <allegro/color.h>
namespace app {
using namespace base;

View File

@ -20,6 +20,7 @@
#include "config.h"
#endif
#include "app/ini_file.h"
#include "app/modules/gui.h"
#include "app/resource_finder.h"
#include "app/ui/skin/button_icon_impl.h"
@ -33,6 +34,7 @@
#include "base/bind.h"
#include "base/fs.h"
#include "base/shared_ptr.h"
#include "base/string.h"
#include "css/sheet.h"
#include "gfx/border.h"
#include "gfx/point.h"
@ -47,8 +49,6 @@
#include "tinyxml.h"
#include <allegro.h>
#define BGCOLOR (getWidgetBgColor(widget))
namespace app {
@ -1082,7 +1082,6 @@ void SkinTheme::paintEntry(PaintEvent& ev)
int scroll, caret, state, selbeg, selend;
std::string textString = widget->getText() + widget->getSuffix();
int suffixIndex = widget->getTextLength();
const char* text = textString.c_str();
int c, ch, x, y, w;
int caret_x;
@ -1107,8 +1106,11 @@ void SkinTheme::paintEntry(PaintEvent& ev)
x = bounds.x + widget->border_width.l;
y = bounds.y + bounds.h/2 - widget->getTextHeight()/2;
for (c=scroll; ugetat(text, c); c++) {
ch = password ? '*': ugetat(text, c);
base::utf8_const_iterator utf8_it = base::utf8_const_iterator(textString.begin());
int textlen = base::utf8_length(textString);
for (c=scroll, utf8_it+=scroll; c<textlen; ++c, ++utf8_it) {
ch = password ? '*': *utf8_it;
// Normal text
bg = ColorNone;
@ -1546,7 +1548,7 @@ void SkinTheme::paintComboBoxEntry(ui::PaintEvent& ev)
gfx::Rect bounds = widget->getClientBounds();
bool password = widget->isPassword();
int scroll, caret, state, selbeg, selend;
const char *text = widget->getText().c_str();
const std::string& textString = widget->getText();
int c, ch, x, y, w;
int caret_x;
@ -1566,8 +1568,11 @@ void SkinTheme::paintComboBoxEntry(ui::PaintEvent& ev)
x = bounds.x + widget->border_width.l;
y = bounds.y + bounds.h/2 - widget->getTextHeight()/2;
for (c=scroll; ugetat(text, c); c++) {
ch = password ? '*': ugetat(text, c);
base::utf8_const_iterator utf8_it = base::utf8_const_iterator(textString.begin());
int textlen = base::utf8_length(textString);
for (c=scroll, utf8_it+=scroll; c<textlen; ++c, ++utf8_it) {
ch = password ? '*': *utf8_it;
// Normal text
bg = ColorNone;

View File

@ -37,9 +37,6 @@
#include "raster/sprite.h"
#include "undo/undo_history.h"
#include <allegro/file.h>
#include <allegro/system.h>
namespace app {
UIContext* UIContext::m_instance = NULL;