mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-09 18:44:46 +00:00
Refactor all member functions of Context class to camel case.
This commit is contained in:
parent
bf395fca61
commit
8e8ac7aa50
12
src/app.cpp
12
src/app.cpp
@ -257,12 +257,12 @@ int App::run()
|
|||||||
else {
|
else {
|
||||||
// Mount and select the sprite
|
// Mount and select the sprite
|
||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
context->add_sprite(sprite);
|
context->addSprite(sprite);
|
||||||
context->set_current_sprite(sprite);
|
context->setCurrentSprite(sprite);
|
||||||
|
|
||||||
if (isGui()) {
|
if (isGui()) {
|
||||||
// Show it
|
// Show it
|
||||||
set_sprite_in_more_reliable_editor(context->get_first_sprite());
|
set_sprite_in_more_reliable_editor(context->getFirstSprite());
|
||||||
|
|
||||||
// Recent file
|
// Recent file
|
||||||
getRecentFiles()->addRecentFile(option->data().c_str());
|
getRecentFiles()->addRecentFile(option->data().c_str());
|
||||||
@ -368,7 +368,7 @@ void app_refresh_screen(const Sprite* sprite)
|
|||||||
void app_realloc_sprite_list()
|
void app_realloc_sprite_list()
|
||||||
{
|
{
|
||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
const SpriteList& list = context->get_sprite_list();
|
const SpriteList& list = context->getSpriteList();
|
||||||
|
|
||||||
// Insert all other sprites
|
// Insert all other sprites
|
||||||
for (SpriteList::const_iterator
|
for (SpriteList::const_iterator
|
||||||
@ -437,7 +437,7 @@ int app_get_current_image_type()
|
|||||||
Context* context = UIContext::instance();
|
Context* context = UIContext::instance();
|
||||||
ASSERT(context != NULL);
|
ASSERT(context != NULL);
|
||||||
|
|
||||||
Sprite* sprite = context->get_current_sprite();
|
Sprite* sprite = context->getCurrentSprite();
|
||||||
if (sprite != NULL)
|
if (sprite != NULL)
|
||||||
return sprite->getImgType();
|
return sprite->getImgType();
|
||||||
else if (screen != NULL && bitmap_color_depth(screen) == 8)
|
else if (screen != NULL && bitmap_color_depth(screen) == 8)
|
||||||
@ -486,7 +486,7 @@ void TabsBarHandler::clickTab(Tabs* tabs, void* data, int button)
|
|||||||
Command* close_file_cmd =
|
Command* close_file_cmd =
|
||||||
CommandsModule::instance()->get_command_by_name(CommandId::close_file);
|
CommandsModule::instance()->get_command_by_name(CommandId::close_file);
|
||||||
|
|
||||||
UIContext::instance()->execute_command(close_file_cmd, NULL);
|
UIContext::instance()->executeCommand(close_file_cmd, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ void CanvasSizeCommand::onExecute(Context* context)
|
|||||||
{
|
{
|
||||||
CurrentSpriteWriter sprite(context);
|
CurrentSpriteWriter sprite(context);
|
||||||
|
|
||||||
if (context->is_ui_available()) {
|
if (context->isUiAvailable()) {
|
||||||
JWidget left, top, right, bottom, ok;
|
JWidget left, top, right, bottom, ok;
|
||||||
|
|
||||||
// load the window widget
|
// load the window widget
|
||||||
|
@ -84,16 +84,16 @@ protected:
|
|||||||
|
|
||||||
bool onEnabled(Context* context)
|
bool onEnabled(Context* context)
|
||||||
{
|
{
|
||||||
return !context->get_sprite_list().empty();
|
return !context->getSpriteList().empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(Context* context)
|
void onExecute(Context* context)
|
||||||
{
|
{
|
||||||
if (!context->get_current_sprite())
|
if (!context->getCurrentSprite())
|
||||||
set_sprite_in_more_reliable_editor(context->get_first_sprite());
|
set_sprite_in_more_reliable_editor(context->getFirstSprite());
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (context->get_current_sprite() != NULL) {
|
if (context->getCurrentSprite() != NULL) {
|
||||||
if (!close_current_sprite(context))
|
if (!close_current_sprite(context))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ try_again:;
|
|||||||
if (save_it) {
|
if (save_it) {
|
||||||
Command* save_command =
|
Command* save_command =
|
||||||
CommandsModule::instance()->get_command_by_name(CommandId::save_file);
|
CommandsModule::instance()->get_command_by_name(CommandId::save_file);
|
||||||
context->execute_command(save_command);
|
context->executeCommand(save_command);
|
||||||
|
|
||||||
goto try_again;
|
goto try_again;
|
||||||
}
|
}
|
||||||
|
@ -539,7 +539,7 @@ void ConfigureTools::onSetGridClick()
|
|||||||
Command* grid_settings_cmd =
|
Command* grid_settings_cmd =
|
||||||
CommandsModule::instance()->get_command_by_name(CommandId::grid_settings);
|
CommandsModule::instance()->get_command_by_name(CommandId::grid_settings);
|
||||||
|
|
||||||
UIContext::instance()->execute_command(grid_settings_cmd, NULL);
|
UIContext::instance()->executeCommand(grid_settings_cmd, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (LockedSpriteException& e) {
|
catch (LockedSpriteException& e) {
|
||||||
|
@ -95,7 +95,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
|
|||||||
if (sprite_copy != NULL) {
|
if (sprite_copy != NULL) {
|
||||||
sprite_copy->setFilename(dst_name->getText());
|
sprite_copy->setFilename(dst_name->getText());
|
||||||
|
|
||||||
context->add_sprite(sprite_copy);
|
context->addSprite(sprite_copy);
|
||||||
set_sprite_in_more_reliable_editor(sprite_copy);
|
set_sprite_in_more_reliable_editor(sprite_copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ ExitCommand::ExitCommand()
|
|||||||
|
|
||||||
void ExitCommand::onExecute(Context* context)
|
void ExitCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
Sprite *sprite = context->get_first_sprite();
|
Sprite *sprite = context->getFirstSprite();
|
||||||
|
|
||||||
while (sprite) {
|
while (sprite) {
|
||||||
// check if this sprite is modified
|
// check if this sprite is modified
|
||||||
@ -57,7 +57,7 @@ void ExitCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sprite = context->get_next_sprite(sprite);
|
sprite = context->getNextSprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* close the window */
|
/* close the window */
|
||||||
|
@ -68,7 +68,7 @@ void InvertMaskCommand::onExecute(Context* context)
|
|||||||
// so we select all
|
// so we select all
|
||||||
Command* mask_all_cmd =
|
Command* mask_all_cmd =
|
||||||
CommandsModule::instance()->get_command_by_name(CommandId::mask_all);
|
CommandsModule::instance()->get_command_by_name(CommandId::mask_all);
|
||||||
context->execute_command(mask_all_cmd);
|
context->executeCommand(mask_all_cmd);
|
||||||
}
|
}
|
||||||
// invert the current mask
|
// invert the current mask
|
||||||
else {
|
else {
|
||||||
|
@ -70,7 +70,7 @@ void LoadMaskCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
base::string filename = m_filename;
|
base::string filename = m_filename;
|
||||||
|
|
||||||
if (context->is_ui_available()) {
|
if (context->isUiAvailable()) {
|
||||||
filename = ase_file_selector("Load .msk File", filename, "msk");
|
filename = ase_file_selector("Load .msk File", filename, "msk");
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -172,7 +172,7 @@ void NewFileCommand::onExecute(Context* context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show the sprite to the user
|
// Show the sprite to the user
|
||||||
context->add_sprite(sprite);
|
context->addSprite(sprite);
|
||||||
set_sprite_in_more_reliable_editor(sprite);
|
set_sprite_in_more_reliable_editor(sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ void OpenFileCommand::onExecute(Context* context)
|
|||||||
Console console;
|
Console console;
|
||||||
|
|
||||||
// interactive
|
// interactive
|
||||||
if (context->is_ui_available() && m_filename.empty()) {
|
if (context->isUiAvailable() && m_filename.empty()) {
|
||||||
char exts[4096];
|
char exts[4096];
|
||||||
get_readable_extensions(exts, sizeof(exts));
|
get_readable_extensions(exts, sizeof(exts));
|
||||||
m_filename = ase_file_selector(friendly_name(), "", exts);
|
m_filename = ase_file_selector(friendly_name(), "", exts);
|
||||||
@ -188,7 +188,7 @@ void OpenFileCommand::onExecute(Context* context)
|
|||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
|
|
||||||
App::instance()->getRecentFiles()->addRecentFile(fop->filename.c_str());
|
App::instance()->getRecentFiles()->addRecentFile(fop->filename.c_str());
|
||||||
context->add_sprite(sprite);
|
context->addSprite(sprite);
|
||||||
|
|
||||||
set_sprite_in_more_reliable_editor(sprite);
|
set_sprite_in_more_reliable_editor(sprite);
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ static void sort_command(JWidget widget)
|
|||||||
std::vector<int> mapping;
|
std::vector<int> mapping;
|
||||||
sort_by_criteria(palette, from, to, data.selected_criteria->children, mapping);
|
sort_by_criteria(palette, from, to, data.selected_criteria->children, mapping);
|
||||||
|
|
||||||
if (UIContext::instance()->get_current_sprite()) {
|
if (UIContext::instance()->getCurrentSprite()) {
|
||||||
// Remap all colors
|
// Remap all colors
|
||||||
if (mapping.size() > 0) {
|
if (mapping.size() > 0) {
|
||||||
CurrentSpriteWriter sprite(UIContext::instance());
|
CurrentSpriteWriter sprite(UIContext::instance());
|
||||||
@ -901,7 +901,7 @@ static void update_hex_entry()
|
|||||||
|
|
||||||
static void update_current_sprite_palette(const char* operationName)
|
static void update_current_sprite_palette(const char* operationName)
|
||||||
{
|
{
|
||||||
if (UIContext::instance()->get_current_sprite()) {
|
if (UIContext::instance()->getCurrentSprite()) {
|
||||||
try {
|
try {
|
||||||
CurrentSpriteWriter sprite(UIContext::instance());
|
CurrentSpriteWriter sprite(UIContext::instance());
|
||||||
Palette* newPalette = get_current_palette(); // System current pal
|
Palette* newPalette = get_current_palette(); // System current pal
|
||||||
|
@ -187,7 +187,7 @@ void PreviewCommand::onExecute(Context* context)
|
|||||||
strcmp(command->short_name(), CommandId::goto_next_frame) == 0 ||
|
strcmp(command->short_name(), CommandId::goto_next_frame) == 0 ||
|
||||||
strcmp(command->short_name(), CommandId::goto_last_frame) == 0)) {
|
strcmp(command->short_name(), CommandId::goto_last_frame) == 0)) {
|
||||||
// Execute the command
|
// Execute the command
|
||||||
context->execute_command(command);
|
context->executeCommand(command);
|
||||||
|
|
||||||
// Redraw
|
// Redraw
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
@ -43,12 +43,12 @@ Context::~Context()
|
|||||||
delete m_settings;
|
delete m_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SpriteList& Context::get_sprite_list() const
|
const SpriteList& Context::getSpriteList() const
|
||||||
{
|
{
|
||||||
return m_sprites;
|
return m_sprites;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite* Context::get_first_sprite() const
|
Sprite* Context::getFirstSprite() const
|
||||||
{
|
{
|
||||||
if (!m_sprites.empty())
|
if (!m_sprites.empty())
|
||||||
return m_sprites.front();
|
return m_sprites.front();
|
||||||
@ -56,7 +56,7 @@ Sprite* Context::get_first_sprite() const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite* Context::get_next_sprite(Sprite* sprite) const
|
Sprite* Context::getNextSprite(Sprite* sprite) const
|
||||||
{
|
{
|
||||||
ASSERT(sprite != NULL);
|
ASSERT(sprite != NULL);
|
||||||
|
|
||||||
@ -70,20 +70,17 @@ Sprite* Context::get_next_sprite(Sprite* sprite) const
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void Context::addSprite(Sprite* sprite)
|
||||||
* Append the sprite to the context's sprites' list.
|
|
||||||
*/
|
|
||||||
void Context::add_sprite(Sprite* sprite)
|
|
||||||
{
|
{
|
||||||
ASSERT(sprite != NULL);
|
ASSERT(sprite != NULL);
|
||||||
|
|
||||||
m_sprites.push_front(sprite);
|
m_sprites.push_front(sprite);
|
||||||
|
|
||||||
// generate on_add_sprite event
|
// Generate onAddSprite event
|
||||||
on_add_sprite(sprite);
|
onAddSprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::remove_sprite(Sprite* sprite)
|
void Context::removeSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
ASSERT(sprite != NULL);
|
ASSERT(sprite != NULL);
|
||||||
|
|
||||||
@ -94,14 +91,14 @@ void Context::remove_sprite(Sprite* sprite)
|
|||||||
m_sprites.erase(it);
|
m_sprites.erase(it);
|
||||||
|
|
||||||
// generate on_remove_sprite event
|
// generate on_remove_sprite event
|
||||||
on_remove_sprite(sprite);
|
onRemoveSprite(sprite);
|
||||||
|
|
||||||
// the current sprite cannot be the removed sprite anymore
|
// the current sprite cannot be the removed sprite anymore
|
||||||
if (m_currentSprite == sprite)
|
if (m_currentSprite == sprite)
|
||||||
set_current_sprite(NULL);
|
setCurrentSprite(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::send_sprite_to_top(Sprite* sprite)
|
void Context::sendSpriteToTop(Sprite* sprite)
|
||||||
{
|
{
|
||||||
ASSERT(sprite);
|
ASSERT(sprite);
|
||||||
|
|
||||||
@ -115,19 +112,19 @@ void Context::send_sprite_to_top(Sprite* sprite)
|
|||||||
m_sprites.push_front(sprite);
|
m_sprites.push_front(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite* Context::get_current_sprite() const
|
Sprite* Context::getCurrentSprite() const
|
||||||
{
|
{
|
||||||
return m_currentSprite;
|
return m_currentSprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::set_current_sprite(Sprite* sprite)
|
void Context::setCurrentSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
m_currentSprite = sprite;
|
m_currentSprite = sprite;
|
||||||
|
|
||||||
on_set_current_sprite(sprite);
|
onSetCurrentSprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::execute_command(Command* command, Params* params)
|
void Context::executeCommand(Command* command, Params* params)
|
||||||
{
|
{
|
||||||
Console console;
|
Console console;
|
||||||
|
|
||||||
@ -168,17 +165,17 @@ void Context::execute_command(Command* command, Params* params)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::on_add_sprite(Sprite* sprite)
|
void Context::onAddSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::on_remove_sprite(Sprite* sprite)
|
void Context::onRemoveSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
void Context::on_set_current_sprite(Sprite* sprite)
|
void Context::onSetCurrentSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -43,34 +43,35 @@ class Context
|
|||||||
public:
|
public:
|
||||||
virtual ~Context();
|
virtual ~Context();
|
||||||
|
|
||||||
virtual bool is_ui_available() const { return false; }
|
virtual bool isUiAvailable() const { return false; }
|
||||||
virtual bool is_recording_macro() const { return false; }
|
virtual bool isRecordingMacro() const { return false; }
|
||||||
virtual bool is_executing_macro() const { return false; }
|
virtual bool isExecutingMacro() const { return false; }
|
||||||
virtual bool is_executing_script() const { return false; }
|
virtual bool isExecutingScript() const { return false; }
|
||||||
|
|
||||||
ISettings* getSettings() { return m_settings; }
|
ISettings* getSettings() { return m_settings; }
|
||||||
|
|
||||||
const SpriteList& get_sprite_list() const;
|
const SpriteList& getSpriteList() const;
|
||||||
Sprite* get_first_sprite() const;
|
Sprite* getFirstSprite() const;
|
||||||
Sprite* get_next_sprite(Sprite* sprite) const;
|
Sprite* getNextSprite(Sprite* sprite) const;
|
||||||
|
|
||||||
void add_sprite(Sprite* sprite);
|
// Appends the sprite to the context's sprites' list.
|
||||||
void remove_sprite(Sprite* sprite);
|
void addSprite(Sprite* sprite);
|
||||||
void send_sprite_to_top(Sprite* sprite);
|
void removeSprite(Sprite* sprite);
|
||||||
|
void sendSpriteToTop(Sprite* sprite);
|
||||||
|
|
||||||
Sprite* get_current_sprite() const;
|
Sprite* getCurrentSprite() const;
|
||||||
void set_current_sprite(Sprite* sprite);
|
void setCurrentSprite(Sprite* sprite);
|
||||||
|
|
||||||
virtual void execute_command(Command* command, Params* params = NULL);
|
virtual void executeCommand(Command* command, Params* params = NULL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// The "settings" are deleted automatically in the ~Context destructor
|
// The "settings" are deleted automatically in the ~Context destructor
|
||||||
Context(ISettings* settings);
|
Context(ISettings* settings);
|
||||||
|
|
||||||
virtual void on_add_sprite(Sprite* sprite);
|
virtual void onAddSprite(Sprite* sprite);
|
||||||
virtual void on_remove_sprite(Sprite* sprite);
|
virtual void onRemoveSprite(Sprite* sprite);
|
||||||
virtual void on_set_current_sprite(Sprite* sprite);
|
virtual void onSetCurrentSprite(Sprite* sprite);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void check_for_dropped_files()
|
|||||||
for (std::vector<base::string>::iterator
|
for (std::vector<base::string>::iterator
|
||||||
it = files.begin(); it != files.end(); ++it) {
|
it = files.begin(); it != files.end(); ++it) {
|
||||||
params.set("filename", it->c_str());
|
params.set("filename", it->c_str());
|
||||||
UIContext::instance()->execute_command(cmd_open_file, ¶ms);
|
UIContext::instance()->executeCommand(cmd_open_file, ¶ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ bool animation_editor_is_movingcel()
|
|||||||
*/
|
*/
|
||||||
void switch_between_animation_and_sprite_editor()
|
void switch_between_animation_and_sprite_editor()
|
||||||
{
|
{
|
||||||
const Sprite* sprite = UIContext::instance()->get_current_sprite();
|
const Sprite* sprite = UIContext::instance()->getCurrentSprite();
|
||||||
|
|
||||||
/* create the window & the animation-editor */
|
/* create the window & the animation-editor */
|
||||||
Frame* window = new Frame(true, NULL);
|
Frame* window = new Frame(true, NULL);
|
||||||
@ -537,8 +537,8 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg)
|
|||||||
else if (msg->mouse.left) {
|
else if (msg->mouse.left) {
|
||||||
if (anieditor->clk_frame == anieditor->hot_frame) {
|
if (anieditor->clk_frame == anieditor->hot_frame) {
|
||||||
UIContext::instance()
|
UIContext::instance()
|
||||||
->execute_command(CommandsModule::instance()
|
->executeCommand(CommandsModule::instance()
|
||||||
->get_command_by_name(CommandId::frame_properties));
|
->get_command_by_name(CommandId::frame_properties));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const SpriteReader sprite((Sprite*)anieditor->sprite);
|
const SpriteReader sprite((Sprite*)anieditor->sprite);
|
||||||
@ -738,7 +738,7 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg)
|
|||||||
strcmp(command->short_name(), CommandId::goto_next_layer) == 0 ||
|
strcmp(command->short_name(), CommandId::goto_next_layer) == 0 ||
|
||||||
strcmp(command->short_name(), CommandId::goto_last_frame) == 0) {
|
strcmp(command->short_name(), CommandId::goto_last_frame) == 0) {
|
||||||
// execute the command
|
// execute the command
|
||||||
UIContext::instance()->execute_command(command);
|
UIContext::instance()->executeCommand(command);
|
||||||
|
|
||||||
anieditor_show_current_cel(widget);
|
anieditor_show_current_cel(widget);
|
||||||
jwidget_dirty(widget);
|
jwidget_dirty(widget);
|
||||||
@ -748,7 +748,7 @@ static bool anieditor_msg_proc(JWidget widget, JMessage msg)
|
|||||||
if (strcmp(command->short_name(), CommandId::new_layer) == 0 ||
|
if (strcmp(command->short_name(), CommandId::new_layer) == 0 ||
|
||||||
strcmp(command->short_name(), CommandId::remove_layer) == 0) {
|
strcmp(command->short_name(), CommandId::remove_layer) == 0) {
|
||||||
// execute the command
|
// execute the command
|
||||||
UIContext::instance()->execute_command(command);
|
UIContext::instance()->executeCommand(command);
|
||||||
|
|
||||||
anieditor_regenerate_layers(widget);
|
anieditor_regenerate_layers(widget);
|
||||||
anieditor_show_current_cel(widget);
|
anieditor_show_current_cel(widget);
|
||||||
|
@ -177,7 +177,7 @@ void editors_draw_sprite_tiled(const Sprite* sprite, int x1, int y1, int x2, int
|
|||||||
void editors_hide_sprite(const Sprite* sprite)
|
void editors_hide_sprite(const Sprite* sprite)
|
||||||
{
|
{
|
||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
bool refresh = (context->get_current_sprite() == sprite) ? true: false;
|
bool refresh = (context->getCurrentSprite() == sprite) ? true: false;
|
||||||
|
|
||||||
for (EditorList::iterator it = editors.begin(); it != editors.end(); ++it) {
|
for (EditorList::iterator it = editors.begin(); it != editors.end(); ++it) {
|
||||||
Editor* editor = *it;
|
Editor* editor = *it;
|
||||||
@ -189,7 +189,7 @@ void editors_hide_sprite(const Sprite* sprite)
|
|||||||
if (refresh) {
|
if (refresh) {
|
||||||
Sprite* sprite = current_editor->getSprite();
|
Sprite* sprite = current_editor->getSprite();
|
||||||
|
|
||||||
context->set_current_sprite(sprite);
|
context->setCurrentSprite(sprite);
|
||||||
app_refresh_screen(sprite);
|
app_refresh_screen(sprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ void set_current_editor(Editor* editor)
|
|||||||
|
|
||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
Sprite* sprite = current_editor->getSprite();
|
Sprite* sprite = current_editor->getSprite();
|
||||||
context->set_current_sprite(sprite);
|
context->setCurrentSprite(sprite);
|
||||||
|
|
||||||
app_refresh_screen(sprite);
|
app_refresh_screen(sprite);
|
||||||
app_realloc_sprite_list();
|
app_realloc_sprite_list();
|
||||||
@ -218,9 +218,9 @@ void set_sprite_in_current_editor(Sprite *sprite)
|
|||||||
if (current_editor) {
|
if (current_editor) {
|
||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
|
|
||||||
context->set_current_sprite(sprite);
|
context->setCurrentSprite(sprite);
|
||||||
if (sprite != NULL)
|
if (sprite != NULL)
|
||||||
context->send_sprite_to_top(sprite);
|
context->sendSpriteToTop(sprite);
|
||||||
|
|
||||||
current_editor->editor_set_sprite(sprite);
|
current_editor->editor_set_sprite(sprite);
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ static int is_sprite_in_some_editor(Sprite* sprite)
|
|||||||
static Sprite* get_more_reliable_sprite()
|
static Sprite* get_more_reliable_sprite()
|
||||||
{
|
{
|
||||||
UIContext* context = UIContext::instance();
|
UIContext* context = UIContext::instance();
|
||||||
const SpriteList& list = context->get_sprite_list();
|
const SpriteList& list = context->getSpriteList();
|
||||||
|
|
||||||
for (SpriteList::const_iterator
|
for (SpriteList::const_iterator
|
||||||
it = list.begin(); it != list.end(); ++it) {
|
it = list.begin(); it != list.end(); ++it) {
|
||||||
|
@ -1240,7 +1240,7 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
|||||||
|
|
||||||
// the screen shot is available in everywhere
|
// the screen shot is available in everywhere
|
||||||
if (strcmp(command->short_name(), CommandId::screen_shot) == 0) {
|
if (strcmp(command->short_name(), CommandId::screen_shot) == 0) {
|
||||||
UIContext::instance()->execute_command(command, shortcut->params);
|
UIContext::instance()->executeCommand(command, shortcut->params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// all other keys are only available in the main-window
|
// all other keys are only available in the main-window
|
||||||
@ -1258,7 +1258,7 @@ static bool manager_msg_proc(JWidget widget, JMessage msg)
|
|||||||
else if (child->is_desktop() && child == app_get_top_window()) {
|
else if (child->is_desktop() && child == app_get_top_window()) {
|
||||||
/* ok, so we can execute the command represented by the
|
/* ok, so we can execute the command represented by the
|
||||||
pressed-key in the message... */
|
pressed-key in the message... */
|
||||||
UIContext::instance()->execute_command(command, shortcut->params);
|
UIContext::instance()->executeCommand(command, shortcut->params);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@ class CurrentSpriteReader : public SpriteReader
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
CurrentSpriteReader(Context* context)
|
CurrentSpriteReader(Context* context)
|
||||||
: SpriteReader(context->get_current_sprite())
|
: SpriteReader(context->getCurrentSprite())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ class CurrentSpriteWriter : public SpriteWriter
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
CurrentSpriteWriter(Context* context)
|
CurrentSpriteWriter(Context* context)
|
||||||
: SpriteWriter(context->get_current_sprite())
|
: SpriteWriter(context->getCurrentSprite())
|
||||||
, m_context(context)
|
, m_context(context)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
{
|
{
|
||||||
ASSERT(m_sprite != NULL);
|
ASSERT(m_sprite != NULL);
|
||||||
|
|
||||||
m_context->remove_sprite(m_sprite);
|
m_context->removeSprite(m_sprite);
|
||||||
unlock_writer();
|
unlock_writer();
|
||||||
|
|
||||||
delete m_sprite;
|
delete m_sprite;
|
||||||
|
@ -44,10 +44,10 @@ UIContext::~UIContext()
|
|||||||
m_instance = NULL;
|
m_instance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIContext::on_add_sprite(Sprite* sprite)
|
void UIContext::onAddSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
// base method
|
// base method
|
||||||
Context::on_add_sprite(sprite);
|
Context::onAddSprite(sprite);
|
||||||
|
|
||||||
// add the tab for this sprite
|
// add the tab for this sprite
|
||||||
app_get_tabsbar()->addTab(get_filename(sprite->getFilename()), sprite);
|
app_get_tabsbar()->addTab(get_filename(sprite->getFilename()), sprite);
|
||||||
@ -56,10 +56,10 @@ void UIContext::on_add_sprite(Sprite* sprite)
|
|||||||
app_realloc_sprite_list();
|
app_realloc_sprite_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIContext::on_remove_sprite(Sprite* sprite)
|
void UIContext::onRemoveSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
// base method
|
// base method
|
||||||
Context::on_remove_sprite(sprite);
|
Context::onRemoveSprite(sprite);
|
||||||
|
|
||||||
// remove this sprite from tabs
|
// remove this sprite from tabs
|
||||||
app_get_tabsbar()->removeTab(sprite);
|
app_get_tabsbar()->removeTab(sprite);
|
||||||
@ -71,9 +71,9 @@ void UIContext::on_remove_sprite(Sprite* sprite)
|
|||||||
editors_hide_sprite(sprite);
|
editors_hide_sprite(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIContext::on_set_current_sprite(Sprite* sprite)
|
void UIContext::onSetCurrentSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
Context::on_set_current_sprite(sprite);
|
Context::onSetCurrentSprite(sprite);
|
||||||
|
|
||||||
// Select the sprite in the tabs.
|
// Select the sprite in the tabs.
|
||||||
app_get_tabsbar()->selectTab(sprite);
|
app_get_tabsbar()->selectTab(sprite);
|
||||||
|
@ -29,12 +29,12 @@ public:
|
|||||||
UIContext();
|
UIContext();
|
||||||
virtual ~UIContext();
|
virtual ~UIContext();
|
||||||
|
|
||||||
virtual bool is_ui_available() const { return true; }
|
virtual bool isUiAvailable() const { return true; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void on_add_sprite(Sprite* sprite);
|
virtual void onAddSprite(Sprite* sprite);
|
||||||
virtual void on_remove_sprite(Sprite* sprite);
|
virtual void onRemoveSprite(Sprite* sprite);
|
||||||
virtual void on_set_current_sprite(Sprite* sprite);
|
virtual void onSetCurrentSprite(Sprite* sprite);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static UIContext* m_instance;
|
static UIContext* m_instance;
|
||||||
|
@ -422,7 +422,7 @@ bool ColorBar::onProcessMessage(JMessage msg)
|
|||||||
params.set("target", (m_hot == HOTCOLOR_FGCOLOR ? "foreground": "background"));
|
params.set("target", (m_hot == HOTCOLOR_FGCOLOR ? "foreground": "background"));
|
||||||
params.set("open", "true");
|
params.set("open", "true");
|
||||||
|
|
||||||
UIContext::instance()->execute_command(paledit_cmd, ¶ms);
|
UIContext::instance()->executeCommand(paledit_cmd, ¶ms);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,7 +1049,7 @@ bool Editor::onProcessMessage(JMessage msg)
|
|||||||
Tool* current_tool = getCurrentEditorTool();
|
Tool* current_tool = getCurrentEditorTool();
|
||||||
|
|
||||||
set_current_editor(this);
|
set_current_editor(this);
|
||||||
context->set_current_sprite(m_sprite);
|
context->setCurrentSprite(m_sprite);
|
||||||
|
|
||||||
// Start scroll loop
|
// Start scroll loop
|
||||||
if (msg->mouse.middle ||
|
if (msg->mouse.middle ||
|
||||||
@ -1145,7 +1145,7 @@ bool Editor::onProcessMessage(JMessage msg)
|
|||||||
Params params;
|
Params params;
|
||||||
params.set("target", msg->mouse.right ? "background": "foreground");
|
params.set("target", msg->mouse.right ? "background": "foreground");
|
||||||
|
|
||||||
UIContext::instance()->execute_command(eyedropper_cmd, ¶ms);
|
UIContext::instance()->executeCommand(eyedropper_cmd, ¶ms);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Start the Tool-Loop
|
// Start the Tool-Loop
|
||||||
@ -1444,7 +1444,7 @@ bool Editor::onProcessMessage(JMessage msg)
|
|||||||
Command* command = CommandsModule::instance()->get_command_by_name
|
Command* command = CommandsModule::instance()->get_command_by_name
|
||||||
((dz < 0) ? CommandId::goto_next_frame: CommandId::goto_previous_frame);
|
((dz < 0) ? CommandId::goto_next_frame: CommandId::goto_previous_frame);
|
||||||
if (command)
|
if (command)
|
||||||
UIContext::instance()->execute_command(command, NULL);
|
UIContext::instance()->executeCommand(command, NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static bool menuitem_msg_proc(JWidget widget, JMessage msg)
|
|||||||
menuitem->m_command->loadParams(menuitem->m_params);
|
menuitem->m_command->loadParams(menuitem->m_params);
|
||||||
|
|
||||||
if (menuitem->m_command->isEnabled(context)) {
|
if (menuitem->m_command->isEnabled(context)) {
|
||||||
context->execute_command(menuitem->m_command);
|
context->executeCommand(menuitem->m_command);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -575,7 +575,7 @@ bool StatusBar::onProcessMessage(JMessage msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case JM_MOUSEENTER: {
|
case JM_MOUSEENTER: {
|
||||||
bool state = (UIContext::instance()->get_current_sprite() != NULL);
|
bool state = (UIContext::instance()->getCurrentSprite() != NULL);
|
||||||
|
|
||||||
if (!jwidget_has_child(this, m_movePixelsBox)) {
|
if (!jwidget_has_child(this, m_movePixelsBox)) {
|
||||||
if (!jwidget_has_child(this, m_commandsBox) && state) {
|
if (!jwidget_has_child(this, m_commandsBox) && state) {
|
||||||
@ -686,7 +686,7 @@ bool StatusBar::onProcessMessage(JMessage msg)
|
|||||||
->get_command_by_name(CommandId::donate);
|
->get_command_by_name(CommandId::donate);
|
||||||
|
|
||||||
Params params;
|
Params params;
|
||||||
UIContext::instance()->execute_command(donate, ¶ms);
|
UIContext::instance()->executeCommand(donate, ¶ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (LockedSpriteException&) {
|
catch (LockedSpriteException&) {
|
||||||
@ -779,7 +779,7 @@ static void ani_button_command(Button* widget, AniAction action)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cmd)
|
if (cmd)
|
||||||
UIContext::instance()->execute_command(cmd);
|
UIContext::instance()->executeCommand(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::updateFromLayer()
|
void StatusBar::updateFromLayer()
|
||||||
|
@ -279,7 +279,7 @@ bool ToolBar::onProcessMessage(JMessage msg)
|
|||||||
Command* conf_tools_cmd =
|
Command* conf_tools_cmd =
|
||||||
CommandsModule::instance()->get_command_by_name(CommandId::configure_tools);
|
CommandsModule::instance()->get_command_by_name(CommandId::configure_tools);
|
||||||
|
|
||||||
UIContext::instance()->execute_command(conf_tools_cmd);
|
UIContext::instance()->executeCommand(conf_tools_cmd);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user