Exemplo n.º 1
0
static void OkCallback(Widget w, void *userData, 
		       XmAnyCallbackStruct *callData)
{
  /* set appData to the toggle button variables */
  appData->show_name = XmToggleButtonGetState(nameToggle);
  appData->show_label = XmToggleButtonGetState(labelToggle);
  appData->show_tree = appData->show_label && 
    XmToggleButtonGetState(treeToggle);
  appData->show_dist = XmToggleButtonGetState(distToggle);
  appData->show_annotation = XmTextGetString(annText);
  MEM_ALLOC_NOTIFY(appData->show_annotation);
  if(!appData->show_annotation[0]) {
    free(appData->show_annotation);
    appData->show_annotation = NULL;
  }
  else 
    ListAddRear(appData->garbage, appData->show_annotation);

  /* similar to Resize() and CloseDB() */
  BusyOn("reconfiguring photos");
  XtpmIPHalt(appData->imp);
  XtpmITFree(appData->imt);
  XFreePixmap(appData->display, appData->no_image_pixmap);
  PixCacheFree();
  if(debug) XC_BLOCKS();
  ConfigurePhotos();
  PixCacheCreate();
  PixCacheSize(appData->cache_size);
  XtpmIPUpdate(appData->imp);
}
Exemplo n.º 2
0
void BrowseView::NewList(HappyLink *t, unsigned int mode)
{
	tasks->GiveUp();
	LockLooper();
	
	top = t;
	// on récupère le numéro du lien actuellement sélectionné
	int n = GetLinkNum();
	
	// on vide la vue actuelle
	Clear();
	
	// on la reconstruit	
	bottomSpace = 8;
	if (mode & BW_NEXTBUTTON)
		bottomSpace += 24;
	
	if (mode & BW_SEARCHTXTV)
	{
		bottomSpace += 24;
		if (mode & BW_CONTAINS)
			bottomSpace += 24;
	}
	
	if (mode & BW_INFOTEXT)
		bottomSpace += 14;

	BRect r=Bounds();
	r.top+=8;
	r.bottom-=bottomSpace;
	r.left+=8;
	r.right-=22;
		
	BRect lr(r);
	
	if (mode & BW_SECONDLIST)
	{
		lr.bottom = (r.top+r.bottom)/2-6;
		mainList = new LinkList2(lr,NULL,B_SINGLE_SELECTION_LIST,this,B_FOLLOW_ALL);

		BRect mr;
		mr.top = lr.bottom+4;
		mr.bottom = mr.top+4;
		mr.left = Bounds().left;
		mr.right = Bounds().right;
		horizontalMover = new Mover(mr,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,false);
		AddChild(horizontalMover);
	
		mainScroll = new BScrollView(NULL,mainList,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,0,false,true);
		AddChild(mainScroll);

		lr.top = lr.bottom+12;
		lr.bottom = r.bottom;
	}
	linksList = new LinkList(lr,NULL,this,B_SINGLE_SELECTION_LIST,B_FOLLOW_ALL);
	
	linksScroll = new BScrollView(NULL,linksList,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP_BOTTOM,0,false,true);
	AddChild(linksScroll);

	if (mode & BW_NEXTBUTTON)
	{
		r.top = r.bottom+4;
		r.bottom = r.top+16;
		
		nextButton = new BButton(r,NULL,T("Next"),new BMessage('NEXT'),B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT);
		AddChild(nextButton);
		
		r.bottom += 4;
	}
	
	if (mode & BW_SEARCHTXTV)
	{
		if (mode & BW_CONTAINS)
		{
			r.top = r.bottom+4;
			r.bottom = r.top+16;
		
			containsView = new BCheckBox(r,NULL,T("Containing:"),new BMessage('IDCN'),B_FOLLOW_LEFT_RIGHT|B_FOLLOW_BOTTOM);
			AddChild(containsView);
		
			r.bottom += 4;
		}

		r.top = r.bottom+4;
		r.bottom = r.top+16;
		
		searchTextView = new BTextControl(r,NULL,"","",new BMessage('IDXV'),B_FOLLOW_LEFT_RIGHT|B_FOLLOW_BOTTOM);
		searchTextView->SetDivider(-2);
		searchTextView->SetModificationMessage(new BMessage('IDXC'));
		AddChild(searchTextView);
		
		r.bottom += 4;
	}
	
	if (mode & BW_INFOTEXT)
	{
		r.top = r.bottom+2;
		r.bottom = r.top+12;
		
		infoText = new BStringView(r,NULL,"",B_FOLLOW_LEFT_RIGHT|B_FOLLOW_BOTTOM);
		AddChild(infoText);
	}
	
	containsSearch = false;
	
	BusyOn();

	if (mainList != NULL)
	{
		if (top != NULL)
		{
			RemoveChild(mainScroll);
			UpdateList(mainList,NULL,top->child);
			AddChild(mainScroll);
		}
	}
	else
	{
		if (top != NULL)
		{
			RemoveChild(linksScroll);
			UpdateList(linksList,NULL,top->child,false);
			AddChild(linksScroll);
		}
	}

	// si un lien était sélectionné avant le changement de liste, on tente de le retrouver
	if (n>=0)
		SetLinkNum(n,top);

	BusyOff();		
	UnlockLooper();
}