summaryrefslogtreecommitdiff
path: root/src/deck_convert_gui.adb
diff options
context:
space:
mode:
Diffstat (limited to 'src/deck_convert_gui.adb')
-rw-r--r--src/deck_convert_gui.adb64
1 files changed, 15 insertions, 49 deletions
diff --git a/src/deck_convert_gui.adb b/src/deck_convert_gui.adb
index 0c352ed..65bc21d 100644
--- a/src/deck_convert_gui.adb
+++ b/src/deck_convert_gui.adb
@@ -1,5 +1,8 @@
+-- This source is licensed under the Sunset License v1.0
+
+
with
Ada.Characters.Handling,
@@ -7,8 +10,8 @@ with
Ada.Exceptions,
Ada.Strings.Unbounded,
Ada.Text_IO,
- Datatypes,
- Deck_IO,
+ Deckdata.IO,
+ Deckdata.Process,
FLTK.Dialogs,
FLTK.Widgets.Boxes,
FLTK.Widgets.Buttons.Enter,
@@ -21,7 +24,7 @@ with
use
Ada.Text_IO,
- Datatypes;
+ Deckdata;
package body Deck_Convert_GUI is
@@ -158,43 +161,6 @@ package body Deck_Convert_GUI is
- procedure Strip_Formatting
- (Notes : in out Note_Vector)
- is
- procedure Strip
- (Text : in out Note;
- Item : in String)
- is
- Position : Natural;
- begin
- for F of Text.Fields loop
- loop
- Position := SU.Index
- (Source => SU.Unbounded_String (F),
- Pattern => Item,
- Going => Ada.Strings.Forward,
- Mapping => Charhand.To_Lower'Access);
- exit when Position = 0;
- SU.Delete (SU.Unbounded_String (F), Position, Position + Item'Length - 1);
- end loop;
- end loop;
- end Strip;
-
- Formatting : array (Positive range <>) of SU.Unbounded_String :=
- (+"<b>", +"</b>", +"<strong>", +"</strong>", +"<i>", +"</i>", +"<em>", +"</em>",
- +"<mark>", +"</mark>", +"<small>", +"</small>", +"<del>", +"</del>",
- +"<ins>", +"</ins>", +"<sub>", +"</sub>", +"<sup>", +"</sup>");
- begin
- for N of Notes loop
- for S of Formatting loop
- Strip (N, -S);
- end loop;
- end loop;
- end Strip_Formatting;
-
-
-
-
task body Worker is
use type FLTK.Widgets.Buttons.State;
use type SU.Unbounded_String;
@@ -206,7 +172,7 @@ package body Deck_Convert_GUI is
Overwrite : Boolean;
Strip_Form : Boolean;
- Deck : Deck_IO.Deck_Handle;
+ Deck : Deckdata.IO.Deck_Handle;
Models : Model_Map;
Notes : Note_Vector;
Media : Media_Collection;
@@ -258,28 +224,28 @@ package body Deck_Convert_GUI is
Status_Box.Set_Label_Color (Status_Black);
Status_Box.Set_Label ("MESSAGE: Opening input deck database...");
Status_Box.Redraw_Label;
- Deck_IO.Open_Database (-Input_Name, Deck);
+ Deckdata.IO.Open_Database (-Input_Name, Deck);
My_Progress.Set_Value (15.0);
My_Progress.Redraw;
Status_Box.Set_Label ("MESSAGE: Querying models...");
Status_Box.Redraw_Label;
- Deck_IO.Query_Models (Deck, Models);
+ Deckdata.IO.Query_Models (Deck, Models);
My_Progress.Set_Value (30.0);
My_Progress.Redraw;
Status_Box.Set_Label ("MESSAGE: Querying notes...");
Status_Box.Redraw_Label;
- Deck_IO.Query_Notes (Deck, Notes);
+ Deckdata.IO.Query_Notes (Deck, Notes);
My_Progress.Set_Value (45.0);
My_Progress.Redraw;
Status_Box.Set_Label ("MESSAGE: Closing database...");
Status_Box.Redraw_Label;
- Deck_IO.Close_Database (Deck);
+ Deckdata.IO.Close_Database (Deck);
My_Progress.Set_Value (60.0);
My_Progress.Redraw;
if Strip_Form then
Status_Box.Set_Label ("MESSAGE: Stripping formatting from notes...");
Status_Box.Redraw_Label;
- Strip_Formatting (Notes);
+ Deckdata.Process.Strip_Formatting (Notes);
My_Progress.Set_Value (70.0);
My_Progress.Redraw;
end if;
@@ -290,7 +256,7 @@ package body Deck_Convert_GUI is
if Deck_Format = "csv" then
Status_Box.Set_Label ("MESSAGE: Writing output to csv...");
Status_Box.Redraw_Label;
- Deck_IO.Write_CSV (Contain_Dir, Simple_Name, Models, Notes, Overwrite);
+ Deckdata.IO.Write_CSV (Contain_Dir, Simple_Name, Models, Notes, Overwrite);
My_Progress.Set_Value (100.0);
My_Progress.Redraw;
Status_Box.Set_Label ("STATUS: Complete success!");
@@ -299,12 +265,12 @@ package body Deck_Convert_GUI is
elsif Deck_Format = "fmd" then
Status_Box.Set_Label ("MESSAGE: Reading media...");
Status_Box.Redraw_Label;
- Deck_IO.Read_Media_Collection (-Input_Name, Media);
+ Deckdata.IO.Read_Media_Collection (-Input_Name, Media);
My_Progress.Set_Value (85.0);
My_Progress.Redraw;
Status_Box.Set_Label ("MESSAGE: Writing output to fmd...");
Status_Box.Redraw_Label;
- Deck_IO.Write_FMD
+ Deckdata.IO.Write_FMD
(Contain_Dir, Simple_Name, Models, Notes, Media, Overwrite);
My_Progress.Set_Value (100.0);
My_Progress.Redraw;