void HexEditorCtrl::OnMouseMove( wxMouseEvent& event ){ if(event.m_leftDown){ //if left button is pressed int new_hex_location=0; // initialize new_hex_location variable if( event.GetEventObject() == hex_ctrl ) // if this event from hex_ctrl area new_hex_location = hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() ); //than take it's location on hex chars else if ( event.GetEventObject() == text_ctrl ){ //if we got this event from text area new_hex_location = GetCharToHexSize()*(text_ctrl->PixelCoordToInternalPosition( event.GetPosition() )); //Than we needed to multiply with 2 for take it's hex location. } int old_hex_location = GetLocalHexInsertionPoint(); //requesting old hex location if( new_hex_location != old_hex_location ){ //if hex selection addresses are different, start selection routine if( !select->GetState() ) //if this is new selection start if( Selector() == false ) //and select without focus return; //don't make anything. SetLocalHexInsertionPoint( new_hex_location ); //Moving cursor to new location. Selector(); //Making actual selection. PaintSelection(); } } else{ if( event.GetEventObject() == hex_ctrl || event.GetEventObject() == text_ctrl || event.GetEventObject() == offset_ctrl ){ TagElement* tg = static_cast<wxHexCtrl*>(event.GetEventObject())->GetTagByPix( event.GetPosition() ); if( (tg == NULL && TAGMutex==true) || //If there is no Tag at under and tag mutex available (tg != NULL && !tg->visible) ) // or Changed to new tag TagHideAll(); } event.Skip(); //enable tags but problems with paint? } }
//------EVENTS---------// void HexEditorCtrl::OnMouseLeft(wxMouseEvent& event){ select->SetState( false ); ClearPaint(); if( event.GetEventObject() == hex_ctrl ){ hex_ctrl->SetFocus(); focus=HEX_CTRL; SetLocalHexInsertionPoint( hex_ctrl->PixelCoordToInternalPosition( event.GetPosition() ) ); } else if( event.GetEventObject() == text_ctrl ){ text_ctrl->SetFocus(); focus=TEXT_CTRL; SetLocalHexInsertionPoint( 2 * text_ctrl->PixelCoordToInternalPosition( event.GetPosition() ) + 1); } else if( event.GetEventObject() == offset_ctrl ){ event.Skip(); //to lower level for copy offset to clipboard } }