Added expression support to the position text control. It's not quite the
direly missing "Go To" function, but better than nothing. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31300 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -16,6 +16,6 @@ Application DiskProbe :
|
||||
ProbeView.cpp
|
||||
OpenWindow.cpp
|
||||
FindWindow.cpp
|
||||
: be tracker translation
|
||||
: be tracker translation libexpression_parser.a libmapm.a
|
||||
: DiskProbe.rdef
|
||||
;
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <PrintJob.h>
|
||||
#include <Beep.h>
|
||||
|
||||
#include <ExpressionParser.h>
|
||||
|
||||
#include "DataView.h"
|
||||
#include "DiskProbe.h"
|
||||
#include "TypeEditors.h"
|
||||
@@ -849,7 +851,7 @@ HeaderView::MessageReceived(BMessage *message)
|
||||
|
||||
case kMsgPositionUpdate:
|
||||
{
|
||||
fLastPosition = fPosition;
|
||||
off_t lastPosition = fPosition;
|
||||
|
||||
off_t position;
|
||||
int32 delta;
|
||||
@@ -862,10 +864,18 @@ HeaderView::MessageReceived(BMessage *message)
|
||||
} else if (message->FindInt32("delta", &delta) == B_OK) {
|
||||
fPosition += delta * off_t(fBlockSize);
|
||||
} else {
|
||||
fPosition = strtoll(fPositionControl->Text(), NULL, 0)
|
||||
* fBlockSize;
|
||||
try {
|
||||
ExpressionParser parser;
|
||||
parser.SetSupportHexInput(true);
|
||||
fPosition = parser.EvaluateToInt64(
|
||||
fPositionControl->Text()) * fBlockSize;
|
||||
} catch (...) {
|
||||
beep();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fLastPosition = lastPosition;
|
||||
fPosition = (fPosition / fBlockSize) * fBlockSize;
|
||||
// round to block size
|
||||
|
||||
|
||||
Reference in New Issue
Block a user