Esempio n. 1
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 );
}
Esempio n. 2
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 );
}
Esempio n. 3
0
void WdeWriteInfo( WdeInfoStruct *is )
{
    static WdeHashTable *last_table = NULL;
    static WdeResInfo   *last_res = NULL;
    static OBJ_ID       last_obj = 0;
    char                *cap_text, *id;
    bool                same_hash;

    if( WdeInfoWindowDepth == 0 || WdeInfoWindow == NULL ) {
        return;
    }

    if( is == NULL || is->obj == NULL || is->res_info == NULL ) {
        WdeWriteTrail( "WdeWriteDialogInfo: NULL parameter!" );
        return;
    }

    /* make sure the resource window is not robbed of focus */
    if( GetFocus() != is->res_info->res_win ) {
        SetFocus( is->res_info->res_win );
    }

    WdeCurrentInfo = *is;

    same_hash = (last_res == is->res_info && last_table == is->res_info->hash_table);

    WdeWriteSymInfo( is, same_hash, NULL );

    last_table = is->res_info->hash_table;
    last_res = is->res_info;

    if( is->obj_id == BASE_OBJ ) {
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_SIZE );
        WdeEnableInfoWindowInput( FALSE );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_CAPTION );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDSTR );
        WdeSetEditWithStr( "", WdeInfoWindow, IDB_INFO_IDNUM );
    } else {
        WdeWriteObjectDimensions( (int_16)is->size.x, (int_16)is->size.y,
                                  (int_16)is->size.width, (int_16)is->size.height );
        WdeEnableInfoWindowInput( TRUE );
        if( is->obj_id == DIALOG_OBJ ) {
            WdeDisplayDialogInfo( is );
        } else if( is->obj_id == CONTROL_OBJ ) {
            WdeDisplayControlInfo( is );
        }
    }

    if( last_obj != is->obj_id ) {
        if( is->obj_id == DIALOG_OBJ ) {
            cap_text = WdeCaptionText;
            id = WdeDlgNameText;
        } else if( is->obj_id == CONTROL_OBJ ) {
            cap_text = WdeTextText;
            id = WdeIDText;
        } else if( is->obj_id == BASE_OBJ ) {
            cap_text = "";
            id       = "";
        }
        WdeSetEditWithStr( cap_text, WdeInfoWindow, IDB_INFO_CAPTEXT );
        WdeSetEditWithStr( id, WdeInfoWindow, IDB_INFO_NAMETEXT );
        last_obj = is->obj_id;
    }
}