What I should have posted was the following:
with TBarSeries(Result) do
case APlotType of
ptBars:
begin
AxisIndexX := AChart.LeftAxis.Index;
AxisIndexY := AChart.BottomAxis.Index;
end;
ptWhatever:
begin
AxisIndexX := something;
AxisIndexY := something_else;
end;
else
AxisIndexX := AChart.BottomAxis.Index;
AxisIndexY := AChart.LeftAxis.Index;
end;
Although this will never satisfy indentation purists
Change "indentation" to "language" and I can agree with that statement.
I find it draws attention in a helpful way to the most important parts of the code (the actions that should follow from each case selector) while relegating the boilerplate stuff (begins and ends) to a less significant position in the construct.
That's reasonable.
I'd format it similarly:
with TBarSeries(Result) do
case APlotType of
ptBars:
begin
AxisIndexX := AChart.LeftAxis.Index;
AxisIndexY := AChart.BottomAxis.Index;
end;
ptWhatever:
begin
AxisIndexX := something;
AxisIndexY := something_else;
end;
else
AxisIndexX := AChart.BottomAxis.Index;
AxisIndexY := AChart.LeftAxis.Index;
end;
The above formatting for the following reasons: "case"/"else"/"end" aligned because they are a single Pascal construct. "case" aligned with "with" because the "case" belongs to the "with". "begin"/end" aligned with the conditions because that's what they are associated with (owned by.)
if Delphi supported "otherwise" in "case" statements, I would use "otherwise" to make it visually noticeable that the statements under it are not associated with an "if".
One thing I find particularly interesting is that, probably NONE of the programmers that use "begin" on the same line as an "else" (or something else) code something like this:
procedure MyProc; begin
end;
which indicates that their formatting choice is not particularly consistent and lacks a solid foundation. Putting the "begin" on the same line as "procedure" would after all, save one line, just as it does in other constructions.