Exemple #1
0
/******************************************************************************
*   MAIN function
******************************************************************************/
int main ( int argc, char **argv )
{

    Widget appShell = init_application(&argc, argv );
    catch_sigterm();
    trace_main = TRACE_MAIN;
    signal(SIGPIPE, SIG_IGN); /* ignore broken pipe on write */

    /*  -- Register all application specific callbacks and widget classes
     */
    RegisterApplication ( appShell );
    add_winmove_translations(appShell);

    /*  -- Create widget tree below toplevel shell using Xrm database
           register callbacks,actions, widget classe before
     */
    WcWidgetCreation ( appShell );

    /* get application resources and widget ptr */
    XtGetApplicationResources(	appShell, (XtPointer)&SETTINGS,
				basicSettingRes,
				XtNumber(basicSettingRes),
				(ArgList)0, 0 );
    SETTINGS.app = XtWidgetToApplicationContext(appShell);
    SETTINGS.vset = v_init();

    /* init widgets */
    trace_level = SETTINGS.traceLevel;
    TRACE(1,"Thermal1 %s\nThermal2 %s", SETTINGS.p[0], SETTINGS.p[1] );

    /*  init application functions
        All widgets are created, but not visible.
        functions can now communicate with widgets
    */
    update_cb(0,0); /* start timer */

    /*  -- Realize the widget tree and enter the main application loop
     */
    XtRealizeWidget ( appShell );
    grab_window_quit( appShell );
    make_borderless_window(appShell);
    make_stay_above(appShell);

    int x0,y0;
    if( load_window_position(&x0,&y0) == 0 )
        XMoveWindow(XtDisplay(appShell),XtWindow(appShell), x0, y0 );

    XtAppMainLoop(XtWidgetToApplicationContext(appShell)); /* use XtAppSetExitFlag */

    Dimension x,y;
    XtVaGetValues( appShell, "x", &x, "y", &y, NULL );
    save_window_position(x,y);

    XtDestroyWidget(appShell);
    v_free( SETTINGS.vset );
    m_destruct();
    return EXIT_SUCCESS;
}
Exemple #2
0
void Options::save_window_position( const QMdiArea *workspace_p )
{
    QList<QMdiSubWindow *>  windows = workspace_p->subWindowList( QMdiArea::StackingOrder );
    QMdiSubWindow *mdi_subwindow_p;
    long nb_widget = windows.count();
    set_opt( "WIDGET_NB_WIDGET", nb_widget );
    int id = 0;
    for ( QList<QMdiSubWindow *>::const_iterator it = windows.begin(); it != windows.end(); ++it )
    {
        mdi_subwindow_p = *it;
        QString name = "WORKSPACE" + QString::number( id );
        OCamlSource *sourceview_p = dynamic_cast<OCamlSource*>( mdi_subwindow_p->widget() );
        if ( sourceview_p )
        {
            set_opt( "TYPE_" + name, QString( "SOURCEVIEW" ) );
            QString source = sourceview_p->currentFile();
            set_opt( "SOURCE_" + name, source );
            set_opt( "SOURCE_USER_LOADED_" + name, sourceview_p->fromUserLoaded() );
            save_window_position( name, mdi_subwindow_p );
        }
        id++;
    }
}
Exemple #3
0
void Options::save_window_position( const QString &name, const QMainWindow *widget_p )
{
    save_window_position( name, ( QWidget* )widget_p );
    set_opt( "WIDGET_POS_DOCKPOS", widget_p->saveState() );
}