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
|
ProbeView.cpp
|
||||||
OpenWindow.cpp
|
OpenWindow.cpp
|
||||||
FindWindow.cpp
|
FindWindow.cpp
|
||||||
: be tracker translation
|
: be tracker translation libexpression_parser.a libmapm.a
|
||||||
: DiskProbe.rdef
|
: DiskProbe.rdef
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -37,6 +37,8 @@
|
|||||||
#include <PrintJob.h>
|
#include <PrintJob.h>
|
||||||
#include <Beep.h>
|
#include <Beep.h>
|
||||||
|
|
||||||
|
#include <ExpressionParser.h>
|
||||||
|
|
||||||
#include "DataView.h"
|
#include "DataView.h"
|
||||||
#include "DiskProbe.h"
|
#include "DiskProbe.h"
|
||||||
#include "TypeEditors.h"
|
#include "TypeEditors.h"
|
||||||
@@ -849,7 +851,7 @@ HeaderView::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
case kMsgPositionUpdate:
|
case kMsgPositionUpdate:
|
||||||
{
|
{
|
||||||
fLastPosition = fPosition;
|
off_t lastPosition = fPosition;
|
||||||
|
|
||||||
off_t position;
|
off_t position;
|
||||||
int32 delta;
|
int32 delta;
|
||||||
@@ -862,10 +864,18 @@ HeaderView::MessageReceived(BMessage *message)
|
|||||||
} else if (message->FindInt32("delta", &delta) == B_OK) {
|
} else if (message->FindInt32("delta", &delta) == B_OK) {
|
||||||
fPosition += delta * off_t(fBlockSize);
|
fPosition += delta * off_t(fBlockSize);
|
||||||
} else {
|
} else {
|
||||||
fPosition = strtoll(fPositionControl->Text(), NULL, 0)
|
try {
|
||||||
* fBlockSize;
|
ExpressionParser parser;
|
||||||
|
parser.SetSupportHexInput(true);
|
||||||
|
fPosition = parser.EvaluateToInt64(
|
||||||
|
fPositionControl->Text()) * fBlockSize;
|
||||||
|
} catch (...) {
|
||||||
|
beep();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fLastPosition = lastPosition;
|
||||||
fPosition = (fPosition / fBlockSize) * fBlockSize;
|
fPosition = (fPosition / fBlockSize) * fBlockSize;
|
||||||
// round to block size
|
// round to block size
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user