Exemple #1
0
void text_f::btnClick( wxCommandEvent& event )
{
	// TODO: Implement btnClick
	wxButton* btn = dynamic_cast<wxButton*>(event.GetEventObject());
	if (btn == 0) return;
	if (active_ == text_ed) {
		text_ed->WriteText(btn->GetLabel());
	}
	else if (active_ == amount_ed && currency) {
		wxString sval = btn->GetLabel();
		amount_ed->SetInsertionPoint(amount_ed->GetLastPosition());
		int val = -1;
		if (sval == _("1")) val = 1;
		else if (sval == _("2")) val = 2;
		else if (sval == _("3")) val = 3;
		else if (sval == _("4")) val = 4;
		else if (sval == _("5")) val = 5;
		else if (sval == _("6")) val = 6;
		else if (sval == _("7")) val = 7;
		else if (sval == _("8")) val = 8;
		else if (sval == _("9")) val = 9;
		else if (sval == _("0")) val = 0;
		
		if (val != -1) {
			double amount = currency->reverse(to_mb(amount_ed->GetValue()));
			if (amount > 999999) return;
			amount = amount*10+double(val)/100;
			amount_ed->SetValue(to_uc(currency->format(amount)));
		}
	}
	if (passwd_) {
		vkbdEvent throw_event(btn->GetLabel(), 0);
		GetParent()->GetEventHandler()->ProcessEvent(throw_event);
	}
}
Exemple #2
0
void text_f::space_btnClick( wxCommandEvent& event )
{
	// TODO: Implement space_btnClick
	wxButton* btn = dynamic_cast<wxButton*>(event.GetEventObject());
	if (btn == 0) return;
	if (active_ == text_ed) {
		text_ed->WriteText(_(" "));
	}
	if (passwd_) {
		vkbdEvent throw_event(_(" "), WXK_RETURN);
		GetParent()->GetEventHandler()->ProcessEvent(throw_event);
	}
}
Exemple #3
0
void text_f::bs_btnClick( wxCommandEvent& event )
{
	// TODO: Implement bs_btnClick
	if (active_ == text_ed) {
		long from = text_ed->GetInsertionPoint() - 1;
		long to = text_ed->GetInsertionPoint();
		text_ed->Remove(from, to);
	}
	else if (active_ ==  amount_ed && currency) {
		amount_ed->SetValue(to_uc(currency->format(0)));
	}
	if (passwd_) {
		vkbdEvent throw_event(_(""), WXK_BACK);
		GetParent()->GetEventHandler()->ProcessEvent(throw_event);
	}
}
Exemple #4
0
void VMEvent::exception_event(Throwable *exception,
                                   JavaFrame *catch_frame,
                                   DebuggerEvent *d_event, int catch_offset)
{
  check_notify_wanted(Dbg_EventKind_EXCEPTION);

  UsingFastOops fast_oops;

  VMEvent::Fast ep, ep_2;
  jlong throw_offset = 0;
  int event_count = 0;
  jbyte suspend_policy = JDWP_SuspendPolicy_NONE;
  InstanceClass::Fast ic;
  LocationModifier::Fast location;
  Method::Fast catch_method;
  Method::Fast throw_method;
  int data_len = JDWP_EVENT_LEN;

  ep = ep_2 = get_event_request(d_event, event_count, suspend_policy);
  if (ep.is_null()) {
    return;
  }
  // Flush any packets waiting in the queue.  This helps avoid a race
  // condition where we may have a resume command in the queue for a
  // previous event, we send this event, process the resume command
  // out of order
  JavaDebugger::dispatch(0);

  // Calculate packet length
  data_len += (JDWP_EVENT_EXCEPTION_LEN * event_count);

  Transport::Fast transport = ep().transport();
  PacketOutputStream out(&transport, data_len, JDWP_COMMAND_SET(Event),
                         JDWP_COMMAND(Event, Composite));
  // Create a buffered output stream so we can asynchronously send an error
  // Calculate the size based on half of the items being 'longs'
  UsingFastOops fast_oops_2;

  Thread::Fast thread = JavaDebugger::get_thread_by_id(d_event->thread_id());
  VMEventModifier::deoptimize_frame(&thread, true);


  VMEvent::Fast info_event = find_event((jbyte)VM_EXCEPTION_INFO_EVENT);
  if (!info_event.is_null()) {
    location = get_modifier(&info_event,
        JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly);
    GUARANTEE(!location.is_null(), "No location modifier in info event");
    throw_method = location().method();
    throw_offset = location().offset();
    remove_event_request(&info_event);
  } else {
    UsingFastOops fast_oops_3;
    ObjArray::Fast trace, methods;
    TypeArray::Fast offsets;
    trace = exception->backtrace();
    if (!trace.is_null()) {
      methods = trace().obj_at(0);
      offsets = trace().obj_at(1);
      if (!methods.is_null() && !offsets.is_null()) {
        throw_method = methods().obj_at(0);
        throw_offset = (jlong)(offsets().int_at(0));
      }
    }
  }

  DEBUGGER_EVENT(("Exception"));
  out.write_byte(suspend_policy);
  out.write_int(event_count);
  while (ep.not_null()) {
    out.write_byte(JDWP_EventKind_EXCEPTION);        
    out.write_int(ep().event_id());

    // thread with exception
    out.write_int(d_event->thread_id());

    // location of exception throw
    if (throw_method.not_null()) {
      ic = throw_method().holder();
    }
    DebuggerEvent throw_event(JDWP_EventKind_EXCEPTION,
                              0, // don't need thread
                              JavaDebugger::get_object_id_by_ref(&ic),
                              JavaDebugger::get_method_id(&ic, &throw_method),
                              (jlong)throw_offset);
    throw_event.write_as_location(&out);

    // thrown exception 
    out.write_byte('L');
    out.write_object(exception);

    // location of catch, or 0 if not caught

    if (catch_frame == NULL) {
      LocationModifier::write_null_location(&out);
    } else {
      catch_method = catch_frame->method();
      ic = catch_method().holder();
      DebuggerEvent catch_event(JDWP_EventKind_EXCEPTION,
                                0, // don't need thread
                                JavaDebugger::get_object_id_by_ref(&ic),
                                JavaDebugger::get_method_id(&ic, &catch_method),
                                (jlong)catch_offset);
      catch_event.write_as_location(&out);
    }
    ep = ep().send_next();
  }
  out.send_packet();
  JavaDebugger::process_suspend_policy(suspend_policy, &thread,
                                      true);
}