prevent selections in multiple views of the same dir. I do it like this to

keep selection info out of the view_model because it really doesnt belong
there, I think.


SVN revision: 5992
This commit is contained in:
Till Adam 2002-02-27 10:39:08 +00:00
parent 963526152c
commit 12fe3a8611
3 changed files with 32 additions and 2 deletions

View File

@ -829,7 +829,21 @@ e_icon_invert_selection(E_Icon *ic)
void
e_icon_select(E_Icon *ic)
{
Evas_List l;
D_ENTER;
if (ic->view->select.lock)
D_RETURN;
if (ic->view->select.count == 0)
{
/* lock all other views of our dir */
for (l= ic->view->model->views;l;l=l->next)
{
E_View *v = (E_View *) l->data;
v->select.lock = 1;
}
/* unlock ourselves */
ic->view->select.lock = 0;
}
if (!ic->state.selected)
{
@ -844,7 +858,10 @@ e_icon_select(E_Icon *ic)
void
e_icon_deselect(E_Icon *ic)
{
Evas_List l;
D_ENTER;
if (ic->view->select.lock)
D_RETURN;
if (ic->state.selected)
{
@ -852,7 +869,16 @@ e_icon_deselect(E_Icon *ic)
ic->view->select.count--;
e_icon_update_state(ic);
}
if (ic->view->select.count == 0)
{
/* we have just unselected the last icon. Unlock all
* other views of our model. */
for (l= ic->view->model->views;l;l=l->next)
{
E_View *v = (E_View *) l->data;
v->select.lock = 0;
}
}
D_RETURN;
}

View File

@ -1652,6 +1652,7 @@ e_view_new(void)
v->options.back_pixmap = 0;
#endif
#endif
v->select.lock = 0;
v->select.config.grad_size.l = 8;
v->select.config.grad_size.r = 8;
v->select.config.grad_size.t = 8;

View File

@ -49,7 +49,7 @@ struct _E_View
char * name;
E_View_Model *model;
struct {
Evas_Render_Method render_method;
int back_pixmap;
@ -94,6 +94,9 @@ struct _E_View
} spacing;
struct {
int on;
/* we set this in all other views of our view_model
* when the first icon in a view is selected. */
int lock;
/* The number of selected icons. */
int count;
/* The number of icons we selected the last time.