{******************************************************************************}
{                                                                              }
{                       Pascal Script Source File                              }
{                                                                              }
{             Run by RemObjects Pascal Script in CnPack IDE Wizards            }
{                                                                              }
{                                   Generated by CnPack IDE Wizards            }
{                                                                              }
{******************************************************************************}

program ToggleEditorBar;

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ActnList, Buttons, ClipBrd, ComCtrls, ExtCtrls, ComObj, ExtDlgs, IniFiles,
  Menus, Printers, Registry, StdCtrls, TypInfo, ToolsAPI, CnDebug,
  RegExpr, ScriptEvent, CnCommon, CnWizClasses, CnWizUtils, CnWizIdeUtils,
  CnWizShortCut, CnWizOptions;

var
  SrcEnh: TCnBaseWizard;
  Mgr: TObject;
  B: string;
begin
  SrcEnh := GetCnWizardMgr.WizardByClassName('TCnSrcEditorEnhance');
  if SrcEnh = nil then
  begin
    ErrorDlg('NO Source Editor Enhancement Found.');
    Exit;
  end;

  Mgr := GetObjectProp(TObject(SrcEnh), 'ToolBarMgr');
  if Mgr = nil then
  begin
    ErrorDlg('NO Toolbar Manager Found.');
    Exit;
  end;

  B := GetEnumProp(Mgr, 'ShowToolBar');
  if LowerCase(B) = 'true' then
    B := 'False'
  else
    B := 'True';

  SetEnumProp(Mgr, 'ShowToolBar', B);
  SetEnumProp(Mgr, 'ShowDesignToolBar', B);
end.
 
