StyledEdit: Use RecentItems helper instead of private impl.
* Switch recent documents list to use RecentItems.h helper instead of homebrewn implementation; * Fixes #9999. - GCI 2013
This commit is contained in:
committed by
Siarzhuk Zharski
parent
ccfb80f995
commit
e056d32027
@@ -1,6 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src apps stylededit ;
|
SubDir HAIKU_TOP src apps stylededit ;
|
||||||
|
|
||||||
UsePrivateHeaders textencoding ;
|
UsePrivateHeaders textencoding ;
|
||||||
|
UsePublicHeaders [ FDirName be_apps Tracker ] ;
|
||||||
|
|
||||||
local styled_edit_rsrc =
|
local styled_edit_rsrc =
|
||||||
[ FGristFiles StyledEdit.rsrc ]
|
[ FGristFiles StyledEdit.rsrc ]
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
#include <NodeMonitor.h>
|
#include <NodeMonitor.h>
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <PrintJob.h>
|
#include <PrintJob.h>
|
||||||
|
#include <RecentItems.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
@@ -572,34 +573,6 @@ StyledEditWindow::MessageReceived(BMessage* message)
|
|||||||
void
|
void
|
||||||
StyledEditWindow::MenusBeginning()
|
StyledEditWindow::MenusBeginning()
|
||||||
{
|
{
|
||||||
// set up the recent documents menu
|
|
||||||
BMessage documents;
|
|
||||||
be_roster->GetRecentDocuments(&documents, 9, NULL, APP_SIGNATURE);
|
|
||||||
|
|
||||||
// delete old items..
|
|
||||||
// shatty: it would be preferable to keep the old
|
|
||||||
// menu around instead of continuously thrashing
|
|
||||||
// the menu, but unfortunately there does not
|
|
||||||
// seem to be a straightforward way to update it
|
|
||||||
// going backwards may simplify memory management
|
|
||||||
for (int i = fRecentMenu->CountItems(); i-- > 0;) {
|
|
||||||
delete fRecentMenu->RemoveItem(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// add new items
|
|
||||||
int count = 0;
|
|
||||||
entry_ref ref;
|
|
||||||
while (documents.FindRef("refs", count++, &ref) == B_OK) {
|
|
||||||
if (ref.device != -1 && ref.directory != -1) {
|
|
||||||
// sanity check passed
|
|
||||||
BMessage* openRecent = new BMessage(B_REFS_RECEIVED);
|
|
||||||
openRecent->AddRef("refs", &ref);
|
|
||||||
BMenuItem* item = new BMenuItem(ref.name, openRecent);
|
|
||||||
item->SetTarget(be_app);
|
|
||||||
fRecentMenu->AddItem(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the font menu
|
// update the font menu
|
||||||
// unselect the old values
|
// unselect the old values
|
||||||
if (fCurrentFontItem != NULL) {
|
if (fCurrentFontItem != NULL) {
|
||||||
@@ -793,10 +766,6 @@ StyledEditWindow::Save(BMessage* message)
|
|||||||
fSaveMessage = new BMessage(*message);
|
fSaveMessage = new BMessage(*message);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry_ref ref;
|
|
||||||
if (entry.GetRef(&ref) == B_OK)
|
|
||||||
be_roster->AddToRecentDocuments(&ref, APP_SIGNATURE);
|
|
||||||
|
|
||||||
// clear clean modes
|
// clear clean modes
|
||||||
fSaveItem->SetEnabled(false);
|
fSaveItem->SetEnabled(false);
|
||||||
fUndoCleans = false;
|
fUndoCleans = false;
|
||||||
@@ -873,7 +842,6 @@ StyledEditWindow::OpenFile(entry_ref* ref)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
be_roster->AddToRecentDocuments(ref, APP_SIGNATURE);
|
|
||||||
fSaveMessage = new BMessage(B_SAVE_REQUESTED);
|
fSaveMessage = new BMessage(B_SAVE_REQUESTED);
|
||||||
if (fSaveMessage) {
|
if (fSaveMessage) {
|
||||||
BEntry entry(ref, true);
|
BEntry entry(ref, true);
|
||||||
@@ -1118,9 +1086,9 @@ StyledEditWindow::_InitWindow(uint32 encoding)
|
|||||||
new BMessage(MENU_NEW), 'N'));
|
new BMessage(MENU_NEW), 'N'));
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
|
|
||||||
menu->AddItem(menuItem = new BMenuItem(fRecentMenu
|
menu->AddItem(menuItem = new BMenuItem(BRecentFilesList::NewFileListMenu(
|
||||||
= new BMenu(B_TRANSLATE("Open" B_UTF8_ELLIPSIS)),
|
B_TRANSLATE("Open"B_UTF8_ELLIPSIS), NULL, NULL, be_app, 9, true,
|
||||||
new BMessage(MENU_OPEN)));
|
NULL, APP_SIGNATURE), new BMessage(MENU_OPEN)));
|
||||||
menuItem->SetShortcut('O', 0);
|
menuItem->SetShortcut('O', 0);
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
@@ -2053,7 +2021,6 @@ StyledEditWindow::_HandleNodeMonitorEvent(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetTitle(name);
|
SetTitle(name);
|
||||||
be_roster->AddToRecentDocuments(&newRef, APP_SIGNATURE);
|
|
||||||
|
|
||||||
if (srcFolder != dstFolder) {
|
if (srcFolder != dstFolder) {
|
||||||
_SwitchNodeMonitor(false);
|
_SwitchNodeMonitor(false);
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ private:
|
|||||||
BMenuBar* fMenuBar;
|
BMenuBar* fMenuBar;
|
||||||
BMessage* fPrintSettings;
|
BMessage* fPrintSettings;
|
||||||
BMessage* fSaveMessage;
|
BMessage* fSaveMessage;
|
||||||
BMenu* fRecentMenu;
|
|
||||||
|
|
||||||
BMenu* fFontMenu;
|
BMenu* fFontMenu;
|
||||||
BMenu* fFontSizeMenu;
|
BMenu* fFontSizeMenu;
|
||||||
@@ -140,6 +139,7 @@ private:
|
|||||||
BMenuItem* fAlignCenter;
|
BMenuItem* fAlignCenter;
|
||||||
BMenuItem* fAlignRight;
|
BMenuItem* fAlignRight;
|
||||||
BMenuItem* fEncodingItem;
|
BMenuItem* fEncodingItem;
|
||||||
|
BMenuItem* fRecentMenuItem;
|
||||||
|
|
||||||
BString fStringToFind;
|
BString fStringToFind;
|
||||||
BString fReplaceString;
|
BString fReplaceString;
|
||||||
|
|||||||
Reference in New Issue
Block a user