Exemplo n.º 1
0
void HexEditorCtrl::OnKillFocus( wxFocusEvent& event){
#ifdef _DEBUG_
	std::cout << "HexEditorCtrl::OnKillFocus( wxFocusEvent& event ) \n" ;
#endif
	TagHideAll();
	event.Skip();
	}
Exemplo n.º 2
0
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?
		}
	}
Exemplo n.º 3
0
void HexEditorCtrl::PreparePaintTAGs( void ){//TagElement& TAG ){
	TagHideAll();
	WX_CLEAR_ARRAY(hex_ctrl->TagArray);
	WX_CLEAR_ARRAY(text_ctrl->TagArray);

	//MainTagArray.Sort( TagElement::TagCompare );
	//for( unsigned i = 0 ; i < MainTagArray.Count() ; i ++ )	//Painting all TAGs here.
	//	PushTAGToControls(MainTagArray.Item(i));
	PaintTAGsPrefilter( MainTagArray );

	//HighlightArray.Sort( TagElement::TagCompare );
   //for( unsigned i = 0 ; i < HighlightArray.Count() ; i ++ )	//Just highlighting required sections.
	//  PushTAGToControls(HighlightArray.Item(i));
	PaintTAGsPrefilter( HighlightArray );

	//CompareArray.Sort( TagElement::TagCompare );
	//for( unsigned i = 0 ; i < CompareArray.Count() ; i ++ )	//Just highlighting diff sections.
	//	PushTAGToControls(CompareArray.Item(i));
	PaintTAGsPrefilter( CompareArray );
	}
Exemplo n.º 4
0
void HexEditorCtrl::OnTagEdit( wxCommandEvent& event ){
	TagElement *TAG;
	uint64_t pos = LastRightClickAt;
#ifdef _DEBUG_TAG_
	std::cout << " Tag Edit on " << pos << std::endl;
#endif
	for( unsigned i = 0 ; i < MainTagArray.Count() ; i++ ){
		TAG = MainTagArray.Item(i);
		if( TAG->isCover(pos) ){
			TagHideAll();	//Hide first, or BUG by double hide...
			TagElement TAGtemp = *TAG;
			TagDialog *x=new TagDialog( TAGtemp, this );
			switch( x->ShowModal() ){
				case wxID_SAVE:
					*TAG = TAGtemp;
					PreparePaintTAGs();
					ClearPaint();
					text_ctrl->RePaint();
					hex_ctrl ->RePaint();
					break;
				case wxID_DELETE:
					delete TAG;
					MainTagArray.Remove(TAG);
					PreparePaintTAGs();
					ClearPaint();
					text_ctrl->RePaint();
					hex_ctrl ->RePaint();
					break;
				default:
					break;
				}
			}
		}
	wxUpdateUIEvent eventx( TAG_CHANGE_EVENT );
	GetEventHandler()->ProcessEvent( eventx );
	}
Exemplo n.º 5
0
void HexEditorCtrl::PreparePaintTAGs( void ){//TagElement& TAG ){
	TagHideAll();
	hex_ctrl->TagArray.Clear();
	text_ctrl->TagArray.Clear();

	MainTagArray.Sort( TagElement::TagCompare );
	TagElement *TAG;
	for( unsigned i = 0 ; i < MainTagArray.Count() ; i ++ ){	//Painting all TAGs here.
		TAG = MainTagArray.Item(i);// For debugging
		PushTAGToControls(TAG);
		}

	HighlightArray.Sort( TagElement::TagCompare );
	for( unsigned i = 0 ; i < HighlightArray.Count() ; i ++ ){	//Just highlighting required sections.
		TAG = HighlightArray.Item(i);// For debugging
		PushTAGToControls(TAG);
		}

	CompareArray.Sort( TagElement::TagCompare );
	for( unsigned i = 0 ; i < CompareArray.Count() ; i ++ ){	//Just highlighting diff sections.
		TAG = CompareArray.Item(i);// For debugging
		PushTAGToControls(TAG);
		}
	}