コード例 #1
0
ファイル: wedit.c プロジェクト: Azarien/open-watcom-v2
void WDoHandleSelChange( WAccelEditInfo *einfo, bool change, bool reset )
{
    HWND        lbox;
    box_pos     pos;
    WAccelEntry *entry;
    bool        mod;

    if( einfo == NULL ) {
        return;
    }

    lbox = GetDlgItem( einfo->edit_dlg, IDM_ACCEDLIST );
    if( lbox == (HWND)NULL ) {
        return;
    }

    pos = (box_pos)SendMessage( lbox, LB_GETCURSEL, 0, 0 );
    if( pos != LB_ERR ) {
        entry = (WAccelEntry *)SendMessage( lbox, LB_GETITEMDATA, pos, 0 );
    } else {
        entry = NULL;
    }

    if( einfo->current_entry != NULL && !reset ) {
        mod = WGetEditWindowKeyEntry( einfo, einfo->current_entry, TRUE );
        if( mod && einfo->current_pos != -1 ) {
            if( change || WQueryChangeEntry( einfo ) ) {
                WGetEditWindowKeyEntry( einfo, einfo->current_entry, FALSE );
                einfo->info->modified = true;
                SendMessage( lbox, LB_DELETESTRING, einfo->current_pos, 0 );
                WAddEditWinLBoxEntry( einfo, einfo->current_entry, einfo->current_pos );
            }
        }
    }

    if( entry != NULL ) {
        if( change ) {
            uint_16 id;
            if( entry->is32bit ) {
                id = entry->u.entry32.Id;
            } else {
                id = (uint_16)entry->u.entry.Id;
            }
            WSetEditWindowID( einfo->edit_dlg, entry->symbol, id );
        } else {
            WSetEditWindowKeyEntry( einfo, entry );
        }
    }

    einfo->current_entry = entry;
    einfo->current_pos = (pos == LB_ERR) ? -1 : pos;
    if ( pos != LB_ERR ) {
        SendMessage ( lbox, LB_SETCURSEL, pos, 0 );
    }
}
コード例 #2
0
Bool WAddEditWinLBoxBlock( WStringEditInfo *einfo, WStringBlock *block, int pos )
{
    int         i;

    if( block != NULL ) {
        for( i = 0; i < STRTABLE_STRS_PER_BLOCK; i++ ) {
            if( block->block.String[i] != NULL ) {
                if( !WAddEditWinLBoxEntry( einfo, block,
                                           (block->blocknum & 0xfff0) + i, pos ) ) {
                    return( FALSE );
                }
                if( pos != -1 ) {
                    pos++;
                }
            }
        }
    }

    return( TRUE );
}
コード例 #3
0
ファイル: wedit.c プロジェクト: Azarien/open-watcom-v2
bool WInitEditWindowListBox( WAccelEditInfo *einfo )
{
    bool        ok;
    HWND        lbox;
    WAccelEntry *entry;

    ok = (einfo != NULL && einfo->edit_dlg != NULL && einfo->tbl != NULL);

    if( ok ) {
        lbox = GetDlgItem( einfo->edit_dlg, IDM_ACCEDLIST );
        SendMessage( lbox, WM_SETREDRAW, FALSE, 0 );
        SendMessage( lbox, LB_RESETCONTENT, 0, 0 );
        entry = einfo->tbl->first_entry;
        while( entry != NULL && ok ) {
            ok = WAddEditWinLBoxEntry( einfo, entry, -1 );
            entry = entry->next;
        }
        SendMessage( lbox, WM_SETREDRAW, TRUE, 0 );
    }

    return( ok );
}
コード例 #4
0
ファイル: wedit.c プロジェクト: Ukusbobra/open-watcom-v2
void WDoHandleSelChange( WMenuEditInfo *einfo, Bool change, Bool reset )
{
    HWND        lbox;
    LRESULT     index;
    WMenuEntry  *entry;
    Bool        reinit;
    Bool        mod;

    if( einfo == NULL ) {
        return;
    }

    reinit = FALSE;

    lbox = GetDlgItem( einfo->edit_dlg, IDM_MENUEDLIST );
    if( lbox == (HWND)NULL ) {
        return;
    }

    index = SendMessage( lbox, LB_GETCURSEL, 0, 0 );
    if( index != LB_ERR ) {
        entry = (WMenuEntry *)SendMessage( lbox, LB_GETITEMDATA, (WPARAM)index, 0 );
    } else {
        entry = NULL;
    }

    if( einfo->current_entry != NULL && !reset ) {
        mod = WGetEditWindowMenuEntry( einfo, einfo->current_entry, TRUE, NULL );
        if( mod && einfo->current_pos != -1 ) {
            if( change || WQueryChangeEntry( einfo ) ) {
                WGetEditWindowMenuEntry( einfo, einfo->current_entry, FALSE, &reinit );
                einfo->info->modified = TRUE;
                if( reinit ) {
                    WInitEditWindowListBox( einfo );
                } else {
                    SendMessage( lbox, LB_DELETESTRING, einfo->current_pos, 0 );
                    WAddEditWinLBoxEntry( lbox, einfo->current_entry, einfo->current_pos );
                    WModifyEntryInPreview( einfo, einfo->current_entry );
                }
            }
        }
    }

    WSetEditWindowControls( einfo, entry );
    if( entry != NULL ) {
        if( !change || reinit ) {
            WSetEditWindowMenuEntry( einfo, entry );
        } else {
            uint_16     id;
            Bool        pop_sep;
            MenuFlags   flags;
            if( entry->item->IsPopup ) {
                flags = entry->item->Item.Popup.ItemFlags;
            } else {
                flags = entry->item->Item.Normal.ItemFlags;
                id = entry->item->Item.Normal.ItemID;
            }
            pop_sep = (entry->item->IsPopup || (flags & MENU_SEPARATOR));
            WSetEditWindowID( einfo->edit_dlg, id, pop_sep, entry->symbol );
        }
    }

    einfo->current_entry = entry;
    einfo->current_pos = (index == LB_ERR ? -1 : index);
    if( index != LB_ERR ) {
        SendMessage( lbox, LB_SETCURSEL, (WPARAM)index, 0 );
    }
}
コード例 #5
0
Bool WInsertStringEntry( WStringEditInfo *einfo )
{
    HWND                lbox;
    Bool                ok;
    Bool                replace;
    WStringBlock        *block;
    uint_16             id;
    char                *text;
    char                *symbol;
    int                 pos;

    text = NULL;
    symbol = NULL;
    replace = FALSE;

    ok = (einfo != NULL && einfo->tbl != NULL && einfo->edit_dlg != NULL);

    if( ok ) {
        lbox = GetDlgItem ( einfo->edit_dlg, IDM_STREDLIST );
        ok = (lbox != NULL);
    }

    if( ok ) {
        ok = WGetEditWindowText( einfo->edit_dlg, &text );
    }

    if( ok ) {
        ok = WGetEditWindowID( einfo->edit_dlg, &symbol, &id,
                               einfo->info->symbol_table, einfo->combo_change );
    }

    if( ok ) {
        if( id == 0 ) {
            id = DEFAULT_STRING_ID;
        }
        block = WInsertStringData( einfo, id, text, symbol, &replace );
        ok = (block != NULL);
    }

    if( ok ) {
        pos = WFindStringPos( einfo->tbl, id );
        ok = (pos != -1);
    }

    if( ok ) {
        if( replace ) {
            SendMessage( lbox, LB_DELETESTRING, pos, 0 );
        }
        ok = WAddEditWinLBoxEntry( einfo, block, id, pos );
    }


    if( ok ) {
        WSetEditWindowID( einfo->edit_dlg, id, block->symbol[id & 0xf] );
        ok = (SendMessage( lbox, LB_SETCURSEL, pos, 0 ) != LB_ERR);
        if( ok ) {
            einfo->current_block = block;
            einfo->current_string = id;
            einfo->current_pos = pos;
#if 0
            einfo->current_block = NULL;
            einfo->current_string = 0;
            einfo->current_pos = -1;
            WHandleSelChange( einfo );
#endif
        }
    }

    if( ok ) {
        SetFocus( GetDlgItem( einfo->edit_dlg, IDM_STREDTEXT ) );
        SendDlgItemMessage( einfo->edit_dlg, IDM_STREDTEXT, EM_SETSEL,
                            GET_EM_SETSEL_MPS( 0, -1 ) );
    }

    if( symbol != NULL ) {
        WMemFree( symbol );
    }

    if( text != NULL ) {
        WMemFree( text );
    }

    return( ok );
}