parent
cf9328df22
commit
8914c88dab
@ -82,6 +82,7 @@ const uint32 SAVE_THEN_QUIT = 'FPsq';
|
||||
|
||||
// Update StatusView
|
||||
const uint32 UPDATE_STATUS = 'UPSt';
|
||||
const uint32 UPDATE_STATUS_REF = 'UPSr';
|
||||
const uint32 UNLOCK_FILE = 'UNLk';
|
||||
const uint32 UPDATE_LINE_SELECTION = 'UPls';
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
SubDir HAIKU_TOP src apps stylededit ;
|
||||
|
||||
UsePrivateHeaders textencoding ;
|
||||
UsePrivateSystemHeaders ;
|
||||
UsePrivateHeaders tracker shared ;
|
||||
UsePublicHeaders [ FDirName be_apps Tracker ] ;
|
||||
SubDirHdrs $(HAIKU_TOP) src kits tracker ;
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) src kits tracker ] : false ;
|
||||
|
||||
local styled_edit_rsrc =
|
||||
[ FGristFiles StyledEdit.rsrc ]
|
||||
@ -18,7 +22,7 @@ Application StyledEdit :
|
||||
StyledEditApp.cpp
|
||||
StyledEditView.cpp
|
||||
StyledEditWindow.cpp
|
||||
: be translation tracker libtextencoding.so localestub
|
||||
: libshared.a be translation tracker libtextencoding.so localestub
|
||||
[ TargetLibsupc++ ]
|
||||
: $(styled_edit_rsrc)
|
||||
;
|
||||
|
@ -25,6 +25,9 @@
|
||||
#include <StringView.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <tracker_private.h>
|
||||
#include "DirMenu.h"
|
||||
|
||||
#include "Constants.h"
|
||||
|
||||
|
||||
@ -156,6 +159,11 @@ StatusView::Draw(BRect updateRect)
|
||||
void
|
||||
StatusView::MouseDown(BPoint where)
|
||||
{
|
||||
if (where.x < fCellWidth[kPositionCell]) {
|
||||
_ShowDirMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fReadOnly || !fCanUnlock)
|
||||
return;
|
||||
|
||||
@ -228,6 +236,13 @@ StatusView::SetStatus(BMessage* message)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::SetRef(const entry_ref& ref)
|
||||
{
|
||||
fRef = ref;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::_ValidatePreferredSize()
|
||||
{
|
||||
@ -264,3 +279,27 @@ StatusView::_ValidatePreferredSize()
|
||||
scrollBar->MoveBy(delta, 0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
StatusView::_ShowDirMenu()
|
||||
{
|
||||
BEntry entry;
|
||||
status_t status = entry.SetTo(&fRef);
|
||||
|
||||
if (status != B_OK || !entry.Exists())
|
||||
return;
|
||||
|
||||
BPrivate::BDirMenu* menu = new BDirMenu(NULL,
|
||||
BMessenger(kTrackerSignature), B_REFS_RECEIVED);
|
||||
|
||||
menu->Populate(&entry, Window(), false, false, true, false, true);
|
||||
|
||||
BPoint point = Bounds().LeftBottom();
|
||||
point.y += 3;
|
||||
ConvertToScreen(&point);
|
||||
BRect clickToOpenRect(Bounds());
|
||||
ConvertToScreen(&clickToOpenRect);
|
||||
menu->Go(point, true, true, clickToOpenRect);
|
||||
delete menu;
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#define STATUS_VIEW_H
|
||||
|
||||
|
||||
#include <Entry.h>
|
||||
#include <String.h>
|
||||
#include <View.h>
|
||||
|
||||
@ -30,6 +31,7 @@ public:
|
||||
~StatusView();
|
||||
|
||||
void SetStatus(BMessage* mesage);
|
||||
void SetRef(const entry_ref& ref);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
virtual void ResizeToPreferred();
|
||||
@ -38,6 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
void _ValidatePreferredSize();
|
||||
void _ShowDirMenu();
|
||||
|
||||
private:
|
||||
BScrollView* fScrollView;
|
||||
@ -47,6 +50,7 @@ private:
|
||||
bool fReadOnly;
|
||||
bool fCanUnlock;
|
||||
BString fEncoding;
|
||||
entry_ref fRef;
|
||||
};
|
||||
|
||||
#endif // STATUS_VIEW_H
|
||||
|
@ -558,6 +558,27 @@ StyledEditWindow::MessageReceived(BMessage* message)
|
||||
break;
|
||||
}
|
||||
|
||||
case UPDATE_STATUS_REF:
|
||||
{
|
||||
entry_ref ref;
|
||||
const char* name;
|
||||
|
||||
if (fSaveMessage != NULL
|
||||
&& fSaveMessage->FindRef("directory", &ref) == B_OK
|
||||
&& fSaveMessage->FindString("name", &name) == B_OK) {
|
||||
|
||||
BDirectory dir(&ref);
|
||||
status_t status = dir.InitCheck();
|
||||
BEntry entry;
|
||||
if (status == B_OK)
|
||||
status = entry.SetTo(&dir, name);
|
||||
if (status == B_OK)
|
||||
status = entry.GetRef(&ref);
|
||||
}
|
||||
fStatusView->SetRef(ref);
|
||||
break;
|
||||
}
|
||||
|
||||
case UNLOCK_FILE:
|
||||
{
|
||||
status_t status = _UnlockFile();
|
||||
@ -801,6 +822,8 @@ StyledEditWindow::Save(BMessage* message)
|
||||
fNagOnNodeChange = true;
|
||||
|
||||
PostMessage(UPDATE_STATUS);
|
||||
PostMessage(UPDATE_STATUS_REF);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -888,6 +911,8 @@ StyledEditWindow::OpenFile(entry_ref* ref)
|
||||
|
||||
_SwitchNodeMonitor(true, ref);
|
||||
|
||||
PostMessage(UPDATE_STATUS_REF);
|
||||
|
||||
fReloadItem->SetEnabled(fSaveMessage != NULL);
|
||||
fEncodingItem->SetEnabled(fSaveMessage != NULL);
|
||||
}
|
||||
@ -2053,6 +2078,7 @@ StyledEditWindow::_HandleNodeMonitorEvent(BMessage *message)
|
||||
_SwitchNodeMonitor(false);
|
||||
_SwitchNodeMonitor(true);
|
||||
}
|
||||
PostMessage(UPDATE_STATUS_REF);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2099,6 +2125,7 @@ StyledEditWindow::_HandleNodeMonitorEvent(BMessage *message)
|
||||
name = "Unknown";
|
||||
|
||||
_ShowNodeChangeAlert(name, true);
|
||||
PostMessage(UPDATE_STATUS_REF);
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user