Skip to content

Commit

Permalink
fix machine list refresh on beam module exit
Browse files Browse the repository at this point in the history
  • Loading branch information
alanphys committed Mar 24, 2020
1 parent b6e1a99 commit 864362b
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 56 deletions.
Binary file modified opf
Binary file not shown.
Binary file modified opf.exe
100644 → 100755
Binary file not shown.
83 changes: 42 additions & 41 deletions opf.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
</Flags>
<MainUnit Value="0"/>
<Title Value="opf"/>
<Icon Value="0"/>
</General>
<MacroValues Count="1">
<Macro1 Name="LCLWidgetType" Value="qt5"/>
Expand Down Expand Up @@ -69,8 +70,10 @@
<ComponentName Value="OPFForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<TopLine Value="10"/>
<CursorPos X="50" Y="46"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="19"/>
<CursorPos X="54" Y="48"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
Expand Down Expand Up @@ -365,7 +368,7 @@
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="3"/>
<CursorPos X="44" Y="38"/>
<UsageCount Value="114"/>
<UsageCount Value="117"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit47>
Expand Down Expand Up @@ -547,9 +550,9 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<EditorIndex Value="2"/>
<TopLine Value="186"/>
<TopLine Value="185"/>
<CursorPos X="20" Y="181"/>
<UsageCount Value="23"/>
<UsageCount Value="26"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit73>
Expand Down Expand Up @@ -588,135 +591,133 @@
<ComponentName Value="BeamForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="82"/>
<CursorPos X="38" Y="103"/>
<UsageCount Value="22"/>
<CursorPos X="92" Y="100"/>
<UsageCount Value="25"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit78>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="opfunit.pas"/>
<Caret Line="445" Column="10" TopLine="413"/>
<Caret Line="525" Column="13" TopLine="493"/>
</Position1>
<Position2>
<Filename Value="opfunit.pas"/>
<Caret Line="446" Column="10" TopLine="414"/>
<Caret Line="527" Column="13" TopLine="495"/>
</Position2>
<Position3>
<Filename Value="opfunit.pas"/>
<Caret Line="525" Column="13" TopLine="493"/>
<Caret Line="528" Column="32" TopLine="496"/>
</Position3>
<Position4>
<Filename Value="opfunit.pas"/>
<Caret Line="527" Column="13" TopLine="495"/>
<Caret Line="529" Column="13" TopLine="503"/>
</Position4>
<Position5>
<Filename Value="opfunit.pas"/>
<Caret Line="528" Column="32" TopLine="496"/>
<Caret Line="148" Column="51" TopLine="119"/>
</Position5>
<Position6>
<Filename Value="opfunit.pas"/>
<Caret Line="529" Column="13" TopLine="503"/>
<Caret Line="825" Column="22" TopLine="816"/>
</Position6>
<Position7>
<Filename Value="opfunit.pas"/>
<Caret Line="148" Column="51" TopLine="119"/>
<Caret Line="870" Column="11" TopLine="837"/>
</Position7>
<Position8>
<Filename Value="opfunit.pas"/>
<Caret Line="825" Column="22" TopLine="816"/>
<Caret Line="849" Column="37" TopLine="829"/>
</Position8>
<Position9>
<Filename Value="opfunit.pas"/>
<Caret Line="870" Column="11" TopLine="837"/>
<Caret Line="10" Column="20"/>
</Position9>
<Position10>
<Filename Value="opfunit.pas"/>
<Caret Line="849" Column="37" TopLine="829"/>
<Caret Line="18" Column="31"/>
</Position10>
<Position11>
<Filename Value="opfunit.pas"/>
<Caret Line="10" Column="20"/>
<Caret Line="254" Column="69" TopLine="222"/>
</Position11>
<Position12>
<Filename Value="opfunit.pas"/>
<Caret Line="18" Column="31"/>
<Caret Line="255" Column="63" TopLine="223"/>
</Position12>
<Position13>
<Filename Value="opfunit.pas"/>
<Caret Line="254" Column="69" TopLine="222"/>
<Caret Line="355" Column="9" TopLine="323"/>
</Position13>
<Position14>
<Filename Value="opfunit.pas"/>
<Caret Line="255" Column="63" TopLine="223"/>
<Caret Line="369" Column="6" TopLine="337"/>
</Position14>
<Position15>
<Filename Value="opfunit.pas"/>
<Caret Line="355" Column="9" TopLine="323"/>
<Caret Line="504" Column="12" TopLine="472"/>
</Position15>
<Position16>
<Filename Value="opfunit.pas"/>
<Caret Line="369" Column="6" TopLine="337"/>
<Caret Line="600" Column="32" TopLine="568"/>
</Position16>
<Position17>
<Filename Value="opfunit.pas"/>
<Caret Line="504" Column="12" TopLine="472"/>
<Caret Line="606" Column="19" TopLine="568"/>
</Position17>
<Position18>
<Filename Value="opfunit.pas"/>
<Caret Line="600" Column="32" TopLine="568"/>
<Caret Line="606" Column="29" TopLine="586"/>
</Position18>
<Position19>
<Filename Value="opfunit.pas"/>
<Caret Line="606" Column="19" TopLine="568"/>
<Caret Line="111" Column="19" TopLine="88"/>
</Position19>
<Position20>
<Filename Value="opfunit.pas"/>
<Caret Line="606" Column="29" TopLine="586"/>
<Caret Line="422" Column="4" TopLine="420"/>
</Position20>
<Position21>
<Filename Value="opfunit.pas"/>
<Caret Line="111" Column="19" TopLine="88"/>
<Caret Line="441" TopLine="421"/>
</Position21>
<Position22>
<Filename Value="opfunit.pas"/>
<Caret Line="422" Column="4" TopLine="420"/>
<Caret Line="436" TopLine="421"/>
</Position22>
<Position23>
<Filename Value="opfunit.pas"/>
<Caret Line="441" TopLine="421"/>
<Caret Line="427" Column="28" TopLine="408"/>
</Position23>
<Position24>
<Filename Value="opfunit.pas"/>
<Caret Line="436" TopLine="421"/>
<Caret Line="434" Column="33" TopLine="414"/>
</Position24>
<Position25>
<Filename Value="opfunit.pas"/>
<Caret Line="427" Column="28" TopLine="408"/>
<Caret Line="55" Column="4" TopLine="28"/>
</Position25>
<Position26>
<Filename Value="opfunit.pas"/>
<Caret Line="434" Column="33" TopLine="414"/>
<Caret Line="44" Column="31" TopLine="29"/>
</Position26>
<Position27>
<Filename Value="opfunit.pas"/>
<Caret Line="55" Column="4" TopLine="28"/>
<Caret Line="304" Column="16" TopLine="290"/>
</Position27>
<Position28>
<Filename Value="opfunit.pas"/>
<Caret Line="44" Column="31" TopLine="29"/>
<Filename Value="beamunit.pas"/>
<Caret Line="11" Column="50"/>
</Position28>
<Position29>
<Filename Value="opfunit.pas"/>
<Caret Line="304" Column="16" TopLine="290"/>
<Caret Line="995" TopLine="976"/>
</Position29>
<Position30>
<Filename Value="beamunit.pas"/>
<Caret Line="11" Column="50"/>
<Filename Value="opfunit.pas"/>
<Caret Line="445" Column="47" TopLine="430"/>
</Position30>
</JumpHistory>
</ProjectOptions>
Expand Down
Binary file modified opf.res
Binary file not shown.
52 changes: 37 additions & 15 deletions opfunit.pas
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@
5/2/2020 remove expiry check
7//2/2020 fix save as file name error
update statusbar messaging system and refactor
implemented login module}
implemented login module
17/3/2020 add refresh linac list on beam module exit}

{$mode DELPHI}{$H+}

Expand Down Expand Up @@ -264,6 +265,7 @@ TOPFForm = class(TForm)
procedure OPFFormCloseQuery(Sender: TObject; var CanClose: boolean);
procedure OpenMenuClick(Sender: TObject);
procedure ReadLinac(FileName:string);
procedure ListLinacs;
procedure OPFFormCreate(Sender: TObject);
procedure PutData(var PatRec:TPatRec);
function GetData(var PatRec:TPatRec):boolean;
Expand Down Expand Up @@ -421,14 +423,26 @@ procedure TOpfForm.StatusBarDrawPanel(SBar: TStatusBar;Panel: TStatusPanel;


procedure TOPFForm.miManageClick(Sender: TObject);
var BeamForm: TBeamForm;
var BeamForm :TBeamForm;
Current :string;

begin
ClearStatus;
Current := cbMachine.Text;
try
BeamForm := TBeamForm.Create(self);
BeamForm.ShowModal;
finally
BeamForm.Free;
end;
ListLinacs;
cbMachine.ItemIndex := cbMachine.Items.IndexOf(Current);
if cbMachine.ItemIndex < 0 then
begin
OPFError('Could not find previous machine.');
cbMachine.ItemIndex := 0;
end;
ReadLinac(cbMachine.Items[cbMachine.ItemIndex]);
end;


Expand Down Expand Up @@ -645,6 +659,22 @@ procedure TOpfForm.ReadLinac(FileName:string);
end;


procedure TOPFForm.ListLinacs;
var SearchRec :TSearchRec;
FileName :string;

begin
CBMachine.Items.Clear;
if FindFirst('*.bdf',0,SearchRec)=0 then
repeat
FileName := ExtractFileName(SearchRec.Name);
FileName := Copy(FileName,1,length(FileName) - 4);
CBMachine.Items.Add(FileName);
until FindNext(SearchRec)<>0;
FindClose(SearchRec);
end;


procedure TOPFForm.OPFFormClose(Sender: TObject; var CloseAction: TCloseAction);
begin
if Pat <> nil then Pat.Free;
Expand Down Expand Up @@ -921,9 +951,7 @@ procedure TOPFForm.OpenMenuClick(Sender: TObject);


procedure TOPFForm.OPFFormCreate(Sender: TObject);
var SearchRec: TSearchRec;
FileName,
sExePath: string;
var sExePath: string;

begin
Linac := nil;
Expand Down Expand Up @@ -976,23 +1004,17 @@ procedure TOPFForm.OPFFormCreate(Sender: TObject);
FileHandler.DirIndexList.Add('index.cgi');
FileHandler.RegisterHandler(PHPCGIHandler);

CBMachine.Items.Clear;
if FindFirst('*.bdf',0,SearchRec)=0 then
repeat
FileName := ExtractFileName(SearchRec.Name);
FileName := Copy(FileName,1,length(FileName) - 4);
CBMachine.Items.Add(FileName);
until FindNext(SearchRec)<>0;
FindClose(SearchRec);
ListLinacs;
if CBMachine.Items.Count <> 0 then
begin
cbMachine.ItemIndex := 0;
ReadLinac(CBMachine.Items[0]);
end
else
begin
ShowMessage('No beam data files exist! Please create a file using Beam.');
Halt;
Fault := true;
OPFError('No beam data files exist! Please create a file using Beam.');
{Halt};
end;

{check if server is running}
Expand Down

0 comments on commit 864362b

Please sign in to comment.