Beispiel #1
0
void WdeWriteSymInfo( WdeInfoStruct *is, bool same_as_last, char *s )
{
    bool    dirty;
    OBJPTR  obj;

    if( is->res_info->hash_table != NULL ) {
        dirty = WdeIsHashTableTouched( is->res_info->hash_table );
        if( dirty && (obj = GetMainObject()) != NULL ) {
            Forward( obj, RESOLVE_SYMBOL, NULL, NULL );
            Forward( obj, RESOLVE_HELPSYMBOL, NULL, NULL );   /* JPK */
        }
        if( !same_as_last || dirty ) {
            WdeAddSymbolsToComboBox( is->res_info->hash_table,
                                     WdeInfoWindow, IDB_INFO_IDSTR );
            WdeUntouchHashTable( is->res_info->hash_table );
        }
    } else {
        if( !same_as_last ) {
            SendDlgItemMessage( WdeInfoWindow, IDB_INFO_IDSTR, CB_RESETCONTENT, 0, 0 );
        }
    }

    if( s != NULL ) {
        WdeSetComboWithStr( s, WdeInfoWindow, IDB_INFO_IDSTR );
    }
}
Beispiel #2
0
Bool WdeDeleteAllObjects( void )
{
    OBJPTR      base;
    OBJPTR      child;

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

    child = NULL;
    base = GetMainObject();
    if( base == NULL ) {
        return( FALSE );
    }

    Forward( base, GET_FIRST_CHILD, &child, NULL );
    while( child != NULL ) {
        MakeObjectCurrent( child );
        Destroy( child, FALSE );
        Forward( base, GET_FIRST_CHILD, &child, NULL );
    }

    MakeObjectCurrent( base );

    return( TRUE );
}
Beispiel #3
0
bool RequestScrollRect( RECT *r )
/*******************************/
{
    OBJPTR      obj;

    obj = GetMainObject();
    return( OBJ_DISPATCHER( obj )( GET_SCROLL_RECT, obj, r, NULL ) );
}
Beispiel #4
0
bool FMEDITAPI FindObjectsPt( POINT pt, LIST **list )
/***************************************************/
{
    OBJPTR      obj;

    obj = GetMainObject();
    *list = NULL;
    return( OBJ_DISPATCHER( obj )( FIND_OBJECTS_PT, obj, &pt, list ) );
}
Beispiel #5
0
void AddCurrObject( OBJPTR obj )
/******************************/
{
    /* add obj to the list of current objects */
    bool        reset;
    OBJPTR      currobj;
    OBJPTR      main_currobj;

    reset = false;
    currobj = GetCurrObj();
    OBJ_DISPATCHER( currobj )( ADD_OBJECT, currobj, obj, &reset );

    /* if the main object is in the list, remove it */
    /* so the main object can't be part of a multiple selection */
    main_currobj = GetCurrObjptr( GetMainObject() );
    if( main_currobj != NULL ) {
        DeleteCurrObject( main_currobj );
    }
}
Beispiel #6
0
void FMEDITAPI ResetCurrObject( bool draw )
/*****************************************/
{
    /* reset the current object */
    OBJPTR      currobj;
    OBJPTR      nextobj;

    for( currobj = GetEditCurrObject(); currobj != NULL; currobj = nextobj ) {
        nextobj = GetNextEditCurrObject( currobj );
        if( draw ) {
            if( GetObjptr( currobj ) != GetMainObject() ) {
                ObjMark( currobj );
            }
        }
        DeleteCurrObject( currobj );
    }
    if( draw ) {
        UpdateWindow( GetAppWnd() );
    }
}
Beispiel #7
0
OBJPTR FMEDITAPI FindObject( SUBOBJ_REQUEST *req )
/************************************************/
{
    /*  Find an object at the specified point.  This is done by asking for the
     *  component item in the highest level object.
     */
    OBJPTR      obj;
    LIST        *subobj;

    obj = GetMainObject();
    for( ;; ) {
        subobj = NULL;
        if( !FindObjList( obj, req, &subobj ) ) {
            break;
        }
        /* There can only be  one object in the list (since rect is just a */
        /* point or panelid is unique) so get the object and free the list.*/
        obj = ListElement( subobj );
        ListFree( subobj );
    }
    return( obj );
}
Beispiel #8
0
bool WdeSaveResource( WdeResInfo *res_info, bool get_name )
{
    WdeGetFileStruct    gf;
    char                *filter;
    char                *fn;
    int                 fn_offset;
    bool                got_name;
    bool                ok;
    OBJPTR              main_obj;

    fn_offset = 0;
    got_name = FALSE;

    ok = (res_info != NULL && res_info->info != NULL);

    if( ok ) {
        if( res_info->info->save_name != NULL ) {
            fn = res_info->info->save_name;
        } else {
            res_info->info->save_type = res_info->info->file_type;
            fn = WdeStrDup( res_info->info->file_name );
            got_name = TRUE;
        }

        if( get_name || fn == NULL || *fn == '\0' ) {
            filter = WdeSelectSaveFilter( res_info->info->file_type );
            gf.file_name = fn;
            gf.title = WdeResSaveTitle;
            gf.filter = filter;
            fn = WdeGetSaveFileName( &gf );
            got_name = TRUE;
            res_info->info->save_type = WR_DONT_KNOW;
        }

        ok = (fn != NULL && *fn != '\0');
    }

    if( ok ) {
        if( got_name && res_info->info->save_name != NULL ) {
            WRMemFree( res_info->info->save_name );
        }
        res_info->info->save_name = fn;
        if( res_info->info->save_type == WR_DONT_KNOW ) {
            res_info->info->save_type = WdeSelectFileType( fn, res_info->is32bit );
        }
        ok = (res_info->info->save_type != WR_DONT_KNOW);
    }

    if( ok ) {
        if( WdeIsHashTableDirty( res_info->hash_table ) &&
                !WdeIsHashSaveRejectedSet( res_info->hash_table ) ) {
            if( res_info->sym_name == NULL ) {
                res_info->sym_name = WdeCreateSymName( fn );
            }
        }
    }

    if( ok ) {
        if( WdeIsHashTableDirty( res_info->hash_table ) ) {
            if( (main_obj = GetMainObject()) != NULL ) {
                Forward( main_obj, RESOLVE_HELPSYMBOL, &ok, NULL ); /* JPK */
                Forward( main_obj, RESOLVE_SYMBOL, &ok, NULL );
            }
        }
        WdeCreateDLGInclude( res_info, res_info->sym_name );
        ok = WdeSaveResourceToFile( res_info );
        if( !ok ) {
            WdeDisplayErrorMsg( WDE_SAVEFAILED );
        }
    }

    if( ok ) {
        if( WdeIsHashTableDirty( res_info->hash_table ) &&
                !WdeIsHashSaveRejectedSet( res_info->hash_table ) ) {
            WdeWriteSymbols( res_info->hash_table, &res_info->sym_name, get_name );
        }
    }

    if( ok ) {
        //fn_offset = WRFindFnOffset( fn );
        SendMessage( res_info->res_win, WM_SETTEXT, 0, (LPARAM)(LPVOID)&fn[fn_offset] );
    }

    return( ok );
}
Beispiel #9
0
static bool WdeMouseRtnResize( HWND win, RECT *r )
{
    POINT           pt;
    LIST            *l;
    OBJPTR          curr_obj;
    OBJ_ID          oid;
    OBJPTR          obj;
    OBJPTR          ro;
    RECT            rect;
    RECT            nc;
    WdeResizeRatio  resizer;
    bool            adjust;
    WdeResInfo      *info;
    DialogSizeInfo  dsize;
    SUBOBJ_REQUEST  req;

    rect = *r;
    adjust = FALSE;

    /* try to find the object id of resized object */
    curr_obj = GetCurrObject();
    if( curr_obj == NULL || !Forward( curr_obj, IDENTIFY, &oid, NULL ) ) {
        oid = 0;
    }

    if( oid == DIALOG_OBJ ) {
        if( !Forward( curr_obj, GET_NC_SIZE, &nc, NULL ) ) {
            return( FALSE );
        }
        rect.left += nc.left;
        rect.top += nc.top;
        rect.right -= nc.right;
        rect.bottom -= nc.bottom;
        if( rect.right < rect.left ) {
            rect.right = rect.left;
        }
        if( rect.bottom < rect.top ) {
            rect.bottom = rect.top;
        }
        if( !Forward( curr_obj, GET_RESIZER, &resizer, &ro ) ) {
            return( FALSE );
        }
    } else {
        l = NULL;
        req.p.ty = AT_POINT;
        req.p.pt.x = rect.left;
        req.p.pt.y = rect.top;
        Forward( GetMainObject(), FIND_SUBOBJECTS, &req, &l );
        obj = WdeIsDialogInList( l );
        if( l != NULL ) {
            ListFree( l );
        }
        if( obj != NULL ) {
            adjust = TRUE;
        } else {
            obj = GetMainObject();
        }
        if( !Forward( obj, GET_RESIZER, &resizer, &ro ) ) {
            return( FALSE );
        }
    }

    if( adjust ) {
        if( !Forward( ro, GET_WINDOW_HANDLE, &win, NULL ) ) {
            return( FALSE );
        }
        GetOffset( &pt );
        OffsetRect( &rect, -pt.x, -pt.y );
        if( (info = WdeGetCurrentRes()) != NULL ) {
            MapWindowPoints( info->edit_win, win, (POINT *)&rect, 2 );
        }
    }

    if( WdeScreenToDialog( NULL, &resizer, &rect, &dsize ) ) {
        WdeWriteObjectDimensions( (int_16)dsize.x, (int_16)dsize.y,
                                  (int_16)dsize.width, (int_16)dsize.height );
    }

    return( TRUE );
}
Beispiel #10
0
static bool WdeMouseRtnCreate( HWND win, RECT *r )
{
    RECT            *ncp;
    RECT            rect;
    LIST            *l;
    SUBOBJ_REQUEST  req;
    OBJPTR          obj;
    OBJPTR          ro;
    bool            adjust;
    POINT           pt;
    WdeResizeRatio  resizer;
    WdeResInfo      *info;
    DialogSizeInfo  dsize;

    rect = *r;

    /* if we are creating a dialog discard the NC area */
    if( GetBaseObjType() == DIALOG_OBJ ) {
        ncp = WdeGetDefaultDialogNCSize();
        rect.left += ncp->left;
        rect.top += ncp->top;
        rect.right -= ncp->right;
        rect.bottom -= ncp->bottom;
        if( rect.right < rect.left ) {
            rect.right = rect.left;
        }
        if( rect.bottom < rect.top ) {
            rect.bottom = rect.top;
        }
        adjust = FALSE;
        obj = GetMainObject();
    } else {
        l = NULL;
        req.p.ty = AT_POINT;
        req.p.pt.x = rect.left;
        req.p.pt.y = rect.top;
        Forward( GetMainObject(), FIND_SUBOBJECTS, &req, &l );

        obj = WdeIsDialogInList( l );

        if( l ) {
            ListFree( l );
        }

        if( obj ) {
            adjust = TRUE;
        } else {
            adjust = FALSE;
            obj = GetMainObject();
        }
    }

    if( !Forward( obj, GET_RESIZER, &resizer, &ro ) ) {
        return( FALSE );
    }

    if( adjust ) {
        if( !Forward( ro, GET_WINDOW_HANDLE, &win, NULL) ) {
            return( FALSE );
        }
        GetOffset( &pt );
        OffsetRect( &rect, -pt.x, -pt.y );
        if( (info = WdeGetCurrentRes()) != NULL ) {
            MapWindowPoints( info->edit_win, win, (POINT *)&rect, 2 );
        }
    }

    if( WdeScreenToDialog( NULL, &resizer, &rect, &dsize ) ) {
        WdeWriteObjectDimensions( (int_16)dsize.x, (int_16)dsize.y,
                                  (int_16)dsize.width, (int_16)dsize.height );
    }

    return( TRUE );
}