Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix search panel size #472

Merged
merged 2 commits into from
Feb 26, 2025
Merged

Fix search panel size #472

merged 2 commits into from
Feb 26, 2025

Conversation

zcsahok
Copy link
Member

@zcsahok zcsahok commented Feb 23, 2025

#459 brought up a hidden issue: in order to everything work correctly search panel was initialized twice. First to ensure that the startup messages are shown and then according to the actual CONTEST_MODE configuration.

The second initialization has been suppressed, so we were left with the 9-band non-contest search panel.
image
And there is no way to get it reduced to 6. :CONtest command merely switches iscontest, doesn't resize the panel.

The solution is to drop the early initialization and call ncurses' plain refresh() in showmsg.c. There are no panels at this point yet, so no use calling out refreshp() (=update_panel() + co).

Getting back to :CONtest - it still can't switch panel size according to iscontest.
My view is that this feature is not needed: one shall not switch contest mode while already running TLF. This is a task to be done when configuring a contest or simple QSO setup, before starting TLF.

Taking it one step further, :CFG/:SET shall also be removed (see the long runner #233). As I see we have practically no chance to cleanly restart the program as there is a number of allocated data structures, TCP and serial connections, etc. to be (really) correctly freed and set up anew. User shall simply restart TLF on such configuration changes. It takes just 1 second. (ok, plus the 3 seconds cluster wait, but that's another story...)

was always using non-contest mode (9 bands)
switched to plain refresh() in showmsg.c
has_room_for_message() is bool
@zcsahok zcsahok requested a review from dl1jbe February 23, 2025 17:48
@dl1jbe
Copy link
Member

dl1jbe commented Feb 25, 2025

#459 brought up a hidden issue: in order to everything work correctly search panel was initialized twice. First to ensure that the startup messages are shown and then according to the actual CONTEST_MODE configuration.

The second initialization has been suppressed, so we were left with the 9-band non-contest search panel.
And there is no way to get it reduced to 6. :CONtest command merely switches iscontest, doesn't resize the panel.

I see the problem.

The solution is to drop the early initialization and call ncurses' plain refresh() in showmsg.c. There are no panels at this point yet, so no use calling out refreshp() (=update_panel() + co).

That will work as long as anybody uses showmsg() and relatives only during initialization. Maybe we should enforce that or add at least a comment on the showmsg code stating the problem.

Other ways would be to allow resizing of the searchwindow, having a dummy panel or using an early init for the keyer panel. But I assume it is not worth the work here.

Getting back to :CONtest - it still can't switch panel size according to iscontest.

That would need a resize_panel() for the new window size. But I agree, we should drop the :CONtest command at all.


Taking it one step further, :CFG/:SET shall also be removed (see the long runner #233). As I see we have practically no chance to cleanly restart the program as there is a number of allocated data structures, TCP and serial connections, etc. to be (really) correctly freed and set up anew. User shall simply restart TLF on such configuration changes. It takes just 1 second. (ok, plus the 3 seconds cluster wait, but that's another story...)

+1 from my side.

@zcsahok
Copy link
Member Author

zcsahok commented Feb 25, 2025

I will add a comment to showmsg.c that these functions shall be using in the setup phase only. They are used like this, so all is fine.

As far as I understand showmsg functions are meant to output to the default screen that is then replaced by a new window in main.c.
What is kind of interesting is that mainscreen is created in ui_init(), but actually activated via set_term in the seemingly unrelated packet_init() function. I have the strong suspicion that the code originated a long time ago from a telnet cluster client...

changepars.c needs a rework anyway (getting rid of the mega-switch with hardcoded indexes), will do the dropping in that round.

@dl1jbe
Copy link
Member

dl1jbe commented Feb 26, 2025

I will add a comment to showmsg.c that these functions shall be using in the setup phase only. They are used like this, so all is fine.

Just merge it in afterwards.

As far as I understand showmsg functions are meant to output to the default screen that is then replaced by a new window in main.c. What is kind of interesting is that mainscreen is created in ui_init(), but actually activated via set_term in the seemingly unrelated packet_init() function. I have the strong suspicion that the code originated a long time ago from a telnet cluster client...

Yes that seems to be the case - just look at the first lines of splitscreen.c. VERSIONSPLIT tells you some of the ancestry. See also the complete handling of the packet interface (addtext, history navigation, ....).

At the time I picked up TLF (around '09) there were three terminals - the default one used during startup, a 'packetscreenfor packet interface and a secondmainscreen` used for TLFs main ui. All overlay windows (search, score, keyer, ...) were made programmatically by redrawing hard coded parts of the main ui. That resulted in a lot of problems:

  • difficult to change layout
  • no chance to resize the screens during runtime.

One of the reasons were that 'newterm' was not designed to handle different screen layouts on the same physical display but to switch between different physical consoles.

So I dropped the second packetscreen and switched packet interface and other overlaying windows to ncurses panels. Maybe it is possible to drop the mainscreen also - needs some experiments.

changepars.c needs a rework anyway (getting rid of the mega-switch with hardcoded indexes), will do the dropping in that round.

Ok. Sounds sensible.

@zcsahok zcsahok merged commit bf70155 into Tlf:master Feb 26, 2025
2 checks passed
@zcsahok zcsahok deleted the fix_search_panel branch February 26, 2025 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants