Skip to content

Commit

Permalink
New Hide F-Key Template menu and other small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
SMerrony committed Nov 16, 2022
1 parent 1a68c13 commit 4efa0f7
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 18 deletions.
8 changes: 6 additions & 2 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
dashera (0.13.1) stable; urgency=low

[SMerrony]
* Fix issue File|Send (Text) File not sending new-lines
* Issue: Fix File|Send (Text) File not sending new-lines
* Usability: Move terminal Resize menu item back to Emulation menu
* Usability: Move Load F-Key Template to View menu
* Usability: Add new Hide F-Key Template menu item
* Performance: Small improvements in Crt.Draw_Crt

-- SMerrony <merrony@gmail.com> Tue, 15 Nov 2022 10:00:00 +0200
-- SMerrony <merrony@gmail.com> Wed, 16 Nov 2022 10:00:00 +0200

dashera (0.13.0) stable; urgency=low

Expand Down
12 changes: 6 additions & 6 deletions src/crt.adb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ package body Crt is
Display.Cell_Set_Dirty_If_Blinking (Line, Col);
end loop;
end loop;
Display.Set_Dirty;
return True;
end Blink_Timeout_CB;

function Redraw_Timeout_CB (DA : Gtk.Drawing_Area.Gtk_Drawing_Area) return Boolean is
begin
if Display.Is_Dirty then
DA.Queue_Draw;
end if;
DA.Queue_Draw;
return True;
end Redraw_Timeout_CB;

Expand Down Expand Up @@ -113,6 +110,9 @@ package body Crt is
Char_X, Char_Y, Char_UL : Gdouble;
Value : Character;
Blnk, Dm, Rv, Under, Prot : Boolean;
All_Dirty : constant Boolean := Display.Is_Dirty;
Blink_Enabled : constant Boolean := Display.Is_Blink_Enabled;
Blink_State : constant Boolean := Tube.Blink_State;
Decoded_Height : constant Gint := Font.Get_Char_Height;
Decoded_Width : constant Gint := Font.Get_Char_Width;
use Glib;
Expand All @@ -126,7 +126,7 @@ package body Crt is
for Col in 0 .. Display.Get_Visible_Cols - 1 loop
Char_X := Gdouble (Gint (Col) * Decoded_Width);

if Display.Cell_Is_Dirty (Line, Col) then
if All_Dirty or else Display.Cell_Is_Dirty (Line, Col) then

Display.Get_Cell (Line, Col, Value, Blnk, Dm, Rv, Under, Prot);

Expand All @@ -135,7 +135,7 @@ package body Crt is
-- raise Unloaded_Character with "Line:" & Line'Image & " Col:" & Col'Image & " Index :" & Char_Ix'Image;
-- end if;

if Display.Is_Blink_Enabled and then Tube.Blink_State and then Blnk then
if Blnk and then Blink_Enabled and then Blink_State then
Gdk.Cairo.Set_Source_Pixbuf (Cr => Cr,
Pixbuf => Font.Get_Dim_Pixbuf (32),
Pixbuf_X => Char_X, Pixbuf_Y => Char_Y);
Expand Down
38 changes: 28 additions & 10 deletions src/gui.adb
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,9 @@ package body GUI is
end loop;
Ada.Text_IO.Close (Templ_File);
Template_Revealer.Set_Reveal_Child (True);
Template_Revealer.Set_Visible (True);
Hide_Template_Item.Set_Sensitive (True);
Display.Set_Dirty;
else
Log (INFO, "No Template file chosen");
end if;
Expand All @@ -371,6 +374,18 @@ package body GUI is
Title => "DasherA - Error");
end Load_Template_CB;

procedure Hide_Template_CB (Self : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (Self);
begin
Template_Revealer.Set_Reveal_Child (False);
Template_Revealer.Set_Visible (False); -- Required to reclaim vertical space when we resize
Hide_Template_Item.Set_Sensitive (False);
-- Ask for window resize to smaller than we are - the effect
-- is to reduce window size to minimum that contains all content.
Main_Window.Resize (400, 400);
Display.Set_Dirty;
end Hide_Template_CB;

procedure Expect_CB (Self : access Gtk.Menu_Item.Gtk_Menu_Item_Record'Class) is
pragma Unreferenced (Self);
Filename : constant String :=
Expand Down Expand Up @@ -775,7 +790,7 @@ package body GUI is
Menu_Item : Gtk.Menu_Item.Gtk_Menu_Item;
Logging_Item, Expect_Item, Send_File_Item,
History_Item, Resize_Item,
D200_Item, D210_Item, Self_Test_Item, Load_Template_Item,
D200_Item, D210_Item, Self_Test_Item,
Quit_Item,
Paste_Item,
About_Item : Gtk.Menu_Item.Gtk_Menu_Item;
Expand Down Expand Up @@ -849,9 +864,15 @@ package body GUI is
View_Menu.Append (History_Item);
History_Item.On_Activate (View_History_CB'Access);

Gtk_New (Resize_Item, "Resize Terminal");
View_Menu.Append (Resize_Item);
Resize_Item.On_Activate (Resize_CB'Access);
Gtk_New (Sep_Item);
View_Menu.Append (Sep_Item);
Gtk_New (Load_Template_Item, "Load Func. Key Template");
View_Menu.Append (Load_Template_Item);
Load_Template_Item.On_Activate (Load_Template_CB'Access);
Gtk_New (Hide_Template_Item, "Hide Func. Key Template");
View_Menu.Append (Hide_Template_Item);
Hide_Template_Item.Set_Sensitive (False);
Hide_Template_Item.On_Activate (Hide_Template_CB'Access);

-- Emulation

Expand All @@ -868,6 +889,9 @@ package body GUI is

Gtk_New (Sep_Item);
Emulation_Menu.Append (Sep_Item);
Gtk_New (Resize_Item, "Resize Terminal");
Emulation_Menu.Append (Resize_Item);
Resize_Item.On_Activate (Resize_CB'Access);

Gtk_New (Sep_Item);
Emulation_Menu.Append (Sep_Item);
Expand All @@ -876,12 +900,6 @@ package body GUI is
Emulation_Menu.Append (Self_Test_Item);
Self_Test_Item.On_Activate (Self_Test_CB'Access);

Gtk_New (Sep_Item);
Emulation_Menu.Append (Sep_Item);
Gtk_New (Load_Template_Item, "Load Func. Key Template");
Emulation_Menu.Append (Load_Template_Item);
Load_Template_Item.On_Activate (Load_Template_CB'Access);

-- Serial

Gtk_New (Menu_Item, "Serial");
Expand Down
1 change: 1 addition & 0 deletions src/gui.ads
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ package GUI is
Saved_Font_Colour : BDF_Font.Font_Colour_T;

-- Menu items for which we need access...
Load_Template_Item, Hide_Template_Item,
Net_Connect_Item, Net_Disconnect_Item,
Xmodem_Rx_Item, Xmodem_Send_Item, Xmodem_Send1k_Item,
Serial_Connect_Item, Serial_Disconnect_Item : Gtk_Menu_Item;
Expand Down

0 comments on commit 4efa0f7

Please sign in to comment.