view m-toolbox/classes/@launchBay/buildMainfig.m @ 47:dd93c9ba6624 database-connection-manager

Fix Java dialog
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 19:07:27 +0100
parents f0afece42f48
children
line wrap: on
line source

% BUILDMAINFIG build the main launchBay window
%
% M Hewitson 30-11-08
%
% $Id: buildMainfig.m,v 1.5 2009/02/02 18:15:24 hewitson Exp $
%
function mainfig = buildMainfig(mainfig, varargin)
  %   %% Check if I exist already
  %   id = findobj('Tag', 'SIGBUILDERmainfig');
  %   if ~isempty(id)
  %     figure(id)
  %     return
  %   end
  
  %% Some initial setup
  
  Screen = get(0,'screensize');
  mainfig.Gproperties.Gcol     = [255 255 255]/255;
  mainfig.Gproperties.Screen   = Screen;
  mainfig.Gproperties.Gwidth   = 0.3;
  mainfig.Gproperties.Gheight  = 0.5;
  mainfig.Gproperties.Gborder  = 10;
  mainfig.Gproperties.fontsize = 12;
  
  l = (0.5-mainfig.Gproperties.Gwidth/2);
  b = (0.5-mainfig.Gproperties.Gheight/2);
  w = mainfig.Gproperties.Gwidth;
  h = mainfig.Gproperties.Gheight;
  mainfig.Gproperties.Gposition = [l b w h];
  
  if ~isempty(varargin) && ishandle(varargin{1})
    mainfig.handle = varargin{1};
    set(mainfig.handle, 'Tag', 'LAUNCHBAYmainfig');
    set(mainfig.handle, 'Units', 'normalized');
  else
    %  Initialize and hide the GUI as it is being constructed.
    mainfig.handle = figure('Name', 'LTPDA Launch Bay',...
      'NumberTitle', 'off',...
      'Visible','off',...
      'Units','normalized',...
      'Position',mainfig.Gproperties.Gposition,...
      'Toolbar', 'none',...
      'MenuBar', 'none',...
      'Color', mainfig.Gproperties.Gcol,...
      'Resize', 'off',...
      'Tag', 'LAUNCHBAYmainfig');
  end
  
  % Set mainfig callbacks
  set(mainfig.handle, 'CloseRequestFcn', {'launchBay.cb_mainfigClose', mainfig});
  
  % Add  Logo
  M = 0.0;
  ax   = axes('Position', [M M 1-2*M 1-2*M], 'Parent', mainfig.handle);
  logo = imread('LPFlogo.gif');
  image(logo, 'Parent', ax)
  set(ax,'Visible', 'on', 'Box', 'off', 'Xtick', [], 'Ytick', []);
  axis(ax, 'off');
  
  % create a grid of launch buttons
  launchers = {'modelViewer', 'modelViewer.png'; ...
               'sigBuilder', 'sigBuilder.png'; ...
               'repogui', 'repogui.png';
               'constructor', 'constructor.png'; 
               'specwinViewer', 'specwinViewer.png';
               'LTPDAprefs', 'ltpdaprefs.png';
               'pzmodel_helper', 'pzmodeldesigner.png';
               'ltpdv', 'ltpdv.png';
               'ltpdaquicklook', 'quicklook.png'};
  
  
  % Place buttons
  vmarg = 0.02;
  h = 0.2;
  w = 0.2;
  l = vmarg;
  b = 1-h-vmarg;
  for kk = 1:size(launchers,1)
    
    pbh = uicontrol(mainfig.handle,'Style','pushbutton',...
      'String','',...
      'Callback', launchers{kk,1}, ...
      'Units', 'normalized', ...
      'Fontsize', mainfig.Gproperties.fontsize, ...
      'Position',[l b w h]);
    
    img = imread(launchers{kk,2});
    set(pbh, 'cdata', img);
    
    l = l + w + vmarg;
    if l+w+vmarg > 1
      l = vmarg;
      b = b - vmarg - h;
    end
        
  end
  
  
  
end