* Fixed CID 461 as well - same thing, only for adding a menu to the save panel.

* The menus are now only created when the menu bar is found.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38466 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-08-30 21:18:20 +00:00
parent 56f837e265
commit 252999c4e2
2 changed files with 47 additions and 45 deletions
+8 -7
View File
@@ -92,12 +92,13 @@ StyledEditApp::StyledEditApp()
fOpenPanel = new BFilePanel();
fOpenAsEncoding = 0;
fOpenPanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding"));
fOpenPanelEncodingMenu->SetRadioMode(true);
BMenuBar* menuBar
= dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
if (menuBar != NULL)
if (menuBar != NULL) {
fOpenPanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding"));
fOpenPanelEncodingMenu->SetRadioMode(true);
menuBar->AddItem(fOpenPanelEncodingMenu);
BCharacterSetRoster roster;
@@ -110,7 +111,7 @@ StyledEditApp::StyledEditApp()
name = charset.GetPrintName();
const char* mime = charset.GetMIMEName();
if (mime) {
if (mime != NULL) {
name.Append(" (");
name.Append(mime);
name.Append(")");
@@ -122,6 +123,8 @@ StyledEditApp::StyledEditApp()
if (charset.GetFontID() == fOpenAsEncoding)
item->SetMarked(true);
}
} else
fOpenPanelEncodingMenu = NULL;
fWindowCount = 0;
fNextUntitledWindow = 1;
@@ -132,8 +135,6 @@ StyledEditApp::StyledEditApp()
StyledEditApp::~StyledEditApp()
{
delete fOpenPanel;
if (fOpenPanelEncodingMenu->Supermenu() == NULL)
delete fOpenPanelEncodingMenu;
}
@@ -153,7 +154,7 @@ StyledEditApp::MessageReceived(BMessage* message)
case OPEN_AS_ENCODING:
void* ptr;
if (message->FindPointer("source", &ptr) == B_OK
&& fOpenPanelEncodingMenu != 0) {
&& fOpenPanelEncodingMenu != NULL) {
fOpenAsEncoding = (uint32)fOpenPanelEncodingMenu->IndexOf(
(BMenuItem*)ptr);
}
+4 -3
View File
@@ -1001,10 +1001,10 @@ StyledEditWindow::SaveAs(BMessage* message)
BMenuBar* menuBar = dynamic_cast<BMenuBar*>(
fSavePanel->Window()->FindView("MenuBar"));
fSavePanelEncodingMenu= new BMenu(B_TRANSLATE("Encoding"));
menuBar->AddItem(fSavePanelEncodingMenu);
if (menuBar != NULL) {
fSavePanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding"));
fSavePanelEncodingMenu->SetRadioMode(true);
menuBar->AddItem(fSavePanelEncodingMenu);
BCharacterSetRoster roster;
BCharacterSet charset;
@@ -1024,6 +1024,7 @@ StyledEditWindow::SaveAs(BMessage* message)
item->SetMarked(true);
}
}
}
fSavePanel->SetSaveText(Title());
if (message != NULL)