Version: 1.0

» Support Tools Such as This One! «

({{To help defray the cost of creating tools such as this, please click on the following link where other tools produced by Scientific Arts are posted}, {}, {MouseOver}, {}, {and click on the various Google Advertising links on the side of the page and those on other pages on the ScientificArts.com site.}, {}, {Thank You!}, {}, {Each such click will take you to the advertiser's page and will cause small advertising payments to be made by Google to Scientific Arts at no expense to you.}})

Explore A WorkLife FrameWork at MouseOver. 30 day trial version available.

NotebookOptionsInspector

Copyright © 2009, Scientific Arts, LLC
Non commercial use only permitted.

Documentation

The purpose of the NotebookOptionsInspector function is to give you easy access to the notebook options of a notebook so that you can see them, edit them, and modify them directly.

When you execute NotebookOptionsInspector[nb] a notebook is opened with the current option names for active options of the NotebookObject, nb.  If you execute NotebookOptionsInspector[] then the NotebookObject is the current InputNotebook.  This latter form is useful when using NotebookOptionsInspector[nb] in a palette as in the following bit of code (make sure to execute the function definition for NotebookOptionsInspector prior to evaluating the following code):

CreateWindow@PaletteNotebook[{Button["nb Options",NotebookOptionsInspector[],BaseStyle->{FontFamily->"Helvetica",FontWeight->"Bold",FontSize->10,FontColor->Black},Appearance->"Palette"]},
WindowTitle->"Options"]

Or to make a palette that does not depend on having executed a definition of NotebookOptionsInspector simply use the function NotebookOptionsInspectorPalette.

When the NotebookOptionsInspector notebook opens each Section cell has the name of an option.  Clicking on the group opener of that cell will display an editable Input cell with the current setting for that option.  If you edit this cell and then click on the button on the Section cell, that option will be set to the new edited value for the InputNotebook that your originally inspected.  Clicking on the name of the option in the Section cell will take you to the documentation for that option in the Documentation Center.

Code

NotebookOptionsInspector, NotebookOptionsInspectorPalette

ClearAll[NotebookOptionsInspector, NotebookOptionsInspectorPalette];

NotebookOptionsInspector::usage="NotebookOptionsInspector[nb] opens a notebook that gives you access to the values of the options for the NotebookObject nb at the time that NotebookOptionsInspector was executed. It also creates links to the Documentation Center documentation for each of the options as well as buttons that allow you to change the values of the options if you edit those values in the notebook.  Use this with care as no error checking is done to confirm that the new values of the options that you specified are valid.  NotebookOptionsInspector[] does this for the current InputNotebook. ";

NotebookOptionsInspector[nb_NotebookObject]:=Module[{nbopts,cells,doc,dockedCells,title,docnb,buttonTextStyle,buttonbarTextStyle},

buttonTextStyle={FontFamily->"Helvetica",FontWeight->"Bold",FontSize->10,FontColor->Darker@Darker@Green};
buttonbarTextStyle={FontFamily->"Helvetica",FontWeight->"Bold",FontSize->10,FontColor->Black};


nbopts=Flatten[{Options[nb]}];

nbopts={First[#],Last[#]}&/@nbopts;

nbopts=Sort[nbopts,OrderedQ[List[#1[[1]],#2[[1]]]]&];

cells=
{TextCell[
Row[{Tooltip[Style[Hyperlink[ToString[#[[1]]],"paclet:ref/"<>ToString[#[[1]]]],"Subsection"],"Click to open the documentaion on the "<>ToString[#[[1]]]<>" option",TooltipDelay->0.5],
Spacer[12],
Button["Reset "<>ToString[#[[1]]]<>" Option",
Module[{nbr,nbSelf},
nbSelf=ButtonNotebook[];
SelectionMove[nbSelf,All,EvaluationCell];
SelectionMove[nbSelf,Next,CellContents];
nbr=NotebookRead[nbSelf];
SetOptions[nb,#[[1]]->ToExpression[nbr]]],
Appearance->"Palette",
BaseStyle->buttonTextStyle,Background->Lighter@LightGray]
}],"Subsection",ShowGroupOpener->True,ShowStringCharacters->False,
CellFrame->1,CellDingbat->None], 

ExpressionCell[#[[2]],"Input",ShowGroupOpener->True]}&/@nbopts;

cells=Flatten[cells];

dockedCells={
MakeBoxes@TextCell[
ButtonBar[{
Tooltip["Close","Close this notebook",TooltipDelay->0.5]:>NotebookClose[ButtonNotebook[]],

Tooltip["Expand All","Expand all of the collapsed cell groups in this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],All,Notebook,AutoScroll->False];
FrontEndExecute[FrontEndToken[ButtonNotebook[],"SelectionOpenAllGroups"]]),

Tooltip["Collapse All","Collapse all of the expanded cell groups in this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],All,Notebook,AutoScroll->False];
FrontEndExecute[FrontEndToken[ButtonNotebook[],"SelectionCloseAllGroups"]]),

Tooltip["Top","Go to the beginning of this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],Before,Notebook,AutoScroll->True]),

Tooltip["Bottom","Go to the end of this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],After,Notebook,AutoScroll->True])
},Appearance->"Palette",
BaseStyle->buttonbarTextStyle],"DockedCell",TextAlignment->Center,CellMargins->{{0,0},{0,0}},StripOnInput->True]
};

title="Options from "<>ToString[WindowTitle/.AbsoluteOptions[nb,WindowTitle]];

doc=
DocumentNotebook[cells,
WindowMargins->{{Automatic,Automatic},{Automatic,40}},
DockedCells->dockedCells,
WindowTitle->title];

docnb=CreateWindow[doc];

SelectionMove[docnb,All,Notebook,AutoScroll->False];

FrontEndExecute[FrontEndToken[docnb,"SelectionCloseAllGroups"]];

SelectionMove[docnb,Before,Notebook,AutoScroll->True]

];

NotebookOptionsInspector[]:=NotebookOptionsInspector[InputNotebook[]];

NotebookOptionsInspectorPalette[]:=
CreateWindow@PaletteNotebook[{Button["nb Options",
Module[{nbopts,cells,doc,dockedCells,title,docnb,buttonTextStyle,buttonbarTextStyle,nb},
nb=InputNotebook[];

buttonTextStyle={FontFamily->"Helvetica",FontWeight->"Bold",FontSize->10,FontColor->Darker@Darker@Green};
buttonbarTextStyle={FontFamily->"Helvetica",FontWeight->"Bold",FontSize->10,FontColor->Black};


nbopts=Flatten[{Options[nb]}];

nbopts={First[#],Last[#]}&/@nbopts;

nbopts=Sort[nbopts,OrderedQ[List[#1[[1]],#2[[1]]]]&];

cells=
Function[thenb,
{TextCell[
Row[{Tooltip[Style[Hyperlink[ToString[#[[1]]],"paclet:ref/"<>ToString[#[[1]]]],"Subsection"],"Click to open the documentaion on the "<>ToString[#[[1]]]<>" option",TooltipDelay->0.5],
Spacer[12],
Button["Reset "<>ToString[#[[1]]]<>" Option",
Module[{nbr,nbSelf},
nbSelf=ButtonNotebook[];
SelectionMove[nbSelf,All,EvaluationCell];
SelectionMove[nbSelf,Next,CellContents];
nbr=NotebookRead[nbSelf];
SetOptions[thenb,#[[1]]->ToExpression[nbr]]],
Appearance->"Palette",
BaseStyle->buttonTextStyle,Background->Lighter@LightGray]
}],"Subsection",ShowGroupOpener->True,ShowStringCharacters->False,
CellFrame->1,CellDingbat->None], 

ExpressionCell[#[[2]],"Input",ShowGroupOpener->True]}&/@nbopts
][nb];

cells=Flatten[cells];

dockedCells={
MakeBoxes@TextCell[
ButtonBar[{
Tooltip["Close","Close this notebook",TooltipDelay->0.5]:>NotebookClose[ButtonNotebook[]],

Tooltip["Expand All","Expand all of the collapsed cell groups in this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],All,Notebook,AutoScroll->False];
FrontEndExecute[FrontEndToken[ButtonNotebook[],"SelectionOpenAllGroups"]]),

Tooltip["Collapse All","Collapse all of the expanded cell groups in this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],All,Notebook,AutoScroll->False];
FrontEndExecute[FrontEndToken[ButtonNotebook[],"SelectionCloseAllGroups"]]),

Tooltip["Top","Go to the beginning of this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],Before,Notebook,AutoScroll->True]),

Tooltip["Bottom","Go to the end of this notebook",TooltipDelay->0.5]:>
(SelectionMove[ButtonNotebook[],After,Notebook,AutoScroll->True])
},Appearance->"Palette",
BaseStyle->buttonbarTextStyle],"DockedCell",TextAlignment->Center,CellMargins->{{0,0},{0,0}},StripOnInput->True]
};

title="Options from "<>ToString[WindowTitle/.AbsoluteOptions[nb,WindowTitle]];

doc=
DocumentNotebook[cells,
WindowMargins->{{Automatic,Automatic},{Automatic,40}},
DockedCells->dockedCells,
WindowTitle->title];

docnb=CreateWindow[doc];

SelectionMove[docnb,All,Notebook,AutoScroll->False];

FrontEndExecute[FrontEndToken[docnb,"SelectionCloseAllGroups"]];

SelectionMove[docnb,Before,Notebook,AutoScroll->True]

],BaseStyle->{FontFamily->"Helvetica",FontWeight->"Bold",FontSize->10,FontColor->Black},Appearance->"Palette"]},
WindowTitle->"Options"];

License

A license for use of this Mathematica code, Package, or tool (the "Product") is provided free of charge from MouseOver for non-commercial use only.  For license information or any other use MouseOver directly.

You may redistribute this code to others, but may only do so by also including this notebook and must also include this copyright license information in all other uses.

Ccpyright, © 2009, Scientific Arts, LLC. Scientific Arts is the sole holder of the copyright to this Product. 

This Mathematica Package, Code, or Tool is provided as is, with no waranty whatsoever.  

IN NO EVENT SHALL SCIENTIFIC ARTS, LLC BE LIABLE FOR ANY LOST PROFITS, LOST BENEFITS, OR ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL, SPECIAL, OR PUNITIVE DAMAGES, WHETHER IN CONTRACT, TORT, OR OTHERWISE, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. LICENSOR'S JOINT CUMULATIVE LIABILITY TO YOU OR ANY OTHER PARTY FOR ANY LOSS OR DAMAGES RESULTING FROM ANY CLAIMS, DEMANDS, ACTIONS, OR OTHERWISE ARISING OUT OF OR RELATING TO THIS AGREEMENT SHALL NOT EXCEED THE LICENSE FEE PAID FOR THE PRODUCT.

Scientific Arts, LLC is not affiliated with Wolfram Research Inc.
Mathematica is a registered trademark of WolframResearch, Inc.