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