% BUILDRETRIEVEPANEL build the retrieve panel
%
% M Hewitson 22-09-08
%
% $Id: buildRetrievePanel.m,v 1.4 2011/04/08 08:56:36 hewitson Exp $
%
function buildRetrievePanel(mainfig)

  import utils.const.*
  utils.helper.msg(msg.PROC1, 'building Retrieve Panel');
  htab = mainfig.panels(4);

  Gproperties = mainfig.Gproperties;
  pmarg = 0.025;
  CommonHeight = 0.06;
  fontsize = Gproperties.fontsize;

  % Retrieve list
  bl = pmarg;
  bh = CommonHeight;
  bb = 1 - pmarg - bh;
  bw = 0.2;
  Osth = uicontrol(htab,'Style','text',...
    'String','Retrieve object IDs',...
    'Units', 'normalized', ...
    'Fontsize', fontsize,...
    'BackgroundColor', Gproperties.Gcol{4},...
    'HorizontalAlignment', 'left',...
    'Position',[bl bb bw bh]);

  %-- ID entry
  bh = 0.5;
  bb = bb - bh - pmarg;
  sth = uicontrol(htab,'Style','edit',...
    'String','',...
    'Units', 'normalized', ...
    'Fontsize', fontsize,...
    'BackgroundColor', 'w',...
    'Max', 100,...
    'HorizontalAlignment', 'left',...
    'Position',[bl bb bw bh],...
    'Tag', 'retrieveIDsTxt');

  %-- Prefix entry
  bh = CommonHeight;
  bb = bb - bh - pmarg;
  bw = 0.1;
  sth = uicontrol(htab,'Style','text',...
    'String','Prefix',...
    'Units', 'normalized', ...
    'Fontsize', fontsize,...
    'BackgroundColor', Gproperties.Gcol{4},...
    'HorizontalAlignment', 'left',...
    'Position',[bl bb bw bh]);

  
  bl = bl + bw + pmarg;
  bw = 0.2;
  sth = uicontrol(htab,'Style','edit',...
    'String','obj',...
    'Fontsize', fontsize,...
    'Units', 'normalized', ...
    'BackgroundColor', 'w',...
    'HorizontalAlignment', 'left',...
    'Position',[bl bb bw bh],...
    'Tag', 'objPrefixTxt');

  %-- Append obj type
  bl = pmarg;
  bb = bb - bh - pmarg;
  bw = 0.2;
  cbh = uicontrol(htab,'Style','checkbox',...
    'String','Append object type',...
    'Fontsize', fontsize,...
    'Units', 'normalized', ...
    'BackgroundColor', Gproperties.Gcol{4},...
    'Value',1,'Position',[bl bb bw bh],...
    'Tag', 'appendObjTypeChk');
  %-- Retrieve binary obj
  bl = pmarg;
  bb = bb - bh - pmarg;
  bw = 0.2;
  cbh = uicontrol(htab,'Style','checkbox',...
    'String','Binary retrieval',...
    'Fontsize', fontsize,...
    'Units', 'normalized', ...
    'BackgroundColor', Gproperties.Gcol{4},...
    'Value',1,'Position',[bl bb bw bh],...
    'Tag', 'retrieveBinaryChk', 'TooltipString', 'retrieve the binary representation of the object. Typically much faster');

  %-- Import Btn

  bl = pmarg;
  bh = CommonHeight;
  bw = 0.2;
  bb = pmarg;
  pbh = uicontrol(htab,'Style','pushbutton','String','Import',...
    'Units', 'normalized', ...
    'Position',[bl bb bw bh ],...
    'Fontsize', fontsize,...
    'Fontweight', 'bold',...
    'Tag', 'importBtn');
  set(pbh, 'Callback', {'repogui2.cb_importBtn', pbh, mainfig});
  set(pbh, 'TooltipString', 'Retrieve objects to MATLAB workspace');

  %-- Save Btn

  bl = bl + pmarg + bw;
  pbh = uicontrol(htab,'Style','pushbutton','String','Save',...
    'Units', 'normalized', ...
    'Position',[bl bb bw bh ],...
    'Fontsize', fontsize,...
    'Fontweight', 'bold',...
    'Tag', 'saveBtn');
  set(pbh, 'Callback', {'repogui2.cb_saveBtn', pbh, mainfig});
  set(pbh, 'TooltipString', 'Retrieve objects to disk');


end
