@@ -44,19 +44,21 @@ namespace HEXCTRL
44
44
********************************************************************************************/
45
45
enum class EHexCmd : WORD
46
46
{
47
- CMD_SEARCH = 0x01 , CMD_SEARCH_NEXT, CMD_SEARCH_PREV,
47
+ CMD_DLG_SEARCH = 0x01 , CMD_SEARCH_NEXT, CMD_SEARCH_PREV,
48
+ CMD_NAV_DLG_GOTO, CMD_NAV_REPFWD, CMD_NAV_REPBKW, CMD_NAV_DATABEG, CMD_NAV_DATAEND,
49
+ CMD_NAV_PAGEBEG, CMD_NAV_PAGEEND, CMD_NAV_LINEBEG, CMD_NAV_LINEEND,
48
50
CMD_SHOWDATA_BYTE, CMD_SHOWDATA_WORD, CMD_SHOWDATA_DWORD, CMD_SHOWDATA_QWORD,
49
- CMD_BKM_ADD, CMD_BKM_REMOVE, CMD_BKM_NEXT, CMD_BKM_PREV, CMD_BKM_CLEARALL, CMD_BKM_MANAGER ,
50
- CMD_CLIPBOARD_COPY_HEX, CMD_CLIPBOARD_COPY_HEXLE, CMD_CLIPBOARD_COPY_HEXFMT, CMD_CLIPBOARD_COPY_TEXT ,
51
- CMD_CLIPBOARD_COPY_BASE64, CMD_CLIPBOARD_COPY_CARR, CMD_CLIPBOARD_COPY_GREPHEX, CMD_CLIPBOARD_COPY_PRNTSCRN ,
52
- CMD_CLIPBOARD_PASTE_HEX, CMD_CLIPBOARD_PASTE_TEXT ,
53
- CMD_MODIFY_OPERS , CMD_MODIFY_FILLZEROS, CMD_MODIFY_FILLDATA , CMD_MODIFY_UNDO, CMD_MODIFY_REDO,
51
+ CMD_BKM_ADD, CMD_BKM_REMOVE, CMD_BKM_NEXT, CMD_BKM_PREV, CMD_BKM_CLEARALL, CMD_BKM_DLG_MANAGER ,
52
+ CMD_CLPBRD_COPYHEX, CMD_CLPBRD_COPYHEXLE, CMD_CLPBRD_COPYHEXFMT, CMD_CLPBRD_COPYTEXT ,
53
+ CMD_CLPBRD_COPYBASE64, CMD_CLPBRD_COPYCARR, CMD_CLPBRD_COPYGREPHEX, CMD_CLPBRD_COPYPRNTSCRN ,
54
+ CMD_CLPBRD_PASTEHEX, CMD_CLPBRD_PASTETEXT ,
55
+ CMD_MODIFY_DLG_OPERS , CMD_MODIFY_FILLZEROS, CMD_MODIFY_DLG_FILLDATA , CMD_MODIFY_UNDO, CMD_MODIFY_REDO,
54
56
CMD_SEL_MARKSTART, CMD_SEL_MARKEND, CMD_SEL_ALL, CMD_SEL_ADDLEFT, CMD_SEL_ADDRIGHT, CMD_SEL_ADDUP, CMD_SEL_ADDDOWN,
55
- CMD_DATAINTERPRET, CMD_ENCODING ,
56
- CMD_APPEARANCE_FONTINC, CMD_APPEARANCE_FONTDEC, CMD_APPEARANCE_CAPACINC, CMD_APPEARANCE_CAPACDEC ,
57
- CMD_PRINT, CMD_ABOUT ,
57
+ CMD_DLG_DATAINTERP, CMD_DLG_ENCODING ,
58
+ CMD_APPEAR_FONTINC, CMD_APPEAR_FONTDEC, CMD_APPEAR_CAPACINC, CMD_APPEAR_CAPACDEC ,
59
+ CMD_DLG_PRINT, CMD_DLG_ABOUT ,
58
60
CMD_CARET_LEFT, CMD_CARET_RIGHT, CMD_CARET_UP, CMD_CARET_DOWN,
59
- CMD_SCROLL_PAGEUP, CMD_SCROLL_PAGEDOWN, CMD_SCROLL_TOP, CMD_SCROLL_BOTTOM
61
+ CMD_SCROLL_PAGEUP, CMD_SCROLL_PAGEDOWN
60
62
};
61
63
62
64
/* *******************************************************************************************
@@ -91,7 +93,8 @@ namespace HEXCTRL
91
93
********************************************************************************************/
92
94
enum class EHexWnd : WORD
93
95
{
94
- WND_MAIN, DLG_BKMMANAGER, DLG_DATAINTERPRET, DLG_FILLDATA, DLG_OPERS, DLG_SEARCH, DLG_ENCODING
96
+ WND_MAIN, DLG_BKMMANAGER, DLG_DATAINTERP, DLG_FILLDATA,
97
+ DLG_OPERS, DLG_SEARCH, DLG_ENCODING, DLG_GOTO
95
98
};
96
99
97
100
/* *******************************************************************************************
@@ -213,7 +216,6 @@ namespace HEXCTRL
213
216
{
214
217
EHexDataMode enDataMode { EHexDataMode::DATA_MEMORY }; // Working data mode.
215
218
ULONGLONG ullDataSize { }; // Size of the data to display, in bytes.
216
- HEXSPANSTRUCT stSelSpan { }; // Select .ullOffset initial position. Works only if .ullSize > 0.
217
219
HWND hwndMsg { }; // Window for DATA_MSG mode. Parent is used by default.
218
220
IHexVirtData* pHexVirtData { }; // Pointer for DATA_VIRTUAL mode.
219
221
IHexVirtColors* pHexVirtColors { }; // Pointer for Custom Colors class.
@@ -245,6 +247,15 @@ namespace HEXCTRL
245
247
bool fIsAscii { false }; // Is cursor at ASCII part or at Hex.
246
248
};
247
249
250
+ /* *******************************************************************************************
251
+ * HEXVISSTRUCT - Offset visibility struct, used in IsOffsetVisible method. *
252
+ ********************************************************************************************/
253
+ struct HEXVISSTRUCT
254
+ {
255
+ std::int8_t i8Vert { }; // Vertical offset.
256
+ std::int8_t i8Horz { }; // Horizontal offset.
257
+ operator bool () { return i8Vert == 0 && i8Horz == 0 ; }; // For test simplicity: if(IsOffsetVisible()).
258
+ };
248
259
249
260
/* *******************************************************************************************
250
261
* IHexCtrl - pure abstract base class. *
@@ -264,38 +275,42 @@ namespace HEXCTRL
264
275
virtual bool Create (const HEXCREATESTRUCT& hcs) = 0; // Main initialization method.
265
276
virtual bool CreateDialogCtrl (UINT uCtrlID, HWND hParent) = 0; // Сreates custom dialog control.
266
277
virtual void Destroy () = 0; // Deleter.
267
- virtual void ExecuteCmd (EHexCmd enCmd) = 0; // Execute a command within the control.
278
+ virtual void ExecuteCmd (EHexCmd enCmd) = 0; // Execute a command within the control.
268
279
[[nodiscard]] virtual DWORD GetCapacity ()const = 0; // Current capacity.
269
280
[[nodiscard]] virtual ULONGLONG GetCaretPos ()const = 0; // Cursor position.
270
281
[[nodiscard]] virtual auto GetColors ()const ->HEXCOLORSSTRUCT = 0; // Current colors.
282
+ [[nodiscard]] virtual auto GetDataSize ()const ->ULONGLONG = 0; // Get currently set data size.
271
283
[[nodiscard]] virtual int GetEncoding ()const = 0; // Get current code page ID.
272
284
[[nodiscard]] virtual long GetFontSize ()const = 0; // Current font size.
273
285
[[nodiscard]] virtual HMENU GetMenuHandle ()const = 0; // Context menu handle.
274
- [[nodiscard]] virtual DWORD GetSectorSize ()const = 0; // Current sector size.
286
+ [[nodiscard]] virtual auto GetPagesCount ()const ->ULONGLONG = 0; // Get count of pages.
287
+ [[nodiscard]] virtual auto GetPagePos ()const ->ULONGLONG = 0; // Get current page a cursor stays at.
288
+ [[nodiscard]] virtual DWORD GetPageSize ()const = 0; // Current page size.
275
289
[[nodiscard]] virtual auto GetSelection ()const ->std::vector<HEXSPANSTRUCT> = 0; // Gets current selection.
276
290
[[nodiscard]] virtual auto GetShowMode ()const ->EHexShowMode = 0; // Retrieves current show mode.
277
291
[[nodiscard]] virtual HWND GetWindowHandle (EHexWnd enWnd)const = 0; // Retrieves control's window/dialog handle.
278
- virtual void GoToOffset (ULONGLONG ullOffset, bool fSelect = false , ULONGLONG ullSize = 1 ) = 0; // Scrolls to given offset.
292
+ virtual void GoToOffset (ULONGLONG ullOffset, int iRelPos = 0 ) = 0; // Go (scroll) to a given offset.
279
293
[[nodiscard]] virtual auto HitTest (POINT pt, bool fScreen = true )const ->std::optional<HEXHITTESTSTRUCT> = 0; // HitTest given point.
280
294
[[nodiscard]] virtual bool IsCmdAvail (EHexCmd enCmd)const = 0; // Is given Cmd currently available (can be executed)?
281
295
[[nodiscard]] virtual bool IsCreated ()const = 0; // Shows whether control is created or not.
282
296
[[nodiscard]] virtual bool IsDataSet ()const = 0; // Shows whether a data was set to the control or not.
283
297
[[nodiscard]] virtual bool IsMutable ()const = 0; // Is edit mode enabled or not.
284
298
[[nodiscard]] virtual bool IsOffsetAsHex ()const = 0; // Is "Offset" currently represented (shown) as Hex or as Decimal.
285
- [[nodiscard]] virtual bool IsOffsetVisible (ULONGLONG ullOffset)const = 0; // Ensures that given offset is visible.
299
+ [[nodiscard]] virtual HEXVISSTRUCT IsOffsetVisible (ULONGLONG ullOffset)const = 0; // Ensures that the given offset is visible.
286
300
virtual void Redraw () = 0; // Redraw the control's window.
287
- virtual void SetCapacity (DWORD dwCapacity) = 0; // Sets the control's current capacity.
288
- virtual void SetColors (const HEXCOLORSSTRUCT& clr) = 0;// Sets all the control's colors.
301
+ virtual void SetCapacity (DWORD dwCapacity) = 0; // Set the control's current capacity.
302
+ virtual void SetCaretPos (ULONGLONG ullOffset, bool fHighLow = true , bool fRedraw = true ) = 0; // Set the caret position.
303
+ virtual void SetColors (const HEXCOLORSSTRUCT& clr) = 0;// Set all the control's colors.
289
304
virtual bool SetConfig (std::wstring_view wstrPath) = 0;// Set configuration file, or "" for defaults.
290
305
virtual void SetData (const HEXDATASTRUCT& hds) = 0; // Main method for setting data to display (and edit).
291
- virtual void SetEncoding (int iCodePage) = 0; // Code page for text area.
292
- virtual void SetFont (const LOGFONTW* pLogFont) = 0; // Sets the control's new font. This font has to be monospaced.
293
- virtual void SetFontSize (UINT uiSize) = 0; // Sets the control's font size.
306
+ virtual void SetEncoding (int iCodePage) = 0; // Code- page for text area.
307
+ virtual void SetFont (const LOGFONTW* pLogFont) = 0; // Set the control's new font. This font has to be monospaced.
308
+ virtual void SetFontSize (UINT uiSize) = 0; // Set the control's font size.
294
309
virtual void SetMutable (bool fEnable ) = 0; // Enable or disable mutable/edit mode.
295
- virtual void SetSectorSize (DWORD dwSize, std::wstring_view wstrName = L" Sector " ) = 0; // Sets sector/ page size and name to draw the lines in-between.
296
- virtual void SetSelection (const std::vector<HEXSPANSTRUCT>& vecSel) = 0; // Sets current selection.
297
- virtual void SetShowMode (EHexShowMode enMode) = 0; // Sets current data show mode.
298
- virtual void SetWheelRatio (double dbRatio) = 0; // Sets the ratio for how much to scroll with mouse-wheel.
310
+ virtual void SetPageSize (DWORD dwSize, std::wstring_view wstrName = L" Page " ) = 0; // Set page size and name to draw the lines in-between.
311
+ virtual void SetSelection (const std::vector<HEXSPANSTRUCT>& vecSel, bool fRedraw = true ) = 0; // Set current selection.
312
+ virtual void SetShowMode (EHexShowMode enMode) = 0; // Set current data show mode.
313
+ virtual void SetWheelRatio (double dbRatio) = 0; // Set the ratio for how much to scroll with mouse-wheel.
299
314
};
300
315
301
316
/* *******************************************************************************************
0 commit comments