view m-toolbox/classes/@repogui/buildMainFig.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
line wrap: on
line source

% BUILDMAINFIG build the main repo gui figure
%
% M Hewitson 22-09-08
%
% $Id: buildMainFig.m,v 1.4 2009/05/15 14:59:12 nicola Exp $
%
function mainfig = buildMainFig(mainfig, varargin)
  
  warning off MATLAB:uitab:DeprecatedFunction
  warning off MATLAB:uitabgroup:DeprecatedFunction

  % Some initial setup
  import utils.const.*
  prefs = getappdata(0, 'LTPDApreferences');
  utils.helper.msg(msg.PROC1, 'building Main Figure');

  Screen = get(0,'screensize');  
  wsize = prefs.repository.winsize;
  mainfig.Gproperties.Screen   = Screen;
  mainfig.Gproperties.Gwidth   = wsize(1);
  mainfig.Gproperties.Gheight  = wsize(2);
  mainfig.Gproperties.Gborder  = 10;
  mainfig.Gproperties.fontsize = prefs.repository.fontsize;
  
  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];
  
%   mainfig.Gproperties.Gcol{1} = [150 180 200]/255;
%   mainfig.Gproperties.Gcol{2} = [200 200 180]/255;
%   mainfig.Gproperties.Gcol{3} = [180 150 200]/255;
%   mainfig.Gproperties.Gcol{4} = [150 200 180]/255;

  mainfig.Gproperties.Gcol{1} = [1 1 1];
  mainfig.Gproperties.Gcol{2} = [1 1 1];
  mainfig.Gproperties.Gcol{3} = [1 1 1];
  mainfig.Gproperties.Gcol{4} = [1 1 1];
  mainfig.Gproperties.Gcol{5} = [1 1 1];

  if ~isempty(varargin) && ishandle(varargin{1})
    mainfig.handle = varargin{1};
    set(mainfig.handle, 'Tag', 'REPOGUImainfig');
    set(mainfig.handle, 'Units', 'normalized');
  else
    %  Initialize and hide the GUI as it is being constructed.
    mainfig.handle = figure('Name', 'LTPDA Repository GUI',...
      'NumberTitle', 'off',...
      'Visible','off',...
      'Units','normalized',...
      'Position',mainfig.Gproperties.Gposition,...
      'Toolbar', 'none',...
      'MenuBar', 'none',...
      'Color', 'w',...
      'Resize', 'on',...
      'Tag', 'REPOGUImainfig');
  end
  

  % Set mainfig callbacks
  set(mainfig.handle, 'CloseRequestFcn', {'repogui.cb_mainfigClose', mainfig});


  % Setup GUI elements

  %----------- Status bar

  Hmargin = 0.0;
  Vmargin = 0.0;

  %-- Status bar
  Sleft   = .01;
  Sbottom = .01;
  Swidth  = 1-0.02;
  Sheight = 0.10-0.02;
  uicontrol(mainfig.handle,'Style','text',...
    'String','not connected',...
    'TooltipString','Current status',...
    'Units','normalized',...
    'Fontsize', mainfig.Gproperties.fontsize+1,...
    'BackgroundColor', [.9 .9 .9],...
    'ForegroundColor', 'r', ...
    'HorizontalAlignment', 'center',...
    'Max', 100,...
    'Position',[Sleft Sbottom Swidth Sheight],...
    'Tag', 'RepoguiStatusTxt');

  %------------------------------------------------------------------------
  %------------------------------------------------------------------------
  %----------- TAB PANEL
  %------------------------------------------------------------------------
  %------------------------------------------------------------------------
  PanLeft = Hmargin;
  Tleft   = PanLeft + Hmargin;
  Theight = 1-2*Vmargin -0.1 - 0.01;
  Tbottom = 0.1;
  Twidth  = 1;

  htab = uitabgroup('v0', 'Parent', mainfig.handle, ...
    'Units','normalized',...
    'Position',[Tleft Tbottom Twidth Theight],...
    'BackgroundColor', mainfig.Gproperties.Gcol{1}, ...
    'SelectionChangeFcn', {'repogui.cb_tabChanged', mainfig});
  t1 = uitab('v0', htab, 'title', ' Connect ');
  t2 = uitab('v0', htab, 'title', ' Submit ');
  t3 = uitab('v0', htab, 'title', ' Query ');
  t3b= uitab('v0', htab, 'title', ' High Level Queries ');
  t4 = uitab('v0', htab, 'title', ' Retrieve ');


  % Set app data
  mainfig.panels = [t1 t2 t3 t4 t3b];
end