Skip to content

Commit

Permalink
Minor stuff for 0.13.2 - remove code dependency on latest GtkAda so o…
Browse files Browse the repository at this point in the history
…lder platforms can build.
  • Loading branch information
SMerrony committed Nov 20, 2022
1 parent 8295422 commit bcde83b
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 15 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ DasherA is [hosted on GitHub](https://github.com/SMerrony/dashera).

A binary version for 64-bit Debian-based systems *may* be available as part of a release.

I would love to be able to provide a Windows binary, but I don't have the required
facilities. If anyone could help with this, please do get in touch.

## Build

Dashera has moved to the [Alire](https://alire.ada.dev/) build system.
### Alire

Dashera has moved to the [Alire](https://alire.ada.dev/) build system (but see below).

[![Alire](https://img.shields.io/endpoint?url=https://alire.ada.dev/badges/dashera.json)](https://alire.ada.dev/crates/dashera.html)

Expand All @@ -47,6 +52,16 @@ alr build
```
N.B. If you have not built a GtkAda crate (the GUI toolkit we use) recently then Alire will automatically download and build that before building Dashera itself. This can take some time when it first happens, subsequent builds should be much faster.

### Non-Alire

If you cannot use Alire, it should still be possible to build Dashera with gprbuild...
```
gprbuild -Pnon_alire
```
Ignore the warning about file name not matching project name.

Without Alire you will have to manually ensure that dependencies (eg. GtkAda) are installed.

## Run
`.bin/dashera`

Expand All @@ -66,9 +81,7 @@ You need the DASHER font and icon to be in the same directory as the executable
## Operational Notes
* The DASHER 'CR' (carriage-return, no line-feed) is available from both the GUI 'CR' button and the
numeric keypad enter key (if present).
* The DASHER 'Hold' key is available from both the GUI 'Hold' button and the PC-style 'Pause'
button (if present).
* The BELL sound will only work if DasherA is started from a terminal supporting such an event,
or if the windowing system permits Window Beeps. In Mint 20, the critical setting is
or if the windowing system permits Window Beeps. In Mint 20+, the critical setting is
Accessibility => Keyboard => Event Feedback => Sound to use for window alerts.

10 changes: 10 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
dashera (0.13.2) stable; urgency=low

[SMerrony]
* Build: Remove call to Set_Monospace in Gui so GtkAda v21 still works
* Build: Reintroduce non-Alire build config
* Docs: Update README.md to include non-Alire build
* Usability: Add more info to message when Telnet fails to connect

-- SMerrony <merrony@gmail.com> Sun, 20 Nov 2022 10:00:00 +0200

dashera (0.13.1) stable; urgency=low

[SMerrony]
Expand Down
File renamed without changes.
34 changes: 25 additions & 9 deletions src/gui.adb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
-- THE SOFTWARE.

with Ada.Directories;
with Ada.Exceptions; use Ada.Exceptions;
with Ada.Sequential_IO;
with Ada.Strings.Fixed;
with Ada.Text_IO;
Expand Down Expand Up @@ -634,8 +635,10 @@ package body GUI is
Saved_Host := To_Unbounded_String (Host_Str);
Saved_Port := To_Unbounded_String (Port_Entry.Get_Text);
exception
when others =>
Unused_Buttons := Gtkada.Dialogs.Message_Dialog (Msg => "Could not connect",
when Error : others =>
Log (DEBUG, Exception_Information (Error));
Unused_Buttons := Gtkada.Dialogs.Message_Dialog (Msg => "Could not connect. " &
Exception_Information (Error),
Title => "DasherA - Error");
end;
end if;
Expand All @@ -659,11 +662,18 @@ package body GUI is
use Gtk.Scrolled_Window;
use Gtk.Text_Buffer;
use Gtk.Text_View;
Dialog : Gtk_Dialog;
Dlg_Box : Gtk.Box.Gtk_Box;
Dialog : Gtk_Dialog;
Dlg_Box : Gtk.Box.Gtk_Box;
FProvider : constant Gtk.Css_Provider.Gtk_Css_Provider := Gtk.Css_Provider.Gtk_Css_Provider_New;
CSS : constant String :=
"textview.view {" & ASCII.LF
& " font-family: monospace;" & ASCII.LF
& "}" & ASCII.LF;
Error : aliased Glib.Error.GError;
Dummy : Boolean;
Scrollable : Gtk_Scrolled_Window;
View : Gtk_Text_View;
Buffer : Gtk_Text_Buffer;
View : Gtk_Text_View;
Buffer : Gtk_Text_Buffer;
Close_Unused : Gtk.Widget.Gtk_Widget;
H_First, H_Last, H_Line : Integer;
begin
Expand All @@ -675,7 +685,12 @@ package body GUI is
Gtk_New (Scrollable);
Gtk_New (View);
View.Set_Editable (False);
View.Set_Monospace (True);
-- View.Set_Monospace (True);
Dummy := FProvider.Load_From_Data (CSS, Error'Access);
if not Dummy then
Log (Logging.ERROR, "Loading CSS from data");
end if;
Apply_Css (Widget => View, Provider => +FProvider);
Buffer := View.Get_Buffer;
Buffer.Set_Text (" *** Start of History ***");
H_First := Display_P.Display.Get_First_History_Line;
Expand Down Expand Up @@ -1370,8 +1385,9 @@ package body GUI is
Saved_Host := To_Unbounded_String (Host_Str);
Saved_Port := To_Unbounded_String (Slice (Host_Arg, Colon_Ix + 1, Length (Host_Arg)));
exception
when others =>
Unused_Buttons := Gtkada.Dialogs.Message_Dialog (Msg => "Could not connect to host",
when Error : others =>
Unused_Buttons := Gtkada.Dialogs.Message_Dialog (Msg => "Could not connect. " &
Exception_Information (Error),
Title => "DasherA - Error");
end;
end if;
Expand Down
2 changes: 1 addition & 1 deletion src/gui.ads
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ package GUI is
package Handlers is new Gtk.Handlers.Callback (Widget_Type => Gtk.Widget.Gtk_Widget_Record);
package SB_Timeout_P is new Glib.Main.Generic_Sources (Gtk.Box.Gtk_Box);

App_SemVer : constant String := "0.13.1"; -- TODO Update Version each release!
App_SemVer : constant String := "0.13.2"; -- TODO Update Version each release!
App_Title : constant String := "DasherA";
App_Comment : constant String := "A Data General DASHER terminal emulator";
App_Author : constant String := "Stephen Merrony";
Expand Down
3 changes: 2 additions & 1 deletion src/telnet.adb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ package body Telnet is
begin
-- Exceptions should be handled by caller
GNAT.Sockets.Create_Socket (Sess.Conn);
Log (DEBUG, "Host: " & Host_Str & ", Port: " & Port_Num'Image);
Log (DEBUG, "Telnet - Host: " & Host_Str & ", Port: " & Port_Num'Image);
Address.Addr := GNAT.Sockets.Addresses (GNAT.Sockets.Get_Host_By_Name (Host_Str), 1);
Address.Port := GNAT.Sockets.Port_Type (Port_Num);
GNAT.Sockets.Connect_Socket (Sess.Conn, Address);
Log (DEBUG, "Telnet - Socket connected");
-- GNAT.Sockets.Set_Socket_Option (Socket => Sess.Conn, Option => (No_Delay, True));
Sess.Host_Str := To_Unbounded_String (Host_Str);
Sess.Port_Num := Port_Num;
Expand Down

0 comments on commit bcde83b

Please sign in to comment.