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