⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fshedview.h

📁 HEX编辑器
💻 H
字号:
// fshedView.h : interface of the CFshedView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_FSHEDVIEW_H__BD87E553_34CD_11D5_B4F0_00B0D0719D70__INCLUDED_)
#define AFX_FSHEDVIEW_H__BD87E553_34CD_11D5_B4F0_00B0D0719D70__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "fshedDoc.h"
#include "FindDlg.h"

//--------------------------------------------------------------------------------------------
// MAKROS
#define CHARSTART (App->m_iOffsetLen + m_stScreenSettings.iByteSpace + App->m_iBytesPerLine * 3 + m_stScreenSettings.iCharSpace)
#define BYTEPOS (m_stScreenSettings.iCurByte % App->m_iBytesPerLine)
#define BYTELINE (m_stScreenSettings.iCurByte / App->m_iBytesPerLine)
#define BYTES_LOGICAL_COLUMN (App->m_iOffsetLen + m_stScreenSettings.iByteSpace + BYTEPOS * 3 + m_stScreenSettings.iCurNibble)
#define CHARS_LOGICAL_COLUMN (CHARSTART + BYTEPOS)
#define LAST_LOG_COLUMN (m_stScreenSettings.iHscrollPos + m_stScreenSettings.cxBuffer - 1) // Last visible logical column.
#define CURSOR_TOO_HIGH (m_stScreenSettings.iCurLine > BYTELINE)
#define CURSOR_TOO_LOW (m_stScreenSettings.iCurLine + m_stScreenSettings.cyBuffer - 1 < BYTELINE)
#define LAST_VISIBLE_LINE (m_stScreenSettings.iCurLine + m_stScreenSettings.cyBuffer - 1)
#define LASTLINE (m_stScreenSettings.iNumlines - 1)
#define STARTSELECTION_LINE (iStartOfSelection / App->m_iBytesPerLine)
#define ENDSELECTION_LINE (iEndOfSelection / App->m_iBytesPerLine)
#define IN_BOUNDS( i, a, b ) ( ( i >= a && i <= b ) || ( i >= b && i <= a ) )
#define BYTES 0 // for EnteringMode
#define CHARS 1
#define WM_F1DOWN (WM_USER+1)

class CScreenSettings
{
public:
	int cxChar, cxCaps, cyChar, cxClient, cyClient, cxBuffer, cyBuffer, iNumlines,
		iVscrollMax, iVscrollPos, iVscrollInc,
		iHscrollMax, iHscrollPos, iHscrollInc,
		iCurLine, iCurByte, iCurNibble;
	int iByteSpace,	iCharSpace, iCharsPerLine;
   int iToolbarHeight;

   CScreenSettings()
   {
      memset(this, 0, sizeof(CScreenSettings));
   }
   void CopySettings(CScreenSettings &rSettings)
   {
      memcpy(this, &rSettings, sizeof(CScreenSettings));
   }
};

class CFshedView : public CView
{
protected: // create from serialization only
	CFshedView();
	DECLARE_DYNCREATE(CFshedView)

// Attributes
public:
	CFshedDoc* GetDocument();

// Operations
public:

    CScreenSettings m_stScreenSettings;
// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CFshedView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	//}}AFX_VIRTUAL

   int update_MRU ();
   int make_MRU_list (HMENU menu);
   int find_byte_pos (const char* src, char c);
   int create_bc_translation (char* dest, const char* src, int srclen, int charmode, int binmode);
   int translate_bytecode (char* dest, const char* src, int srclen, int binmode);
   int calc_bctrans_destlen (const char* src, int srclen);
   int is_bytecode (const char* src, int len);
   int create_bc_translation (char** ppd, const char* src, int srclen, int charmode, int binmode);
   int translate_bytes_to_BC (CString &strTranslated, unsigned char* src, int srclen);
   int byte_to_BC_destlen (char* src, int srclen);
   void update_for_new_datasize ();
   char TranslateAnsiToOem (char c);
   int resize_window (int cx, int cy);
   void set_wnd_title();
   void set_caret_pos ();
   int repaint( int line =-1);
   void clear_all ();
   void adjust_vscrollbar ();
   void adjust_hscrollbar ();
   int  make_font ();
   void print_line (HDC hdc, int line, char* linbuf, HBRUSH hbr );
   void mark_char (HDC hdc);
   void draw_client_border (HDC hdc);
   int  character (char ch);
   int  keydown (int key);
   void adjust_view_for_caret ();
   int  timer ();
   void adjust_view_for_selection ();
   int  transl_binary_to_text( SimpleString& dest, char* src, int len );
   int  findnext();
   int  findprev();
   int  GotoBookmark( int cmd );

   CFont *m_cfPrintFont;
   BOOL   m_bPrinting;
   CScreenSettings m_saveSettings;

// Implementation
public:
	virtual ~CFshedView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

   // String containing data to replace.
   CString strToReplaceData;
   // String containing data to replace with.
   SimpleString strReplaceWithData;

   CFindDlg m_dlgFind;
   BOOL m_bFirstSearch;
	CFindReplaceDialog* m_pFindReplaceDlg; // find or replace dialog
	BOOL m_bFindOnly; // Is pFindReplace the find or replace?
	CString m_strFind;    // last find string
	CString m_strReplace; // last replace string
	BOOL m_bCase; // TRUE==case sensitive, FALSE==not
	int m_bNext;  // TRUE==search down, FALSE== search up
	BOOL m_bWord; // TRUE==match whole word, FALSE==not
   long m_lInitialSearchPos; 

   char *pcGotoDlgBuffer;
   int iGotoDlgBufLen;
   int bOpenReadOnlySetting;
   unsigned int iStartPL, iNumBytesPl, iPLFileLen;
   bookmark *pbmkRemove;
   int iDecValDlgOffset, iDecValDlgValue, iDecValDlgSize, iDecValDlgTimes;
   int iCutMode;
   int iManipPos;
   char szFileName[_MAX_PATH];
   int iDestFileLen, iSrcFileLen;
   intpair* pdiffChoice;
   int iDiffNum;
   char* pcTmplText;

   public:
	int iWindowShowCmd, iWindowX, iWindowY, iWindowWidth, iWindowHeight;

private:
	int bDontMarkCurrentPos;
	int bInsertingHex;
	SimpleArray<char> Linebuffer;
	int iHexWidth;
	int iBmkCount;
	bookmark pbmkList[BMKMAX];
	int iUpdateLine;
	int bTimerSet;
	int iMouseX, iMouseY;
	HFONT hFont;
	int iInsertMode;
	int iTextColor, iBkColor, iSelBkColor, iSelTextColor;
//	COLORREF iTextColorValue, iBkColorValue, iSepColorValue;
//	COLORREF iSelBkColorValue, iSelTextColorValue;
//	COLORREF iBmkColor;
	int bSelected;
	int bLButtonIsDown, iLBDownX, iLBDownY;
	int iStartOfSelection, iEndOfSelection;
	int m_iEnteringMode;
	HWND hwndStatusBar, hwndToolBar, hwndHBar, hwndVBar;

public:
   void HideSelection( BOOL bHide, BOOL bPerm );
   CString GetSelText( );
   void GetSel( CHARRANGE& cr ) const;
   void GetSel( long& nStartChar, long& nEndChar ) const;
   long GetTextLength( );
   void SetSel( CHARRANGE& cr );
   void SetSel( long nStartChar, long nEndChar );
   void ReplaceSel( LPCTSTR lpszNewText, BOOL bCanUndo = FALSE );
   long FindText( DWORD dwFlags, BOOL m_bNext, FINDTEXTEX* pFindText );
   CPoint GetCharPos( long lChar ) const;

protected:
	int save_ini_data ();
	int read_ini_data ();

   void AdjustDialogPosition(CDialog* pDlg);
   void OnReplaceSel(LPCTSTR lpszFind, BOOL bNext, BOOL bCase,
	               BOOL bWord, LPCTSTR lpszReplace);
   void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace, BOOL bCase, BOOL bWord);
   BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bCase, BOOL bWord);
   long FindAndSelect(DWORD dwFlags, FINDTEXTEX& ft, BOOL m_bNext);
   void TextNotFound(LPCTSTR lpszFind);
   void OnTextNotFound(LPCTSTR);
	BOOL FindText(LPCTSTR lpszFind, BOOL bCase = TRUE, BOOL bWord = TRUE, BOOL m_bNext = TRUE);
	BOOL FindTextSimple(LPCTSTR lpszFind, BOOL bCase = TRUE,
		BOOL bWord = TRUE, BOOL m_bNext = TRUE);
   void OnEditFindReplace(BOOL bFindOnly = TRUE);
   afx_msg LRESULT OnFindReplaceCmd(WPARAM, LPARAM lParam);
   void OnFindNext(LPCTSTR lpszFind, BOOL bNext, BOOL bCase, BOOL bWord);

   // Generated message map functions
protected:
	//{{AFX_MSG(CFshedView)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnPaint();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg void OnEditFind();
	afx_msg void OnEditCut();
	afx_msg void OnEditCopy();
	afx_msg void OnEditPaste();
	afx_msg void OnEditRepeat();
	afx_msg void OnEditReplace();
	afx_msg void OnBookmark(UINT nId);
	afx_msg void OnRemoveBkm();
	afx_msg void OnClearallBmk();
	afx_msg void OnAddbookmark();
	afx_msg void OnCopyHexdump();
	afx_msg void OnInsertfile();
	afx_msg void OnSaveselas();
	afx_msg void OnEditClear();
	afx_msg void OnEditSelectAll();
	afx_msg void OnInsertmodetoggle();
	afx_msg void OnChangeMode();
	afx_msg void OnEditReadonlymode();
	afx_msg void OnEditAppend();
	afx_msg void OnEditManipulatebits();
	afx_msg void OnViewOptions();
	afx_msg void OnSelectBlock();
	afx_msg void OnReadfloat();
	afx_msg void OnProperties();
	afx_msg void OnRevert();
	afx_msg void OnBookmarksGotobookmark();
	afx_msg void OnUpdateBookmarksGotobookmark(CCmdUI* pCmdUI);
	afx_msg void OnEditPasteSpecial();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in fshedView.cpp
inline CFshedDoc* CFshedView::GetDocument()
   { return (CFshedDoc*)m_pDocument; }
#endif

#define Doc (GetDocument())

void count_instances();
int find_bytes (char* ps, int ls, char* pb, int lb, int mode, char (*cmp) (char));
int find_bytes (char* ps, int ls, char* pb, int lb, long lStartSel, long lEndSel, 
                int mode, BOOL bCaseSensitive, BOOL bWholeWord);

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_FSHEDVIEW_H__BD87E553_34CD_11D5_B4F0_00B0D0719D70__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -