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(); m_editor->backToPreviousState();
} }
bool pressedOk() { return getKiller() == ok(); } bool pressedOk() { return closer() == ok(); }
int getWidth() { return width()->textInt(); } int getWidth() { return width()->textInt(); }
int getHeight() { return height()->textInt(); } int getHeight() { return height()->textInt(); }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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