From: Peter S. <zu...@us...> - 2009-04-21 07:58:29
|
Update of /cvsroot/apophysis/2.10/Source In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv975 Modified Files: Editor.pas Log Message: highlighting fix Index: Editor.pas =================================================================== RCS file: /cvsroot/apophysis/2.10/Source/Editor.pas,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** Editor.pas 20 Apr 2009 08:15:03 -0000 1.70 --- Editor.pas 21 Apr 2009 07:58:23 -0000 1.71 *************** *** 260,265 **** ScrollCode: TScrollCode; var ScrollPos: Integer); procedure scrlXFormColorChange(Sender: TObject); - // procedure chkUseXFormColorClick(Sender: TObject); - // procedure chkHelpersClick(Sender: TObject); procedure txtXFormColorExit(Sender: TObject); procedure txtXFormColorKeyPress(Sender: TObject; var Key: Char); --- 260,263 ---- *************** *** 423,431 **** VarsCache: array of double; // hack: to prevent slow valuelist redraw ! // -JF- 64 wasn't big enough... buffer overrun ! // VariablesOddness: array of integer; VariableUsed: array of bool; - // VariableFavsHighlight: array of bool; //hmm VariableListColors, VariableListTextColors: array of TColor; VariableListStrings: TStrings; variableListCount: integer; --- 421,430 ---- VarsCache: array of double; // hack: to prevent slow valuelist redraw ! // -JF- 64 wasn't big enough... buffer overrun ! VariationListColors, VariationListTextColors: array of TColor; ! VariableUsed: array of bool; VariableListColors, VariableListTextColors: array of TColor; + VariableListStrings: TStrings; variableListCount: integer; *************** *** 693,698 **** procedure TEditForm.UpdateDisplay(PreviewOnly: boolean = false); - var - i, j, n: integer; begin // currently EditForm does not really know if we select another --- 692,695 ---- *************** *** 735,744 **** if MainForm.UndoIndex = 0 then AutoZoom // auto-zoom only on 'new' flame else TriangleView.Invalidate; - - for i := 0 to GetNrRegisteredVariations-1 do begin - n := GetRegisteredVariation(i).firstVariableIndex; - // for j := 0 to GetRegisteredVariation(i).GetNrVariables-1 do - // VariableFavsHighlight[n + j] := FavouriteVariations[NRLOCVAR + i]; - end; end; --- 732,735 ---- *************** *** 771,775 **** procedure TEditForm.ShowSelectedInfo; var ! i, j, n: integer; v: double; strval: string; --- 762,766 ---- procedure TEditForm.ShowSelectedInfo; var ! i, j, k, n: integer; v: double; strval: string; *************** *** 898,902 **** if v <> VarsCache[i] then begin ! VarsCache[i]:=v; VEVars.Values[VarNames(i)] := FloatToStr(v); //Format('%.6g', [v]); --- 889,893 ---- if v <> VarsCache[i] then begin ! VarsCache[i] := v; VEVars.Values[VarNames(i)] := FloatToStr(v); //Format('%.6g', [v]); *************** *** 904,920 **** //else VEVars.RowHeights[i+1] := VEVars.DefaultRowHeight; if i >= NRLOCVAR then begin n := GetRegisteredVariation(i - NRLOCVAR).GetNrVariables; if n > 0 then begin j := GetRegisteredVariation(i - NRLOCVAR).firstVariableIndex; repeat - nonzero := (v <> 0); usedVarsChanged := usedVarsChanged or (VariableUsed[j] <> nonzero); VariableUsed[j] := nonzero; - Inc(j); Dec(n); until n = 0; end; end; end; --- 895,925 ---- //else VEVars.RowHeights[i+1] := VEVars.DefaultRowHeight; + nonzero := (v <> 0); + if nonzero then + VariationListTextColors[i] := IfThen(FavouriteVariations[i], clFavVariation, vleVariables.Font.Color) + else + VariationListTextColors[i] := IfThen(FavouriteVariations[i], clFavVarGreyed, clGrayText); + if i >= NRLOCVAR then begin n := GetRegisteredVariation(i - NRLOCVAR).GetNrVariables; if n > 0 then begin + k := GetRegisteredVariation(i - NRLOCVAR).firstVariableIndex; + for j := k to k+n-1 do begin + usedVarsChanged := usedVarsChanged or (VariableUsed[j] <> nonzero); + VariableUsed[j] := nonzero; + end; + end; + { + n := GetRegisteredVariation(i - NRLOCVAR).GetNrVariables; + if n > 0 then begin j := GetRegisteredVariation(i - NRLOCVAR).firstVariableIndex; repeat usedVarsChanged := usedVarsChanged or (VariableUsed[j] <> nonzero); VariableUsed[j] := nonzero; Inc(j); Dec(n); until n = 0; end; + } end; end; *************** *** 933,939 **** VariableListStrings.Add(varname + '=' + FloatToStr(v)); if i <= NumBuiltinVariations then ! VariableListColors[n] := ParametricVarColors[n and 1 xor 1] else ! VariableListColors[n] := PluginVarColors[n and 1 xor 1]; VariableListTextColors[n] := IfThen(FavouriteVariations[i], clFavVariation, vleVariables.Font.Color); Inc(n); --- 938,944 ---- VariableListStrings.Add(varname + '=' + FloatToStr(v)); if i <= NumBuiltinVariations then ! VariableListColors[n] := ParametricVarColors[n and 1] else ! VariableListColors[n] := PluginVarColors[n and 1]; VariableListTextColors[n] := IfThen(FavouriteVariations[i], clFavVariation, vleVariables.Font.Color); Inc(n); *************** *** 1782,1786 **** var i: integer; - j, n: integer; listBkgColor: TColor; begin --- 1787,1790 ---- *************** *** 1807,1812 **** --- 1811,1820 ---- TriangleView.OnMouseLeave := TriangleViewmouseLeave; + SetLength(VarsCache, NRVAR); + SetLength(VariationListColors, NRVAR); + SetLength(VariationListTextColors, NRVAR); for i := 0 to NRVAR-1 do begin VEVars.InsertRow(Varnames(i), '0', True); + VarsCache[i] := MinDouble; end; *************** *** 1867,1882 **** MemTriangle.y[2] := 1; - SetLength(VarsCache, NRVAR); - for i := 0 to NRVAR-1 do - VarsCache[i] := MinDouble; - listBkgColor := VEVars.Canvas.Brush.Color; ! NormalVarColors[0] := MixColor(listBkgColor, clNormalHilite); ! NormalVarColors[1] := listBkgColor; ! ParametricVarColors[0] := MixColor(listBkgColor, clParametricHilite); ! ParametricVarColors[1] := MixColor(listBkgColor, ParametricVarColors[0]); ! PluginVarColors[0] := MixColor(listBkgColor, clPluginsHilite); ! PluginVarColors[1] := MixColor(listBkgColor, PluginVarColors[0]); ChaosColors[0] := MixColor(listBkgColor, clChaosHilite); ChaosColors[1] := MixColor(listBkgColor, ChaosColors[0]); --- 1875,1893 ---- MemTriangle.y[2] := 1; listBkgColor := VEVars.Canvas.Brush.Color; ! NormalVarColors[1] := MixColor(listBkgColor, clNormalHilite); ! NormalVarColors[0] := listBkgColor; ! ParametricVarColors[1] := MixColor(listBkgColor, clParametricHilite); ! ParametricVarColors[0] := MixColor(listBkgColor, ParametricVarColors[1]); ! PluginVarColors[1] := MixColor(listBkgColor, clPluginsHilite); ! PluginVarColors[0] := MixColor(listBkgColor, PluginVarColors[1]); + for i := 0 to NrLocVar-1 do + VariationListColors[i] := NormalVarColors[i and 1]; + for i := NrLocVar to NumBuiltinVariations-1 do + VariationListColors[i] := ParametricVarColors[i and 1]; + for i := NumBuiltinVariations to NrVAR-1 do + VariationListColors[i] := PluginVarColors[i and 1]; + ChaosColors[0] := MixColor(listBkgColor, clChaosHilite); ChaosColors[1] := MixColor(listBkgColor, ChaosColors[0]); *************** *** 3204,3210 **** procedure TEditForm.txtSymmetrKeyPress(Sender: TObject; var Key: Char); - var - Allow: boolean; - NewVal, OldVal: double; begin if key = #13 then --- 3215,3218 ---- *************** *** 3297,3301 **** var cell: TGridCoord; - i, n: integer; begin if Button = mbLeft then begin --- 3305,3308 ---- *************** *** 4480,4483 **** --- 4487,4491 ---- begin if (ARow = 0) or (gdSelected in State) then exit; + { if (ARow <= NRLOCVAR) then VEVars.canvas.brush.Color := NormalVarColors[ARow and 1] *************** *** 4501,4504 **** --- 4509,4519 ---- VEVars.canvas.TextRect(Rect, Rect.Left+2, Rect.Top+2, VEVars.Cells[ACol,ARow]); + } + with VEVars.Canvas do begin + Brush.Color := VariationListColors[ARow-1]; + FillRect(Rect); + Font.Color := VariationListTextColors[ARow-1]; + TextRect(Rect, Rect.Left+2, Rect.Top+2, VEVars.Cells[ACol,ARow]); + end; end; *************** *** 5240,5260 **** editor := TEditorHacker(TGridHacker(sender).InplaceEditor); if Assigned(editor) then begin ! if (ARow <= NRLOCVAR) then ! editor.Color := NormalVarColors[ARow and 1] ! else ! begin ! if ARow <= NumBuiltinVariations then ! editor.Color := ParametricVarColors[ARow and 1] ! else ! editor.Color := PluginVarColors[ARow and 1]; ! end; ! if VEVars.Cells[1,Arow] = '0' then begin ! if FavouriteVariations[ARow-1] = true then ! editor.Font.Color := clFavVarGreyed ! else ! editor.Font.Color := clGrayText; end ! else if FavouriteVariations[ARow-1] = true then ! editor.Font.Color := clFavVariation; end; end; --- 5255,5268 ---- editor := TEditorHacker(TGridHacker(sender).InplaceEditor); if Assigned(editor) then begin ! editor.Color := VariationListColors[ARow-1]; ! //editor.Font.Color := VariationListTextColors[ARow-1]; ! ! if (VEVars.Cells[1, ARow] <> '0') or (value <> '0') then begin ! editor.Font.Color := IfThen(FavouriteVariations[ARow-1], clFavVariation, VEVars.Font.Color); end ! else begin ! editor.Font.Color := IfThen(FavouriteVariations[ARow-1], clFavVarGreyed, clGrayText); ! end; ! end; end; |