-
Notifications
You must be signed in to change notification settings - Fork 5
/
lea_without_data.adb
99 lines (80 loc) · 3.08 KB
/
lea_without_data.adb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
-- The GWindows* packages need to be available to the compiler.
-- See installation instructions in the header part of the lea.gpr file.
--
with GWindows.Application,
GWindows.Base,
GWindows.GStrings,
GWindows.Message_Boxes,
GWindows.Scintilla,
GWindows.Single_Instance,
GWindows.Types;
with LEA_Common.User_options,
LEA_Common.Color_Themes;
with LEA_GWin.MDI_Main,
LEA_GWin.Installer,
LEA_GWin.Persistence;
with Ada.Command_Line,
Ada.Exceptions;
with GNAT.Traceback.Symbolic;
procedure LEA_Without_Data is
Options : LEA_Common.User_options.Option_Pack_Type renames LEA_Common.User_options.Options;
Top : LEA_GWin.MDI_Main.MDI_Main_Type;
procedure LEA_Process_Argument (Position, Total : Positive; Arg : String) is
begin
Top.Process_Argument (Position, Total, Arg);
end LEA_Process_Argument;
package LEA_Single_Instance is
new GWindows.Single_Instance (LEA_Process_Argument);
use LEA_GWin;
use GWindows.Message_Boxes;
procedure Interactive_crash (
Window : in out GWindows.Base.Base_Window_Type'Class;
E : Ada.Exceptions.Exception_Occurrence)
is
pragma Unreferenced (Window);
small_insult : constant String :=
Ada.Exceptions.Exception_Name (E) & ASCII.LF &
Ada.Exceptions.Exception_Message (E);
insult : constant String :=
small_insult & ASCII.LF &
GNAT.Traceback.Symbolic.Symbolic_Traceback (E);
begin
GWindows.Base.On_Exception_Handler (Handler => null); -- Avoid infinite recursion!
Message_Box
("Crash in LEA",
GWindows.GStrings.To_GString_From_String (insult),
OK_Box);
end Interactive_crash;
procedure LEA_start is
Exit_Requested : Boolean;
LEA_Class_Name : constant GWindows.GString := "LEA_Editor_Class_Name";
LEA_Instance_Name : constant GWindows.GString := "LEA_Editor_Instance";
begin
GWindows.Base.On_Exception_Handler (Handler => Interactive_crash'Unrestricted_Access);
LEA_GWin.Persistence.Blockwise_IO.Load (Options);
LEA_Common.Color_Themes.Select_Theme (Options.color_theme);
LEA_Single_Instance.Manage_Single_Instance
(Application_Class_Name => LEA_Class_Name,
Application_Instance_Name => LEA_Instance_Name,
Exit_Requested => Exit_Requested);
if not Exit_Requested then
Top.Create_MDI_Top ("LEA - starting", CClass => LEA_Class_Name);
Top.Update_Title;
Top.Focus;
GWindows.Application.Message_Loop;
end if;
LEA_GWin.Persistence.Blockwise_IO.Save (Options);
end LEA_start;
begin
-- Message_Box ("GWindows.Scintilla.Int is...",
-- GWindows.Scintilla.Int'Size'Wide_Image & " bits");
if GWindows.Scintilla.SCI_Lexer_DLL_Successfully_Loaded then
-- The file scilexer.dll was found and has been loaded.
null;
else
-- Unpack scilexer.dll as memory stream and into
-- a string. Load it to the Windows system from there.
LEA_GWin.Installer.Load_Scintilla_DLL_from_Memory;
end if;
LEA_start;
end LEA_Without_Data;