Rename ui::Window::getKiller() -> closer()

This commit is contained in:
David Capello 2015-12-04 14:54:15 -03:00
parent 1aaeacc460
commit 06be4f7fa6
29 changed files with 40 additions and 45 deletions

View File

@ -80,7 +80,7 @@ public:
m_editor->backToPreviousState();
}
bool pressedOk() { return getKiller() == ok(); }
bool pressedOk() { return closer() == ok(); }
int getWidth() { return width()->textInt(); }
int getHeight() { return height()->textInt(); }

View File

@ -123,7 +123,7 @@ void ColorQuantizationCommand::onExecute(Context* context)
}
window.openWindowInForeground();
if (window.getKiller() != window.ok())
if (window.closer() != window.ok())
return;
bool withAlpha = window.alphaChannel()->isSelected();

View File

@ -68,7 +68,7 @@ void DuplicateSpriteCommand::onExecute(Context* context)
// Open the window
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
set_config_bool("DuplicateSprite", "Flatten", window.flatten()->isSelected());
// Make a copy of the document

View File

@ -402,7 +402,7 @@ public:
}
bool ok() const {
return getKiller() == exportButton();
return closer() == exportButton();
}
app::SpriteSheetType spriteSheetTypeValue() const {

View File

@ -118,7 +118,7 @@ void FramePropertiesCommand::onExecute(Context* context)
window.frlen()->setTextf("%d", sprite->frameDuration(firstFrame));
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
int num = window.frlen()->textInt();
ContextWriter writer(reader);

View File

@ -122,7 +122,7 @@ protected:
window.frame()->setTextf("%d", editor->frame()+1);
window.openWindowInForeground();
if (window.getKiller() != window.ok())
if (window.closer() != window.ok())
return editor->frame();
m_frame = window.frame()->textInt();

View File

@ -168,7 +168,7 @@ void GridSettingsCommand::onExecute(Context* context)
window->openWindowInForeground();
if (window->getKiller() == button_ok) {
if (window->closer() == button_ok) {
bounds.x = grid_x->textInt();
bounds.y = grid_y->textInt();
bounds.w = grid_w->textInt();

View File

@ -93,7 +93,7 @@ public:
}
bool ok() const {
return getKiller() == import();
return closer() == import();
}
Document* document() const {

View File

@ -544,7 +544,7 @@ void KeyboardShortcutsCommand::onExecute(Context* context)
window.setVisible(true);
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
// Save keyboard shortcuts in configuration file
{
ResourceFinder rf;

View File

@ -151,7 +151,7 @@ void MaskByColorCommand::onExecute(Context* context)
// Open the window
m_window->openWindowInForeground();
bool apply = (m_window->getKiller() == button_ok);
bool apply = (m_window->closer() == button_ok);
ContextWriter writer(reader);
Document* document(writer.document());

View File

@ -105,7 +105,7 @@ void NewFileCommand::onExecute(Context* context)
// Open the window
window.openWindowInForeground();
if (window.getKiller() == window.okButton()) {
if (window.closer() == window.okButton()) {
bool ok = false;
// Get the options

View File

@ -96,7 +96,7 @@ void NewLayerCommand::onExecute(Context* context)
window->openWindowInForeground();
if (window->getKiller() != window->findChild("ok"))
if (window->closer() != window->findChild("ok"))
return;
name = window->findChild("name")->text();

View File

@ -61,7 +61,7 @@ void NewLayerSetCommand::onExecute(Context* context)
window->openWindowInForeground();
if (window->getKiller() != window->findChild("ok"))
if (window->closer() != window->findChild("ok"))
return;
std::string name = window->findChild("name")->text();

View File

@ -169,7 +169,7 @@ public:
}
bool ok() {
return (getKiller() == buttonOk());
return (closer() == buttonOk());
}
void saveConfig() {

View File

@ -60,7 +60,7 @@ void PaletteSizeCommand::onExecute(Context* context)
app::gen::PaletteSize window;
window.colors()->setTextf("%d", palette.size());
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
int ncolors = window.colors()->textInt();
if (ncolors == palette.size())
return;

View File

@ -156,7 +156,7 @@ void PasteTextCommand::onExecute(Context* ctx)
window.userText()->setText(last_text_used);
window.openWindowInForeground();
if (window.getKiller() != window.ok())
if (window.closer() != window.ok())
return;
last_text_used = window.userText()->text();

View File

@ -121,7 +121,7 @@ void SpritePropertiesCommand::onExecute(Context* context)
window.setVisible(true);
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
if (color_button) {
ContextWriter writer(context);
Sprite* sprite(writer.sprite());

View File

@ -310,7 +310,7 @@ void SpriteSizeCommand::onExecute(Context* context)
window.openWindowInForeground();
save_window_pos(&window, "SpriteSize");
if (window.getKiller() != window.ok())
if (window.closer() != window.ok())
return;
new_width = window.widthPx()->textInt();

View File

@ -266,14 +266,14 @@ bool ColorCurveEditor::editNodeManually(gfx::Point& viewPt)
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
viewPt.x = int(window.x()->textDouble());
viewPt.y = int(window.y()->textDouble());
viewPt.x = MID(0, viewPt.x, 255);
viewPt.y = MID(0, viewPt.y, 255);
return true;
}
else if (window.getKiller() == window.deleteButton()) {
else if (window.closer() == window.deleteButton()) {
removePoint(&viewPt);
return true;
}

View File

@ -100,7 +100,7 @@ bool FilterWindow::doModal()
openWindowInForeground();
// Did the user press OK?
if (getKiller() == &m_okButton) {
if (closer() == &m_okButton) {
m_preview.stop();
// Apply the filter in background

View File

@ -1326,7 +1326,7 @@ base::SharedPtr<FormatOptions> GifFormat::onGetFormatOptions(FileOp* fop)
win.openWindowInForeground();
if (win.getKiller() == win.ok()) {
if (win.closer() == win.ok()) {
gif_options->setInterlaced(win.interlaced()->isSelected());
gif_options->setLoop(win.loop()->isSelected());

View File

@ -376,7 +376,7 @@ base::SharedPtr<FormatOptions> JpegFormat::onGetFormatOptions(FileOp* fop)
window->openWindowInForeground();
if (window->getKiller() == ok) {
if (window->closer() == ok) {
jpeg_options->quality = slider_quality->getValue() / 10.0f;
set_config_float("JPEG", "Quality", jpeg_options->quality);
}

View File

@ -349,7 +349,7 @@ base::SharedPtr<FormatOptions> WebPFormat::onGetFormatOptions(FileOp* fop)
win.openWindowInForeground();
if (win.getKiller() == win.ok()) {
if (win.closer() == win.ok()) {
webp_options->setQuality(win.quality()->getValue());
webp_options->setMethod(win.compression()->getValue());
webp_options->setLossless(win.lossless()->isSelected());

View File

@ -66,7 +66,7 @@ void SendCrash::notificationClick()
dlg.filename()->Click.connect(Bind(&SendCrash::onClickFilename, this));
dlg.openWindowInForeground();
if (dlg.getKiller() == dlg.deleteFile()) {
if (dlg.closer() == dlg.deleteFile()) {
try {
base::delete_file(m_dumpFilename);
m_dumpFilename = "";

View File

@ -445,8 +445,8 @@ std::string FileSelector::show(
// open the window and run... the user press ok?
again:
openWindowInForeground();
if (getKiller() == ok ||
getKiller() == m_fileList) {
if (closer() == ok ||
closer() == m_fileList) {
// open the selected file
IFileItem* folder = m_fileList->getCurrentFolder();
ASSERT(folder);
@ -732,7 +732,7 @@ void FileSelector::onNewFolder()
app::gen::NewFolderWindow window;
window.openWindowInForeground();
if (window.getKiller() == window.ok()) {
if (window.closer() == window.ok()) {
IFileItem* currentFolder = m_fileList->getCurrentFolder();
if (currentFolder) {
std::string dirname = window.name()->text();

View File

@ -40,7 +40,7 @@ FrameTagWindow::FrameTagWindow(const doc::Sprite* sprite, const doc::FrameTag* f
bool FrameTagWindow::show()
{
openWindowInForeground();
return (getKiller() == ok());
return (closer() == ok());
}
std::string FrameTagWindow::nameValue()

View File

@ -112,11 +112,11 @@ int Alert::show(const char* format, ...)
// Open it
window->openWindowInForeground();
// Check the killer
// Check the closer
int ret = 0;
if (Widget* killer = window->getKiller()) {
if (Widget* closer = window->closer()) {
for (int i=0; i<(int)buttons.size(); ++i) {
if (killer == buttons[i]) {
if (closer == buttons[i]) {
ret = i+1;
break;
}

View File

@ -41,7 +41,7 @@ static gfx::Rect* clickedWindowPos = NULL;
Window::Window(Type type, const std::string& text)
: Widget(kWindowWidget)
{
m_killer = NULL;
m_closer = NULL;
m_isDesktop = (type == DesktopWindow);
m_isMoveable = !m_isDesktop;
m_isSizeable = !m_isDesktop;
@ -63,11 +63,6 @@ Window::~Window()
manager()->_closeWindow(this, false);
}
Widget* Window::getKiller() const
{
return m_killer;
}
void Window::setAutoRemap(bool state)
{
m_isAutoRemap = state;
@ -252,14 +247,14 @@ void Window::openWindowInForeground()
m_isForeground = false;
}
void Window::closeWindow(Widget* killer)
void Window::closeWindow(Widget* closer)
{
m_killer = killer;
m_closer = closer;
manager()->_closeWindow(this, true);
// Close event
CloseEvent ev(killer);
CloseEvent ev(closer);
onClose(ev);
}
@ -277,7 +272,7 @@ bool Window::onProcessMessage(Message* msg)
switch (msg->type()) {
case kOpenMessage:
m_killer = NULL;
m_closer = NULL;
break;
case kCloseMessage:

View File

@ -24,7 +24,7 @@ namespace ui {
explicit Window(Type type, const std::string& text = "");
~Window();
Widget* getKiller() const;
Widget* closer() const { return m_closer; }
void setAutoRemap(bool state);
void setMoveable(bool state);
@ -39,7 +39,7 @@ namespace ui {
void openWindow();
void openWindowInForeground();
void closeWindow(Widget* killer);
void closeWindow(Widget* closer);
bool isTopLevel();
bool isForeground() const { return m_isForeground; }
@ -74,7 +74,7 @@ namespace ui {
void limitSize(int* w, int* h);
void moveWindow(const gfx::Rect& rect, bool use_blit);
Widget* m_killer;
Widget* m_closer;
bool m_isDesktop : 1;
bool m_isMoveable : 1;
bool m_isSizeable : 1;