Add support for multiple browser windows
This commit is contained in:
parent
8bafbbf0cd
commit
801cf24da7
28
README.md
28
README.md
|
@ -42,13 +42,31 @@ So far, the following keyboard shortcuts are supported:
|
||||||
* Alt+left - Back.
|
* Alt+left - Back.
|
||||||
* Alt+right - Forward.
|
* Alt+right - Forward.
|
||||||
|
|
||||||
|
# How do i build & run it
|
||||||
|
|
||||||
|
At the time of writing, I still have to put up a build toolchain with proper build scripts
|
||||||
|
and such for building outside of Lazarus.
|
||||||
|
|
||||||
|
So to build it right now, you have to open the turbogopher.lpi file with lazarus and build with shift+f9
|
||||||
|
This should produce an executable in the project root directory that you can run from a terminal.
|
||||||
|
Don't run it from within lazarus, because it doesn't know how to handle console stuff.
|
||||||
|
|
||||||
|
# FILES
|
||||||
|
|
||||||
|
The only relevant file right now is /tmp/turbogopher_debug.txt which should contain the last
|
||||||
|
log line (for debugging) - this will go away / be configurable eventually.
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
(very) basic browsing works, but a lot of work is left:
|
(very) basic browsing works, but a lot of work is left:
|
||||||
|
|
||||||
* Opening non-text links and associated mime type handling.
|
* (essential) Opening non-text links and associated mime type handling.
|
||||||
* Opening search links / stuff that takes user input.
|
* (essential) Opening search links / stuff that takes user input.
|
||||||
* A lot of configuration dialogs to allow configuration of keybindings, colors, logfile, loglevel, etc,...
|
* (feature) A lot of configuration dialogs to allow configuration of keybindings, colors, logfile, loglevel, etc,...
|
||||||
* Better UTF-8 to Ansi conversion.
|
* (improvement) Better UTF-8 to Ansi conversion.
|
||||||
* ... stuff?
|
* (essential) Add make scripts for people to build this without lazarus. Add packaging stuff, release pipeline stuff.
|
||||||
|
* (FV bug?) Application does not resize when terminal is resized.
|
||||||
|
* (feature) History menu and/or window.
|
||||||
|
* (feature) ability to download/save pages.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ uses
|
||||||
GopherClient;
|
GopherClient;
|
||||||
|
|
||||||
const cmGo = 1000;
|
const cmGo = 1000;
|
||||||
|
const cmNewBrowser = 1001;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -26,8 +27,11 @@ type
|
||||||
procedure HandleEvent(var Event: TEvent); virtual;
|
procedure HandleEvent(var Event: TEvent); virtual;
|
||||||
procedure InitStatusLine; virtual;
|
procedure InitStatusLine; virtual;
|
||||||
procedure InitMenuBar; virtual;
|
procedure InitMenuBar; virtual;
|
||||||
|
private
|
||||||
|
WindowMenu: PMenu;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
PTurboGopherApplication = ^TTurboGopherApplication;
|
||||||
TTurboGopherApplication = class(TCustomApplication)
|
TTurboGopherApplication = class(TCustomApplication)
|
||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
@ -48,8 +52,6 @@ type
|
||||||
FileLogger: TFileLogger;
|
FileLogger: TFileLogger;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
PTurboGopherApplication = ^TTurboGopherApplication;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
@ -58,6 +60,7 @@ implementation
|
||||||
GoWindow;
|
GoWindow;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
FApplication: PTurboGopherApplication = nil;
|
||||||
FLogWindow: TLogWindow;
|
FLogWindow: TLogWindow;
|
||||||
FGoWindow: TGoWindow;
|
FGoWindow: TGoWindow;
|
||||||
FBrowserWindows: array of TBrowserWindow;
|
FBrowserWindows: array of TBrowserWindow;
|
||||||
|
@ -80,6 +83,13 @@ implementation
|
||||||
FGoWindow.Show();
|
FGoWindow.Show();
|
||||||
ClearEvent(Event);
|
ClearEvent(Event);
|
||||||
end;
|
end;
|
||||||
|
cmNewBrowser:
|
||||||
|
begin
|
||||||
|
if FApplication <> nil then
|
||||||
|
begin
|
||||||
|
FApplication^.CreateBrowserWindow;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -110,6 +120,9 @@ implementation
|
||||||
Rect := default(Objects.TRect);
|
Rect := default(Objects.TRect);
|
||||||
GetExtent(Rect);
|
GetExtent(Rect);
|
||||||
Rect.B.Y := Rect.A.Y + 1;
|
Rect.B.Y := Rect.A.Y + 1;
|
||||||
|
WindowMenu := NewMenu(
|
||||||
|
NewItem('~N~ew browser window', 'Ctrl-T', kbCtrlT, cmNewBrowser, hcNoContext, nil)
|
||||||
|
);
|
||||||
MenuBar := New(
|
MenuBar := New(
|
||||||
PMenuBar,
|
PMenuBar,
|
||||||
Init(
|
Init(
|
||||||
|
@ -122,7 +135,8 @@ implementation
|
||||||
NewSubMenu('~B~rowse', hcNoContext,
|
NewSubMenu('~B~rowse', hcNoContext,
|
||||||
NewMenu(
|
NewMenu(
|
||||||
NewItem('~G~o', 'Alt-G', kbAltG, cmGo, hcNoContext, nil)
|
NewItem('~G~o', 'Alt-G', kbAltG, cmGo, hcNoContext, nil)
|
||||||
), nil
|
),
|
||||||
|
NewSubMenu('~W~indow', hcNoContext, WindowMenu, nil)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -134,16 +148,16 @@ implementation
|
||||||
|
|
||||||
constructor TTurboGopherApplication.Create(TheOwner: TComponent);
|
constructor TTurboGopherApplication.Create(TheOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
ActiveBrowserWindow := 0;
|
ActiveBrowserWindow := 0;
|
||||||
StopOnException := True;
|
StopOnException := True;
|
||||||
TurboGraphicsApplication.Init;
|
TurboGraphicsApplication.Init;
|
||||||
Logger := TLogger.Create;
|
Logger := TLogger.Create;
|
||||||
FileLogger := TFileLogger.Create(@Logger, '/tmp/turbogopher_debug.txt');
|
FileLogger := TFileLogger.Create(@Logger, '/tmp/turbogopher_debug.txt');
|
||||||
Client := TGopherClient.Create(@Logger);
|
Client := TGopherClient.Create(@Logger);
|
||||||
FLogWindow := TLogWindow.Init(Self);
|
FLogWindow := TLogWindow.Init(Self);
|
||||||
FGoWindow := TGoWindow.Create(Self);
|
FGoWindow := TGoWindow.Create(Self);
|
||||||
CreateBrowserWindow;
|
CreateBrowserWindow;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTurboGopherApplication.CreateBrowserWindow;
|
procedure TTurboGopherApplication.CreateBrowserWindow;
|
||||||
|
@ -157,6 +171,7 @@ implementation
|
||||||
var
|
var
|
||||||
ErrorMsg: String;
|
ErrorMsg: String;
|
||||||
begin
|
begin
|
||||||
|
FApplication := @Self;
|
||||||
{ quick check parameters }
|
{ quick check parameters }
|
||||||
ErrorMsg:=CheckOptions('h', 'help');
|
ErrorMsg:=CheckOptions('h', 'help');
|
||||||
if ErrorMsg<>'' then
|
if ErrorMsg<>'' then
|
||||||
|
@ -220,8 +235,7 @@ implementation
|
||||||
|
|
||||||
procedure TTurboGopherApplication.WriteHelp;
|
procedure TTurboGopherApplication.WriteHelp;
|
||||||
begin
|
begin
|
||||||
{ add your help code here }
|
writeln('Usage: ', ExeName, ' -h');
|
||||||
writeln('Usage: ', ExeName, ' -h');
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue