Therefore, the recent commits were rather destructive
hmm... that's bad
but it explains a few annoying messages on compiling
...
Since we're still in the process of going back and forth
what would you think of changing the TPaletteSelectionKind to: "none, thin, normal, thick" and of modifying the selection color to
fixed or
auto ? Auto being the inverted colors... I'm still looking for the right calibration here... what do you think?
On the subject of questioning, why is it that we need a mouseColorMove
and a MouseMove? Since we are here in a colorPalette, isn't it self-descriptive that the mouseMoves will be mouseColorMoves? ... just trying to simplify...
Finally
i'm working on a merge of my former colorpalette to this one and am preparing a new demo. I'm not ready to send it right away, i need a few hours more... but in the process i've got an issue on loading and saving that you might be simplify. If i show you the code you'll probably understand immediatly so here are the saving and loading procedures:
procedure TmainForm.doSavePalFile;
var pStr, fName, tmp: string;
i: word;
outFile: tStringList;
begin
try
outFile := tStringList.create;
with colPalet do
begin
fName := mainPath+'tmp.pal';
savePalette(fName); //TColorPalette save
outFile.LoadFromFile(fName);
tmp := outFile.text;
// prepare properties
pStr := '# ' + PalName + #10
+ '#<PROPS>' + #10
+ '##########################################' + #10
+ '# PALETTE PROPERTIES ( Should/Could be unHashed? ) ' + #10
+ '#$BTNSIZE ' + intToStr(ButtonWidth) + #10
+ '#$BTNCOLOR ' + colorToString(ButtonBorderColor) + #10
+ '#$BTNDIST ' + intToStr(ButtonDistance) + #10
+ '#$SELKIND ' + intToStr(ord(SelectionKind)) + #10
+ '#$SELCOLOR ' + colorToString(SelectionColor) + #10
+ '#' + #10
+ '#</PROPS>'
+ #10
;
end;
finally
outFile.text := pStr + tmp ;
fName := filePath + palName;
outFile.SaveToFile(fName);
outFile.free;
FListBox.UpdateFileList;
lastFileName := fName;
end;
end; {doSavePalFile}
procedure TmainForm.doLoadPalFile(fName: string);
var pBuff: string;
inStr: TStringList;
function getValue(aKey: string):string;
var ...
begin
sKey := '#$'+aKey;
...
result := //the corresponding value
end;
end;
begin
if not fileExists(fName) then exit;
inStr := TStringList.create;
inStr.LoadFromFile(fName);
pBuff := copy(inStr.text,1,pos('#</PROPS>',inStr.text));
with ColPalet do
begin
if pBuff <> '' then
begin
ButtonWidth := strToInt(getValue('BTNSIZE'));
... etc
end;
loadPalette(fName);
EdColCount.Value := columnCount ;
end;
inStr.free;
end; {doLoadPalFile}
Could we extend the TColorPalette syntax to include a few properties? Although those procedures work well, - hidden behind the hashes could be inserted a second level of instructions that don't trouble the colorPalette - but it would be much simpler if it was integrated...
I don't think all the properties have to get there but some might be quite convenient: a palette with numerous entries might be better served with small buttons and inversely few entries better served with large buttons...