Exemple #1
0
/*****************************************************************************
 * Function:	    void _DtHelpUpdatePathArea(char *locationId,
 *                                 DtHelpDialogWidget nw);  
 *
 *
 * Parameters:      locationId Specifies the ID string for the new topic we
 *                              are going to display in the HelpDialog widget.
 *
 *                  helpDialogWidget  Specifies the current help dialog widget.
 *
 * Return Value:    Void.
 *
 * Purpose: 	    Updates the Path Display area on top of the help
 *                  dialog.
 *
 *****************************************************************************/
void _DtHelpUpdatePathArea(
    char *locationId,
    DtHelpDialogWidget nw)
{
  DtHelpDialogWidget hw = (DtHelpDialogWidget) nw ;
  int retState=-1;


  if (locationId != NULL)
    {
      retState = _DtHelpUpdatePath (hw->help_dialog.browser.pTocArea,
					hw->help_dialog.display.volumeHandle,
					locationId);

      if (retState == -1) 
        {

          /* Some error occured while processing the new toc, 
           * error out or something ??? 
           */
        }
    }
  else if (locationId == NULL)
    { 
      /* We have most likely entered an error state and must set our path 
       * area to NULL values while we display and error message in the 
       * display area 
       */   
      _DtHelpDisplayAreaClean(hw->help_dialog.browser.pTocArea);
 
      /* We set our volumeFlag back to false so we are sure to create a new
       * toc next time we enter this function (i.e. recovering from our
       * error state.
       */
      hw->help_dialog.ghelp.volumeFlag  = FALSE; 
    }
}
Exemple #2
0
/*********************************************************************
 * Function: _DtHelpDisplayAreaDestroyCB
 *
 *    _DtHelpDisplayAreaDestroyCB deallocates all information
 *    associated with it.
 *
 *********************************************************************/
void
_DtHelpDisplayAreaDestroyCB (
    Widget w,
    XtPointer client_data,
    XtPointer call_data)
{
    int      i;
    long     strIdx;
    XrmName		  xrmList[_DtHelpFontQuarkNumber];
    Display		 *dpy;
    DtHelpDispAreaStruct *pDAS = (DtHelpDispAreaStruct *) client_data;
    Boolean  usedDef = False;

    /*
     * do the gross cleaning
     */
    _DtHelpDisplayAreaClean(client_data);

    if (NULL != pDAS->canvas)
	_DtCanvasDestroy (pDAS->canvas);

    dpy = XtDisplay(pDAS->dispWid);
    /*
     * Free the gc's
     */
    XFreeGC (dpy, pDAS->normalGC);
    XFreeGC (dpy, pDAS->pixmapGC);
    XFreeGC (dpy, pDAS->invertGC);
    if (pDAS->def_pix != 0 &&
	XmDestroyPixmap(XDefaultScreenOfDisplay(dpy), pDAS->def_pix) == False)
	    XFreePixmap(dpy, pDAS->def_pix);
    if (pDAS->context != NULL)
    {
        _DtGrDestroyContext(pDAS->context);
        XtFree((char *) pDAS->context);
    }

    /*
     * destroy the widgets.
     */
    XtDestroyWidget(pDAS->dispWid);

    if (pDAS->horzScrollWid != NULL)
        XtDestroyWidget(pDAS->horzScrollWid);
    if (pDAS->vertScrollWid != NULL)
        XtDestroyWidget(pDAS->vertScrollWid);

    /*
     * free the special characters
     */
    if (pDAS->spc_chars != NULL)
        free ((char *) pDAS->spc_chars);

    /*
     * free the font info.
     */
    _DtHelpGetStringQuarks(xrmList);
    if (__DtHelpFontIndexGet(pDAS, xrmList, &strIdx) != 0)
	usedDef = True;

    if (pDAS->font_info.def_font_db != NULL)
        XrmDestroyDatabase(pDAS->font_info.def_font_db);
    if (pDAS->font_info.font_idx_db != NULL)
        XrmDestroyDatabase(pDAS->font_info.font_idx_db);
    if (pDAS->font_info.exact_fonts != NULL)
      {
	_DtHelpCeFreeStringArray(pDAS->font_info.exact_fonts);
	free(pDAS->font_info.exact_idx);
      }
    if (pDAS->font_info.font_structs != NULL)
      {
	/*
	 * if the string index is a positive number, this
	 * indicates that the string font is a font not
	 * a font set and it wouldn't be freed in this
	 * routine.
	 */
	for (i = 0; i < pDAS->font_info.struct_cnt; i++)
	  {
	    if (usedDef == True || i != strIdx)
	        XFreeFont(dpy, pDAS->font_info.font_structs[i]);
	  }
        free(pDAS->font_info.font_structs);
      }
    if (pDAS->font_info.font_sets != NULL)
      {
	/*
	 * if the string index is a negative number, this turns
	 * it to positive and the tests will succeed.
	 *
	 * if the string index was a font not a fontset, then
	 * this will turn the value negative and the test
	 * will never succeed.
	 */
	strIdx = (-strIdx) - 1;
	for (i = 0; i < pDAS->font_info.set_cnt; i++)
	  {
	    if (usedDef == True || i != strIdx)
	        XFreeFontSet(dpy, pDAS->font_info.font_sets[i]);
	  }
        free(pDAS->font_info.font_sets);
        free(pDAS->font_info.fs_metrics);
      }

    /*
     * free the locale dependant information
     */
    if (NULL != pDAS->cant_begin_chars)
        free (pDAS->cant_begin_chars);
    if (NULL != pDAS->cant_end_chars)
        free (pDAS->cant_end_chars);

    /*
     * destroy the display area pointer
     */
    XtFree ((char *) pDAS);

}  /* End DtHelpDisplayAreaDestroy */