Esempio n. 1
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();
}
Esempio n. 2
0
void StdNodalTetExp::NodalToModal(
    const Array<OneD, const NekDouble>& inarray,
    Array<OneD,       NekDouble>& outarray)
{
    StdMatrixKey   Nkey(eInvNBasisTrans, DetShapeType(), *this,
                        NullConstFactorMap, NullVarCoeffMap,
                        m_nodalPointsKey.GetPointsType());
    DNekMatSharedPtr  inv_vdm = GetStdMatrix(Nkey);

    NekVector<NekDouble> nodal(m_ncoeffs,inarray,eWrapper);
    NekVector<NekDouble> modal(m_ncoeffs,outarray,eWrapper);
    modal = (*inv_vdm) * nodal;
}
Esempio n. 3
0
        void StdNodalTriExp::ModalToNodal(
            const Array<OneD, const NekDouble>& inarray, 
                  Array<OneD,       NekDouble>& outarray)
        {
            StdMatrixKey      Nkey(eNBasisTrans, DetShapeType(), *this,
                                    NullConstFactorMap, NullVarCoeffMap,
                                    m_nodalPointsKey.GetPointsType());
            DNekMatSharedPtr  vdm = GetStdMatrix(Nkey);

            // Multiply out matrix
            NekVector<NekDouble> modal(m_ncoeffs,inarray,eWrapper);
            NekVector<NekDouble> nodal(m_ncoeffs,outarray,eWrapper);
            nodal = (*vdm)*modal;
        }
Esempio n. 4
0
void cruzamento()
{
    int i, j, k, cont=0, qtd_filhos, cru[indiv][alelo], tot_filhos=0;
    float perc;
    /* Calcula a qtd. de filhos p/ cada selecionado */
    for(i=0,perc=.3; i<3; i++,perc-=.1)
    {
        reproducao[i]=perc*indiv;
        tot_filhos+=reproducao[i];
    }
    qtd_filhos=(indiv-tot_filhos)/(qtd_selecionados-3);

    for(i=3; i<qtd_selecionados; i++)
        reproducao[i]=qtd_filhos;
    reproducao[3]+=indiv-(tot_filhos+(qtd_filhos*(qtd_selecionados-3)));

    /* Calcula os pontos de corte */
    ponto_corte1 = modal() * no_alelo;

    if(ponto_corte1 <= alelo-(no_alelo*2))
        ponto_corte2 =  ponto_corte1+((alelo-ponto_corte1)/2);
    else
        ponto_corte2 = alelo;

    do {
        for(i=0; i<qtd_selecionados; i++)
        {
            qtd_filhos=reproducao[i];
            for(j=0; j<qtd_filhos; j++)
            {
                for(k=0; k<ponto_corte1; k++)
                    cru[cont][k] = bin[i][k];
                for(k=ponto_corte1; k<ponto_corte2; k++)
                    cru[cont][k] = bin[j][k];
                for(k=ponto_corte2; k<alelo; k++)
                    cru[cont][k] = bin[j+1][k];
                cont++;
            }
        }
    } while(cont < indiv);

    for(i=0; i<indiv; i++)
        for(j=0; j<alelo; j++)
        {
            bin[i][j] = cru[i][j];
        }
}
Esempio n. 5
0
int wxDialog::ShowModal()
{
    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();

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

    wxBusyCursorSuspender cs; // temporarily suppress the busy cursor

    Show( true );

    m_modalShowing = true;

    wxOpenModalDialogsCount++;

    // 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();
    }

    gtk_window_set_modal(GTK_WINDOW(m_widget), FALSE);

    wxOpenModalDialogsCount--;

    return GetReturnCode();
}
Esempio n. 6
0
int wxDialog::ShowModal()
{
    WX_HOOK_MODAL_DIALOG();

    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) );
    }

#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

    // NOTE: this will cause a gtk_grab_add() during Show()
    gtk_window_set_modal(GTK_WINDOW(m_widget), true);

    Show( true );

    m_modalShowing = true;

    wxOpenModalDialogLocker modalLock;

    // Prevent the widget from being destroyed if the user closes the window.
    // Needed for derived classes which bypass wxTLW::Create(), and therefore
    // the wxTLW "delete-event" handler is not connected
    gulong handler_id = g_signal_connect(
        m_widget, "delete-event", G_CALLBACK(gtk_true), this);

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

    g_signal_handler_disconnect(m_widget, handler_id);
#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();
}