summaryrefslogtreecommitdiff
path: root/docview/src/frm_configuration.pas
diff options
context:
space:
mode:
Diffstat (limited to 'docview/src/frm_configuration.pas')
-rw-r--r--docview/src/frm_configuration.pas174
1 files changed, 128 insertions, 46 deletions
diff --git a/docview/src/frm_configuration.pas b/docview/src/frm_configuration.pas
index 9d63db94..10ea5616 100644
--- a/docview/src/frm_configuration.pas
+++ b/docview/src/frm_configuration.pas
@@ -7,22 +7,22 @@ interface
uses
SysUtils, Classes, fpg_base, fpg_main, fpg_form, fpg_tab, fpg_button,
fpg_label, fpg_edit, fpg_panel, fpg_combobox, fpg_listbox, fpg_checkbox,
- fpg_editbtn;
+ fpg_editbtn, fpg_radiobutton;
type
TConfigurationForm = class(TfpgForm)
private
{@VFD_HEAD_BEGIN: ConfigurationForm}
- PageControl1: TfpgPageControl;
+ pcSettings: TfpgPageControl;
btnSave: TfpgButton;
btnCancel: TfpgButton;
tsGeneral: TfpgTabSheet;
tsFontsColor: TfpgTabSheet;
+ tsIndex: TfpgTabSheet;
Label1: TfpgLabel;
Label2: TfpgLabel;
pnlSearchHighlight: TfpgPanel;
- cbIndexStyle: TfpgComboBox;
lblIndexStyle: TfpgLabel;
lblSearchDirs: TfpgLabel;
btnSearchDirAdd: TfpgButton;
@@ -35,6 +35,12 @@ type
btnResetColors: TfpgButton;
edtFixedFont: TfpgFontEdit;
edtNormalFont: TfpgFontEdit;
+ rbIndexOrig: TfpgRadioButton;
+ rbIndexAlpha: TfpgRadioButton;
+ rbIndexBoth: TfpgRadioButton;
+ lblScrollDistance: TfpgLabel;
+ edtScrollDistance: TfpgEditInteger;
+ lblPixels: TfpgLabel;
{@VFD_HEAD_END: ConfigurationForm}
btnHelp: TfpgButton;
procedure ConfigurationFormShow(Sender: TObject);
@@ -79,7 +85,7 @@ end;
procedure TConfigurationForm.ConfigurationFormShow(Sender: TObject);
begin
SettingsToGui;
- PageControl1.ActivePage := tsGeneral;
+ pcSettings.ActivePage := tsGeneral;
// programatically seting a tab does not fire OnChange event, so we do it mantually
PageControl1Change(self, tsGeneral);
end;
@@ -143,31 +149,44 @@ End;
procedure TConfigurationForm.SettingsToGui;
begin
// General
- cbIndexStyle.FocusItem := Ord(Settings.IndexStyle);
+ edtScrollDistance.Value := Settings.ScrollDistance;
lbSearchDirs.Items.Assign(Settings.SearchDirectories);
chkEscapeIPFSymbols.Checked := Settings.IPFTopicSaveAsEscaped;
chkStartupHelp.Checked := Settings.StartupHelp;
chkOpenTOC.Checked := Settings.OpenWithExpandedContents;
// Fonts & Color
- edtNormalFont.FontDesc := Settings.NormalFont.FontDesc;
- edtFixedFont.FontDesc := Settings.FixedFont.FontDesc;
+ edtNormalFont.FontDesc := Settings.NormalFontDesc;
+ edtFixedFont.FontDesc := Settings.FixedFontDesc;
UpdateColorPanels;
+ // Index
+ rbIndexOrig.Checked := Settings.IndexStyle = isFileOnly;
+ rbIndexAlpha.Checked := Settings.IndexStyle = isAlphabetical;
+ rbIndexBoth.Checked := Settings.IndexStyle = isFull;
end;
procedure TConfigurationForm.GuiToSettings;
begin
// General
- Settings.IndexStyle := TIndexStyle(cbIndexStyle.FocusItem);
+ if edtScrollDistance.Value < 1 then
+ edtScrollDistance.Value := 75; // default
+ if edtScrollDistance.Value > 400 then
+ edtScrollDistance.Value := 400;
+ Settings.ScrollDistance := edtScrollDistance.Value;
Settings.SearchDirectories.Assign(lbSearchDirs.Items);
Settings.IPFTopicSaveAsEscaped := chkEscapeIPFSymbols.Checked;
Settings.StartupHelp := chkStartupHelp.Checked;
Settings.OpenWithExpandedContents := chkOpenTOC.Checked;
// Fonts & Color
- Settings.NormalFont.Free;
- Settings.NormalFont := fpgGetFont(edtNormalFont.FontDesc);
- Settings.FixedFont.Free;
- Settings.FixedFont := fpgGetFont(edtFixedFont.FontDesc);
+ Settings.NormalFontDesc := edtNormalFont.FontDesc;
+ Settings.FixedFontDesc := edtFixedFont.FontDesc;
Settings.Colors[SearchHighlightTextColorIndex] := pnlSearchHighlight.BackgroundColor;
+ // Index
+ if rbIndexOrig.Checked then
+ Settings.IndexStyle := isFileOnly
+ else if rbIndexAlpha.Checked then
+ Settings.IndexStyle := isAlphabetical
+ else if rbIndexBoth.Checked then
+ Settings.IndexStyle := isFull;
end;
procedure TConfigurationForm.UpdateColorPanels;
@@ -189,12 +208,13 @@ begin
SetPosition(402, 189, 515, 439);
WindowTitle := 'Configuration';
Hint := '';
+ ShowHint := True;
WindowPosition := wpOneThirdDown;
- PageControl1 := TfpgPageControl.Create(self);
- with PageControl1 do
+ pcSettings := TfpgPageControl.Create(self);
+ with pcSettings do
begin
- Name := 'PageControl1';
+ Name := 'pcSettings';
SetPosition(4, 4, 506, 388);
Anchors := [anLeft,anRight,anTop,anBottom];
ActivePageIndex := 0;
@@ -212,7 +232,7 @@ begin
FontDesc := '#Label1';
Hint := '';
ImageName := '';
- TabOrder := 19;
+ TabOrder := 25;
OnClick := @btnSaveClick;
end;
@@ -225,11 +245,11 @@ begin
FontDesc := '#Label1';
Hint := '';
ImageName := '';
- TabOrder := 20;
+ TabOrder := 26;
OnClick := @btnCancelClick;
end;
- tsGeneral := TfpgTabSheet.Create(PageControl1);
+ tsGeneral := TfpgTabSheet.Create(pcSettings);
with tsGeneral do
begin
Name := 'tsGeneral';
@@ -237,7 +257,7 @@ begin
Text := 'General';
end;
- tsFontsColor := TfpgTabSheet.Create(PageControl1);
+ tsFontsColor := TfpgTabSheet.Create(pcSettings);
with tsFontsColor do
begin
Name := 'tsFontsColor';
@@ -245,6 +265,14 @@ begin
Text := 'Fonts & Color';
end;
+ tsIndex := TfpgTabSheet.Create(pcSettings);
+ with tsIndex do
+ begin
+ Name := 'tsIndex';
+ SetPosition(3, 24, 500, 361);
+ Text := 'Index';
+ end;
+
Label1 := TfpgLabel.Create(tsFontsColor);
with Label1 do
begin
@@ -278,25 +306,12 @@ begin
Text := 'Search Highlight Color';
end;
- cbIndexStyle := TfpgComboBox.Create(tsGeneral);
- with cbIndexStyle do
- begin
- Name := 'cbIndexStyle';
- SetPosition(12, 32, 160, 25);
- FontDesc := '#List';
- Hint := '';
- Items.Add('Alphabetical');
- Items.Add('FileOnly');
- Items.Add('Full');
- TabOrder := 2;
- end;
-
- lblIndexStyle := TfpgLabel.Create(tsGeneral);
+ lblIndexStyle := TfpgLabel.Create(tsIndex);
with lblIndexStyle do
begin
Name := 'lblIndexStyle';
- SetPosition(12, 13, 296, 17);
- FontDesc := '#Label1';
+ SetPosition(12, 12, 224, 17);
+ FontDesc := '#Label2';
Hint := '';
Text := 'Index style';
end;
@@ -320,7 +335,7 @@ begin
FontDesc := '#Label1';
Hint := '';
ImageName := '';
- TabOrder := 5;
+ TabOrder := 3;
OnClick :=@btnSearchDirAddClicked;
end;
@@ -333,7 +348,7 @@ begin
Hint := '';
HotTrack := False;
PopupFrame := False;
- TabOrder := 7;
+ TabOrder := 5;
Items.Duplicates := dupIgnore;
end;
@@ -346,7 +361,7 @@ begin
FontDesc := '#Label1';
Hint := '';
ImageName := '';
- TabOrder := 6;
+ TabOrder := 4;
end;
chkEscapeIPFSymbols := TfpgCheckBox.Create(tsGeneral);
@@ -357,7 +372,7 @@ begin
Anchors := [anLeft,anRight,anTop];
FontDesc := '#Label1';
Hint := '';
- TabOrder := 8;
+ TabOrder := 6;
Text := 'Escape symbols when saving topics as IPF text';
end;
@@ -370,7 +385,7 @@ begin
Checked := True;
FontDesc := '#Label1';
Hint := '';
- TabOrder := 9;
+ TabOrder := 7;
Text := 'Show DocView help at startup if no files opened';
end;
@@ -382,7 +397,7 @@ begin
Anchors := [anLeft,anRight,anTop];
FontDesc := '#Label1';
Hint := '';
- TabOrder := 10;
+ TabOrder := 8;
Text := 'Open files with contents expanded';
end;
@@ -395,7 +410,7 @@ begin
FontDesc := '#Label1';
Hint := '';
ImageName := '';
- TabOrder := 17;
+ TabOrder := 15;
OnClick := @btnSearchHighlightClicked;
end;
@@ -408,7 +423,7 @@ begin
FontDesc := '#Label1';
Hint := '';
ImageName := '';
- TabOrder := 18;
+ TabOrder := 16;
OnClick := @ResetColorsButtonOnClick;
end;
@@ -419,7 +434,7 @@ begin
SetPosition(124, 48, 340, 24);
Anchors := [anLeft,anRight,anTop];
FontDesc := '';
- TabOrder := 15;
+ TabOrder := 14;
end;
edtNormalFont := TfpgFontEdit.Create(tsFontsColor);
@@ -429,14 +444,81 @@ begin
SetPosition(124, 16, 340, 24);
Anchors := [anLeft,anRight,anTop];
FontDesc := '';
- TabOrder := 14;
+ TabOrder := 13;
+ end;
+
+ rbIndexOrig := TfpgRadioButton.Create(tsIndex);
+ with rbIndexOrig do
+ begin
+ Name := 'rbIndexOrig';
+ SetPosition(24, 28, 280, 20);
+ FontDesc := '#Label1';
+ GroupIndex := 1;
+ Hint := '';
+ TabOrder := 21;
+ Text := 'File Only (only entries specified in file)';
+ end;
+
+ rbIndexAlpha := TfpgRadioButton.Create(tsIndex);
+ with rbIndexAlpha do
+ begin
+ Name := 'rbIndexAlpha';
+ SetPosition(24, 48, 280, 20);
+ FontDesc := '#Label1';
+ GroupIndex := 1;
+ Hint := '';
+ TabOrder := 22;
+ Text := 'Alphabetical listing of topics';
+ end;
+
+ rbIndexBoth := TfpgRadioButton.Create(tsIndex);
+ with rbIndexBoth do
+ begin
+ Name := 'rbIndexBoth';
+ SetPosition(24, 68, 280, 20);
+ FontDesc := '#Label1';
+ GroupIndex := 1;
+ Hint := '';
+ TabOrder := 23;
+ Text := 'Both';
+ end;
+
+ lblScrollDistance := TfpgLabel.Create(tsGeneral);
+ with lblScrollDistance do
+ begin
+ Name := 'lblScrollDistance';
+ SetPosition(12, 12, 280, 17);
+ FontDesc := '#Label1';
+ Hint := '';
+ Text := 'Mouse Wheel Scroll Distance';
+ end;
+
+ edtScrollDistance := TfpgEditInteger.Create(tsGeneral);
+ with edtScrollDistance do
+ begin
+ Name := 'edtScrollDistance';
+ SetPosition(12, 32, 72, 24);
+ Hint := '';
+ TabOrder := 2;
+ FontDesc := '#Edit1';
+ Value := 0;
+ end;
+
+ lblPixels := TfpgLabel.Create(tsGeneral);
+ with lblPixels do
+ begin
+ Name := 'lblPixels';
+ SetPosition(88, 36, 80, 17);
+ FontDesc := '#Label1';
+ Hint := '';
+ Text := '(pixels)';
end;
{@VFD_BODY_END: ConfigurationForm}
{%endregion}
// always reset pagecotrol
- PageControl1.ActivePageIndex := 0;
+ pcSettings.ActivePageIndex := 0;
//btnHelp := TfpgButton.Create(self);
//with btnHelp do