function update_titlebar(hFig)
%UPDATE_TITLEBAR Sets the figure name to the new file name; it also
%                enables/disables the 'Save' button and adds the dirty file
%                indicator to the file name as appropriate.
%
% Input:
%    hFig - handle to Filter design figure.

%   Author(s): P. Pacheco, R. Losada
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.3 $  $Date: 2000/06/13 21:23:53 $ 

ud = get(hFig,'userdata');
file = ud.filename.session;

figname = 'Filter Design & Analysis Tool - ';

% Find the handle to the 'save' item in the file menu
h_save = findobj(ud.h.menus.file,'tag','save');

if ud.flags.file_dirty,
   dirtyMarker = ' *';
   set(h_save,'enable','on');
else
   dirtyMarker = '';
   set(h_save,'enable','off');
end

maxStrLen = 50;
if length(file) > maxStrLen
   file = ['...' file(end-maxStrLen:end)];
end    

set(hFig, 'name', [ figname, ' [', file, dirtyMarker, ']' ]);

% [EOF] - update_titlebar.m
