Cell Properties Palette

January 2000

Rolf Mertig   
Mertig Research & Consulting http://www.mertig.com

All buttons act on one or more selected cells and toggle

The code is straightforward and self-explanatory.

Click on the "VP" button of the ButtonTools palette from http://www.mathdepot.com

Open

SelectionMove[InputNotebook[],All,Cell];

If[Options[NotebookSelection[InputNotebook[]],CellOpen][[1, 2]]===True,SetOptions[NotebookSelection[InputNotebook[]],CellOpen->False],SetOptions[NotebookSelection[InputNotebook[]],CellOpen->True]]

Editable

Module[{temp},temp=Flatten[{NotebookRead[InputNotebook[]]}];If[temp === {},SelectionMove[InputNotebook[],All,Cell];temp=Flatten[{NotebookRead[InputNotebook[]]}];];If[MatchQ[temp,{BlankSequence[Cell]}],If[\(\((Union[\((#1[[2]] &)\) /@ 
                            temp])\) ⋂ {"Title", "Subtitle", "Subsubtitle", "Section", "Subsection", "Subsubsection"} === {}\),If[Options[NotebookSelection[InputNotebook[]],Editable][[1, 2]]===True,SetOptions[NotebookSelection[InputNotebook[]],Editable -> False],NotebookWrite[InputNotebook[],NotebookRead[InputNotebook[]]/.(Editable -> 
                                    False) :> Sequence[],GeneratedCell->False];SelectionMove[InputNotebook[],Previous,Cell]]]];]

Evaluatable

SelectionMove[InputNotebook[],All,Cell];

If[Options[NotebookSelection[InputNotebook[]],Evaluatable][[1, 2]]===True,SetOptions[NotebookSelection[InputNotebook[]],Evaluatable -> False],SetOptions[NotebookSelection[InputNotebook[]],Evaluatable->True]]

Active

SelectionMove[InputNotebook[],All,Cell];

If[Options[NotebookSelection[InputNotebook[]],Active][[1, 2]]===True,SetOptions[NotebookSelection[InputNotebook[]],Active -> False],SetOptions[NotebookSelection[InputNotebook[]],Active->True]]

Initialization

SelectionMove[InputNotebook[],All,Cell];

If[Options[NotebookSelection[InputNotebook[]],InitializationCell][[1, 2]]===True,SetOptions[NotebookSelection[InputNotebook[]],InitializationCell->False],SetOptions[NotebookSelection[InputNotebook[]],InitializationCell->True]]

Duplicate

Module[{temp},temp=Flatten[{NotebookRead[InputNotebook[]]}];If[temp === {},SelectionMove[InputNotebook[],All,Cell];temp=Flatten[{NotebookRead[InputNotebook[]]}];];If[MatchQ[temp,{BlankSequence[Cell]}],If[\(\((Union[\((#1[[2]] &)\) /@ 
                            temp])\) ⋂ {"Title", "Subtitle", "Subsubtitle", "Section", "Subsection", "Subsubsection"} === {}\),SelectionMove[InputNotebook[],After,Cell];NotebookWrite[InputNotebook[],temp,All]]];]

OpenAllGroups

SelectionMove[InputNotebook[],All,CellGroup];

FrontEndExecute[{FrontEnd`FrontEndToken[InputNotebook[],"SelectionOpenAllGroups"]}];

CloseAllGroups

SelectionMove[InputNotebook[],All,CellGroup];

FrontEndExecute[{FrontEnd`FrontEndToken[InputNotebook[],"SelectionCloseAllGroups"]}];