void KLFLibEntryEditor::displayEntries(const QList<KLFLibEntry>& entrylist)
{
  // refresh the display label's glow effect
  /** \bug .... find a better way to synchronize config values like this. ....... */
  u->lblPreview->setGlowEffect(klfconfig.UI.glowEffect);
  u->lblPreview->setGlowEffectColor(klfconfig.UI.glowEffectColor);
  u->lblPreview->setGlowEffectRadius(klfconfig.UI.glowEffectRadius);

  u->cbxCategory->lineEdit()->setReadOnly(!pInputEnabled);
  u->cbxTags->lineEdit()->setReadOnly(!pInputEnabled);
  if (entrylist.size() == 0) {
    u->lblPreview->display(QImage(":/pics/nopreview.png"), QImage(), false);
    u->txtPreviewLatex->setText(tr("[ No Item Selected ]"));
    u->cbxCategory->setEditText(tr("[ No Item Selected ]"));
    u->cbxTags->setEditText(tr("[ No Item Selected ]"));
    //    u->lblStylePreview->setText(tr("[ No Item Selected ]"));
    u->cbxCategory->setEnabled(false);
    u->cbxTags->setEnabled(false);
    u->btnApplyChanges->setEnabled(false);
    u->btnRestoreStyle->setEnabled(false);
    pCurrentStyle = KLFStyle();
    displayStyle(false, KLFStyle());
    u->lblStyMathMode->setText(tr("[ No Item Selected ]"));
    u->txtStyPreamble->setPlainText(tr("[ No Item Selected ]"));
    slotModified(false);
    return;
  }
  if (entrylist.size() == 1) {
    KLFLibEntry e = entrylist[0];
    QImage img = e.preview();
    u->lblPreview->display(img, img, true);
    u->txtPreviewLatex->setText(e.latex());
    u->cbxCategory->setEditText(e.category());
    u->cbxTags->setEditText(e.tags());
    pCurrentStyle = e.style();
    //    u->lblStylePreview->setText(prettyPrintStyle(pCurrentStyle));
    u->cbxCategory->setEnabled(true);
    u->cbxTags->setEnabled(true);
    u->btnApplyChanges->setEnabled(pInputEnabled && true);
    u->btnRestoreStyle->setEnabled(true); // NOT pInputEnabled && : not true input
    displayStyle(true, pCurrentStyle);
    slotModified(false);
    return;
  }
  // multiple items selected
  u->lblPreview->display(QImage(":/pics/nopreview.png"), QImage(), false);
  u->txtPreviewLatex->setText(tr("[ %n Items Selected ]", 0, entrylist.size()));
  u->cbxTags->setEditText(tr("[ Multiple Items Selected ]"));
  // if all elements have same category and style, display them, otherwise set
  // the respective field empty
  QString cat;
  bool allsamestyle = true;
  KLFStyle style;
  int k;
  for (k = 0; k < entrylist.size(); ++k) {
    QString thiscat = entrylist[k].category();
    KLFStyle thisstyle = entrylist[k].style();
    if (k == 0) {
      cat = thiscat;
      style = thisstyle;
      allsamestyle = true;
      continue;
    }
    if ( !cat.isEmpty() && thiscat != cat ) {
      cat = "";
    }
    if ( allsamestyle && !(style == thisstyle) ) {
      allsamestyle = false;
    }
  }
  u->cbxCategory->setEditText(cat);
  if ( allsamestyle ) {
    pCurrentStyle = style;
    displayStyle(true, pCurrentStyle);
    u->btnRestoreStyle->setEnabled(true); // NOT pInputEnabled && : not true input
  } else {
    pCurrentStyle = KLFStyle();
    displayStyle(false, KLFStyle());
    u->lblStyMathMode->setText(tr("[ Different Styles ]"));
    u->txtStyPreamble->setPlainText(tr("[ Different Styles ]"));
    u->btnRestoreStyle->setEnabled(false);
  }

  u->cbxCategory->setEnabled(pInputEnabled && true);
  u->cbxTags->setEnabled(pInputEnabled && false);
  u->btnApplyChanges->setEnabled(pInputEnabled && true);
  slotModified(false);
}
//-----------------------------------------------------------------------------
// Purpose:
// Input  :	i_m3dView	The Maya 3D view the node will be drawn in
//			i_mDagPath		The Maya dagPath to the node that will be drawn
//			i_displayStyle	The style in which to draw the object, can be
//							completely ignored but one of the following
//							will be passed:
//
//							M3dView::kBoundingBox	Just draw a bounding box
//							M3dView::kFlatShaded	Draw object flat shaded
//							M3dView::kGouraudShaded	Draw object smooth shaded
//							M3dView::kWireFrame		Draw object wireframe
//							M3dView::kPoints		Draw object as points only
//			i_displayStatus	The status of the object being drawn, status mainly
//							refers to the selection status of the object
//							and for some things Maya uses different colors
//							to reflect that status
//							See M3dView::DisplayStatus for more info
//-----------------------------------------------------------------------------
void CVstExampleLocator::draw(
	M3dView &i_m3dView,
	const MDagPath & /* i_mDagPath */,
	M3dView::DisplayStyle i_displayStyle,
	M3dView::DisplayStatus /* i_displayStatus */ )
{
	// Necessary step before doing any OpenGL calls
	// NOTE: This call does not push or save any OpenGL state info
	//       doing so is up to the implementor of draw()

	i_m3dView.beginGL();

	// Drawing happens here

	// Save the parts of the OpenGL state that will be changed

	glPushAttrib( GL_POLYGON_BIT );

	// Set up drawing state as requested by Maya or the user

	M3dView::DisplayStyle displayStyle( i_displayStyle );

	// Get the MObject for this node
	const MObject thisObj( thisMObject() );
	
	// Create an MPlug for the s_iaDisplayStyle attribute
	const MPlug iaDisplayStyleP( thisObj, s_iaDisplayStyle );

	// Get the value of that attribute
	short iaDisplayStyleV( 0 );
	iaDisplayStyleP.getValue( iaDisplayStyleV );

	switch ( iaDisplayStyleV )
	{
	case 0:		// Use Maya
	default:
		break;
	case 1:		// Force shaded
		displayStyle = M3dView::kFlatShaded;
		break;
	case 2:		// Force wireframe
		displayStyle = M3dView::kWireFrame;
		break;
	case 3:		// Force points
		displayStyle = M3dView::kFlatShaded;
		break;
	}

	switch ( displayStyle )
	{
	case M3dView::kFlatShaded:
	case M3dView::kGouraudShaded:
		// In this case, flat and smooth shaded are the same thing
		glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		break;
	case M3dView::kPoints:
		glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
		break;
	case M3dView::kBoundingBox:
	case M3dView::kWireFrame:
	default:
		// In this case, wireframe and bounding box are the same thing
		// and we'll default to wireframe
		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		break;
	}

	// Set up the drawing color as requested

	// For now, do nothing... let Maya set the color

	DrawCube();

	// Restore the OpenGL state to what it was before we mucked with it
	// Not necessary to restore current draw position, etc...

	glPopAttrib();

	// Necessary step after all OpenGL drawing has finished

	i_m3dView.endGL();
}