libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / resedit / App.cpp
blob4f20e5f5a9a575dfee24a9365acc378405b1aaf6
1 /*
2 * Copyright (c) 2005-2010, Haiku, Inc.
3 * Distributed under the terms of the MIT license.
5 * Author:
6 * DarkWyrm <darkwyrm@gmail.com>
7 */
8 #include "App.h"
9 #include "ResWindow.h"
11 #include <Entry.h>
13 int
14 main(void)
16 App app;
17 app.Run();
18 return 0;
22 App::App(void)
23 : BApplication("application/x-vnd.Haiku-ResEdit")
25 fOpenPanel = new BFilePanel();
29 App::~App(void)
31 delete fOpenPanel;
35 void
36 App::ReadyToRun(void)
38 // CountWindows() needs to be used instead of fWindowCount because the registration
39 // message isn't processed in time. One of the windows belong to the BFilePanels and is
40 // counted in CountWindows().
41 if (CountWindows() < 2)
42 new ResWindow(BRect(50, 100, 600, 400));
46 void
47 App::MessageReceived(BMessage *msg)
49 switch(msg->what) {
50 case M_SHOW_OPEN_PANEL: {
51 // Don't do anything if it's already open
52 if (fOpenPanel->IsShowing())
53 break;
54 fOpenPanel->Show();
55 break;
57 default:
58 BApplication::MessageReceived(msg);
63 void
64 App::ArgvReceived(int32 argc, char** argv)
66 for (int32 i = 1; i < argc; i++) {
67 BEntry entry(argv[i]);
68 entry_ref ref;
69 if (entry.GetRef(&ref) < B_OK)
70 continue;
71 new ResWindow(BRect(50, 100, 600, 400), &ref);
76 void
77 App::RefsReceived(BMessage *msg)
79 entry_ref ref;
80 int32 i = 0;
81 while (msg->FindRef("refs", i++, &ref) == B_OK)
82 new ResWindow(BRect(50, 100, 600, 400), &ref);