Exemple #1
0
void IngameWindow::MouseLeftUp(const MouseCoords& mc)
{
    // Bewegung stoppen
    isMoving = false;

    // beiden Buttons oben links und rechts prfen
    const Rect rec[2] =
    {
        GetLeftButtonRect(),
        GetRightButtonRect()
    };

    for(unsigned i = 0; i < 2; ++i)
    {
        button_state[i] = BUTTON_UP;
        if(Coll(mc.x, mc.y, rec[i]))
        {
            if(i == 0 && (!IsModal() || closeOnRightClick_))
                Close();
            else if(i==1 && !IsModal())
            {
                SetMinimized(!IsMinimized());
                LOADER.GetSoundN("sound", 113)->Play(255, false);
            }
        }
    }
}
Exemple #2
0
void dlgSearchObject::OnCancel(wxCommandEvent &ev)
{
	if (IsModal())
		EndModal(wxID_CANCEL);
	else
		Destroy();
}
Exemple #3
0
void pgDialog::OnCancel(wxCommandEvent &ev)
{
	if (IsModal())
		EndModal(wxID_CANCEL);
	else
		Destroy();
}
Exemple #4
0
void pgDialog::OnClose(wxCloseEvent &event)
{
	if (IsModal())
		EndModal(wxID_CANCEL);
	else
		Destroy();
}
void DlgSaveLayout::OnOkClick( wxCommandEvent& event )
{
	if(!m_ComboLayout->GetValue().IsEmpty())
    {
		if(bSave)
		{
			wxMainFrame::Get()->AddLayout(m_ComboLayout->GetValue());
		}
		else
		{
			wxMainFrame::Get()->RemoveLayout(m_ComboLayout->GetValue());
		}

        if ( IsModal() )
            EndModal(wxID_OK); // If modal
        else
        {
            SetReturnCode(wxID_OK);
            this->Show(false); // If modeless
        }
    }	
	else
	{
		wxMessageBox(wxT("You must enter a layout name"), wxT("Error"));
	}
}
void DIALOG_DRC_CONTROL::OnLeftDClickClearance( wxMouseEvent& event )
{
    event.Skip();

    // I am assuming that the double click actually changed the selected item.
    // please verify this.
    int selection = m_ClearanceListBox->GetSelection();

    if( selection != wxNOT_FOUND )
    {
        // Find the selected MARKER in the PCB, position cursor there.
        // Then close the dialog.
        const DRC_ITEM* item = m_ClearanceListBox->GetItem( selection );

        if( item )
        {
            m_brdEditor->CursorGoto( item->GetPointA() );
            m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );

            if( !IsModal() )
            {
                // turn control over to m_brdEditor, hide this DIALOG_DRC_CONTROL window,
                // no destruction so we can preserve listbox cursor
                Show( false );

                // We do not want the clarification popup window.
                // when releasing the left button in the main window
                m_brdEditor->SkipNextLeftButtonReleaseEvent();
            }
        }
    }
}
Exemple #7
0
int wxDialog::ShowModal()
{
    if ( IsModal() )
    {
       wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
       return GetReturnCode();
    }

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    wxWindow * const parent = GetParentForModalDialog();
    if ( parent && parent != this )
    {
        m_parent = parent;
    }

    Show(true);

    m_isShowingModal = true;

    wxASSERT_MSG( !m_windowDisabler, wxT("disabling windows twice?") );

#if defined(__WXGTK__) || defined(__WXMGL__)
    wxBusyCursorSuspender suspender;
    // FIXME (FIXME_MGL) - make sure busy cursor disappears under MSW too
#endif

    m_windowDisabler = new wxWindowDisabler(this);
    if ( !m_eventLoop )
        m_eventLoop = new wxEventLoop;

    m_eventLoop->Run();

    return GetReturnCode();
}
void DIALOG_DRC_CONTROL::OnLeftDClickUnconnected( wxMouseEvent& event )
{
    event.Skip();

    // I am assuming that the double click actually changed the selected item.
    // please verify this.
    int selection = m_UnconnectedListBox->GetSelection();

    if( selection != wxNOT_FOUND )
    {
        // Find the selected DRC_ITEM in the listbox, position cursor there,
        // at the first of the two pads.
        // Then hide the dialog.
        const DRC_ITEM* item = m_UnconnectedListBox->GetItem( selection );
        if( item )
        {
            m_brdEditor->CursorGoto( item->GetPointA() );
            m_brdEditor->GetGalCanvas()->GetView()->SetCenter( VECTOR2D( item->GetPointA() ) );

            if( !IsModal() )
            {
                Show( false );

                // We do not want the clarification popup window.
                // when releasing the left button in the main window
                m_brdEditor->SkipNextLeftButtonReleaseEvent();
            }
        }
    }
}
Exemple #9
0
void frmExport::OnCancel(wxCommandEvent &ev)
{
    if (IsModal())
        EndModal(wxID_CANCEL);
    else
        Destroy();
}
Exemple #10
0
bool wxDialog::Show(bool show)
{
    if ( !wxDialogBase::Show(show) )
    {
        // nothing to do
        return FALSE;
    }

    if ( show )
    {
        // usually will result in TransferDataToWindow() being called
        InitDialog();
    }

    if ( IsModal() )
    {
        if ( show )
        {
            DoShowModal();
        }
        else // end of modal dialog
        {
            // this will cause IsModalShowing() return FALSE and our local
            // message loop will terminate
            wxModalDialogs.DeleteObject(this);
        }
    }

    return TRUE;
}
Exemple #11
0
void wxDialogBase::EndDialog(int rc)
{
    if ( IsModal() )
        EndModal(rc);
    else
        Hide();
}
void DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem( wxMouseEvent& event )
{
    event.Skip();

    int selection = m_ItemsListBox->GetSelection();

    if( selection != wxNOT_FOUND )
    {
        // Find the selected DRC_ITEM in the listbox, position cursor there.
        // Then hide the dialog.
        const DRC_ITEM* item = m_ItemsListBox->GetItem( selection );
        if( item )
        {
            m_parentFrame->FocusOnLocation( item->GetPointA(), true, true );

            if( !IsModal() )
            {
                Show( false );

                // We do not want the clarify selection popup when releasing the
                // left button in the main window
                m_parentFrame->SkipNextLeftButtonReleaseEvent();
            }
        }
    }
}
void tmwxOptimizerDialog::DoStartModal() {
  /* CAF - essentially lifted from wxGTK 2.5.1's wxDialog::ShowModal, up to
     grabbing the focus. */
    if (IsModal()) {
       wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
       mStatus = GetReturnCode();
       return;
    }

    // use the apps top level window as parent if none given unless explicitly
    // forbidden
    if (! GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT)) {
        wxWindow *parent = wxTheApp->GetTopWindow();
        if (parent && parent != this &&
            parent -> IsBeingDeleted() &&
            ! (parent->GetExtraStyle() & wxWS_EX_TRANSIENT)) {
            m_parent = parent;
            gtk_window_set_transient_for (GTK_WINDOW(m_widget),
            GTK_WINDOW(parent->m_widget) );
        }
    }

    wxBeginBusyCursor ();
    Show (true);
    SetFocus();
    m_modalShowing = true;
    g_openDialogs++;
    gtk_grab_add (m_widget);
}
Exemple #14
0
int wxDialog::ShowModal()
{
    WX_TESTING_SHOW_MODAL_HOOK();

    wxASSERT_MSG( !IsModal(), "ShowModal() can't be called twice" );

    // release the mouse if it's currently captured as the window having it
    // will be disabled when this dialog is shown -- but will still keep the
    // capture making it impossible to do anything in the modal dialog itself
    wxWindow * const win = wxWindow::GetCapture();
    if ( win )
        win->GTKReleaseMouseAndNotify();

    wxWindow * const parent = GetParentForModalDialog();
    if ( parent )
    {
        gtk_window_set_transient_for( GTK_WINDOW(m_widget),
                                      GTK_WINDOW(parent->m_widget) );
    }

    wxBusyCursorSuspender cs; // temporarily suppress the busy cursor

#if GTK_CHECK_VERSION(2,10,0)
    unsigned sigId = 0;
    gulong hookId = 0;
#ifndef __WXGTK3__
    // Ubuntu overlay scrollbar uses at least GTK 2.24
    if (gtk_check_version(2,24,0) == NULL)
#endif
    {
        sigId = g_signal_lookup("realize", GTK_TYPE_WIDGET);
        hookId = g_signal_add_emission_hook(sigId, 0, realize_hook, NULL, NULL);
    }
#endif

    Show( true );

    m_modalShowing = true;

    wxOpenModalDialogLocker modalLock;

    // NOTE: gtk_window_set_modal internally calls gtk_grab_add() !
    gtk_window_set_modal(GTK_WINDOW(m_widget), TRUE);

    // Run modal dialog event loop.
    {
        wxGUIEventLoopTiedPtr modal(&m_modalLoop, new wxGUIEventLoop());
        m_modalLoop->Run();
    }

#if GTK_CHECK_VERSION(2,10,0)
    if (sigId)
        g_signal_remove_emission_hook(sigId, hookId);
#endif

    gtk_window_set_modal(GTK_WINDOW(m_widget), FALSE);

    return GetReturnCode();
}
Exemple #15
0
void ParamEdit::Close() {
	if (IsModal()) 
		EndModal(wxID_OK);
	else {
		SetReturnCode(wxID_OK);
		Show(false);
	}
}
Exemple #16
0
void CustomMessageBox::CloseDialog()
{
	if (IsModal()) {
		EndModal(wxID_NO);
	} else {
		Close(false);
	}
}
Exemple #17
0
void wxGenericAboutDialog::OnCloseWindow(wxCloseEvent& event)
{
    // safeguards in case the window is still shown using ShowModal
    if ( !IsModal() )
        Destroy();

    event.Skip();
}
Exemple #18
0
void wxDialog::EndModal(int retCode)
{
    wxASSERT_MSG( IsModal(), wxT("EndModal() called for non modal dialog") );

    SetReturnCode(retCode);

    Hide();
}
Exemple #19
0
void ParamEdit::OnCancel(wxCommandEvent & event) {
	if (IsModal()) 
		EndModal(wxID_CANCEL);
	else {
		SetReturnCode(wxID_CANCEL);
		Show(false);
	}
}
Exemple #20
0
void WeatherFaxWizard::OnWizardPageChanged( wxWizardEvent& event )
{
    if(event.GetPage() == m_pages[1]) {
        if(!event.GetDirection()) {
            /* if we backed up, convert the mapped coordinates back to the input */
            double x1, y1, mx1, my1;
            double x2, y2, mx2, my2;

            x1 = m_sCoord1X->GetValue(), y1 = m_sCoord1Y->GetValue();
            x2 = m_sCoord2X->GetValue(), y2 = m_sCoord2Y->GetValue();

            m_wfimg.MercatorToInput(x1, y1, mx1, my1);
            m_sCoord1XUnMapped->SetValue(round(mx1));
            m_sCoord1YUnMapped->SetValue(round(my1));

            m_wfimg.MercatorToInput(x2, y2, mx2, my2);
            m_sCoord2XUnMapped->SetValue(round(mx2));
            m_sCoord2YUnMapped->SetValue(round(my2));
    
            double coord1lat, coord1lon, coord2lat, coord2lon;
            m_tCoord1Lat->GetValue().ToDouble(&coord1lat);
            m_tCoord1Lon->GetValue().ToDouble(&coord1lon);
            m_tCoord2Lat->GetValue().ToDouble(&coord2lat);
            m_tCoord2Lon->GetValue().ToDouble(&coord2lon);
            WriteMappingLatLon(coord1lat, coord1lon, coord2lat, coord2lon);
        }

        SetUnMappedCoordRanges();
        UpdateMappingControls();

        m_rbCoord1UnMapped->SetValue(true);
        m_rbCoord2UnMapped->SetValue(false);
    } else if(event.GetPage() == m_pages[2]) {
        StoreMappingParams();
        /* invalidate mapped image */
        m_wfimg.m_mappedimg = wxNullImage;
        m_rbCoord1UnMapped->SetValue(true);
        m_rbCoord2UnMapped->SetValue(false);

        if(!ApplyMapping()) {
            wxMessageDialog w
                ( this, _("Failed to apply mapping\nCheck Mapping Correction Parameters"),
                  _("Mapping"), wxOK | wxICON_ERROR );
            w.ShowModal();
            ShowPage(m_pages[1], true);
        } else if(m_curCoords->mapping == WeatherFaxImageCoordinates::MERCATOR &&
                m_curCoords->mappingmultiplier == 1 &&
                  m_curCoords->mappingratio == 1) {
            wxWizardEvent dummy;
            OnWizardFinished( dummy );
            if(IsModal())
                EndModal(wxID_OK);
            else
                Hide();
        }
    }
}
void wxDialog::EndModal(int retCode)
{
    wxASSERT_MSG( IsModal(), _T("EndModal() called for non modal dialog") );

//    m_endModalCalled = true;
    SetReturnCode(retCode);

    Hide();
}
Exemple #22
0
void CConfigChooser::onCancel(wxCommandEvent& WXUNUSED(event))
{
	if (IsModal()) {
		EndModal(wxID_CANCEL);
	} else {
		SetReturnCode(wxID_CANCEL);
		Show(false);
	}
}
Exemple #23
0
void ExecutionDialog::OnClose(wxCloseEvent &event)
{
	Abort();
	delete conn;
	if (IsModal())
		EndModal(-1);
	else
		Destroy();
}
// show dialog modally
int wxDialog::ShowModal()
{
    wxASSERT_MSG( !IsModal(), _T("wxDialog::ShowModal() reentered?") );

    m_oldFocus = FindFocus();
    m_endModalCalled = false;

    Show();

    // EndModal may have been called from InitDialog handler (called from
    // inside Show()), which would cause an infinite loop if we didn't take it
    // into account
    if ( !m_endModalCalled )
    {
        // modal dialog needs a parent window, so try to find one
        wxWindow *parent = GetParent();
        if ( !parent )
        {
            parent = FindSuitableParent();
        }

        // remember where the focus was
        wxWindow *oldFocus = m_oldFocus;
        if ( !oldFocus )
        {
            // VZ: do we really want to do this?
            oldFocus = parent;
        }

        // We have to remember the HWND because we need to check
        // the HWND still exists (oldFocus can be garbage when the dialog
        // exits, if it has been destroyed)
        HWND hwndOldFocus = oldFocus ? GetHwndOf(oldFocus) : NULL;


        // enter and run the modal loop
        {
            wxDialogModalDataTiedPtr modalData(&m_modalData,
                                               new wxDialogModalData(this));
            modalData->RunLoop();
        }


        // and restore focus
        // Note that this code MUST NOT access the dialog object's data
        // in case the object has been deleted (which will be the case
        // for a modal dialog that has been destroyed before calling EndModal).
        if ( oldFocus && (oldFocus != this) && ::IsWindow(hwndOldFocus))
        {
            // This is likely to prove that the object still exists
            if (wxFindWinFromHandle((WXHWND) hwndOldFocus) == oldFocus)
                oldFocus->SetFocus();
        }
    }

    return GetReturnCode();
}
Exemple #25
0
void DatChoiceDialog::OnOkButtonClick(wxCommandEvent& event)
{
    TransferDataFromWindow();
    sCam=Choice1->GetString(Choice1->GetSelection());
    sCadr=TextCtrl1->GetValue();
    sBright=TextCtrl2->GetValue();
    if (IsModal())
        EndModal(wxID_OK);
}
Exemple #26
0
void ComboBox::HandleUpdate( float seconds ) {
	Bin::HandleUpdate( seconds );

	if( GetState() != State::ACTIVE ) {
		if( IsModal() ) {
			ReleaseModal();
		}
	}
}
Exemple #27
0
void wxDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
{
    if ( IsModal() )
        EndModal(wxID_CANCEL);
    else
    {
        SetReturnCode(wxID_CANCEL);
        this->Show(false);
    }
}
void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event )
{
    if( IsModal() )
        EndModal( wxID_CANCEL );
    else
    {
        SetReturnCode( wxID_CANCEL );
        this->Show( false );
    }
}
Exemple #29
0
// Replacement for Show(TRUE) for modal dialogs - returns return code
int wxDialog::ShowModal()
{
    if ( !IsModal() )
    {
        SetModal(TRUE);
    }

    Show(TRUE);
    return GetReturnCode();
}
Exemple #30
0
bool MenuBar::Command(int id, int subId, Win *win, void *d)
{
	if (id == CMD_CHECK) 
		return Parent() ? Parent()->Command(id,subId,this,d) : false;
	
	SetSelect(-1);
	if (IsModal()) EndModal(id);
	
	return (Parent()) ?  Parent()->Command(id, subId, win, d) : false;
}