* fix probable memory leaks, not in the image but anyway...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27851 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,18 +12,18 @@
|
|||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
// to deal in the Software without restriction, including without limitation
|
// to deal in the Software without restriction, including without limitation
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
//
|
//
|
||||||
// The above copyright notice and this permission notice shall be included
|
// The above copyright notice and this permission notice shall be included
|
||||||
// in all copies or substantial portions of the Software.
|
// in all copies or substantial portions of the Software.
|
||||||
//
|
//
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -59,12 +59,12 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
|
|||||||
: BView(frame, name, resize, flags)
|
: BView(frame, name, resize, flags)
|
||||||
{
|
{
|
||||||
fSettings = settings;
|
fSettings = settings;
|
||||||
|
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
BMessage *pMsg;
|
BMessage *pMsg;
|
||||||
int32 val;
|
int32 val;
|
||||||
|
|
||||||
// Show Caption checkbox
|
// Show Caption checkbox
|
||||||
pMsg = new BMessage(CHANGE_CAPTION);
|
pMsg = new BMessage(CHANGE_CAPTION);
|
||||||
fShowCaption = new BCheckBox(BRect(10, 45, 180, 62),
|
fShowCaption = new BCheckBox(BRect(10, 45, 180, 62),
|
||||||
@@ -73,7 +73,7 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
|
|||||||
fShowCaption->SetValue(val);
|
fShowCaption->SetValue(val);
|
||||||
fShowCaption->SetViewColor(ViewColor());
|
fShowCaption->SetViewColor(ViewColor());
|
||||||
AddChild(fShowCaption);
|
AddChild(fShowCaption);
|
||||||
|
|
||||||
// Change Border checkbox
|
// Change Border checkbox
|
||||||
pMsg = new BMessage(CHANGE_BORDER);
|
pMsg = new BMessage(CHANGE_BORDER);
|
||||||
fShowBorder = new BCheckBox(BRect(10, 70, 180, 87),
|
fShowBorder = new BCheckBox(BRect(10, 70, 180, 87),
|
||||||
@@ -82,7 +82,7 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
|
|||||||
fShowBorder->SetValue(val);
|
fShowBorder->SetValue(val);
|
||||||
fShowBorder->SetViewColor(ViewColor());
|
fShowBorder->SetViewColor(ViewColor());
|
||||||
AddChild(fShowBorder);
|
AddChild(fShowBorder);
|
||||||
|
|
||||||
// Delay Menu
|
// Delay Menu
|
||||||
// setup PNG interlace options menu
|
// setup PNG interlace options menu
|
||||||
int32 currentDelay = fSettings->SetGetInt32(SAVER_SETTING_DELAY) / 1000;
|
int32 currentDelay = fSettings->SetGetInt32(SAVER_SETTING_DELAY) / 1000;
|
||||||
@@ -123,19 +123,20 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
|
|||||||
"Delay Menu Field", "Delay:", fDelayMenu);
|
"Delay Menu Field", "Delay:", fDelayMenu);
|
||||||
fDelayMenuField->SetViewColor(ViewColor());
|
fDelayMenuField->SetViewColor(ViewColor());
|
||||||
fDelayMenuField->SetDivider(40);
|
fDelayMenuField->SetDivider(40);
|
||||||
AddChild(fDelayMenuField);
|
AddChild(fDelayMenuField);
|
||||||
|
|
||||||
// Choose Image Folder button
|
// Choose Image Folder button
|
||||||
pMsg = new BMessage(CHOOSE_DIRECTORY);
|
pMsg = new BMessage(CHOOSE_DIRECTORY);
|
||||||
fChooseFolder = new BButton(BRect(50, 160, 180, 180),
|
fChooseFolder = new BButton(BRect(50, 160, 180, 180),
|
||||||
"Choose Folder", "Choose Image Folder" B_UTF8_ELLIPSIS, pMsg);
|
"Choose Folder", "Choose Image Folder" B_UTF8_ELLIPSIS, pMsg);
|
||||||
AddChild(fChooseFolder);
|
AddChild(fChooseFolder);
|
||||||
|
|
||||||
// Setup choose folder file panel
|
// Setup choose folder file panel
|
||||||
pMsg = new BMessage(CHANGE_DIRECTORY);
|
pMsg = new BMessage(CHANGE_DIRECTORY);
|
||||||
fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, (const entry_ref *) NULL,
|
fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, (const entry_ref *) NULL,
|
||||||
B_DIRECTORY_NODE, false, pMsg, NULL, true, true);
|
B_DIRECTORY_NODE, false, pMsg, NULL, true, true);
|
||||||
fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select");
|
||||||
|
delete pMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
@@ -154,7 +155,7 @@ SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name,
|
|||||||
SlideShowConfigView::~SlideShowConfigView()
|
SlideShowConfigView::~SlideShowConfigView()
|
||||||
{
|
{
|
||||||
fSettings->Release();
|
fSettings->Release();
|
||||||
|
|
||||||
delete fFilePanel;
|
delete fFilePanel;
|
||||||
fFilePanel = NULL;
|
fFilePanel = NULL;
|
||||||
}
|
}
|
||||||
@@ -180,7 +181,7 @@ SlideShowConfigView::AllAttached()
|
|||||||
fShowBorder->SetTarget(msgr);
|
fShowBorder->SetTarget(msgr);
|
||||||
fChooseFolder->SetTarget(msgr);
|
fChooseFolder->SetTarget(msgr);
|
||||||
fFilePanel->SetTarget(msgr);
|
fFilePanel->SetTarget(msgr);
|
||||||
|
|
||||||
// Set target for menu items
|
// Set target for menu items
|
||||||
for (int32 i = 0; i < fDelayMenu->CountItems(); i++) {
|
for (int32 i = 0; i < fDelayMenu->CountItems(); i++) {
|
||||||
BMenuItem *item = fDelayMenu->ItemAt(i);
|
BMenuItem *item = fDelayMenu->ItemAt(i);
|
||||||
@@ -215,7 +216,7 @@ SlideShowConfigView::MessageReceived(BMessage *message)
|
|||||||
fSettings->SetGetBool(SAVER_SETTING_CAPTION, &bNewVal);
|
fSettings->SetGetBool(SAVER_SETTING_CAPTION, &bNewVal);
|
||||||
fSettings->SaveSettings();
|
fSettings->SaveSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHANGE_BORDER:
|
case CHANGE_BORDER:
|
||||||
if (fShowBorder->Value())
|
if (fShowBorder->Value())
|
||||||
bNewVal = true;
|
bNewVal = true;
|
||||||
@@ -224,7 +225,7 @@ SlideShowConfigView::MessageReceived(BMessage *message)
|
|||||||
fSettings->SetGetBool(SAVER_SETTING_BORDER, &bNewVal);
|
fSettings->SetGetBool(SAVER_SETTING_BORDER, &bNewVal);
|
||||||
fSettings->SaveSettings();
|
fSettings->SaveSettings();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHOOSE_DIRECTORY:
|
case CHOOSE_DIRECTORY:
|
||||||
{
|
{
|
||||||
BString strDirectory;
|
BString strDirectory;
|
||||||
@@ -236,11 +237,11 @@ SlideShowConfigView::MessageReceived(BMessage *message)
|
|||||||
if (entry.GetRef(&ref) != B_OK)
|
if (entry.GetRef(&ref) != B_OK)
|
||||||
return;
|
return;
|
||||||
fFilePanel->SetPanelDirectory(&ref);
|
fFilePanel->SetPanelDirectory(&ref);
|
||||||
|
|
||||||
fFilePanel->Show();
|
fFilePanel->Show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CHANGE_DIRECTORY:
|
case CHANGE_DIRECTORY:
|
||||||
{
|
{
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
@@ -253,14 +254,14 @@ SlideShowConfigView::MessageReceived(BMessage *message)
|
|||||||
if (path.InitCheck() != B_OK)
|
if (path.InitCheck() != B_OK)
|
||||||
return;
|
return;
|
||||||
BString strDirectory = path.Path();
|
BString strDirectory = path.Path();
|
||||||
|
|
||||||
fSettings->SetString(SAVER_SETTING_DIRECTORY, strDirectory);
|
fSettings->SetString(SAVER_SETTING_DIRECTORY, strDirectory);
|
||||||
fSettings->SaveSettings();
|
fSettings->SaveSettings();
|
||||||
|
|
||||||
Invalidate();
|
Invalidate();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CHANGE_DELAY:
|
case CHANGE_DELAY:
|
||||||
{
|
{
|
||||||
int32 newVal;
|
int32 newVal;
|
||||||
@@ -271,7 +272,7 @@ SlideShowConfigView::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -300,10 +301,10 @@ SlideShowConfigView::Draw(BRect area)
|
|||||||
float xbold, ybold;
|
float xbold, ybold;
|
||||||
xbold = fh.descent + 1;
|
xbold = fh.descent + 1;
|
||||||
ybold = fh.ascent + fh.descent * 2 + fh.leading;
|
ybold = fh.ascent + fh.descent * 2 + fh.leading;
|
||||||
|
|
||||||
char title[] = "SlideShow Screen Saver";
|
char title[] = "SlideShow Screen Saver";
|
||||||
DrawString(title, BPoint(xbold, ybold));
|
DrawString(title, BPoint(xbold, ybold));
|
||||||
|
|
||||||
SetFont(be_plain_font);
|
SetFont(be_plain_font);
|
||||||
font_height plainh;
|
font_height plainh;
|
||||||
GetFontHeight(&plainh);
|
GetFontHeight(&plainh);
|
||||||
@@ -312,7 +313,7 @@ SlideShowConfigView::Draw(BRect area)
|
|||||||
|
|
||||||
char writtenby[] = "Written by Michael Wilber";
|
char writtenby[] = "Written by Michael Wilber";
|
||||||
DrawString(writtenby, BPoint(xbold, yplain * 1 + ybold));
|
DrawString(writtenby, BPoint(xbold, yplain * 1 + ybold));
|
||||||
|
|
||||||
// Draw current folder
|
// Draw current folder
|
||||||
BString strFolder;
|
BString strFolder;
|
||||||
fSettings->GetString(SAVER_SETTING_DIRECTORY, strFolder);
|
fSettings->GetString(SAVER_SETTING_DIRECTORY, strFolder);
|
||||||
|
|||||||
@@ -186,8 +186,8 @@ void UserPropertiesView::Draw(BRect rect)
|
|||||||
MovePenTo(202, 210);
|
MovePenTo(202, 210);
|
||||||
DrawString("days");
|
DrawString("days");
|
||||||
|
|
||||||
SetDrawingMode(B_OP_ALPHA);
|
SetDrawingMode(B_OP_ALPHA);
|
||||||
SetHighColor(0, 0, 0, 180);
|
SetHighColor(0, 0, 0, 180);
|
||||||
SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
|
SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);
|
||||||
DrawBitmap(icon, iconRect);
|
DrawBitmap(icon, iconRect);
|
||||||
}
|
}
|
||||||
@@ -246,7 +246,6 @@ UserPropertiesPanel::UserPropertiesPanel(BRect frame, const char *name, BWindow
|
|||||||
infoView = new UserPropertiesView(r, name == NULL ? NULL : user);
|
infoView = new UserPropertiesView(r, name == NULL ? NULL : user);
|
||||||
AddChild(infoView);
|
AddChild(infoView);
|
||||||
|
|
||||||
myMsgr = new BMessenger(NULL, this, NULL);
|
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,7 +263,9 @@ void UserPropertiesPanel::MessageReceived(BMessage *msg)
|
|||||||
switch (msg->what)
|
switch (msg->what)
|
||||||
{
|
{
|
||||||
case MSG_USER_BROWSE:
|
case MSG_USER_BROWSE:
|
||||||
filePanel = new BFilePanel(B_OPEN_PANEL, myMsgr, &entryRef, B_DIRECTORY_NODE, false);
|
BMessenger messenger(this);
|
||||||
|
filePanel = new BFilePanel(B_OPEN_PANEL, &messenger, &entryRef,
|
||||||
|
B_DIRECTORY_NODE, false);
|
||||||
// filePanel->SetTarget(this);
|
// filePanel->SetTarget(this);
|
||||||
filePanel->Show();
|
filePanel->Show();
|
||||||
filePanel->Window()->SetTitle("User Home");
|
filePanel->Window()->SetTitle("User Home");
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ class UserPropertiesPanel : public BWindow
|
|||||||
bool isCancelled() { return cancelled; }
|
bool isCancelled() { return cancelled; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMessenger *myMsgr;
|
|
||||||
UserPropertiesView *infoView;
|
UserPropertiesView *infoView;
|
||||||
BWindow *shareWin;
|
BWindow *shareWin;
|
||||||
char user[33];
|
char user[33];
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
{
|
{
|
||||||
fWindows->Show();
|
fWindows->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------
|
//--------------
|
||||||
|
|
||||||
void SetOrigin(BPoint origin)
|
void SetOrigin(BPoint origin)
|
||||||
@@ -326,7 +326,9 @@ entry_ref ref;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fInputFilePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL, B_FILE_NODE, false, msg);
|
BMessenger messenger(this)
|
||||||
|
fInputFilePanel = new BFilePanel(B_OPEN_PANEL, &messenger,
|
||||||
|
NULL, B_FILE_NODE, false, msg);
|
||||||
fInputFilePanel->Show();
|
fInputFilePanel->Show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -375,7 +377,9 @@ entry_ref ref;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fOutputFilePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), NULL, B_FILE_NODE, false, msg);
|
BMessenger messenger(this)
|
||||||
|
fOutputFilePanel = new BFilePanel(B_SAVE_PANEL, &messenger,
|
||||||
|
NULL, B_FILE_NODE, false, msg);
|
||||||
fOutputFilePanel->Show();
|
fOutputFilePanel->Show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -437,7 +441,9 @@ entry_ref ref;
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fOutputFilePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL, B_FILE_NODE, false, msg);
|
BMessenger messenger(this)
|
||||||
|
fOutputFilePanel = new BFilePanel(B_OPEN_PANEL, &messenger,
|
||||||
|
NULL, B_FILE_NODE, false, msg);
|
||||||
fOutputFilePanel->Show();
|
fOutputFilePanel->Show();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -552,7 +558,9 @@ entry_ref ref;
|
|||||||
PostMessage(&message);
|
PostMessage(&message);
|
||||||
message = BMessage(*msg);
|
message = BMessage(*msg);
|
||||||
message.what = CHANGE_INPUT_FILE;
|
message.what = CHANGE_INPUT_FILE;
|
||||||
fInputFilePanel = fInputFilePanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this), NULL, B_FILE_NODE, false, msg);;
|
BMessenger messenger(this)
|
||||||
|
fInputFilePanel = new BFilePanel(B_OPEN_PANEL, &messenger,
|
||||||
|
NULL, B_FILE_NODE, false, msg);;
|
||||||
PostMessage(&message);
|
PostMessage(&message);
|
||||||
message = BMessage(OUTPUT_CHANGE_TO_BEOS_SYNTH);
|
message = BMessage(OUTPUT_CHANGE_TO_BEOS_SYNTH);
|
||||||
PostMessage(&message);
|
PostMessage(&message);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
// ImageWindow.cpp
|
// ImageWindow.cpp
|
||||||
//
|
//
|
||||||
// BWindow class for displaying an image. Uses ImageView class for its
|
// BWindow class for displaying an image. Uses ImageView class for its
|
||||||
// view.
|
// view.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Copyright (c) 2003 OpenBeOS Project
|
// Copyright (c) 2003 OpenBeOS Project
|
||||||
@@ -13,18 +13,18 @@
|
|||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
// to deal in the Software without restriction, including without limitation
|
// to deal in the Software without restriction, including without limitation
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
// and/or sell copies of the Software, and to permit persons to whom the
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
// Software is furnished to do so, subject to the following conditions:
|
||||||
//
|
//
|
||||||
// The above copyright notice and this permission notice shall be included
|
// The above copyright notice and this permission notice shall be included
|
||||||
// in all copies or substantial portions of the Software.
|
// in all copies or substantial portions of the Software.
|
||||||
//
|
//
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
@@ -44,73 +44,74 @@ ImageWindow::ImageWindow(BRect rect, const char *name)
|
|||||||
// Setup menu bar
|
// Setup menu bar
|
||||||
BRect rctbar(0, 0, 100, 10);
|
BRect rctbar(0, 0, 100, 10);
|
||||||
BMenuBar *pbar = new BMenuBar(rctbar, "MenuBar");
|
BMenuBar *pbar = new BMenuBar(rctbar, "MenuBar");
|
||||||
|
|
||||||
BMenu *pmnufile = new BMenu("File");
|
BMenu *pmnufile = new BMenu("File");
|
||||||
BMenuItem *pitmopen = new BMenuItem("Open...",
|
BMenuItem *pitmopen = new BMenuItem("Open...",
|
||||||
new BMessage(M_OPEN_IMAGE), 'O', 0);
|
new BMessage(M_OPEN_IMAGE), 'O', 0);
|
||||||
|
|
||||||
BMenuItem *pitmsave = new BMenuItem("Save...",
|
BMenuItem *pitmsave = new BMenuItem("Save...",
|
||||||
new BMessage(M_SAVE_IMAGE), 'S', 0);
|
new BMessage(M_SAVE_IMAGE), 'S', 0);
|
||||||
|
|
||||||
BMenuItem *pitmquit = new BMenuItem("Quit",
|
BMenuItem *pitmquit = new BMenuItem("Quit",
|
||||||
new BMessage(B_QUIT_REQUESTED), 'Q', 0);
|
new BMessage(B_QUIT_REQUESTED), 'Q', 0);
|
||||||
|
|
||||||
pmnufile->AddItem(pitmopen);
|
pmnufile->AddItem(pitmopen);
|
||||||
pmnufile->AddItem(pitmsave);
|
pmnufile->AddItem(pitmsave);
|
||||||
pmnufile->AddSeparatorItem();
|
pmnufile->AddSeparatorItem();
|
||||||
pmnufile->AddItem(pitmquit);
|
pmnufile->AddItem(pitmquit);
|
||||||
pbar->AddItem(pmnufile);
|
pbar->AddItem(pmnufile);
|
||||||
|
|
||||||
BMenu *pmnuview = new BMenu("View");
|
BMenu *pmnuview = new BMenu("View");
|
||||||
BMenuItem *pitmfirst = new BMenuItem("First Page",
|
BMenuItem *pitmfirst = new BMenuItem("First Page",
|
||||||
new BMessage(M_VIEW_FIRST_PAGE), 'F', 0);
|
new BMessage(M_VIEW_FIRST_PAGE), 'F', 0);
|
||||||
|
|
||||||
BMenuItem *pitmlast = new BMenuItem("Last Page",
|
BMenuItem *pitmlast = new BMenuItem("Last Page",
|
||||||
new BMessage(M_VIEW_LAST_PAGE), 'L', 0);
|
new BMessage(M_VIEW_LAST_PAGE), 'L', 0);
|
||||||
|
|
||||||
BMenuItem *pitmnext = new BMenuItem("Next Page",
|
BMenuItem *pitmnext = new BMenuItem("Next Page",
|
||||||
new BMessage(M_VIEW_NEXT_PAGE), 'N', 0);
|
new BMessage(M_VIEW_NEXT_PAGE), 'N', 0);
|
||||||
|
|
||||||
BMenuItem *pitmprev = new BMenuItem("Previous Page",
|
BMenuItem *pitmprev = new BMenuItem("Previous Page",
|
||||||
new BMessage(M_VIEW_PREV_PAGE), 'P', 0);
|
new BMessage(M_VIEW_PREV_PAGE), 'P', 0);
|
||||||
|
|
||||||
pmnuview->AddItem(pitmfirst);
|
pmnuview->AddItem(pitmfirst);
|
||||||
pmnuview->AddItem(pitmlast);
|
pmnuview->AddItem(pitmlast);
|
||||||
pmnuview->AddItem(pitmnext);
|
pmnuview->AddItem(pitmnext);
|
||||||
pmnuview->AddItem(pitmprev);
|
pmnuview->AddItem(pitmprev);
|
||||||
pbar->AddItem(pmnuview);
|
pbar->AddItem(pmnuview);
|
||||||
|
|
||||||
|
|
||||||
BMenu *pmnuwindow = new BMenu("Window");
|
BMenu *pmnuwindow = new BMenu("Window");
|
||||||
BMenuItem *pitmactives = new BMenuItem("Active Translators",
|
BMenuItem *pitmactives = new BMenuItem("Active Translators",
|
||||||
new BMessage(M_ACTIVE_TRANSLATORS_WINDOW), 'T', 0);
|
new BMessage(M_ACTIVE_TRANSLATORS_WINDOW), 'T', 0);
|
||||||
pitmactives->SetTarget(be_app);
|
pitmactives->SetTarget(be_app);
|
||||||
|
|
||||||
BMenuItem *pitminfo = new BMenuItem("Info",
|
BMenuItem *pitminfo = new BMenuItem("Info",
|
||||||
new BMessage(M_INFO_WINDOW), 'I', 0);
|
new BMessage(M_INFO_WINDOW), 'I', 0);
|
||||||
pitminfo->SetTarget(be_app);
|
pitminfo->SetTarget(be_app);
|
||||||
|
|
||||||
pmnuwindow->AddItem(pitmactives);
|
pmnuwindow->AddItem(pitmactives);
|
||||||
pmnuwindow->AddItem(pitminfo);
|
pmnuwindow->AddItem(pitminfo);
|
||||||
pbar->AddItem(pmnuwindow);
|
pbar->AddItem(pmnuwindow);
|
||||||
|
|
||||||
AddChild(pbar);
|
AddChild(pbar);
|
||||||
|
|
||||||
// Setup image view
|
// Setup image view
|
||||||
BRect rctview = Bounds();
|
BRect rctview = Bounds();
|
||||||
rctview.top = pbar->Frame().bottom + 1;
|
rctview.top = pbar->Frame().bottom + 1;
|
||||||
rctview.right -= B_V_SCROLL_BAR_WIDTH;
|
rctview.right -= B_V_SCROLL_BAR_WIDTH;
|
||||||
rctview.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
rctview.bottom -= B_H_SCROLL_BAR_HEIGHT;
|
||||||
|
|
||||||
fpimageView = new ImageView(rctview, "ImageView");
|
fpimageView = new ImageView(rctview, "ImageView");
|
||||||
AddChild(new BScrollView("ImageScroll", fpimageView,
|
AddChild(new BScrollView("ImageScroll", fpimageView,
|
||||||
B_FOLLOW_ALL_SIDES, 0, true, true));
|
B_FOLLOW_ALL_SIDES, 0, true, true));
|
||||||
|
|
||||||
// Setup file open panel
|
// Setup file open panel
|
||||||
fpopenPanel = new BFilePanel(B_OPEN_PANEL, new BMessenger(this),
|
BMessenger messenger(this);
|
||||||
(const entry_ref *)NULL, 0L, false, new BMessage(M_OPEN_FILE_PANEL),
|
BMessage message(M_OPEN_FILE_PANEL);
|
||||||
NULL, false, true);
|
fpopenPanel = new BFilePanel(B_OPEN_PANEL, &messenger, NULL, 0L, false,
|
||||||
|
&message, NULL, false, true);
|
||||||
|
|
||||||
SetSizeLimits(200, 10000, 150, 10000);
|
SetSizeLimits(200, 10000, 150, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ ImageWindow::MessageReceived(BMessage *pmsg)
|
|||||||
fpopenPanel->Window()->SetWorkspaces(B_CURRENT_WORKSPACE);
|
fpopenPanel->Window()->SetWorkspaces(B_CURRENT_WORKSPACE);
|
||||||
fpopenPanel->Show();
|
fpopenPanel->Show();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_SAVE_IMAGE:
|
case M_SAVE_IMAGE:
|
||||||
if (fpimageView->HasImage()) {
|
if (fpimageView->HasImage()) {
|
||||||
BAlert *palert = new BAlert(NULL,
|
BAlert *palert = new BAlert(NULL,
|
||||||
@@ -140,12 +141,12 @@ ImageWindow::MessageReceived(BMessage *pmsg)
|
|||||||
palert->Go();
|
palert->Go();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_OPEN_FILE_PANEL:
|
case M_OPEN_FILE_PANEL:
|
||||||
case B_SIMPLE_DATA:
|
case B_SIMPLE_DATA:
|
||||||
fpimageView->SetImage(pmsg);
|
fpimageView->SetImage(pmsg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M_VIEW_FIRST_PAGE:
|
case M_VIEW_FIRST_PAGE:
|
||||||
fpimageView->FirstPage();
|
fpimageView->FirstPage();
|
||||||
break;
|
break;
|
||||||
@@ -158,10 +159,10 @@ ImageWindow::MessageReceived(BMessage *pmsg)
|
|||||||
case M_VIEW_PREV_PAGE:
|
case M_VIEW_PREV_PAGE:
|
||||||
fpimageView->PrevPage();
|
fpimageView->PrevPage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_CANCEL:
|
case B_CANCEL:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(pmsg);
|
BWindow::MessageReceived(pmsg);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user