コード例 #1
0
int ResWriteNameOrOrdinal( ResNameOrOrdinal *name, uint_8 use_unicode, int handle )
/*********************************************************************************/
{
    int         error;
    uint_16     flag;
    uint_16     tmp16;
    uint_8      tmp8;

    if( name == NULL ) {
        error = ResWriteString( "", use_unicode, handle );
    } else {
        if (name->ord.fFlag == 0xff) {
            if( use_unicode ) {
                flag = 0xffff;
                error = ResWriteUint16( &flag, handle );
            } else {
                tmp8 = name->ord.fFlag;
                error = ResWriteUint8( &tmp8, handle );
            }
            if (!error) {
                tmp16 = name->ord.wOrdinalID;
                ResWriteUint16( &tmp16, handle );
            }
        } else {
            error = ResWriteString( name->name, use_unicode, handle );
        }
    }

    return( error );
} /* ResWriteNameOrOrdinal */
コード例 #2
0
bool ResWriteDialogBoxHeader( DialogBoxHeader *head, FILE *fp )
/*************************************************************/
{
    bool            error;

    error = ResWriteUint32( head->Style, fp );
    if( !error ) {
        error = ResWriteUint8( head->NumOfItems, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(head->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteNameOrOrdinal( head->MenuName, false, fp );
    }
    if( !error ) {
        error = ResWriteNameOrOrdinal( head->ClassName, false, fp );
    }
    if( !error ) {
        error = ResWriteString( head->Caption, false, fp );
    }
    /* if the font was set output the font name and point size */
    if( !error && (head->Style & DS_SETFONT) ) {
        error = ResWriteUint16( head->PointSize, fp );
        if( !error ) {
            error = ResWriteString( head->FontName, false, fp );
        }
    }
    return( error );
}
コード例 #3
0
ファイル: resmenu.c プロジェクト: ABratovic/open-watcom-v2
bool ResWriteMenuExItemNormal( const MenuItemNormal *curritem, const MenuExItemNormal *exdata,
                              bool use_unicode, WResFileID handle )
/*******************************************************************************************/
{
    bool        error;
    uint_16     tmp16;
    uint_32     tmp32;

    if( curritem->ItemFlags & MENUEX_POPUP ) {
        WRES_ERROR( WRS_BAD_PARAMETER );
        error = true;
    } else {
        error = ResWriteUint32( &(exdata->ItemType), handle );
        if( !error ) {
            error = ResWriteUint32( &(exdata->ItemState), handle );
        }
        if( !error ) {
            tmp32 = curritem->ItemID;
            error = ResWriteUint32( &tmp32, handle );
        }
        if( !error ) {
            tmp16 = curritem->ItemFlags;
            error = ResWriteUint16( &tmp16, handle );
        }
        if( !error ) {
            error = ResWriteString( curritem->ItemText, use_unicode, handle );
        }
        if( !error ) {
            error = ResPadDWord( handle );
        }
    }

    return( error );
}
コード例 #4
0
ファイル: sem2diag.c プロジェクト: Ukusbobra/open-watcom-v2
extern void SemOS2AddDlgincResource( WResID *name, char *filename )
/*****************************************************************/
{
    ResLocation loc;
    int         error, err_code;

    loc.start = SemStartResource();
    error = ResWriteString( filename, FALSE, CurrResFile.handle );
    if( error ) {
        err_code = LastWresErr();
        goto OutputWriteError;
    }
    loc.len = SemEndResource( loc.start );
    SemAddResourceFree( name, WResIDFromNum( OS2_RT_DLGINCLUDE ),
                        MEMFLAG_DISCARDABLE | MEMFLAG_MOVEABLE | MEMFLAG_PURE,
                        loc );
    RcMemFree( filename );
    return;

OutputWriteError:
    RcError( ERR_WRITTING_RES_FILE, CurrResFile.filename,
             strerror( err_code ) );
    ErrorHasOccured = TRUE;
    RcMemFree( filename );
    return;
}
コード例 #5
0
static bool ResWriteDialogHeaderCommon32( DialogBoxHeader32 *head, FILE *fp, bool add_quotes )
/********************************************************************************************/
{
    bool    error;
    size_t  len;
    char    *newname;

    if( add_quotes ) {
        if( head->MenuName != NULL && head->MenuName->name[0] != '\0' ) {
            len = strlen( head->MenuName->name );
            newname = WRESALLOC( len + 3 );
            newname[0] = '"';
            strcpy( newname + 1, head->MenuName->name );
            newname[len + 1] = '"';
            newname[len + 2] = '\0';
            head->MenuName = ResStrToNameOrOrd( newname );
            WRESFREE( newname );
        }
    }

    error = ResWriteNameOrOrdinal( head->MenuName, true, fp );
    if( !error ) {
        error = ResWriteNameOrOrdinal( head->ClassName, true, fp );
    }
    if( !error ) {
        error = ResWriteString( head->Caption, true, fp );
    }

    return( error );
}
コード例 #6
0
static bool ResWriteDialogControlCommon32( ControlClass *class_id, ResNameOrOrdinal *text,
                                                  uint_16 extra_bytes, FILE *fp )
/****************************************************************************************/
{
    bool      error;

    /* if the ClassID is one of the predefined ones write it out as a byte */
    /* otherwise it is a string */
    if( class_id->Class & 0x80 ) {
        /*the class number is prefixed by 0xFFFF to distinguish it
         * from a string */
        error = ResWriteUint16( (uint_16)-1, fp );
        if( !error ) {
            error = ResWriteUint16( class_id->Class, fp );
        }
    } else {
        error = ResWriteString( class_id->ClassName, true, fp );
    }
    if( !error ) {
        error = ResWriteNameOrOrdinal( text, true, fp );
    }

    if( !error ) {
        error = ResWriteUint16( extra_bytes, fp );
    }

    return( error );
}
コード例 #7
0
bool ResWriteDialogBoxControl( DialogBoxControl *control, FILE *fp )
/******************************************************************/
{
    bool            error;

    error = ResWriteDialogSizeInfo( &(control->SizeInfo), fp );
    if( !error ) {
        error = ResWriteUint16( control->ID, fp );
    }
    if( !error ) {
        error = ResWriteUint32( control->Style, fp );
    }

    /* if the ClassID is one of the predefined ones write it out as a byte */
    /* otherwise it is a string */
    if( !error ) {
        if( control->ClassID->Class & 0x80 ) {
            error = ResWriteUint8( control->ClassID->Class, fp );
        } else {
            error = ResWriteString( control->ClassID->ClassName, false, fp );
        }
    }

    if( !error ) {
        error = ResWriteNameOrOrdinal( control->Text, false, fp );
    }
    if( !error ) {
        error = ResWriteUint8( control->ExtraBytes, fp );
    }

    return( error );
}
コード例 #8
0
bool ResWriteDialogBoxHeader32( DialogBoxHeader32 *head, FILE *fp )
/*****************************************************************/
{
    bool            error;

    error = ResWriteUint32( head->Style, fp );
    if( !error ) {
        error = ResWriteUint32( head->ExtendedStyle, fp );
    }
    if( !error ) {
        error = ResWriteUint16( head->NumOfItems, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(head->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteDialogHeaderCommon32( head, fp, false );
    }
    /* if the font was set output the font name and point size */
    if( !error && (head->Style & DS_SETFONT) ) {
        error = ResWriteUint16( head->PointSize, fp );
        if( !error ) {
            error = ResWriteString( head->FontName, true, fp );
        }
    }

    if( !error ) {
        /* padding full record to dword boundary if necessary */
        error = ResWritePadDWord( fp );
    }
    return( error );
}
コード例 #9
0
bool ResWriteDialogBoxExHeader32( DialogBoxHeader32 *head, DialogBoxExHeader32short *exhead, FILE *fp )
/*****************************************************************************************************/
{
    bool            error;

    /* Write out the miscellaneous two WORDs 0x0001, 0xFFFF */

    error = ResWriteUint16( 0x0001, fp );
    if( !error ) {
        error = ResWriteUint16( 0xFFFF, fp );
    }
    if( !error ) {
        error = ResWriteUint32( exhead->HelpId, fp );
    }
    if( !error ) {
        error = ResWriteUint32( head->ExtendedStyle, fp );
    }
    if( !error ) {
        error = ResWriteUint32( head->Style, fp );
    }
    if( !error ) {
        error = ResWriteUint16( head->NumOfItems, fp );
    }
    if( !error ) {
        error = ResWriteDialogSizeInfo( &(head->SizeInfo), fp );
    }
    if( !error ) {
        error = ResWriteDialogHeaderCommon32( head, fp, true );
    }
    /* If the font was set, write the font information */
    if( !error && (head->Style & DS_SETFONT) ) {
        error = ResWriteUint16( head->PointSize, fp );
        if( !error ) {
            error = ResWriteUint16( exhead->FontWeight, fp );
        }
        if( !error ) {
            error = ResWriteUint8( exhead->FontItalic, fp );
        }
        if( !error ) {
            error = ResWriteUint8( exhead->FontCharset, fp );
        }
        if( !error ) {
            error = ResWriteString( head->FontName, true, fp );
        }
    }

    if( !error ) {
        /* padding full record to dword boundary if necessary */
        error = ResWritePadDWord( fp );
    }
    return( error );
}
コード例 #10
0
ファイル: write.c プロジェクト: Azarien/open-watcom-v2
bool ResWriteNameOrOrdinal( ResNameOrOrdinal *name, bool use_unicode, WResFileID handle )
/*****************************************************************************************/
{
    bool        error;

    if( name == NULL ) {
        error = ResWriteString( "", use_unicode, handle );
    } else {
        if( name->ord.fFlag == 0xff ) {
            if( use_unicode ) {
                error = ResWriteUint16( (uint_16)-1, handle );
            } else {
                error = ResWriteUint8( name->ord.fFlag, handle );
            }
            if( !error ) {
                error = ResWriteUint16( name->ord.wOrdinalID, handle );
            }
        } else {
            error = ResWriteString( name->name, use_unicode, handle );
        }
    }

    return( error );
} /* ResWriteNameOrOrdinal */
コード例 #11
0
ファイル: resmenu.c プロジェクト: ABratovic/open-watcom-v2
bool ResWriteMenuItemPopup( const MenuItemPopup *curritem, bool use_unicode, WResFileID handle )
/**********************************************************************************************/
{
    bool        error;
    uint_16     tmp16;

    if( curritem->ItemFlags & MENU_POPUP ) {
        tmp16 = curritem->ItemFlags;
        error = ResWriteUint16( &tmp16, handle );
        if( !error ) {
            error = ResWriteString( curritem->ItemText, use_unicode, handle );
        }
    } else {
        WRES_ERROR( WRS_BAD_PARAMETER );
        error = true;
    }

    return( error );
}
コード例 #12
0
int ResOS2WriteMenuItemNormal( const MenuItemOS2 *curritem, WResFileID handle )
/*****************************************************************************/
{
    int         error;
    uint_16     tmp16;

    tmp16 = curritem->ItemStyle;
    error = ResWriteUint16( &tmp16, handle );
    if( !error ) {
        tmp16 = curritem->ItemAttrs;
        error = ResWriteUint16( &tmp16, handle );
    }
    if( !error ) {
        tmp16 = curritem->ItemCmd;
        error = ResWriteUint16( &tmp16, handle );
    }
    if( !error ) {
        if( !(curritem->ItemStyle & OS2_MIS_SEPARATOR) && curritem->ItemText != NULL )
            error = ResWriteString( curritem->ItemText, FALSE, handle );
    }

    return( error );
}