|
63 | 63 | 2019/12/11 Heavily restructured Startup, Main Menu everywhere !
|
64 | 64 | 2019/12/20 Added option --delay-start for when desktop is slow to determine its (dark) colours
|
65 | 65 | 2020/03/30 Allow user to set display colours.
|
| 66 | + 2020/04/10 Make help files non modal |
66 | 67 |
|
67 | 68 | CommandLine Switches
|
68 | 69 |
|
@@ -110,6 +111,9 @@ interface
|
110 | 111 | // These are the possible kinds of main menu items
|
111 | 112 | // type TMenuKind = (mkFileMenu, mkRecentMenu, mkHelpMenu);
|
112 | 113 |
|
| 114 | + |
| 115 | + |
| 116 | + |
113 | 117 | type
|
114 | 118 |
|
115 | 119 | { TMainForm }
|
@@ -155,6 +159,7 @@ TMainForm = class(TForm)
|
155 | 159 | procedure TrayIconClick(Sender: TObject);
|
156 | 160 | procedure TrayMenuTomdroidClick(Sender: TObject);
|
157 | 161 | private
|
| 162 | + HelpList : TStringList; |
158 | 163 | CommsClient : TSimpleIPCClient;
|
159 | 164 | CommsServer : TSimpleIPCServer;
|
160 | 165 | // Don't assign if desktop is KDE and Qt5, it stuffs up in November 2019
|
@@ -280,13 +285,52 @@ procedure TMainForm.SingleNoteMode(FullFileName : string; const CloseOnExit, Vie
|
280 | 285 | if CloseOnExit then Close; // we also use singlenotemode internally in several places
|
281 | 286 | end;
|
282 | 287 |
|
| 288 | + |
283 | 289 | // ---------------- HELP NOTES STUFF ------------------
|
284 | 290 |
|
285 | 291 | procedure TMainForm.ShowHelpNote(HelpNoteName: string);
|
| 292 | +var |
| 293 | + EBox : TEditBoxForm; |
| 294 | + TheForm : TForm; |
| 295 | + Index : integer; |
286 | 296 | begin
|
287 |
| - if FileExists(ActualHelpNotesPath() + HelpNoteName) then |
288 |
| - SingleNoteMode(ActualHelpNotesPath() + HelpNoteName, False, True) |
289 |
| - else showmessage('Unable to find ' + HelpNotesPath + HelpNoteName); |
| 297 | + if FileExists(ActualHelpNotesPath() + HelpNoteName) then begin |
| 298 | + If HelpList = nil then |
| 299 | + HelpList := TStringList.Create |
| 300 | + else begin |
| 301 | + if HelpList.Find(HelpNoteName, Index) then begin |
| 302 | + // Bring TForm(HelpList.Objects[Index]) to front |
| 303 | + TheForm := TForm(HelpList.Objects[Index]); |
| 304 | + try |
| 305 | + //writeln('Attempting a reshow'); |
| 306 | + TheForm.Show; |
| 307 | + SearchForm.MoveWindowHere(TheForm.Caption); |
| 308 | + TheForm.EnsureVisible(true); |
| 309 | + exit; |
| 310 | + except on E: Exception do {showmessage(E.Message)}; |
| 311 | + // If user had this help page open but then closed it entry is still in |
| 312 | + // list so we catch the exception, ignore it and upen a new note. |
| 313 | + // its pretty ugly under debugger but user does not see this. |
| 314 | + end; |
| 315 | + end; |
| 316 | + end; |
| 317 | + // If we did not find it in the list and exit, above, we will make a new one. |
| 318 | + //SingleNoteMode(ActualHelpNotesPath() + HelpNoteName, False, True) |
| 319 | + EBox := TEditBoxForm.Create(Application); |
| 320 | + EBox.SetReadOnly(False); |
| 321 | + EBox.SearchedTerm := ''; |
| 322 | + EBox.NoteTitle:= ''; |
| 323 | + EBox.NoteFileName := ActualHelpNotesPath() + HelpNoteName; |
| 324 | + Ebox.TemplateIs := ''; |
| 325 | + EBox.Show; |
| 326 | + EBox.Dirty := False; |
| 327 | + writeln('Adding to list'); |
| 328 | + HelpList.AddObject(HelpNoteName, EBox); |
| 329 | + HelpList.Sort; |
| 330 | + //showmessage('List is sorted ' + booltostr(HelpList.Sorted, true)); |
| 331 | + HelpList.Sorted:=True; |
| 332 | + |
| 333 | + end else showmessage('Unable to find ' + HelpNotesPath + HelpNoteName); |
290 | 334 | end;
|
291 | 335 |
|
292 | 336 | function TMainForm.ActualHelpNotesPath(): string;
|
@@ -399,6 +443,7 @@ function TMainForm.HaveCMDParam() : boolean;
|
399 | 443 |
|
400 | 444 | procedure TMainForm.FormCreate(Sender: TObject);
|
401 | 445 | begin
|
| 446 | + HelpList := Nil; |
402 | 447 | if Application.HasOption('delay-start') then // This to allow eg Enlightenment to decide its colours.
|
403 | 448 | sleep(2000);
|
404 | 449 | AssignPopupToTray := True;
|
@@ -452,6 +497,8 @@ procedure TMainForm.FormDestroy(Sender: TObject);
|
452 | 497 | begin
|
453 | 498 | freeandnil(CommsServer);
|
454 | 499 | freeandnil(HelpNotes);
|
| 500 | + //if HelpList <> Nil then writeln('Help List has ' + inttostr(HelpList.Count)); |
| 501 | + freeandnil(HelpList); |
455 | 502 | end;
|
456 | 503 |
|
457 | 504 | procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
|
0 commit comments