Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

A few fixes for LCD Smartie (source code / binary)

Plans and future development for LCD Smartie.

Moderators: dperrow, caesar, IFR, limbo, hydrolisk1792, fruittool, Development

Forum rules
Only Serious posts about ideas and future development of the Main LCD Smartie Program please.
Post Reply
cranq
Posts: 13
Joined: January 1st, 2014, 6:25 pm

A few fixes for LCD Smartie (source code / binary)

Post by cranq »

Hi! I want to share some small fixes for LCD Smartie. English isn’t my first language, so please excuse any mistakes.

If u don't want to read whole text then jump to the end. There's short discription and binary file to download.

-------------------------------------------------------------------------------
Jump to current (active) screen setup
-------------------------------------------------------------------------------

File: USetup.pas / procedure: TSetupForm.FormShow(Sender: TObject);

change this:

Code: Select all

  ScreenSpinEdit.MaxValue := MaxScreens;
  ScreenSpinEdit.Value := 1;
  CurrentScreen := 1;
  //CurrentScreen :=  activescreen;
  //ScreenSpinEdit.Value := activescreen;

  LoadScreen( CurrentScreen );   // setup screen in setup form
  LCDSmartieDisplayForm.ChangeScreen(CurrentScreen);   // setup screen in main form
to:

Code: Select all

  ScreenSpinEdit.MaxValue := MaxScreens;
  CurrentScreen := 0;   // skip saving previous screen
  ScreenSpinEdit.Value := activeScreen;

  LoadScreen(activeScreen);   // setup screen in setup form
  LCDSmartieDisplayForm.ChangeScreen(activeScreen);   // setup screen in main form
add to procedure: TSetupForm.SaveScreen(scr: Integer);

Code: Select all

  ...
  begin
	if scr = 0 then Exit;
  ...
In source code I saw two commented lines and it looks like someone before was trying to implement this so I will write some more information.

This line "ScreenSpinEdit.Value := 1;" won't trigger this procedure "ScreenSpinEditChange(Sender: TObject);" because "ScreenSpinEdit.Value" on form = 1. When we try change it to <> 1 (e.g. activeScreen), procedure "SaveScreen(scr: Integer);" from "ScreenSpinEditChange(Sender: TObject);" is executed but there is no previous screen to save and error occurs.

-------------------------------------------------------------------------------
Network stats > 9
-------------------------------------------------------------------------------

File: UDataNetwork.pas

change:

Code: Select all

const
  MAXNETSTATS = 10;
to:

Code: Select all

const
  MAXNETSTATS = 50;
I think 50 should be enough for most users.

-------------------------------------------------------------------------------
Position of editing window (double click edit fields on setup form)
Center on screen when form.ini is empty or not exists
-------------------------------------------------------------------------------

File: UEditLine.pas / procedure: TFormEdit.EditClose(Sender: TObject; var Action: TCloseAction);
change to:

Code: Select all

var
  FEdit: TFormEdit;
  Pos : TFormPos;
begin
  FEdit := Sender AS TFormEdit;
  Pos := TFormPos.Create('forms.ini');
  Pos.Tag := 'edit';
  Pos.Width := FEdit.Width;
  Pos.Height := Fedit.Height;
  Pos.Left := Fedit.Left; 
  Pos.Top := FEdit.Top;   
  Pos.save;      
end;	
and file: USetup.pas / procedure: TSetupForm.LineEditClick(Sender: TObject);
change to:

Code: Select all

var
  oEdit : TEdit;
  oPos : TFormPos;
begin
  oEdit := Sender as TEdit;

  oEditForm := TFormEdit.Create(nil);
  with oEditForm do begin
    Memo1.Text := oEdit.Text;

    oPos := TFormPos.Create('forms.ini');
    oPos.Tag := 'edit';
    oPos.load;

    Width := oPos.Width;
    Height := oPos.Height;

    if oPos.Top = -1 then
      Top := GetSystemMetrics(SM_CYSCREEN) div 2 - Height div 2
    else
      Top := oPos.Top;

    if oPos.Left = -1 then
      Left := GetSystemMetrics(SM_CXSCREEN) div 2 - Width div 2
    else
      Left := oPos.Left;

    ShowModal;

    if ModalResult = mrOk then
      oEdit.Text := TrimRight(Memo1.Text);

    oEdit.SelLength :=0 ;

    Free;
  end;
  oEditForm := nil;
end;
Well, not everyone uses FHD screen resolutions (or even bigger) and for smaller ones this window is halfway off screen (+/-) so it may be better to make it this way.

-------------------------------------------------------------------------------
Center main form when form.ini doesn't exists
-------------------------------------------------------------------------------

File: UMain.pas / procedure: TLCDSmartieDisplayForm.FormCreate(Sender: TObject);
Change:

Code: Select all

  ...
  // restore last form position
  oPos := TFormPos.Create('forms.ini');
  oPos.Tag := 'main';
  oPos.load;
  if ((oPos.Top <> -1) and (oPos.Left <> -1)) then
  begin
    LCDSmartieDisplayForm.Top  := oPos.Top;
    LCDSmartieDisplayForm.Left := oPos.Left;
  end;
end;
To:

Code: Select all

  
  ...
  // restore last form position
  oPos := TFormPos.Create('forms.ini');
  oPos.Tag := 'main';
  oPos.load;

  if oPos.Top = -1 then
    LCDSmartieDisplayForm.Top := GetSystemMetrics(SM_CYSCREEN) div 2 - LCDSmartieDisplayForm.Height div 2
  else
    LCDSmartieDisplayForm.Top := oPos.Top;

  if oPos.Left = -1 then
    LCDSmartieDisplayForm.Left := GetSystemMetrics(SM_CXSCREEN) div 2 - LCDSmartieDisplayForm.Width div 2
  else
    LCDSmartieDisplayForm.Left := oPos.Left;
end;
--------------------------------------------------------------------------------------------------------------
Add new buttons to Actions tab (Move Up, Move Down, Clear All, Modify aka Save changes)
--------------------------------------------------------------------------------------------------------------

File: USetup.pas / add procedure for Move Up button

Code: Select all

var
  TempStringGrid:  TStringGrid;
begin
  if (ActionsStringGrid.Row > 0) and (Trim(ActionsStringGrid.Rows[ActionsStringGrid.Row].Text) <> '') then
  begin
    TempStringGrid := TStringGrid.Create(nil);
    TempStringGrid.Rows[0] := ActionsStringGrid.Rows[ActionsStringGrid.Row];
    ActionsStringGrid.Rows[ActionsStringGrid.Row].Assign(ActionsStringGrid.Rows[ActionsStringGrid.Row - 1]);
    ActionsStringGrid.Rows[ActionsStringGrid.Row - 1] := TempStringGrid.Rows[0];
    ActionsStringGrid.Row := ActionsStringGrid.Row - 1;
    TempStringGrid.Free;
  end;
end;
File: USetup.pas / add procedure for Move Down button

Code: Select all

var
  TempStringGrid:  TStringGrid;
begin
  if (ActionsStringGrid.Row < ActionsStringGrid.RowCount -1) and (Trim(ActionsStringGrid.Rows[ActionsStringGrid.Row +1].Text) <> '') then
  begin
    TempStringGrid := TStringGrid.Create(nil);
    TempStringGrid.Rows[0] := ActionsStringGrid.Rows[ActionsStringGrid.Row];
    ActionsStringGrid.Rows[ActionsStringGrid.Row].Assign(ActionsStringGrid.Rows[ActionsStringGrid.Row + 1]);
    ActionsStringGrid.Rows[ActionsStringGrid.Row + 1] := TempStringGrid.Rows[0];
    ActionsStringGrid.Row := ActionsStringGrid.Row + 1;
    TempStringGrid.Free;
  end;
end;
File: USetup.pas / add procedure for Clear All button

Code: Select all

var
  i: integer;
begin
  for i := 0 to ActionsStringGrid.RowCount - 1 do
    ActionsStringGrid.Rows[i].Clear;
  ActionsStringGrid.RowCount := 1;

  Operand1Edit.Text := '';
  Operand2Edit.Text := '';
  StatementEdit.Text := '';
end;
File: USetup.pas / add procedure for Modify aka Save changes

Code: Select all

procedure TSetupForm.Button4Click(Sender: TObject);
begin
  if (Operand1Edit.text <> '') and (OperatorComboBox.ItemIndex <> -1)
    and (Operand2Edit.text <> '') and (StatementEdit.text <> '') then
  begin
    if Trim(ActionsStringGrid.Rows[ActionsStringGrid.Row].Text) = '' then
      ActionsStringGrid.RowCount := ActionsStringGrid.RowCount + 1;
    ActionsStringGrid.Cells[0, ActionsStringGrid.Row] := Operand1Edit.text;
    ActionsStringGrid.Cells[1, ActionsStringGrid.Row] :=
      OperatorComboBox.Items.Strings[OperatorComboBox.ItemIndex];
    ActionsStringGrid.Cells[2, ActionsStringGrid.Row] := Operand2Edit.text;
    ActionsStringGrid.Cells[3, ActionsStringGrid.Row] := 'then';
    ActionsStringGrid.Cells[4, ActionsStringGrid.Row] := StatementEdit.text;
  end;
end;
Other Fixes for Actions Tab:

File: USetup.pas / procedure: TSetupForm.FormShow(Sender: TObject);

after this code:

Code: Select all

  ...
  for i := 1 to config.totalactions do
  begin
      Operand1Edit.text := config.actionsArray[i, 1];
      OperatorComboBox.itemindex := StrToInt(config.actionsArray[i, 2]);
      Operand2Edit.text := config.actionsArray[i, 3];
      StatementEdit.text := config.actionsArray[i, 4];
      ActionAddButton.click;
  end;

add this:

Code: Select all

ActionsStringGridClick(nil); // load first row to edit fields instead of leaving last one with selected first row
or this:

Code: Select all

if ActionsStringGrid.RowCount > 1 then
   ActionsStringGrid.Row := ActionsStringGrid.RowCount - 2;  // select the last row according to edit fields
next - change in Object inspector:

Code: Select all

ActionsStringGrid > Options > goRangeSelect > False
Operand2Edit > Text > Leave this empty
StatementEdit > Text > Leave this empty
and the last change:

File: USetup.pas / procedure: TSetupForm.MainPageControlChange(Sender: TObject);

delete this line:

Code: Select all

OperatorComboBox.ItemIndex := 0;
or change it to:

Code: Select all

if OperatorComboBox.ItemIndex = -1 then
  OperatorComboBox.ItemIndex := 0;
----------------------------------------------------------------------------------
Window blinking on program startup when start hidden is activated
----------------------------------------------------------------------------------

First, add global variable to UMain.pas:

Code: Select all

ShowWindowFlag: Boolean;
File: LCDSmartie.DPR

change to this:

Code: Select all

  ...
  Application.ShowMainForm := False;
  Application.CreateForm(TLCDSmartieDisplayForm, LCDSmartieDisplayForm);
  ...
File: UMain.pas / procedure: TLCDSmartieDisplayForm.FormCreate(Sender: TObject);

delete from this procedure:

Code: Select all

  if (config.bHideOnStartup) then
    InitialWindowState := HideMainForm;
add this before procedure end (on bottom)

Code: Select all

   ...
  if not (config.bHideOnStartup) and (ShowWindowFlag) then
    LCDSmartieDisplayForm.Show;
end;
File: UMain.pas / procedure: TLCDSmartieDisplayForm.ProcessCommandLineParams;

change this procedure to:

Code: Select all

var
  I: integer;
  parameter: String;
begin
  ShowWindowFlag := True;
  i := 1;
  while (i <= ParamCount) do
  begin
    parameter := LowerCase(ParamStr(i));

    if (parameter = '-hide') then
      ShowWindowFlag := False;

    if (parameter = '-totalhide') then
      ShowWindowFlag := False;

    if (parameter = '-config') then
    begin
      Inc(i);
      ConfigFileName := ParamStr(i);  // will give '' if out of range
    end;
    Inc(i);
  end;
end;
File: UMain.pas / procedure: TLCDSmartieDisplayForm.TimerRefreshTimer(Sender: TObject);

remove from this procedure:

Code: Select all

  if (InitialWindowState <> NoChange) then
  begin
    case InitialWindowState of
      HideMainForm : Application.Minimize;
      TotalHideMainForm : CoolTrayIcon1.HideMainForm;
    end;
    InitialWindowState := NoChange;
  end; 
-------------------------------------------------------------------------------
OK, that's all for now. Hope that someone will find it useful.
-------------------------------------------------------------------------------

Short list of changes:
-Jump to current (active) screen setup
-Network stats > 9
-Save position of dialog used with edit fields
-Form autocenter on first start (without forms.ini)
-Removed window blinking on program startup when start hidden is activated
-Add new buttons to Actions tab (Move Up, Move Down, Clear All, Modify aka Save changes)
-New misc button on screen setup: copy, paste, clear - all fields
-Change refresh time for actions (misc tab)

I have compiled LCD Smartie with those fixes so if someone want to try, here's a link: ge.tt/9XRBthG1/v/0

----------------------------------------------------
It seems Smartie is dead. Too bad...

hurley
Posts: 46
Joined: May 26th, 2011, 8:03 am

Re: A few fixes for LCD Smartie (source code / binary)

Post by hurley »

Hi cranq, this slipped my attention.
I just tried your modified binary, everything works great!
This I found especially good fixes: (Particularly when testing/debugging plugins.)
-Jump to current (active) screen setup
-New misc button on screen setup: copy, paste, clear - all fields
It's a shame these boards and LCD Smartie development has gone quiet but it's efforts like yours that could breathe new life into the project.
I speak for the smaller band of die hard users and say thank you very much for your work here.
I hope someone from the dev team buys you a beer :)

-----
Actually I had some ideas for improvement's to LCD Smartie a while ago but was completely lost in pascal, I only know a little C#.
I'm very busy with a new plugin at the moment but if you're still around in the future, and I make sure my ideas are viable, might be cool to pitch them at someone who understands LCD Smartie's source code...
..anyway, thanks again for your efforts.

hurley.

cranq
Posts: 13
Joined: January 1st, 2014, 6:25 pm

Re: A few fixes for LCD Smartie (source code / binary)

Post by cranq »

Hi hurley, thanks for replay.
Currently I'm working on other project but feel free to post your ideas.

samali
Posts: 1
Joined: February 19th, 2017, 12:04 am

Re: A few fixes for LCD Smartie (source code / binary)

Post by samali »

Hi, does anyone have plugin fixed by Cranq? Download from .tt does not work, please share the file. Thanks

cranq
Posts: 13
Joined: January 1st, 2014, 6:25 pm

Re: A few fixes for LCD Smartie (source code / binary)

Post by cranq »

Here you go: http://rgho.st/private/7QLRdd2pb/91308e ... b3e1d8e2e5

(I can't put it as attachment, maybe some mod could do it)

skite2001
Posts: 12
Joined: October 21st, 2017, 8:08 pm

Re: A few fixes for LCD Smartie (source code / binary)

Post by skite2001 »

somebody still got the fixed version? this link is dead.

cranq
Posts: 13
Joined: January 1st, 2014, 6:25 pm

Re: A few fixes for LCD Smartie (source code / binary)

Post by cranq »

Here you go: https://goo.gl/JCakvp (this one I'm using right now on my pc)

U can get it also from here: https://sourceforge.net/projects/lcdsmartie/ (included in v5.4.2.92++)

Checksum is different, because I probably recompiled it while checking/testing some stuff (after it was posted on this forum for the first time). Anyway, I will look for sources on my hdd and post it later here.

hydrolisk1792
Site Admin
Posts: 305
Joined: July 23rd, 2010, 8:32 pm
Location: Las Vegas, NV USA
Contact:

Re: A few fixes for LCD Smartie (source code / binary)

Post by hydrolisk1792 »

cranq wrote:
October 23rd, 2017, 5:12 am
Here you go: https://goo.gl/JCakvp (this one I'm using right now on my pc)

U can get it also from here: https://sourceforge.net/projects/lcdsmartie/ (included in v5.4.2.92++)

Checksum is different, because I probably recompiled it while checking/testing some stuff (after it was posted on this forum for the first time). Anyway, I will look for sources on my hdd and post it later here.
You might want to double check the download and the distro you made. My PC comes up with this being a Trojan:Win32/Vigorf.A

Post Reply