⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fm_laprint.m

📁 这是一个很适合研究和学习用的电力系统仿真软件
💻 M
📖 第 1 页 / 共 5 页
字号:
  set(h,'Style','pushbutton')
  set(h,'BackgroundColor',Theme.color01)
  set(h,'Units','Points')
  set(h,'Position',[23*fsize curh 5*fsize loch])
  set(h,'HorizontalAlignment','center')
  set(h,'String','Quit')
  set(h,'Callback','fm_laprint({''quit''});')

  h=uicontrol;
  set(h,'Parent',hf)
  set(h,'Style','pushbutton')
  set(h,'BackgroundColor',Theme.color01)
  set(h,'Units','Points')
  set(h,'Position',[13*fsize curh 5*fsize loch])
  set(h,'HorizontalAlignment','center')
  set(h,'String','Help')
  set(h,'Callback','fm_laprint({''help''});')

  h=uicontrol;
  set(h,'Parent',hf)
  set(h,'BackgroundColor',Theme.color03)
  set(h,'FontWeight','bold')
  set(h,'ForegroundColor',Theme.color09)
  set(h,'Style','pushbutton')
  set(h,'Units','Points')
  set(h,'Position',[3*fsize curh 5*fsize loch])
  set(h,'HorizontalAlignment','center')
  set(h,'String','Export')
  set(h,'Callback','fm_laprint({''save''});')

  %---------------------------------
  % options uimenue
  %---------------------------------

  % Menu File
  h1 = uimenu('Parent',hf, ...
              'Label','File', ...
              'Tag','MenuFile');
  h2 = uimenu('Parent',h1, ...
              'Label', 'Export figure', ...
              'Callback','fm_laprint({''save''});', ... 
              'Accelerator','s', ...
              'Tag','file_save');
  h2 = uimenu('Parent',h1, ...
              'Label', 'Quit LaPrint', ...
              'Callback','fm_laprint({''quit''});', ... 
              'Accelerator','x', ...
              'Separator','on', ...
              'Tag','file_quit');

  hm=uimenu('label','Options');

  LAPRINTHAN.asonscreen=uimenu(hm,...
                               'label','as on screen',...
                               'callback','fm_laprint({''asonscreen''})',...
                               'checked','off');

  LAPRINTHAN.keepticklabels=uimenu(hm,...
                                   'label','keep tick labels',...
                                   'callback','fm_laprint({''keepticklabels''})',...
                                   'checked','off');

  LAPRINTHAN.mathticklabels=uimenu(hm,...
                                   'label','math tick labels',...
                                   'callback','fm_laprint({''mathticklabels''})',...
                                   'checked','off');

  LAPRINTHAN.keepfontprops=uimenu(hm,...
                                  'label','keep font props',...
                                  'callback','fm_laprint({''keepfontprops''})',...
                                  'checked','off');

  LAPRINTHAN.extrapicture=uimenu(hm,...
                                 'label','extra picture',...
                                 'callback','fm_laprint({''extrapicture''})',...
                                 'checked','on');

  LAPRINTHAN.loose=uimenu(hm,...
                          'label','print loose',...
                          'callback','fm_laprint({''loose''})',...
                          'checked','off');

  LAPRINTHAN.nofigcopy=uimenu(hm,...
                              'label','figure copy',...
                              'callback','fm_laprint({''nofigcopy''})',...
                              'checked','on');

  LAPRINTHAN.nohead=uimenu(hm,...
                           'label','file head',...
                           'callback','fm_laprint({''nohead''})',...
                           'checked','on');

  LAPRINTHAN.noscalefonts=uimenu(hm,...
                                 'label','scale fonts',...
                                 'callback','fm_laprint({''noscalefonts''})',...
                                 'checked','on');

  LAPRINTHAN.caption=uimenu(hm,...
                            'label','caption',...
                            'callback','fm_laprint({''caption''})',...
                            'checked','off');

  LAPRINTHAN.viewfile=uimenu(hm,...
                             'label','viewfile',...
                             'callback','fm_laprint({''viewfile''})',...
                             'checked','off');

  uimenu(hm,...
         'label','Defaults',...
         'callback','laprint({''defaults''})',...
         'separator','on');

  % Menu Help
  h1 = uimenu('Parent',hf, ...
              'Label','Help', ...
              'Tag','MenuFile');
  h2 = uimenu('Parent',h1, ...
              'Label', 'LaPrint help', ...
              'Callback','fm_laprint({''help''});', ... 
              'Accelerator','h', ...
              'Tag','file_help');
  h2 = uimenu('Parent',h1, ...
              'label','About',...
              'callback','fm_laprint({''whois''})');

  %---------------------------------
  % make hf invisible
  %---------------------------------
  set(hf,'HandleVisibility','callback') 

  return
end  % if nargin==0

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%
%%%% callback calls
%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if isa(figno,'cell')
  switch lower(figno{1})
    %%% figno %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
   case 'figno'
    global LAPRINTOPT
    global LAPRINTHAN
    LAPRINTOPT.figno=eval(get(LAPRINTHAN.figno,'string'));
    figure(LAPRINTOPT.figno)
    figure(Fig.laprint)
    txt=[ 'Pushing ''Export'' will save the contents of Figure No. '...
	  int2str(LAPRINTOPT.figno) '.' ];
    showtext({txt});
    %%% filename %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
   case 'filename'
    global LAPRINTOPT
    global LAPRINTHAN
    LAPRINTOPT.filename=get(LAPRINTHAN.filename,'string');
    LAPRINTOPT.viewfilename=[ LAPRINTOPT.filename '_'];
    [texfullnameext,texbasenameext,texbasename,texdirname] = ...
	getfilenames(LAPRINTOPT.filename,'tex',0);
    [epsfullnameext,epsbasenameext,epsbasename,epsdirname] = ...
	getfilenames(LAPRINTOPT.filename,'eps',0);
    txt0=[ 'Pushing ''save'' will create the following files:' ];
    txt1=[ texfullnameext '  (LaTeX file)' ];
    txt2=[ epsfullnameext '  (Postscript file)'];
    if exist(texfullnameext,'file')
      txt5=[ 'Warning: LaTeX file exists an will be overwritten.'];
    else 
      txt5='';
    end  
    if exist(epsfullnameext,'file')
      txt6=[ 'Warning: Postscript file exists an will be overwritten.'];
    else 
      txt6='';
    end
    if LAPRINTOPT.viewfile
      [viewfullnameext,viewbasenameext,viewbasename,viewdirname] = ...
 	  getfilenames(LAPRINTOPT.viewfilename,'tex',0);
      txt3=[ viewfullnameext '  (View file)'];
      if exist(viewfullnameext,'file')
        txt7=[ 'Warning: View file exists an will be overwritten.'];
      else 
        txt7='';
      end
    else
      txt3='';
      txt7='';
    end 
    showtext({txt0,txt1,txt2,txt3,txt5,txt6,txt7});
    %%% width %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
   case 'width'
    global LAPRINTOPT
    global LAPRINTHAN
    LAPRINTOPT.width=eval(get(LAPRINTHAN.width,'string'));
    txt1=[ 'The width of the figure in the LaTeX document is set to '...
	   int2str(LAPRINTOPT.width) ' cm. Its height is determined '...
	   'by the aspect ratio of the figure on screen '...
	   '(i.e. the figure ''position'' property).']; 
    showtext({txt1});
    showsizes;
    %%% factor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
   case 'factor'
    global LAPRINTOPT
    global LAPRINTHAN
    LAPRINTOPT.factor=eval(get(LAPRINTHAN.factor,'string'));
    txt1=[ 'The factor to scale the fonts and the eps figure is set to '...
	   num2str(LAPRINTOPT.factor) '.'];
    if LAPRINTOPT.factor < 1
      txt2=[ 'Thus the (bounding box of the) eps figure is ' ...
	     'larger than the figure in the LaTeX document ' ...
	     'and the text fonts of the figure are ' ...
	     'by the factor ' num2str(LAPRINTOPT.factor) ' smaller ' ...
	     'than the fonts of the surrounding text.'];
    elseif LAPRINTOPT.factor > 1
      txt2=[ 'Thus the (bounding box of the) eps figure ' ...
	     'is smaller than the figure in the LaTeX document. ' ...
	     'Especially, the text fonts of the figure are ' ...
	     'by the factor ' num2str(LAPRINTOPT.factor) ' larger ' ...
	     'than the fonts of the surrounding text.'];
    else 
      txt2=[ 'Thus the eps figure is displayed 1:1.'...
	     'Especially, the text fonts of the figure are of ' ...
	     'the same size as the fonts of the surrounding text.'];
    end  
    showtext({txt1,txt2});
    showsizes;
   case 'commenttext'
    global LAPRINTOPT
    global LAPRINTHAN
    LAPRINTOPT.commenttext=get(LAPRINTHAN.commenttext,'string');
    txt=[ 'The comment text is displayed in the commenting header '...
          'of the tex file. This is for bookkeeping only.' ...
          'If the option ''caption'' is set to ''on'', then '...
          'this text is also displayed in the caption of the figure.'];
    showtext({txt});
    %%% options %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
   case 'asonscreen'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', the ticks, ticklabels '...
	   'and lims are printed ''as on screen''. Note that the '...
	   'aspect ratio of the printed figure is always equal '...
	   'to the aspect ratio on screen.'];
    if LAPRINTOPT.asonscreen==1
      LAPRINTOPT.asonscreen=0;
      set(LAPRINTHAN.asonscreen,'check','off')
      txt2= 'Current setting is: off'; 
    else
      LAPRINTOPT.asonscreen=1;
      set(LAPRINTHAN.asonscreen,'check','on')
      txt2='Current setting is: on'; 
    end      
    showtext({txt1, txt2});
   case 'keepticklabels'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', the tick labels '...
	   'are kept within the eps-file and are therefore not set '...
	   'in LaTeX. This option is useful for some rotated 3D plots.'];
    if LAPRINTOPT.keepticklabels==1
      LAPRINTOPT.keepticklabels=0;
      set(LAPRINTHAN.keepticklabels,'check','off')
      txt2= 'Current setting is: off'; 
    else
      LAPRINTOPT.keepticklabels=1;
      set(LAPRINTHAN.keepticklabels,'check','on')
      txt2='Current setting is: on'; 
    end      
    showtext({txt1, txt2});
   case 'mathticklabels'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', the tick labels '...
	   'are set in LaTeX math mode.'];
    if LAPRINTOPT.mathticklabels==1
      LAPRINTOPT.mathticklabels=0;
      set(LAPRINTHAN.mathticklabels,'check','off')
      txt2= 'Current setting is: off'; 
    else
      LAPRINTOPT.mathticklabels=1;
      set(LAPRINTHAN.mathticklabels,'check','on')
      txt2='Current setting is: on'; 
    end      
    showtext({txt1, txt2});
   case 'keepfontprops'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', LaPrint tries to ',...
	   'translate the MATLAB font properties (size, width, ',...
	   'angle) into similar LaTeX font properties. Set to ''off'', ',...
	   'LaPrint does not introduce any LaTeX font selection commands.'];
    if LAPRINTOPT.keepfontprops==1
      LAPRINTOPT.keepfontprops=0;
      set(LAPRINTHAN.keepfontprops,'check','off')
      txt2= 'Current setting is: off'; 
    else
      LAPRINTOPT.keepfontprops=1;
      set(LAPRINTHAN.keepfontprops,'check','on')
      txt2='Current setting is: on'; 
    end      
    showtext({txt1, txt2});
   case 'loose'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', LaPrint uses the ',...
	   '''-loose'' option in the Matlab print command. '];
    if LAPRINTOPT.loose==1
      LAPRINTOPT.loose=0;
      set(LAPRINTHAN.loose,'check','off')
      txt2= 'Current setting is: off'; 
    else
      LAPRINTOPT.loose=1;
      set(LAPRINTHAN.loose,'check','on')
      txt2='Current setting is: on'; 
    end      
    showtext({txt1, txt2});
   case 'extrapicture'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', LaPrint adds an ',...
	   'extra picture environment to each axis correponding to a '...
	   '2D plot. The picture ',...
	   'is empty, but alows to place LaTeX objects in arbitrary ',...
	   'positions by editing the tex file. '];
    if LAPRINTOPT.extrapicture==1
      LAPRINTOPT.extrapicture=0;
      set(LAPRINTHAN.extrapicture,'check','off')
      txt2= 'Current setting is: off'; 
    else
      LAPRINTOPT.extrapicture=1;
      set(LAPRINTHAN.extrapicture,'check','on')
      txt2='Current setting is: on'; 
    end      
    showtext({txt1, txt2});
   case 'nofigcopy'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', LaPrint creates a temporary ',...
	   'figure to introduce the tags. If set to ''off'', it directly ',...
	   'modifies the original figure. ' ...
	   'There are some bugs in the Matlab copyobj '...
	   'command. If you encounter these cases, set this '...
	   'option to ''off''.'];
    if LAPRINTOPT.nofigcopy==1
      LAPRINTOPT.nofigcopy=0;
      set(LAPRINTHAN.nofigcopy,'check','on')
      txt2= 'Current setting is: on'; 
    else
      LAPRINTOPT.nofigcopy=1;
      set(LAPRINTHAN.nofigcopy,'check','off')
      txt2='Current setting is: off'; 
    end      
    showtext({txt1, txt2});
   case 'nohead'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', LaPrint ',...
	   'adds a commenting head to the tex-file. To save disk '...
	   'space, out can turn this option ''off''.'];
    if LAPRINTOPT.nohead==1
      LAPRINTOPT.nohead=0;
      set(LAPRINTHAN.nohead,'check','on')
      txt2= 'Current setting is: on'; 
    else
      LAPRINTOPT.nohead=1;
      set(LAPRINTHAN.nohead,'check','off')
      txt2='Current setting is: off'; 
    end      
    showtext({txt1, txt2});
   case 'noscalefonts'
    global LAPRINTOPT
    global LAPRINTHAN
    txt1=[ 'With this option set to ''on'', LaPrint scales the ',...
	   'fonts with the figure. With this option set to '...
	   '''off'', the font size in the figure is equal to the '...
	   'size of the surrounding text.'];
    if LAPRINTOPT.noscalefonts==1
      LAPRINTOPT.noscalefonts=0;
      set(LAPRINTHAN.noscalefonts,'check','on')
      txt2= 'Current setting is: on'; 
    else
      LAPRINTOPT.noscalefonts=1;
      set(LAPRINTHAN.noscalefonts,'check','off')
      txt2='Current setting is: off'; 
    end      
    showtext({txt1, txt2});
   case 'caption'
    global LAPRINTOPT

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -