예제 #1
0
void WREShowRibbon( HMENU menu )
{
    char        *mtext;

    if( WRERibbonHeight != 0 ) {
        ShowWindow( WRERibbon->win, SW_HIDE );
        WRERibbonHeight = 0;
        WREResizeWindows();
        mtext = WREAllocRCString( WRE_SHOWTOOLBAR );
    } else {
        ShowWindow( WRERibbon->win, SW_SHOW );
        WRERibbonHeight = 2 * WRERibbonInfo->dinfo.border_size.y +
                          WRERibbonInfo->dinfo.button_size.y +
                          2 * GetSystemMetrics( SM_CYBORDER );
        WREResizeWindows();
        mtext = WREAllocRCString( WRE_HIDETOOLBAR );
    }

    ModifyMenu( menu, IDM_SHOW_RIBBON, MF_BYCOMMAND | MF_STRING,
                IDM_SHOW_RIBBON, mtext );

    if( mtext != NULL ) {
        WREFreeRCString( mtext );
    }
}
예제 #2
0
WREToolBar *WRECreateToolBar( WREToolBarInfo *info, HWND parent )
{
    WREToolBar  *tbar;
    int         i;
    HMENU       sys_menu;
    char        *text;

    if( info == NULL ) {
        return( NULL );
    }

    tbar = WREAllocToolBar();
    if( tbar == NULL ) {
        return( NULL );
    }

    tbar->info = info;
    tbar->parent = parent;
    tbar->tbar = (toolbar)ToolBarInit( parent );

    ToolBarDisplay( tbar->tbar, &info->dinfo );

    for( i = 0; i < info->num_items; i++ ) {
        ToolBarAddItem( tbar->tbar, &info->items[i] );
    }

    tbar->win = ToolBarWindow( tbar->tbar );

    if( (info->dinfo.style & TOOLBAR_FLOAT_STYLE) == TOOLBAR_FLOAT_STYLE ) {
        sys_menu = GetSystemMenu( tbar->win, FALSE );
        i = GetMenuItemCount( sys_menu );
        for( ; i > 0; i-- ) {
            DeleteMenu( sys_menu, i, MF_BYPOSITION );
        }
        text = WREAllocRCString( WRE_SYSMENUMOVE );
        AppendMenu( sys_menu, MF_STRING, SC_MOVE, text != NULL ? text : "Move" );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
        text = WREAllocRCString( WRE_SYSMENUSIZE );
        AppendMenu( sys_menu, MF_STRING, SC_SIZE, text != NULL ? text : "Size" );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
        text = WREAllocRCString( WRE_SYSMENUHIDE );
        AppendMenu( sys_menu, MF_STRING, SC_CLOSE, text != NULL ? text : "Hide" );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
    }

    ShowWindow( tbar->win, SW_SHOWNORMAL );

    UpdateWindow( tbar->win );

    WREAddToolBar( tbar );

    return( tbar );
}
예제 #3
0
Bool WREInitTotalText( void )
{
    WRETotalText = WREAllocRCString( WRE_TOTALTEXT );
    WRETotalTextOne = WREAllocRCString( WRE_TOTALTEXT_ONE );
    WRETotalTextNone = WREAllocRCString( WRE_TOTALTEXT_NONE );
    if( WRETotalText == NULL || WRETotalTextOne == NULL || WRETotalTextNone == NULL ) {
        return( FALSE );
    }
    return( TRUE );
}
예제 #4
0
void WREDisplayHint( int id )
{
    char        *buf;
    char        *mditext;
    WREHintItem *hint;

    if( id < WRE_MDI_FIRST ) {
        hint = WREGetHintItem ( id );
        if( hint ) {
            WRESetStatusByID( -1, hint->hint );
        }
    } else {
        mditext = WREAllocRCString( WRE_HINT_MDIMSG );
        if( mditext ) {
            buf = WREMemAlloc( strlen(mditext) + 20 + 1 );
            if( buf ) {
                sprintf( buf, mditext, WRE_MDI_FIRST + 1 - id );
                WRESetStatusText( NULL, buf, TRUE );
                WREMemFree( buf );
            }
            WREFreeRCString( mditext );
        }
    }

    return;
}
예제 #5
0
Bool WREQuerySaveResOnDeleteRes( WREResInfo *res_info, Bool fatal_exit )
{
    int         ret;
    UINT        style;
    HWND        frame;
    char        *text;

    if( WRENoInterface ) {
        return( TRUE );
    }

    if( res_info != NULL && WREIsResModified( res_info ) ) {
        if( fatal_exit ) {
            style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
        } else {
            style = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONEXCLAMATION;
        }
        WRECheckIfActiveWindow();
        frame = WREGetMDIWindowHandle();
        SendMessage( frame, WM_MDIRESTORE, (WPARAM)res_info->res_win, 0 );
        SendMessage( frame, WM_MDIACTIVATE, (WPARAM)res_info->res_win, 0 );
        text = WREAllocRCString( WRE_QUERYMODIFIED );
        ret = MessageBox( res_info->res_win, text, WREGetQueryName( res_info ), style );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
        if( ret == IDYES ) {
            return( WRESaveResource( res_info, FALSE ) );
        } else if( ret == IDCANCEL ) {
            return( FALSE );
        }
    }

    return( TRUE );
}
예제 #6
0
void WREInitTypeNames( void )
{
    int i;

    for( i = 0; WRETypeNames[i].name != 0; i++ ) {
        WRETypeNames[i].typeName = WREAllocRCString( WRETypeNames[i].name );
    }
}
예제 #7
0
Bool WREQuerySaveSymOnDeleteRes( WREResInfo *res_info, Bool fatal_exit )
{
    int         ret;
    UINT        style;
    char        *text;
    char        *file;
    HWND        frame;

    if( WRENoInterface ) {
        return( TRUE );
    }

    if( res_info == NULL || res_info->symbol_table == NULL ) {
        return( TRUE );
    }

    if( WRIsHashTableDirty( res_info->symbol_table ) ) {
        if( fatal_exit ) {
            style = MB_YESNO | MB_APPLMODAL | MB_ICONEXCLAMATION;
        } else {
            style = MB_YESNOCANCEL | MB_APPLMODAL | MB_ICONEXCLAMATION;
        }
        WRECheckIfActiveWindow();
        frame = WREGetMDIWindowHandle();
        SendMessage( frame, WM_MDIRESTORE, (WPARAM)res_info->res_win, 0 );
        SendMessage( frame, WM_MDIACTIVATE, (WPARAM)res_info->res_win, 0 );
        file = WREGetQueryName( res_info );
        text = WREAllocRCString( WRE_SAVEMODIFIEDSYM );
        ret = MessageBox( res_info->res_win, text, file, style );
        if( text != NULL ) {
            WREFreeRCString( text );
        }
        if( ret == IDYES ) {
            if( res_info->symbol_file == NULL ) {
                res_info->symbol_file = WRECreateSymName( file );
            }
            if( !WRESaveSymbols( res_info->symbol_table, &res_info->symbol_file, FALSE ) ) {
                return( FALSE );
            }
        } else if( ret == IDCANCEL ) {
            return( FALSE );
        }
    }

    return( TRUE );
}
예제 #8
0
UINT WINEXPORT WREOpenHookProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    char    *title;

    _wre_touch( wparam );
    _wre_touch( lparam );

    switch( msg ) {
    case WM_INITDIALOG:
        // We must call this to subclass the directory listbox even
        // if the app calls Ctl3dAutoSubclass (commdlg bug)
        //WRECtl3dSubclassDlg( hwnd, CTL3D_ALL );

        title = WREAllocRCString( WRE_GETFNCOMBOTITLE );
        if( title != NULL ) {
            SendDlgItemMessage( hwnd, stc2, WM_SETTEXT, 0, (LPARAM)title );
            WREFreeRCString( title );
        }
        return( TRUE );
    }

    return( FALSE );
}
예제 #9
0
/* Function to initialize all instances of WRE */
Bool WREInitInst( HINSTANCE app_inst )
{
    RECT        r, screen, t;
    char        *title;
    DWORD       style;

    if( !WRERegisterClipFormats( app_inst ) ) {
        WREDisplayErrorMsg( WRE_NOREGISTERCLIPFORMATS );
        return( FALSE );
    }

    if( !JDialogInit() ) {
        return( FALSE );
    }

    WRECtl3DInit( app_inst );
    WREInitOpts();
    WREInitRibbon( app_inst );
    WREInitTypeNames();
    WREInitTotalText();

    if( !WREInitResources( app_inst ) ) {
        return( FALSE );
    }

    /* load the accelerator table */
    WREAccel = LoadAccelerators( app_inst, "WREAccelTable" );

    /* if the window could not be created return FALSE */
    if( WREAccel == NULL ) {
        WREDisplayErrorMsg( WRE_NOLOADACCELTABLE );
        return( FALSE );
    }

    WREGetScreenPosOption( &r );
    GetWindowRect( GetDesktopWindow(), &screen );
    IntersectRect( &t, &screen, &r );

    title = WREAllocRCString( WRE_APPNAME );

    /* attempt to create the main application window */
    style = WS_OVERLAPPEDWINDOW;
    if( IsRectEmpty( &r ) ) {
        WREMainWin = CreateWindow( WREMainClass, title, style,
                                   CW_USEDEFAULT, CW_USEDEFAULT,
                                   CW_USEDEFAULT, CW_USEDEFAULT,
                                   (HWND)NULL, (HMENU)NULL, app_inst, NULL );
    } else {
        WREMainWin = CreateWindow( WREMainClass, title, style,
                                   r.left, r.top, r.right - r.left, r.bottom - r.top,
                                   (HWND)NULL, (HMENU)NULL, app_inst, NULL );
    }

    if( title != NULL ) {
        WREFreeRCString( title );
    }

    /* if the window could not be created return FALSE */
    if( WREMainWin == NULL ) {
        WREDisplayErrorMsg( WRE_NOCREATEAPPWINDOW );
        return( FALSE );
    }

    WREMDIWin = WRECreateMDIClientWindow( WREMainWin, app_inst );

    /* attempt to create the main application ribbon */
    if( !WRECreateRibbon( WREMainWin ) ) {
        WREDisplayErrorMsg( WRE_NOCREATETOOLRIBBON );
        return( FALSE );
    }

    if( !WRECreateStatusLine( WREMainWin, app_inst ) ) {
        WREDisplayErrorMsg( WRE_NOCREATESTATUSLINE );
        return( FALSE );
    }

    WREMenu = GetMenu( WREMainWin );
    if( WREMenu != (HMENU)NULL ) {
        EnableMenuItem( WREMenu, IDM_CUT, MF_GRAYED );
        EnableMenuItem( WREMenu, IDM_COPY, MF_GRAYED );
        EnableMenuItem( WREMenu, IDM_OPTIONS, MF_GRAYED );
    }

    WREEnableMenus( FALSE );

    if( !WREInitHints() ) {
        WREDisplayErrorMsg( WRE_NOINITHINTS );
        return( FALSE );
    }

    /* if the window was created Show and Update it */
    if( !WRENoInterface ) {
        if( WREGetOption( WREOptScreenMax ) ) {
            ShowWindow( WREMainWin, SW_SHOWMAXIMIZED );
        } else {
            ShowWindow( WREMainWin, SW_SHOWNORMAL );
        }
        UpdateWindow( WREMainWin );

        WREDisplaySplashScreen( WREInst, WREMainWin, 1250 );
    }

    return( TRUE );
}
예제 #10
0
Bool pleaseOpenFile( UINT msg )
{
    char                *filter;
    char                *title;
    char                *name;
    WREResInfo          *res_info;
    WREResInfo          *old_info;
    WREGetFileStruct    gf;
    uint_16             type;
    Bool                ok;

    old_info = WREGetCurrentRes();
    res_info = NULL;
    filter = NULL;
    title = NULL;
    name = NULL;

    if( msg == ACCEL_PLEASE_OPENME ) {
        filter = WREAccelFilter;
        title = WREAllocRCString( WRE_OPENACCEL );
        type = (uint_16)RT_ACCELERATOR;
    } else if( msg == MENU_PLEASE_OPENME ) {
        filter = WREMenuFilter;
        title = WREAllocRCString( WRE_OPENMENU );
        type = (uint_16)RT_MENU;
    } else if( msg == STRING_PLEASE_OPENME ) {
        filter = WREStringFilter;
        title = WREAllocRCString( WRE_OPENSTRING );
        type = (uint_16)RT_STRING;
    }

    ok = (filter != NULL && title != NULL);

    if( ok ) {
        gf.file_name = NULL;
        gf.title = title;
        gf.filter = filter;
        gf.save_ext = FALSE;
        ok = ((name = WREGetOpenFileName( &gf )) != NULL);
    }

    if( ok ) {
        ok = ((res_info = WRELoadResource( name )) != NULL);
    }

    if( ok ) {
        WREFindAndLoadSymbols( res_info );
        ok = WRECreateResourceWindow( res_info );
    }

    if( ok ) {
        ListAddElt( &WREResList, (void *)res_info );
    }

    if( ok ) {
        ok = (WREFindTypeNode( res_info->info->dir, type, NULL ) != NULL);
    }

    if( ok ) {
        ok = WRESetResNamesFromType( res_info, type, FALSE, NULL, 0 );
    }

    if( ok ) {
        ok = WREHandleResEdit();
    }

    if( ok ) {
        SendMessage( old_info->res_win, WM_CLOSE, 0, 0 );
    }

    if( !ok ) {
        if( res_info != NULL ) {
            WREFreeResInfo( res_info );
            res_info = NULL;
        }
    }

    if( name != NULL ) {
        WREMemFree( name );
    }

    if( title != NULL ) {
        WREFreeRCString( title );
    }

    return( ok );
}
예제 #11
0
static Bool WREInitStaticVars( void )
{
    Bool        ok;

    WREResUntitled = WREAllocRCString( WRE_UNTITLED );
    ok = (WREResUntitled != NULL);

    if( ok ) {
        WREResOpenTitle = WREAllocRCString( WRE_OPENPROJECTTITLE );
        ok = (WREResOpenTitle != NULL);
    }

    if( ok ) {
        WREResSaveTitle = WREAllocRCString( WRE_SAVEPROJECTTITLE );
        ok = (WREResSaveTitle != NULL);
    }

    if( ok ) {
        WREResSaveIntoTitle = WREAllocRCString( WRE_COPYINTOPROJECTTITLE );
        ok = (WREResSaveIntoTitle != NULL);
    }

    if( ok ) {
        WREResSaveAsTitle = WREAllocRCString( WRE_SAVEASPROJECTTITLE );
        ok = (WREResSaveAsTitle != NULL);
    }

    if( ok ) {
        WREResFilter = WREAllocRCString( WRE_PROJECTFILTER );
        ok = (WREResFilter != NULL);
        if( ok ) {
            WREMassageFilter( WREResFilter );
        }
    }

    if( ok ) {
        WREResSaveMltFilter = WREAllocRCString( WRE_SAVEMLTFILTER );
        ok = (WREResSaveMltFilter != NULL);
        if( ok ) {
            WREMassageFilter( WREResSaveMltFilter );
        }
    }

    if( ok ) {
        WRESymSaveFilter = WREAllocRCString( WRE_SYMFILTER );
        ok = (WRESymSaveFilter != NULL);
        if( ok ) {
            WREMassageFilter( WRESymSaveFilter );
        }
    }

    if( ok ) {
        WRESymLoadTitle = WREAllocRCString( WRE_LOADSYMTITLE );
        ok = (WRESymLoadTitle != NULL);
    }

    if( ok ) {
        WRESymSaveTitle = WREAllocRCString( WRE_SAVESYMTITLE );
        ok = (WRESymSaveTitle != NULL);
    }

    if( ok ) {
        WREAccelFilter = WREAllocRCString( WRE_ACCELFILTER );
        ok = (WREAccelFilter != NULL);
        if( ok ) {
            WREMassageFilter( WREAccelFilter );
        }
    }

    if( ok ) {
        WREMenuFilter = WREAllocRCString( WRE_MENUFILTER );
        ok = (WREMenuFilter != NULL);
        if( ok ) {
            WREMassageFilter( WREMenuFilter );
        }
    }

    if( ok ) {
        WREStringFilter = WREAllocRCString( WRE_STRINGFILTER );
        ok = (WREStringFilter != NULL);
        if( ok ) {
            WREMassageFilter( WREStringFilter );
        }
    }

    if( !ok ) {
        WREFiniStaticVars();
    }

    return( ok );
}