Skip to content

Commit

Permalink
Implement the menu/tool/statusbar checkboxes on the dialers GUI setti…
Browse files Browse the repository at this point in the history
…ngs page

These were new in K95 2.1.3 but this dialer code comes from K95 2.1.2 requiring this feature to be reimplemented from scratch. The implementation is compatible with K95 2.1.3 so these settings should be preserved in any data files previously edited in that version. Data files edited with previous open-source versions will be correctly migrated.

Fixes #266 (K95 bug 718)
  • Loading branch information
davidrg committed Nov 14, 2024
1 parent d4eb4ee commit c8b4704
Show file tree
Hide file tree
Showing 8 changed files with 133 additions and 38 deletions.
9 changes: 9 additions & 0 deletions doc/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ by OpenSSH on modern versions of windows, add the command
* No dialer (crashes when built with Open Watcom)
* No SSL/TLS support (can't be built with Open Watcom)
* No legacy telnet encryption (may return in a future release)
* Reimplemented the three checkboxes in the Dialers GUI settings page for the
menu bar, toolbar and status bar. These options were new in Kermit 95 2.1.3
but were not present in previous open source releases of the dialer as it's
based on code from K95 2.1.2. Any dialer entries edited with the dialer from
C-Kermit for Windows betas 4-6, or Kermit 95 2.1.2 or older, will have these
checkboxes default to ON. Entries last edited with the K95 2.1.3 dialer will
have these three settings preserved. Turning off the GUI bars in this way does
so via command line arguments rather than the new `set gui` commands so they
can't be turned back on with the new `set gui` commands.

### Minor Enhancements and other changes
* All executables (*.exe, *.dll) now have proper versioninfo resources
Expand Down
Binary file modified kermit/dialer/dialer.dat
Binary file not shown.
71 changes: 37 additions & 34 deletions kermit/dialer/dialer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,40 +667,6 @@ const ZIL_NUMBERID DEMO_OK = 0x0003;
const ZIL_NUMBERID DEMO_NOTE = 0x0004;
#endif

#if defined(USE_DIALOG_GUI_SETTINGS)
const ZIL_NUMBERID FIELD_1 = 0x0002;
const ZIL_NUMBERID BUTTON_SET_GUI_OK = 0x0003;
const ZIL_NUMBERID BUTTON_SET_GUI_CANCEL = 0x0004;
const ZIL_NUMBERID BUTTON_SET_GUI_HELP = 0x0005;
const ZIL_NUMBERID CHECK_GUI_USE = 0x0006;
const ZIL_NUMBERID PROMPT_GUI_FACENAME = 0x0007;
const ZIL_NUMBERID PROMPT_GUI_FONTSIZE = 0x0008;
const ZIL_NUMBERID PROMPT_GUI_STARTUP = 0x0009;
const ZIL_NUMBERID PROMPT_GUI_YPOS = 0x000A;
const ZIL_NUMBERID COMBO_GUI_FACENAME = 0x000B;
const ZIL_NUMBERID LIST_GUI_FACENAME = 0x000C;
const ZIL_NUMBERID SPIN_GUI_FONT_SIZE = 0x000D;
const ZIL_NUMBERID GUI_INT_FONT_SIZE = 0x000E;
const ZIL_NUMBERID COMBO_GUI_RESIZE = 0x000F;
const ZIL_NUMBERID LIST_GUI_RESIZE = 0x0010;
const ZIL_NUMBERID BUTTON_GUI_RES_SCALE = 0x0011;
const ZIL_NUMBERID BUTTON_GUI_RES_DIM = 0x0012;
const ZIL_NUMBERID COMBO_GUI_RUN = 0x0013;
const ZIL_NUMBERID LIST_GUI_RUN = 0x0014;
const ZIL_NUMBERID BUTTON_GUI_RUN_RES = 0x0015;
const ZIL_NUMBERID BUTTON_GUI_RUN_MAX = 0x0016;
const ZIL_NUMBERID BUTTON_GUI_RUN_MIN = 0x0017;
const ZIL_NUMBERID CHECK_GUI_DEFAULT_POS = 0x0018;
const ZIL_NUMBERID SPIN_GUI_XPOS = 0x0019;
const ZIL_NUMBERID INT_GUI_XPOS = 0x001A;
const ZIL_NUMBERID SPIN_GUI_YPOS = 0x001B;
const ZIL_NUMBERID INT_GUI_YPOS = 0x001C;
const ZIL_NUMBERID PROMPT_GUI_XPOS = 0x001D;
const ZIL_NUMBERID TABLE_GROUP = 0x001E;
const ZIL_NUMBERID PROMPT_GUI_RESIZE_MODE = 0x001F;
const ZIL_NUMBERID PROMPT_GUI_RUN = 0x0020;
#endif

#if defined(USE_WINDOW_DIALER)
const ZIL_NUMBERID ICON_K95 = 0x0002;
const ZIL_NUMBERID MENU = 0x0003;
Expand Down Expand Up @@ -1104,6 +1070,43 @@ const ZIL_NUMBERID BUTTON_DIALDIR_CANCEL = 0x0006;
const ZIL_NUMBERID BUTTON_DIALDIR_HELP = 0x0007;
#endif

#if defined(USE_DIALOG_GUI_SETTINGS)
const ZIL_NUMBERID FIELD_1 = 0x0002;
const ZIL_NUMBERID BUTTON_SET_GUI_OK = 0x0003;
const ZIL_NUMBERID BUTTON_SET_GUI_CANCEL = 0x0004;
const ZIL_NUMBERID BUTTON_SET_GUI_HELP = 0x0005;
const ZIL_NUMBERID CHECK_GUI_USE = 0x0006;
const ZIL_NUMBERID PROMPT_GUI_FACENAME = 0x0007;
const ZIL_NUMBERID PROMPT_GUI_FONTSIZE = 0x0008;
const ZIL_NUMBERID PROMPT_GUI_STARTUP = 0x0009;
const ZIL_NUMBERID PROMPT_GUI_YPOS = 0x000A;
const ZIL_NUMBERID COMBO_GUI_FACENAME = 0x000B;
const ZIL_NUMBERID LIST_GUI_FACENAME = 0x000C;
const ZIL_NUMBERID SPIN_GUI_FONT_SIZE = 0x000D;
const ZIL_NUMBERID GUI_INT_FONT_SIZE = 0x000E;
const ZIL_NUMBERID COMBO_GUI_RESIZE = 0x000F;
const ZIL_NUMBERID LIST_GUI_RESIZE = 0x0010;
const ZIL_NUMBERID BUTTON_GUI_RES_SCALE = 0x0011;
const ZIL_NUMBERID BUTTON_GUI_RES_DIM = 0x0012;
const ZIL_NUMBERID COMBO_GUI_RUN = 0x0013;
const ZIL_NUMBERID LIST_GUI_RUN = 0x0014;
const ZIL_NUMBERID BUTTON_GUI_RUN_RES = 0x0015;
const ZIL_NUMBERID BUTTON_GUI_RUN_MAX = 0x0016;
const ZIL_NUMBERID BUTTON_GUI_RUN_MIN = 0x0017;
const ZIL_NUMBERID CHECK_GUI_DEFAULT_POS = 0x0018;
const ZIL_NUMBERID SPIN_GUI_XPOS = 0x0019;
const ZIL_NUMBERID INT_GUI_XPOS = 0x001A;
const ZIL_NUMBERID SPIN_GUI_YPOS = 0x001B;
const ZIL_NUMBERID INT_GUI_YPOS = 0x001C;
const ZIL_NUMBERID PROMPT_GUI_XPOS = 0x001D;
const ZIL_NUMBERID TABLE_GROUP = 0x001E;
const ZIL_NUMBERID PROMPT_GUI_RESIZE_MODE = 0x001F;
const ZIL_NUMBERID PROMPT_GUI_RUN = 0x0020;
const ZIL_NUMBERID CHECK_GUI_MENUBAR = 0x002A;
const ZIL_NUMBERID CHECK_GUI_TASKBAR = 0x002C;
const ZIL_NUMBERID CHECK_GUI_STATUSBAR = 0x002D;
#endif

#if defined(USE_DERIVED_OBJECTS)
#endif

15 changes: 15 additions & 0 deletions kermit/dialer/kconnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7451,6 +7451,21 @@ StartKermit( KD_LIST_ITEM * entry, KD_CONFIG * config, KD_LIST_ITEM * def_entry
entry->_startpos_x, entry->_startpos_y,
tmp, entry->_fontsize) ;
}

/* The K95 2.1.3 dialer turned off the GUI bars with command line
* arguments rather than SET GUI commands. I'm not sure if this is
* exactly how it did it, but it works. */
if (!entry->_gui_menu_bar) {
sprintf(buf + strlen(buf), " --nomenubar");
}

if (!entry->_gui_tool_bar) {
sprintf(buf + strlen(buf), " --notoolbar");
}

if (!entry->_gui_status_bar) {
sprintf(buf + strlen(buf), " --nostatusbar");
}
} else
#endif /* WIN32 */
sprintf( buf, "k95.exe \"%s\" -W %d %d", StartKermitFileName,frameID,K_STATUS::Instance ) ;
Expand Down
25 changes: 25 additions & 0 deletions kermit/dialer/ksetgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,27 @@ K_DIALOG_GUI_SETTINGS( KD_LIST_ITEM * entry, enum ENTRYMODE mode )
list = (UIW_VT_LIST *) Get(LIST_GUI_RUN);
SetRunMode(combo,entry->_gui_run);

button = (UIW_BUTTON *)Get(CHECK_GUI_MENUBAR);
if ( entry->_gui_menu_bar )
button->woStatus |= WOS_SELECTED ;
else
button->woStatus &= ~WOS_SELECTED ;
button->Information( I_CHANGED_STATUS, NULL ) ;

button = (UIW_BUTTON *)Get(CHECK_GUI_TASKBAR);
if ( entry->_gui_tool_bar )
button->woStatus |= WOS_SELECTED ;
else
button->woStatus &= ~WOS_SELECTED ;
button->Information( I_CHANGED_STATUS, NULL ) ;

button = (UIW_BUTTON *)Get(CHECK_GUI_STATUSBAR);
if ( entry->_gui_status_bar )
button->woStatus |= WOS_SELECTED ;
else
button->woStatus &= ~WOS_SELECTED ;
button->Information( I_CHANGED_STATUS, NULL ) ;

UI_EVENT event(OPT_INITIALIZED);
event.windowObject = this ;
eventManager->Put(event);
Expand Down Expand Up @@ -871,6 +892,10 @@ ApplyChangesToEntry( void )
_entry->_rgb[i][1] = _rgbData[i].green;
_entry->_rgb[i][2] = _rgbData[i].blue;
}

_entry->_gui_menu_bar = FlagSet(Get(CHECK_GUI_MENUBAR)->woStatus,WOS_SELECTED);
_entry->_gui_tool_bar = FlagSet(Get(CHECK_GUI_TASKBAR)->woStatus,WOS_SELECTED);
_entry->_gui_status_bar = FlagSet(Get(CHECK_GUI_STATUSBAR)->woStatus,WOS_SELECTED);
}

#ifdef WIN32
Expand Down
39 changes: 38 additions & 1 deletion kermit/dialer/lstitm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ KD_LIST_ITEM::KD_LIST_ITEM():
_startpos_auto = 1;
_startpos_x = 0;
_startpos_y = 0;
_gui_menu_bar = 1;
_gui_tool_bar = 1;
_gui_status_bar = 1;

// Idx Colour R G B
// 0 Black 0 0 0
Expand Down Expand Up @@ -712,6 +715,9 @@ KD_LIST_ITEM::KD_LIST_ITEM(KD_LIST_ITEM & item):
_startpos_auto = item._startpos_auto;
_startpos_x = item._startpos_x;
_startpos_y = item._startpos_y;
_gui_menu_bar = item._gui_menu_bar;
_gui_tool_bar = item._gui_tool_bar;
_gui_status_bar = item._gui_status_bar;
_rgb[0][0] = item._rgb[0][0];
_rgb[0][1] = item._rgb[0][1];
_rgb[0][2] = item._rgb[0][2];
Expand Down Expand Up @@ -1045,6 +1051,9 @@ KD_LIST_ITEM::KD_LIST_ITEM(TRANSPORT tType,
_startpos_auto = 1;
_startpos_x = 0;
_startpos_y = 0;
_gui_menu_bar = 1;
_gui_tool_bar = 1;
_gui_status_bar = 1;
_rgb[0][0] = 0;
_rgb[0][1] = 0;
_rgb[0][2] = 0;
Expand Down Expand Up @@ -1671,6 +1680,9 @@ KD_LIST_ITEM::KD_LIST_ITEM(const ZIL_ICHAR *name, ZIL_STORAGE_READ_ONLY *directo
_startpos_auto = 1;
_startpos_x = 0;
_startpos_y = 0;
_gui_menu_bar = 1;
_gui_tool_bar = 1;
_gui_status_bar = 1;
_rgb[0][0] = 0;
_rgb[0][1] = 0;
_rgb[0][2] = 0;
Expand Down Expand Up @@ -2920,6 +2932,7 @@ void KD_LIST_ITEM::Load(const ZIL_ICHAR *name, ZIL_STORAGE_READ_ONLY *directory,
}

// ver_1_37:
// ver_1_38:
if ( itemMinor < 37 ) {
_ssh2_cipher_aes128ctr = 1;
_ssh2_cipher_aes192ctr = 1;
Expand Down Expand Up @@ -2955,7 +2968,25 @@ void KD_LIST_ITEM::Load(const ZIL_ICHAR *name, ZIL_STORAGE_READ_ONLY *directory,
_ssh2_kex_dh_group1_sha1 = 1;
_ssh2_kex_ext_info_c = 1;
_ssh2_kex_dh_group_exchange_sha1 = 1;
}

if (itemMinor == 38 || itemMinor < 37) {
/* These settings only existed in 1.37 (K95 2.1.3) and 1.39+
* (K95 3.0 beta7+). Version 1.38 (K95 3.0 betas 4 through 6) didn't
* have it as the open-source dialer code is based something slightly
* older than K95 2.1.3, so they had to be reimplemented. v1.37 stores
* these settings in this order in the file, while 1.38 stored the
* new SSH settings starting here. */
_gui_menu_bar = 1;
_gui_tool_bar = 1;
_gui_status_bar = 1;
} else {
file->Load(&_gui_menu_bar);
file->Load(&_gui_tool_bar);
file->Load(&_gui_status_bar);
}

if ( itemMinor >= 38 ) {
file->Load(&_ssh2_cipher_aes128ctr);
file->Load(&_ssh2_cipher_aes192ctr);
file->Load(&_ssh2_cipher_aes256ctr);
Expand Down Expand Up @@ -3482,7 +3513,13 @@ void KD_LIST_ITEM::Store(const ZIL_ICHAR *name, ZIL_STORAGE *directory,
// itemMinor = 36
file->Store(Enum = _printer_charset) ;

// itemMinor = 37
// itemMinor = 37 || itemMinor > 38
// (these appeared in 1.37 (K95 2.1.3) and 1.39+ (K95 3.0 beta7)
file->Store(_gui_menu_bar);
file->Store(_gui_tool_bar);
file->Store(_gui_status_bar);

// itemMinor = 38
file->Store(_ssh2_cipher_aes128ctr);
file->Store(_ssh2_cipher_aes192ctr);
file->Store(_ssh2_cipher_aes256ctr);
Expand Down
3 changes: 3 additions & 0 deletions kermit/dialer/lstitm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ class ZIL_EXPORT_CLASS KD_LIST_ITEM : public UIW_BUTTON
ZIL_UINT16 _startpos_x;
ZIL_UINT16 _startpos_y;
ZIL_UINT8 _rgb[16][3];
ZIL_UINT8 _gui_menu_bar,
_gui_tool_bar,
_gui_status_bar;

ZIL_UINT8 _ssh_credfwd;

Expand Down
9 changes: 6 additions & 3 deletions kermit/dialer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ K_CONNECTOR *connector = NULL ;
UIW_TOOL_BAR *toolbar = NULL ;
UID_TIMER * timer = NULL ;

/* Dialer 1.37 = Final Kermit 95 release? (either 2.1.2 or 2.1.3)
* Dialer 1.38 = Kermit 95 3.0 (open source)
/* Dialer 1.37 = Kermit 95 2.1.3
* Dialer 1.38 = Kermit 95 3.0 (open source) beta 4
* Updated the SSH settings
* Dialer 1.39 = Kermit 95 3.0 (open source) beta 7
* reimplemented GUI menu/tool/statusbar checkboxes from 2.1.3
*/
ZIL_UINT8 kd_major = 1, kd_minor = 38;
ZIL_UINT8 kd_major = 1, kd_minor = 39;

ZIL_ICHAR * pathname = "";
ZIL_UINT8 TapiAvail = 0;
Expand Down

0 comments on commit c8b4704

Please sign in to comment.