Starts adding the modules UI

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1954 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-09-15 12:07:03 +00:00
parent b2e30cdc23
commit d02c83c767
5 changed files with 140 additions and 84 deletions

View File

@ -25,7 +25,7 @@ uses
{$ifdef FPBROWSER_TURBOPOWERIPRO} {$ifdef FPBROWSER_TURBOPOWERIPRO}
viewer_ipro, viewer_ipro,
{$endif} {$endif}
browserviewer; browserviewer, utf8_braille;
begin begin
Application.Initialize; Application.Initialize;

View File

@ -44,7 +44,7 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item4> </Item4>
</RequiredPackages> </RequiredPackages>
<Units Count="10"> <Units Count="11">
<Unit0> <Unit0>
<Filename Value="fpbrowser.dpr"/> <Filename Value="fpbrowser.dpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -101,6 +101,11 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="viewer_ipro"/> <UnitName Value="viewer_ipro"/>
</Unit9> </Unit9>
<Unit10>
<Filename Value="utf8_braille.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="utf8_braille"/>
</Unit10>
</Units> </Units>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -3,7 +3,7 @@ object formBrowser: TformBrowser
Height = 439 Height = 439
Top = 186 Top = 186
Width = 621 Width = 621
ClientHeight = 439 ClientHeight = 412
ClientWidth = 621 ClientWidth = 621
Color = clBtnFace Color = clBtnFace
Font.Color = clWindowText Font.Color = clWindowText
@ -18,7 +18,7 @@ object formBrowser: TformBrowser
object panelBottom: TPanel object panelBottom: TPanel
Left = 0 Left = 0
Height = 18 Height = 18
Top = 421 Top = 394
Width = 621 Width = 621
Align = alBottom Align = alBottom
Alignment = taLeftJustify Alignment = taLeftJustify
@ -39,14 +39,14 @@ object formBrowser: TformBrowser
Left = 319 Left = 319
Height = 16 Height = 16
Top = 3 Top = 3
Width = 22 Width = 21
Caption = 'Idle' Caption = 'Idle'
ParentColor = False ParentColor = False
end end
end end
object pageBrowser: TPageControl object pageBrowser: TPageControl
Left = 0 Left = 0
Height = 421 Height = 394
Top = 0 Top = 0
Width = 621 Width = 621
Align = alClient Align = alClient
@ -121,7 +121,7 @@ object formBrowser: TformBrowser
OnClick = SelectAllItemClick OnClick = SelectAllItemClick
end end
end end
object options1: TMenuItem object menuOptions: TMenuItem
Caption = '&Tools' Caption = '&Tools'
object ShowImages: TMenuItem object ShowImages: TMenuItem
Caption = '&Show images' Caption = '&Show images'
@ -135,6 +135,9 @@ object formBrowser: TformBrowser
Caption = 'View Source and Debug info' Caption = 'View Source and Debug info'
OnClick = menuViewDebugClick OnClick = menuViewDebugClick
end end
object menuToolsModules: TMenuItem
Caption = 'Modules'
end
end end
object HistoryMenuItem: TMenuItem object HistoryMenuItem: TMenuItem
Caption = '&History' Caption = '&History'

View File

@ -2,19 +2,19 @@
LazarusResources.Add('TformBrowser','FORMDATA',[ LazarusResources.Add('TformBrowser','FORMDATA',[
'TPF0'#12'TformBrowser'#11'formBrowser'#4'Left'#3'G'#1#6'Height'#3#183#1#3'To' 'TPF0'#12'TformBrowser'#11'formBrowser'#4'Left'#3'G'#1#6'Height'#3#183#1#3'To'
+'p'#3#186#0#5'Width'#3'm'#2#12'ClientHeight'#3#183#1#11'ClientWidth'#3'm'#2#5 +'p'#3#186#0#5'Width'#3'm'#2#12'ClientHeight'#3#156#1#11'ClientWidth'#3'm'#2#5
+'Color'#7#9'clBtnFace'#10'Font.Color'#7#12'clWindowText'#11'Font.Height'#2 +'Color'#7#9'clBtnFace'#10'Font.Color'#7#12'clWindowText'#11'Font.Height'#2
+#243#9'Font.Name'#6#5'Arial'#4'Menu'#7#8'MainMenu'#8'OnCreate'#7#10'FormCrea' +#243#9'Font.Name'#6#5'Arial'#4'Menu'#7#8'MainMenu'#8'OnCreate'#7#10'FormCrea'
+'te'#9'OnDestroy'#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#8'Position'#7#14 +'te'#9'OnDestroy'#7#11'FormDestroy'#6'OnShow'#7#8'FormShow'#8'Position'#7#14
+'poScreenCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TPanel'#11'panelBottom'#4'Le' +'poScreenCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TPanel'#11'panelBottom'#4'Le'
+'ft'#2#0#6'Height'#2#18#3'Top'#3#165#1#5'Width'#3'm'#2#5'Align'#7#8'alBottom' +'ft'#2#0#6'Height'#2#18#3'Top'#3#138#1#5'Width'#3'm'#2#5'Align'#7#8'alBottom'
+#9'Alignment'#7#13'taLeftJustify'#10'BevelInner'#7#9'bvLowered'#10'BevelOute' +#9'Alignment'#7#13'taLeftJustify'#10'BevelInner'#7#9'bvLowered'#10'BevelOute'
+'r'#7#6'bvNone'#12'ClientHeight'#2#18#11'ClientWidth'#3'm'#2#8'TabOrder'#2#0 +'r'#7#6'bvNone'#12'ClientHeight'#2#18#11'ClientWidth'#3'm'#2#8'TabOrder'#2#0
+#0#12'TProgressBar'#11'ProgressBar'#4'Left'#3#214#1#6'Height'#2#16#3'Top'#2#1 +#0#12'TProgressBar'#11'ProgressBar'#4'Left'#3#214#1#6'Height'#2#16#3'Top'#2#1
+#5'Width'#3#150#0#5'Align'#7#7'alRight'#8'TabOrder'#2#0#0#0#6'TLabel'#13'lab' +#5'Width'#3#150#0#5'Align'#7#7'alRight'#8'TabOrder'#2#0#0#0#6'TLabel'#13'lab'
+'elProgress'#4'Left'#3'?'#1#6'Height'#2#16#3'Top'#2#3#5'Width'#2#22#7'Captio' +'elProgress'#4'Left'#3'?'#1#6'Height'#2#16#3'Top'#2#3#5'Width'#2#21#7'Captio'
+'n'#6#4'Idle'#11'ParentColor'#8#0#0#0#12'TPageControl'#11'pageBrowser'#4'Lef' +'n'#6#4'Idle'#11'ParentColor'#8#0#0#0#12'TPageControl'#11'pageBrowser'#4'Lef'
+'t'#2#0#6'Height'#3#165#1#3'Top'#2#0#5'Width'#3'm'#2#5'Align'#7#8'alClient'#8 +'t'#2#0#6'Height'#3#138#1#3'Top'#2#0#5'Width'#3'm'#2#5'Align'#7#8'alClient'#8
+'TabOrder'#2#1#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.htm'#6 +'TabOrder'#2#1#0#0#11'TOpenDialog'#10'OpenDialog'#10'DefaultExt'#6#4'.htm'#6
+'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofHideRe' +'Filter'#6'%html files|*.htm;*.html|all files|*.*'#7'Options'#11#14'ofHideRe'
+'adOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'#1#3'top'#2#2 +'adOnly'#15'ofPathMustExist'#15'ofFileMustExist'#0#4'left'#3'I'#1#3'top'#2#2
@ -34,26 +34,26 @@ LazarusResources.Add('TformBrowser','FORMDATA',[
+#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Copy'#8'Short' +#7#10'Find1Click'#0#0#9'TMenuItem'#8'CopyItem'#7'Caption'#6#5'&Copy'#8'Short'
+'Cut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'#7'Caption' +'Cut'#3'C@'#7'OnClick'#7#13'CopyItemClick'#0#0#9'TMenuItem'#2'N2'#7'Caption'
+#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select &All'#7'En' +#6#1'-'#0#0#9'TMenuItem'#13'SelectAllItem'#7'Caption'#6#11'Select &All'#7'En'
+'abled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#8'options1' +'abled'#8#7'OnClick'#7#18'SelectAllItemClick'#0#0#0#9'TMenuItem'#11'menuOpti'
+#7'Caption'#6#6'&Tools'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6#12'&Show ' +'ons'#7'Caption'#6#6'&Tools'#0#9'TMenuItem'#10'ShowImages'#7'Caption'#6#12'&'
+'images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'#7'Captio' +'Show images'#7'OnClick'#7#15'ShowImagesClick'#0#0#9'TMenuItem'#5'Fonts'#7'C'
+'n'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0#0#9'TMe' +'aption'#6#23'Default &Font/Colors...'#7'OnClick'#7#15'FontColorsClick'#0#0#9
+'nuItem'#13'menuViewDebug'#7'Caption'#6#26'View Source and Debug info'#7'OnC' +'TMenuItem'#13'menuViewDebug'#7'Caption'#6#26'View Source and Debug info'#7
+'lick'#7#18'menuViewDebugClick'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'Cap' +'OnClick'#7#18'menuViewDebugClick'#0#0#9'TMenuItem'#16'menuToolsModules'#7'C'
+'tion'#6#8'&History'#7'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6#6 +'aption'#6#7'Modules'#0#0#0#9'TMenuItem'#15'HistoryMenuItem'#7'Caption'#6#8
+'&About'#7'OnClick'#7#11'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialog' +'&History'#7'Visible'#8#0#0#9'TMenuItem'#6'About1'#7'Caption'#6#6'&About'#7
+#8'FromPage'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPageN' +'OnClick'#7#11'About1Click'#0#0#0#12'TPrintDialog'#11'PrintDialog'#8'FromPag'
+'ums'#0#6'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'FindD' +'e'#2#1#7'MinPage'#2#1#7'MaxPage'#3#15''''#7'Options'#11#10'poPageNums'#0#6
+'ialog'#7'Options'#11#6'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'#0 +'ToPage'#2#1#4'left'#3'j'#1#3'top'#2#1#0#0#11'TFindDialog'#10'FindDialog'#7
+#6'OnFind'#7#14'FindDialogFind'#4'left'#3#248#0#3'top'#2#4#0#0#10'TPopupMenu' +'Options'#11#6'frDown'#15'frHideWholeWord'#18'frDisableWholeWord'#0#6'OnFind'
+#9'PopupMenu'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'Capti' +#7#14'FindDialogFind'#4'left'#3#248#0#3'top'#2#4#0#0#10'TPopupMenu'#9'PopupM'
+'on'#6#11'&View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'#20'C' +'enu'#4'left'#3#144#1#3'top'#2#1#0#9'TMenuItem'#9'Viewimage'#7'Caption'#6#11
+'opyImageToClipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClick'#7 +'&View image'#7'OnClick'#7#14'ViewimageClick'#0#0#9'TMenuItem'#20'CopyImageT'
+#25'CopyImageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0#0#9 +'oClipboard'#7'Caption'#6#24'&Copy image to clipboard'#7'OnClick'#7#25'CopyI'
+'TMenuItem'#15'OpenInNewWindow'#7'Caption'#6#19'&Open in new window'#7'OnCli' +'mageToClipboardClick'#0#0#9'TMenuItem'#2'N3'#7'Caption'#6#1'-'#0#0#9'TMenuI'
+'ck'#7#20'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'Enabled'#8#7 +'tem'#15'OpenInNewWindow'#7'Caption'#6#19'&Open in new window'#7'OnClick'#7
+'OnTimer'#7#14'MetaTimerTimer'#4'left'#3#242#0#3'top'#2'K'#0#0#6'TTimer'#6'T' +#20'OpenInNewWindowClick'#0#0#0#6'TTimer'#9'MetaTimer'#7'Enabled'#8#7'OnTime'
+'imer1'#8'Interval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'0'#1#3'to' +'r'#7#14'MetaTimerTimer'#4'left'#3#242#0#3'top'#2'K'#0#0#6'TTimer'#6'Timer1'
+'p'#2'G'#0#0#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1#0 +#8'Interval'#3#200#0#7'OnTimer'#7#11'Timer1Timer'#4'left'#3'0'#1#3'top'#2'G'
+#0#0 +#0#0#19'TPrinterSetupDialog'#18'PrinterSetupDialog'#4'left'#3#192#1#0#0#0
]); ]);

View File

@ -14,8 +14,7 @@ uses
ComCtrls, ComCtrls,
{$IFDEF MSWINDOWS} ShellAPI, {$ELSE} Unix, {$ENDIF} {$IFDEF MSWINDOWS} ShellAPI, {$ELSE} Unix, {$ENDIF}
HTMLabt, HTMLabt,
pageloader, pageloader, browserviewer, browsermodules;
browserviewer;
type type
@ -23,6 +22,7 @@ type
TformBrowser = class(TForm) TformBrowser = class(TForm)
labelProgress: TLabel; labelProgress: TLabel;
menuToolsModules: TMenuItem;
menuViewDebug: TMenuItem; menuViewDebug: TMenuItem;
N1: TMenuItem; N1: TMenuItem;
OpenDialog: TOpenDialog; OpenDialog: TOpenDialog;
@ -31,7 +31,7 @@ type
panelBottom: TPanel; panelBottom: TPanel;
File1: TMenuItem; File1: TMenuItem;
Open: TMenuItem; Open: TMenuItem;
options1: TMenuItem; menuOptions: TMenuItem;
ShowImages: TMenuItem; ShowImages: TMenuItem;
Fonts: TMenuItem; Fonts: TMenuItem;
HistoryMenuItem: TMenuItem; HistoryMenuItem: TMenuItem;
@ -114,6 +114,9 @@ type
procedure CloseAll; procedure CloseAll;
procedure ForwardClick(Sender: TObject); procedure ForwardClick(Sender: TObject);
procedure BackClick(Sender: TObject); procedure BackClick(Sender: TObject);
procedure InitializeForm();
procedure UpdateModulesMenu();
procedure HandleModuleMenuItemClick(Sender: TObject);
public public
{ Public declarations } { Public declarations }
CurrentTab: Integer; CurrentTab: Integer;
@ -133,55 +136,8 @@ uses
Submit, ImgForm;//, FontDlg; Submit, ImgForm;//, FontDlg;
procedure TformBrowser.FormCreate(Sender: TObject); procedure TformBrowser.FormCreate(Sender: TObject);
var
I: integer;
begin begin
History := TStringList.Create; InitializeForm();
AddBrowserTab('', True);
Position := poScreenCenter;
{$IFDEF DARWIN} //Don't default to within app bundle.
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0)) + '../../../';
{$ELSE}
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0));
{$ENDIF}
Caption := 'HTML Demo, Version '+HTMLAbt.Version;
(*for I := 0 to MaxHistories-1 do
begin {create the MenuItems for the history list}
Histories[I] := TMenuItem.Create(HistoryMenuItem);
HistoryMenuItem.Insert(I, Histories[I]);
with Histories[I] do
begin
Visible := False;
OnClick := HistoryClick;
Tag := I;
end;
end;*)
{$IFDEF LCLCarbon}
AppMenu := TMenuItem.Create(Self); //Application menu
AppMenu.Caption := #$EF#$A3#$BF; //Unicode Apple logo char
MainMenu.Items.Insert(0, AppMenu);
MainMenu.Items.Remove(About1); //Remove About as separate menu
AppMenu.Add(About1); //Add About as item in application menu
File1.Remove(File1.Items[File1.Count-2]);
File1.Remove(Exit1); //Remove Exit since have Quit
Find1.ShortCut := ShortCut(VK_F, [ssMeta]);
CopyItem.ShortCut := ShortCut(VK_C, [ssMeta]);
SelectAllItem.ShortCut := ShortCut(VK_A, [ssMeta]);
{$ENDIF}
AllowDropFiles := True;
OnDropFiles := DropFiles;
HintWindow := THintWindow.Create(Self);
HintWindow.Color := $C0FFFF;
end; end;
procedure TformBrowser.FormShow(Sender: TObject); procedure TformBrowser.FormShow(Sender: TObject);
@ -272,6 +228,97 @@ begin
//buttonForward.Enabled := True; //buttonForward.Enabled := True;
end; end;
procedure TformBrowser.InitializeForm;
var
I: integer;
begin
History := TStringList.Create;
AddBrowserTab('', True);
Position := poScreenCenter;
{$IFDEF DARWIN} //Don't default to within app bundle.
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0)) + '../../../';
{$ELSE}
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0));
{$ENDIF}
Caption := 'fpBrowser, Version '+HTMLAbt.Version;
(*for I := 0 to MaxHistories-1 do
begin {create the MenuItems for the history list}
Histories[I] := TMenuItem.Create(HistoryMenuItem);
HistoryMenuItem.Insert(I, Histories[I]);
with Histories[I] do
begin
Visible := False;
OnClick := HistoryClick;
Tag := I;
end;
end;*)
{$IFDEF LCLCarbon}
AppMenu := TMenuItem.Create(Self); //Application menu
AppMenu.Caption := #$EF#$A3#$BF; //Unicode Apple logo char
MainMenu.Items.Insert(0, AppMenu);
MainMenu.Items.Remove(About1); //Remove About as separate menu
AppMenu.Add(About1); //Add About as item in application menu
File1.Remove(File1.Items[File1.Count-2]);
File1.Remove(Exit1); //Remove Exit since have Quit
Find1.ShortCut := ShortCut(VK_F, [ssMeta]);
CopyItem.ShortCut := ShortCut(VK_C, [ssMeta]);
SelectAllItem.ShortCut := ShortCut(VK_A, [ssMeta]);
{$ENDIF}
AllowDropFiles := True;
OnDropFiles := DropFiles;
HintWindow := THintWindow.Create(Self);
HintWindow.Color := $C0FFFF;
// Add the modules menu
UpdateModulesMenu();
end;
procedure TformBrowser.UpdateModulesMenu;
var
lItem: TMenuItem;
lModule: TBrowserModule;
i: Integer;
begin
// First remove any existing modules
menuToolsModules.Clear;
// Now add all modules and their state
for i := 0 to GetBrowserModuleCount() - 1 do
begin
lModule := GetBrowserModule(0);
lItem := TMenuItem.Create(nil);
lItem.Caption := lModule.ShortDescription;
lItem.Checked := lModule.Activated;
lItem.OnClick := HandleModuleMenuItemClick;
menuToolsModules.Add(lItem);
end;
end;
procedure TformBrowser.HandleModuleMenuItemClick(Sender: TObject);
var
lItem: TMenuItem;
lModuleNum: Integer;
lModule: TBrowserModule;
lNewState: Boolean;
begin
lItem := Sender as TMenuItem;
lNewState := not lItem.Checked;
lItem.Checked := lNewState;
lModuleNum := lItem.Parent.IndexOf(lItem);
lModule := GetBrowserModule(lModuleNum);
lModule.Activated := lNewState;
end;
procedure TformBrowser.HistoryChange(Sender: TObject); procedure TformBrowser.HistoryChange(Sender: TObject);
{This event occurs when something changes history list} {This event occurs when something changes history list}
var var
@ -702,6 +749,7 @@ var
leditURL: TEdit; leditURL: TEdit;
begin begin
lTabSheet := pageBrowser.AddTabSheet(); // This call requires Lazarus 0.9.31+ lTabSheet := pageBrowser.AddTabSheet(); // This call requires Lazarus 0.9.31+
lTabSheet.Caption := 'WebPage';
// Add the top panel of the tab with buttons and the edit box // Add the top panel of the tab with buttons and the edit box
lTopPanel := TPanel.Create(lTabSheet); lTopPanel := TPanel.Create(lTabSheet);