Happy new year to everyone.

   I´m having some troubles when using other compiler messages files to compile 
Lazarus or 
when using fpc compiled with other message file language than english.
   The fact is that Lazarus IDE has some pieces of code with embedded strings 
constants. 
   I thought the most common way to solve problems like this was to declare an 
identifier to it and
moving it to resourcestring header (or file, i.e. LazarusIDEstrconsts)


*** The question is : What should be moved or not moved there ???? ***


Other situation occurs with constant string in logic, like this example from 
msgview.pp


procedure TMessagesView.MessageViewDrawItem(Sender: TCustomTreeView;
  Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage;
  var PaintImages, DefaultDraw: Boolean);
var
  TheText: string;
  ARect: TRect;

const
->  cHint         = 'Hint: User defined:';
->  cNote         = 'Note: User defined:';
->  cWarning      = 'Warning: User defined:';
  clMsgHint     = clBlue;
  clMsgNote     = clGreen;
  clMsgWarning  = clRed;
  cLeftSpacer   = 0;
  
  procedure ChangeFontColor(c: TColor);
[-] ...
  end;
  
begin
  if Stage<>cdPostPaint then exit;
  // a paint means, something has changed (scrolling, expand, collapse, resize, 
...)
  Changed;

  //DebugLn(['TMessagesView.MessageViewDrawItem Index=',Node.Index,' 
Count=',MessageTreeView.Items.Count,' TheText="',TheText,'"']);

  { Only use custom colors if not selected, otherwise it is difficult to read }
  if not (cdsSelected in State)
  then begin
->    TheText := Node.Text;
->    if Pos(cNote, TheText) > 0 then
->      ChangeFontColor(clMsgNote)
->    else if Pos(cHint, TheText) > 0 then
->      ChangeFontColor(clMsgHint)
->    else if Pos(cWarning, TheText) > 0 then
->      ChangeFontColor(clMsgWarning);
  end;
end;


   If i use other language the code above will not work, since messages are 
translated.

   I´m trying to figure how to solve this one, but before start sending patches 
maybe should be wise to
hear what others have to say.
   Maybe we get some guidelines on how to proceed in such situations.

Regards,

Marcelo.
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to