mirror of
https://github.com/TTimo/GtkRadiant.git
synced 2025-01-10 12:01:10 +00:00
Adjusting Focus 2d View for multiselect
This commit is contained in:
parent
e23b567c7f
commit
8ea1da552a
1 changed files with 45 additions and 29 deletions
|
@ -1174,36 +1174,23 @@ static void entitylist_multiselect( GtkWidget *widget, gpointer data ) {
|
|||
Sys_UpdateWindows( W_ALL );
|
||||
}
|
||||
|
||||
static void entitylist_focus( GtkWidget *widget, gpointer data ){
|
||||
GtkTreeView* view = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( data ), "entities" ) );
|
||||
|
||||
GtkTreeSelection* selection = gtk_tree_view_get_selection( view );
|
||||
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter selected;
|
||||
if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
|
||||
entity_t* pEntity;
|
||||
gtk_tree_model_get( model, &selected, 1, &pEntity, -1 );
|
||||
|
||||
static void entity_focus_2d( entity_t *pEntity ) {
|
||||
if ( pEntity ) {
|
||||
for ( epair_t* pEpair = pEntity->epairs; pEpair; pEpair = pEpair->next )
|
||||
{
|
||||
brush_t *b;
|
||||
|
||||
b = pEntity->brushes.onext;
|
||||
if( b )
|
||||
{
|
||||
if ( b ) {
|
||||
int i;
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
if ( g_pParentWnd->GetXYWnd() ) {
|
||||
g_pParentWnd->GetXYWnd()->GetOrigin()[i] = ( b->mins[i] + b->maxs[i] ) / 2;
|
||||
}
|
||||
|
||||
if ( g_pParentWnd->GetXZWnd() ) {
|
||||
g_pParentWnd->GetXZWnd()->GetOrigin()[i] = ( b->mins[i] + b->maxs[i] ) / 2;
|
||||
}
|
||||
|
||||
if ( g_pParentWnd->GetYZWnd() ) {
|
||||
g_pParentWnd->GetYZWnd()->GetOrigin()[i] = ( b->mins[i] + b->maxs[i] ) / 2;
|
||||
}
|
||||
|
@ -1212,12 +1199,41 @@ static void entitylist_focus( GtkWidget *widget, gpointer data ){
|
|||
Sys_UpdateWindows( W_ALL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void entitylist_focus( GtkWidget *widget, gpointer data ){
|
||||
GtkTreeView* view = GTK_TREE_VIEW( g_object_get_data( G_OBJECT( data ), "entities" ) );
|
||||
|
||||
GtkTreeSelection* selection = gtk_tree_view_get_selection( view );
|
||||
|
||||
GtkTreeModel* model;
|
||||
GtkTreeIter selected;
|
||||
entity_t* pEntity;
|
||||
|
||||
if ( gtk_tree_selection_get_mode( selection ) == GTK_SELECTION_MULTIPLE ) {
|
||||
GList *rows, *first;
|
||||
rows = gtk_tree_selection_get_selected_rows( selection, &model );
|
||||
//only the keys/values of the last selected node with entity
|
||||
first = g_list_first( rows );
|
||||
if ( first ) {
|
||||
if ( gtk_tree_model_get_iter( model, &selected, (GtkTreePath *)first->data ) == TRUE ) {
|
||||
gtk_tree_model_get( model, &selected, 1, &pEntity, -1 );
|
||||
entity_focus_2d( pEntity );
|
||||
}
|
||||
}
|
||||
g_list_free_full( rows, (GDestroyNotify)gtk_tree_path_free );
|
||||
|
||||
} else if ( gtk_tree_selection_get_selected( selection, &model, &selected ) ) {
|
||||
|
||||
gtk_tree_model_get( model, &selected, 1, &pEntity, -1 );
|
||||
|
||||
entity_focus_2d( pEntity );
|
||||
}
|
||||
}
|
||||
|
||||
static gint entitylist_click( GtkWidget *widget, GdkEventButton *event, gpointer data ){
|
||||
if ( event->type == GDK_2BUTTON_PRESS ) {
|
||||
entitylist_select( NULL, data );
|
||||
entitylist_multiselect( NULL, data );
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue