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

📄 fm_tviewer.m

📁 这是一个很适合研究和学习用的电力系统仿真软件
💻 M
字号:
function fig = fm_tviewer()
% FM_TVIEWER create GUI for text viewer selection
%
% HDL = FM_TVIEWER()
%
%Author:    Federico Milano
%Date:      11-Nov-2002
%Version:   1.0.0
%
%E-mail:    fmilano@thunderbox.uwaterloo.ca
%Web-site:  http://thunderbox.uwaterloo.ca/~fmilano
%
% Copyright (C) 2002-2006 Federico Milano

global Settings Theme Fig

if Fig.tviewer, figure(Fig.tviewer), return, end

unix_tv  = {'cat';
            'awk ''{print}''';
            'emacs';
            'nedit';
            'netscape';
            'firefox';
            'dtpad'};
linux_tv = {'cat';
            'gawk ''{print}''';
            'emacs';
            'nautilus';
            'netscape';
            'gedit';
            'nedit';
            'mozilla';
            'firefox';
            'xedit';
            'gless';
            'kedit';
            'kwrite'};
win_tv   = {'type';
            'notepad';
            'write';
            'uedit32';
            'explorer';
            'firefox'};

h0 = figure('Color',Theme.color01, ...
            'Units', 'normalized', ...
            'ColorMap', [], ...
            'CreateFcn','Fig.tviewer = gcf;', ...
            'DeleteFcn','Fig.tviewer = 0;', ...
            'FileName','fm_tviewer', ...
            'MenuBar','none', ...
            'Name','Text Viewer', ...
            'NumberTitle','off', ...
            'PaperPosition',[18 180 576 432], ...
            'PaperType','A4', ...
            'PaperUnits','points', ...
            'Position',sizefig(0.4,0.4), ...
            'RendererMode','manual', ...
            'ToolBar','none');
h1 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color02, ...
               'ForegroundColor',Theme.color03, ...
               'Position',[0.05 0.05  0.9  0.9], ...
               'Style','frame', ...
               'Tag','Frame1');
h1 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color04, ...
               'Callback','Settings.tviewer = [''!'',popupstr(gcbo),'' ''];', ...
               'ForegroundColor',Theme.color05, ...
               'Position',[0.1089    0.5737+0.03    0.3985    0.07], ...
               'String',unix_tv, ...
               'Style','popupmenu', ...
               'Tag','PopupMenu1');
h2 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color04, ...
               'Callback','Settings.tviewer = [''!'',popupstr(gcbo),'' ''];', ...
               'ForegroundColor',Theme.color05, ...
               'Position',[0.1089    0.3323+0.03     0.3985    0.07], ...
               'String',linux_tv, ...
               'Style','popupmenu', ...
               'Tag','PopupMenu2');
h3 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color04, ...
               'Callback','Settings.tviewer = [''!'',popupstr(gcbo),'' ''];', ...
               'ForegroundColor',Theme.color05, ...
               'Position',[0.1089    0.0909+0.03    0.3985    0.07], ...
               'String',win_tv, ...
               'Style','popupmenu', ...
               'Tag','PopupMenu3');

h13 = uicontrol('Parent',h0, ...
                'Units', 'normalized', ...
                'BackgroundColor',Theme.color02, ...
                'HorizontalAlignment','left', ...
                'Position',[0.1089    0.2038    0.3985    0.07], ...
                'String','Windows Text Viewers', ...
                'Style','text', ...
                'Tag','StaticText3');
h12 = uicontrol('Parent',h0, ...
                'Units', 'normalized', ...
                'BackgroundColor',Theme.color02, ...
                'HorizontalAlignment','left', ...
                'Position',[0.1089    0.4451    0.3985    0.07], ...
                'String','Linux Text Viewers', ...
                'Style','text', ...
                'Tag','StaticText2');
h11 = uicontrol('Parent',h0, ...
                'Units', 'normalized', ...
                'BackgroundColor',Theme.color02, ...
                'HorizontalAlignment','left', ...
                'Position',[0.1089    0.6865    0.3985    0.07], ...
                'String','Unix Text Viewers', ...
                'Style','text', ...
                'Tag','StaticText1');

h4 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color02, ...
               'ForegroundColor',Theme.color05, ...
               'HorizontalAlignment','left', ...
               'Position',[0.1089    0.8   0.3985    0.1003], ...
               'String',['Computer type: ', computer], ...
               'Style','text', ...
               'Tag','StaticText4');
h4 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color02, ...
               'ForegroundColor',Theme.color05, ...
               'HorizontalAlignment','left', ...
               'Position',[0.6114    0.8    0.2847    0.1003], ...
               'String','Output Format', ...
               'Style','text', ...
               'Tag','StaticText5');

ht1 = uicontrol('Parent',h0, ...
  'Units', 'normalized', ...
  'CData', fm_mat('view_latex'), ...
  'BackgroundColor',Theme.color02, ...
  'Callback','fm_text(14)', ...
  'ForegroundColor',Theme.color09, ...
  'Position',[0.6163    0.3574-0.08    0.2847    0.1129], ...
  'Style','toggle', ...
  'Tag','PushTEX');
ht2 = uicontrol('Parent',h0, ...
  'CData', fm_mat('view_ascii'), ...
  'Units', 'normalized', ...
  'BackgroundColor',Theme.color02, ...
  'Callback','fm_text(14)', ...
  'ForegroundColor',Theme.color09, ...
  'Position',[0.6163    0.5016-0.08    0.2847    0.1129], ...
  'Style','toggle', ...
  'Tag','PushTXT');
ht3 = uicontrol('Parent',h0, ...
  'CData', fm_mat('view_excel'), ...
  'Units', 'normalized', ...
  'BackgroundColor',Theme.color02, ...
  'Callback','fm_text(14)', ...
  'ForegroundColor',Theme.color09, ...
  'Position',[0.6163    0.6489-0.08    0.2847    0.1129], ...
  'Style','toggle', ...
  'Tag','PushXLS');
ht4 = uicontrol('Parent',h0, ...
  'CData', fm_mat('view_html'), ...
  'Units', 'normalized', ...
  'BackgroundColor',Theme.color02, ...
  'Callback','fm_text(14)', ...
  'ForegroundColor',Theme.color09, ...
  'Position',[0.6163    0.7962-0.08    0.2847    0.1129], ...
  'Style','toggle', ...
  'Tag','PushHTM');

if isunix
  if strcmp(Settings.export,'xls')
    Settings.export = 'txt';
  end
  set(ht3,'Enable','off')
end

switch Settings.export
case 'tex'
  set(ht1,'Value',1);
case 'xls'
  set(ht3,'Value',1);
case 'html'
  set(ht4,'Value',1);
case 'txt'
  set(ht2,'Value',1);
end

h4 = uicontrol('Parent',h0, ...
               'Units', 'normalized', ...
               'BackgroundColor',Theme.color03, ...
               'Callback','close(gcf);', ...
               'FontWeight','bold', ...
               'ForegroundColor',Theme.color09, ...
               'Position',[0.6163    0.1223    0.2847    0.1129], ...
               'String','OK', ...
               'Tag','Pushbutton1');

a = [];
switch computer
 case 'GLNX86',
  h = [h1, h11, h3, h13];
  for i = 1:length(linux_tv)
    if findstr(Settings.tviewer,linux_tv{i}),
      a = i;
      break,
    end
  end
  if isempty(a),
    a = 1;
  end
  set(h2,'Value',a)
 case 'PCWIN',
  h = [h1, h11, h2, h12];
  for i = 1:length(win_tv)
    if findstr(Settings.tviewer,win_tv{i}),
      a = i;
      break,
    end
  end
  if isempty(a), a = 1; end
  set(h3,'Value',a)
 otherwise,
  h = [h2, h12, h3, h13];
  for i = 1:length(unix_tv)
    if findstr(Settings.tviewer,unix_tv{i}),
      a = i;
      break,
    end
  end
  if isempty(a),
    a = 1;
  end
  set(h1,'Value',a)
end

set(h,'Enable','off')

if nargout > 0, fig = h0; end

⌨️ 快捷键说明

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