added encodings menu for save and open file panel (not functional yet)
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1864 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fc8dfd798a
commit
844ea151d0
@ -11,7 +11,15 @@ StyledEditApp * styled_edit_app;
|
||||
StyledEditApp::StyledEditApp()
|
||||
: BApplication(APP_SIGNATURE)
|
||||
{
|
||||
fOpenPanel= new BFilePanel;
|
||||
fOpenPanel= new BFilePanel();
|
||||
BMenuBar * menuBar =
|
||||
dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
|
||||
|
||||
fOpenPanelEncodingMenu= new BMenu("Encoding");
|
||||
menuBar->AddItem(fOpenPanelEncodingMenu);
|
||||
|
||||
// TODO: add encodings
|
||||
|
||||
fWindowCount= 0;
|
||||
fNext_Untitled_Window= 1;
|
||||
styled_edit_app = this;
|
||||
@ -38,7 +46,7 @@ void
|
||||
StyledEditApp::OpenDocument()
|
||||
{
|
||||
new StyledEditWindow(windowRect,fNext_Untitled_Window++);
|
||||
windowRect.OffsetBy(15,15); // todo: wrap around screen
|
||||
windowRect.OffsetBy(15,15); // TODO: wrap around screen
|
||||
fWindowCount++;
|
||||
}
|
||||
|
||||
@ -46,7 +54,7 @@ void
|
||||
StyledEditApp::OpenDocument(entry_ref * ref)
|
||||
{
|
||||
new StyledEditWindow(windowRect,ref);
|
||||
windowRect.OffsetBy(15,15); // todo: wrap around screen
|
||||
windowRect.OffsetBy(15,15); // TODO: wrap around screen
|
||||
fWindowCount++;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ public:
|
||||
|
||||
private:
|
||||
BFilePanel *fOpenPanel;
|
||||
BMenu *fOpenPanelEncodingMenu;
|
||||
int32 fWindowCount;
|
||||
int32 fNext_Untitled_Window;
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <ScrollView.h>
|
||||
#include <stdlib.h>
|
||||
#include <String.h>
|
||||
#include <TextControl.h>
|
||||
#include <TranslationUtils.h>
|
||||
#include <Window.h>
|
||||
|
||||
@ -274,7 +275,16 @@ StyledEditWindow::InitWindow()
|
||||
/***************************MENUS ADDED***********************/
|
||||
|
||||
fSavePanel= new BFilePanel(B_SAVE_PANEL, new BMessenger(this), NULL, B_FILE_NODE, false);
|
||||
|
||||
fSavePanelTextView =
|
||||
dynamic_cast<BTextControl*>(fSavePanel->Window()->FindView("text view"));
|
||||
BMenuBar * menuBar =
|
||||
dynamic_cast<BMenuBar*>(fSavePanel->Window()->FindView("MenuBar"));
|
||||
|
||||
fSavePanelEncodingMenu= new BMenu("Encoding");
|
||||
menuBar->AddItem(fSavePanelEncodingMenu);
|
||||
|
||||
// TODO: add encodings
|
||||
|
||||
} /***StyledEditWindow::Initwindow()***/
|
||||
|
||||
void
|
||||
@ -656,18 +666,15 @@ StyledEditWindow::Save(BMessage *message)
|
||||
return err;
|
||||
} /***Save()***/
|
||||
|
||||
#include <TextControl.h>
|
||||
#include <Autolock.h>
|
||||
|
||||
status_t
|
||||
StyledEditWindow::SaveAs()
|
||||
{
|
||||
BWindow * saveWindow = fSavePanel->Window();
|
||||
BTextControl * textView =
|
||||
dynamic_cast<BTextControl*>(saveWindow->FindView("text view"));
|
||||
if (textView) {
|
||||
BAutolock lock(saveWindow);
|
||||
textView->SetText(Title());
|
||||
// it's own scope allows the lock to be released before Show()
|
||||
{
|
||||
BAutolock lock(fSavePanel->Window());
|
||||
if (lock.IsLocked()) {
|
||||
fSavePanelTextView->SetText(Title());
|
||||
}
|
||||
}
|
||||
fSavePanel->Show();
|
||||
}
|
||||
|
@ -73,7 +73,10 @@ private:
|
||||
|
||||
StyledEditView *fTextView;
|
||||
BScrollView *fScrollView;
|
||||
|
||||
BFilePanel *fSavePanel;
|
||||
BTextControl *fSavePanelTextView;
|
||||
BMenu *fSavePanelEncodingMenu;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user