* make sure we close the app on ESCAPE

* do not launch a second window in case of RefsReceived



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27799 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich 2008-09-30 21:43:36 +00:00
parent 4c39bafa21
commit ef52eb17ea
4 changed files with 16 additions and 8 deletions

View File

@ -14,7 +14,8 @@
Screenshot::Screenshot()
: BApplication("application/x-vnd.haiku-screenshot"),
fArgvReceived(false)
fArgvReceived(false),
fRefsReceived(false)
{
}
@ -27,10 +28,11 @@ Screenshot::~Screenshot()
void
Screenshot::ReadyToRun()
{
if(!fArgvReceived)
if(!fArgvReceived && !fRefsReceived)
new ScreenshotWindow();
fArgvReceived = false;
fRefsReceived = false;
}
@ -57,6 +59,8 @@ Screenshot::RefsReceived(BMessage* message)
new ScreenshotWindow(delay * 1000000, includeBorder, includeCursor,
grabActiveWindow, showConfigureWindow, saveScreenshotSilent);
fRefsReceived = true;
}

View File

@ -19,4 +19,5 @@ private:
private:
bool fArgvReceived;
bool fRefsReceived;
};

View File

@ -190,11 +190,14 @@ ScreenshotWindow::MessageReceived(BMessage* message)
}
} break;
case kFinishScreenshot: {
case kFinishScreenshot:
_WriteSettings();
_SaveScreenshot();
// fall through
case B_QUIT_REQUESTED:
be_app_messenger.SendMessage(B_QUIT_REQUESTED);
} break;
break;
case kShowOptions: {
BCardLayout* layout = dynamic_cast<BCardLayout*> (GetLayout());
@ -323,7 +326,7 @@ ScreenshotWindow::_SetupSecondLayoutItem(BCardLayout* layout)
fPreviewBox->SetExplicitMinSize(BSize(200.0, B_SIZE_UNSET));
fPreviewBox->SetFlags(fPreviewBox->Flags() | B_FULL_UPDATE_ON_RESIZE);
fNameControl = new BTextControl("", "Name:", "screenshot", NULL);
fNameControl = new BTextControl("", "Name:", "screenshot1", NULL);
BMessage settings(_ReadSettings());
@ -333,7 +336,7 @@ ScreenshotWindow::_SetupSecondLayoutItem(BCardLayout* layout)
_SetupOutputPathMenu(new BMenu("Please select"), settings);
BMenuField* menuField2 = new BMenuField("Save in:", fOutputPathMenu);
fNameControl->SetText(_FindValidFileName("screenshot").String());
fNameControl->SetText(_FindValidFileName("screenshot1").String());
BBox* divider = new BBox(B_FANCY_BORDER, NULL);
divider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));
@ -739,7 +742,7 @@ ScreenshotWindow::_SaveScreenshotSilent() const
int32 index = 1;
do {
char filename[32];
sprintf(filename, "screenshot%ld.png", index++);
sprintf(filename, "screenshot%ld", index++);
path = homePath;
path.Append(filename);
entry.SetTo(path.Path());

View File

@ -28,7 +28,7 @@ public:
bool saveScreenshotSilent = false);
virtual ~ScreenshotWindow();
virtual void MessageReceived(BMessage* message);
virtual void MessageReceived(BMessage* message);
private:
void _InitWindow();