File: QueryBrowserOptionPages.pas

package info (click to toggle)
mysql-gui-tools 5.0r14%2BopenSUSE-2.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 116,956 kB
  • ctags: 48,715
  • sloc: sql: 341,918; pascal: 276,698; ansic: 91,020; cpp: 90,451; objc: 33,236; sh: 29,481; yacc: 10,756; xml: 10,589; java: 10,079; php: 2,806; python: 2,092; makefile: 1,783; perl: 4
file content (197 lines) | stat: -rw-r--r-- 7,439 bytes parent folder | download
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
unit QueryBrowserOptionPages;

// Copyright (C) 2003, 2004 MySQL AB
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, Options, TntStdCtrls, AuxFuncs, TntComCtrls;

type
  TQueryBrowserOptionPagesForm = class(TApplicationOptionsForm)
    OptionPageControl: TTntPageControl;
    BrowserTabSheet: TTntTabSheet;
    GroupBox4: TTntGroupBox;
    HideTabWhenOneOpenCBox: TTntCheckBox;
    ToolbarGradientCBox: TTntCheckBox;
    TntGroupBox1: TTntGroupBox;
    EnforceEditableQueriesCBox: TTntCheckBox;
    OpenExportedResultsetCBox: TTntCheckBox;
    TntGroupBox2: TTntGroupBox;
    AssociateFileExtensionsCBox: TTntCheckBox;
    ShowAdvancedToolbarMI: TTntCheckBox;
    ShowFieldOverlayImagesCBox: TTntCheckBox;
    EnableFriendlyLineBreaksCBox: TTntCheckBox;
    SubstLFLU: TTntComboBox;
    TntLabel1: TTntLabel;
    TntLabel2: TTntLabel;
    SubstCRLU: TTntComboBox;
    CreateWindowsStyleLineBreaksCBox: TTntCheckBox;
    ShowMouseCursorToolbarGroupCBox: TTntCheckBox;
    AlignNumericColsRightCBox: TTntCheckBox;
    AutoEditCheckbox: TTntCheckBox;
    ForceQueryCheckbox: TCheckBox;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);

    procedure SetControls(PageNr: integer); override;
    procedure ApplyChanges(PageNr: integer); override;

    procedure DoChange(Sender: TObject);
    procedure EnableDisableControls;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

//----------------------------------------------------------------------------------------------------------------------

implementation

//----------------------------------------------------------------------------------------------------------------------

uses
  ApplicationDataModule;

{$R *.dfm}

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.FormCreate(Sender: TObject);

begin
  InitForm(self);

  OptionsImgNames.Add('options_querybrowser');

  DockOptionPageControl := OptionPageControl;
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.FormDestroy(Sender: TObject);

begin
  //
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.FormClose(Sender: TObject; var Action: TCloseAction);

begin
  //
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.SetControls(PageNr: integer);

var
  Options: IOptionProvider;

begin
  Options := ApplicationDM.QBOptions;

  if (PageNr = 0) then
  begin
    ToolbarGradientCBox.Checked := ApplicationDM.QBOptions.UseToolbarGradient;
    HideTabWhenOneOpenCBox.Checked := ApplicationDM.QBOptions.HideTabWhenOneOpen;
    ShowFieldOverlayImagesCBox.Checked := ApplicationDM.QBOptions.ShowFieldOverlayImages;
    ShowMouseCursorToolbarGroupCBox.Checked := ApplicationDM.QBOptions.ShowMouseCursorToolbarGroup;

    EnforceEditableQueriesCBox.Checked := ApplicationDM.QBOptions.EnforceEditableQueries;
    OpenExportedResultsetCBox.Checked := ApplicationDM.QBOptions.OpenExportedResultset;

    EnableFriendlyLineBreaksCBox.Checked := ApplicationDM.QBOptions.FriendlyLineBreaks;
    SubstLFLU.Text := ApplicationDM.QBOptions.FriendlyLineBreaksLF;
    SubstCRLU.Text := ApplicationDM.QBOptions.FriendlyLineBreaksCR;
    CreateWindowsStyleLineBreaksCBox.Checked := ApplicationDM.QBOptions.CreateWindowsStyleLineBreaks;

    AlignNumericColsRightCBox.Checked := ApplicationDM.QBOptions.AlignNumericColsRight;
    AssociateFileExtensionsCBox.Checked := ApplicationDM.QBOptions.AssociateFileExtensions;
    ShowAdvancedToolbarMI.Checked := ApplicationDM.QBOptions.ShowAdvancedToolbar;

    AutoEditCheckbox.Checked := Options.OptionAsBoolean['ResultsetAutoEdit'];
    ForceQueryCheckbox.Checked := Options.OptionAsBoolean['ForceScriptOnErrors'];

    EnableDisableControls;
  end;
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.ApplyChanges(PageNr: integer);

var
  Options: IOptionProvider;

begin
  Options := ApplicationDM.QBOptions;
  
  if (PageNr = 0) then
  begin
    ApplicationDM.QBOptions.UseToolbarGradient := ToolbarGradientCBox.Checked;
    ApplicationDM.QBOptions.HideTabWhenOneOpen := HideTabWhenOneOpenCBox.Checked;
    ApplicationDM.QBOptions.ShowFieldOverlayImages := ShowFieldOverlayImagesCBox.Checked;
    ApplicationDM.QBOptions.ShowMouseCursorToolbarGroup := ShowMouseCursorToolbarGroupCBox.Checked;


    ApplicationDM.QBOptions.EnforceEditableQueries := EnforceEditableQueriesCBox.Checked;
    ApplicationDM.QBOptions.OpenExportedResultset := OpenExportedResultsetCBox.Checked;

    ApplicationDM.QBOptions.FriendlyLineBreaks := EnableFriendlyLineBreaksCBox.Checked;
    ApplicationDM.QBOptions.FriendlyLineBreaksLF := SubstLFLU.Text[1];
    ApplicationDM.QBOptions.FriendlyLineBreaksCR := SubstCRLU.Text[1];
    ApplicationDM.QBOptions.CreateWindowsStyleLineBreaks := CreateWindowsStyleLineBreaksCBox.Checked;

    ApplicationDM.QBOptions.AlignNumericColsRight := AlignNumericColsRightCBox.Checked;
    ApplicationDM.QBOptions.ShowAdvancedToolbar := ShowAdvancedToolbarMI.Checked;
    ApplicationDM.QBOptions.AssociateFileExtensions := AssociateFileExtensionsCBox.Checked;

    Options.OptionAsBoolean['ResultsetAutoEdit'] := AutoEditCheckbox.Checked;
    Options.OptionAsBoolean['ForceScriptOnErrors'] := ForceQueryCheckbox.Checked;

    ApplicationDM.QBOptions.StoreOptions;
  end;
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.DoChange(Sender: TObject);

begin
  if (@DoPageContentChanged <> nil) then
    DoPageContentChanged(Sender);
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TQueryBrowserOptionPagesForm.EnableDisableControls;

begin
  //
end;

//----------------------------------------------------------------------------------------------------------------------

end.