Applied patch by Maurice Kalinowski with additional changes by myself:

* Fixed ResEdit build.
* Small cleanups and simplifications.
* Removed reference to CapitalB resource in ReadyToRun().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24049 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-02-21 20:10:41 +00:00
parent deeaca74b8
commit 3c3f84d112
4 changed files with 25 additions and 33 deletions
+9 -23
View File
@@ -17,6 +17,7 @@ main(void)
return 0; return 0;
} }
App::App(void) App::App(void)
: BApplication("application/x-vnd.Haiku-ResEdit"), : BApplication("application/x-vnd.Haiku-ResEdit"),
fWindowCount(0) fWindowCount(0)
@@ -36,19 +37,8 @@ App::~App(void)
void void
App::ReadyToRun(void) App::ReadyToRun(void)
{ {
/* if (fWindowCount < 1)
if (fWindowCount < 1) { new ResWindow(BRect(50, 100, 600, 400));
ResWindow *win = new ResWindow(BRect(50,100,600,400));
win->Show();
}
*/
if (fWindowCount < 1) {
BEntry entry("/boot/develop/projects/ResEdit/CapitalBe.rsrc");
entry_ref ref;
entry.GetRef(&ref);
ResWindow *win = new ResWindow(BRect(50,100,600,400),&ref);
win->Show();
}
} }
@@ -82,27 +72,23 @@ App::MessageReceived(BMessage *msg)
void void
App::ArgvReceived(int32 argc, char** argv) App::ArgvReceived(int32 argc, char** argv)
{ {
int i; for (int32 i = 1; i < argc; i++) {
for (i = 1; i < argc; i++) {
BEntry entry(argv[i]); BEntry entry(argv[i]);
entry_ref ref; entry_ref ref;
if (entry.GetRef(&ref) < B_OK) if (entry.GetRef(&ref) < B_OK)
continue; continue;
ResWindow *win = new ResWindow(BRect(50,100,600,400),&ref); new ResWindow(BRect(50, 100, 600, 400), &ref);
win->Show();
} }
} }
void void
App::RefsReceived(BMessage *msg) App::RefsReceived(BMessage *msg)
{ {
entry_ref ref; entry_ref ref;
int32 i=0; int32 i = 0;
while (msg->FindRef("refs",i,&ref) == B_OK) { while (msg->FindRef("refs", i++, &ref) == B_OK)
ResWindow *win = new ResWindow(BRect(50,100,600,400),&ref); new ResWindow(BRect(50, 100, 600, 400), &ref);
win->Show();
i++;
}
} }
+1 -1
View File
@@ -26,5 +26,5 @@ Application ResEdit :
ResourceRoster.cpp ResourceRoster.cpp
ResView.cpp ResView.cpp
ResWindow.cpp ResWindow.cpp
: be tracker translation : be tracker translation libcolumnlistview.a
; ;
+4 -1
View File
@@ -14,10 +14,13 @@ ResWindow::ResWindow(const BRect &rect, const entry_ref *ref)
{ {
be_app->PostMessage(M_REGISTER_WINDOW); be_app->PostMessage(M_REGISTER_WINDOW);
ResView *child = new ResView(Bounds(), "resview", B_FOLLOW_ALL, B_WILL_DRAW, ref); ResView *child = new ResView(Bounds(), "resview", B_FOLLOW_ALL,
B_WILL_DRAW, ref);
AddChild(child); AddChild(child);
SetTitle(child->Filename()); SetTitle(child->Filename());
Show();
} }
+11 -8
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005-2006, Haiku, Inc. * Copyright (c) 2005-2008, Haiku, Inc.
* Distributed under the terms of the MIT license. * Distributed under the terms of the MIT license.
* *
* Author: * Author:
@@ -10,13 +10,16 @@
#include <Window.h> #include <Window.h>
class ResWindow : public BWindow
{ struct entry_ref;
class ResWindow : public BWindow {
public: public:
ResWindow(const BRect &rect, ResWindow(const BRect& rect,
const entry_ref *ref=NULL); const entry_ref* ref = NULL);
~ResWindow(void); virtual ~ResWindow();
bool QuitRequested(void);
virtual bool QuitRequested();
}; };
#endif #endif // RESWIN_H