mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Make snippets directory customizable. Fixes issue #3276
This commit is contained in:
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: HeidiSQL\n"
|
||||
"POT-Creation-Date: 2012-11-05 21:40\n"
|
||||
"PO-Revision-Date: 2013-09-28 07:29+0100\n"
|
||||
"PO-Revision-Date: 2013-09-28 11:59+0100\n"
|
||||
"Last-Translator: Ansgar Becker <heidisql@anse.de>\n"
|
||||
"Language-Team: English (http://www.transifex.com/projects/p/heidisql/"
|
||||
"language/en/)\n"
|
||||
@@ -2503,6 +2503,10 @@ msgstr "Set interval ..."
|
||||
msgid "Miscellaneous"
|
||||
msgstr "Miscellaneous"
|
||||
|
||||
#. Preferences
|
||||
msgid "Custom snippets directory:"
|
||||
msgstr "Custom snippets directory:"
|
||||
|
||||
#. optionsform..pagecontrolMain..tabMisc..lblMySQLBinaries..Caption
|
||||
#: options.dfm:48
|
||||
msgid "MySQL command line programs:"
|
||||
@@ -2563,11 +2567,6 @@ msgstr "Allow multiple application instances"
|
||||
msgid "Display bars in various list columns"
|
||||
msgstr "Display bars in various list columns"
|
||||
|
||||
#. optionsform..pagecontrolMain..tabMisc..editMySQLBinaries..TextHint
|
||||
#: options.dfm:177
|
||||
msgid "Required to launch mysql.exe shell"
|
||||
msgstr "Required to launch mysql.exe shell"
|
||||
|
||||
#. optionsform..pagecontrolMain..tabLogging..Caption
|
||||
#: options.dfm:184
|
||||
msgid "Logging"
|
||||
|
||||
@@ -166,7 +166,7 @@ type
|
||||
asCopyTableWindowHeight, asCopyTableWindowWidth, asCopyTableColumns, asCopyTableKeys, asCopyTableForeignKeys,
|
||||
asCopyTableData, asCopyTableRecentFilter, asServerVersion, asServerVersionFull, asLastConnect,
|
||||
asConnectCount, asRefusedCount, asSessionCreated, asDoUsageStatistics,
|
||||
asLastUsageStatisticCall, asDisplayBars, asBarColor, asMySQLBinaries, asPromptSaveFileOnTabClose,
|
||||
asLastUsageStatisticCall, asDisplayBars, asBarColor, asMySQLBinaries, asCustomSnippetsDirectory, asPromptSaveFileOnTabClose,
|
||||
asCompletionProposal, asTabsToSpaces, asFilterPanel, asAllowMultipleInstances, asFindDialogSearchHistory,
|
||||
asFindDialogReplaceHistory, asMaxQueryResults, asSetEditorWidth, asSetEditorHeight, asLogErrors,
|
||||
asLogUserSQL, asLogSQL, asLogInfos, asLogDebug, asFieldColorNumeric,
|
||||
@@ -786,11 +786,7 @@ end;
|
||||
function DirnameSnippets: String;
|
||||
begin
|
||||
// Folder for snippets
|
||||
if AppSettings.PortableMode then
|
||||
Result := ExtractFilePath(ParamStr(0))
|
||||
else
|
||||
Result := DirnameCommonAppData;
|
||||
Result := Result + 'Snippets\';
|
||||
Result := IncludeTrailingBackslash(AppSettings.ReadString(asCustomSnippetsDirectory));
|
||||
end;
|
||||
|
||||
|
||||
@@ -3121,6 +3117,7 @@ constructor TAppSettings.Create;
|
||||
var
|
||||
rx: TRegExpr;
|
||||
i: Integer;
|
||||
DefaultSnippetsDirectory: String;
|
||||
begin
|
||||
inherited;
|
||||
FRegistry := TRegistry.Create;
|
||||
@@ -3315,6 +3312,13 @@ begin
|
||||
InitSetting(asDisplayBars, 'DisplayBars', 0, true);
|
||||
InitSetting(asBarColor, 'BarColor', $00BBFFDD);
|
||||
InitSetting(asMySQLBinaries, 'MySQL_Binaries', 0, False, '');
|
||||
// Default folder for snippets
|
||||
if FPortableMode then
|
||||
DefaultSnippetsDirectory := ExtractFilePath(ParamStr(0))
|
||||
else
|
||||
DefaultSnippetsDirectory := DirnameCommonAppData;
|
||||
DefaultSnippetsDirectory := DefaultSnippetsDirectory + 'Snippets\';
|
||||
InitSetting(asCustomSnippetsDirectory, 'CustomSnippetsDirectory', 0, False, DefaultSnippetsDirectory);
|
||||
InitSetting(asPromptSaveFileOnTabClose, 'PromptSaveFileOnTabClose', 0, True);
|
||||
InitSetting(asCompletionProposal, 'CompletionProposal', 0, True);
|
||||
InitSetting(asTabsToSpaces, 'TabsToSpaces', 0, False);
|
||||
|
||||
@@ -45,11 +45,18 @@ object optionsform: Toptionsform
|
||||
end
|
||||
object lblLanguage: TLabel
|
||||
Left = 8
|
||||
Top = 246
|
||||
Top = 273
|
||||
Width = 189
|
||||
Height = 13
|
||||
Caption = 'Application language (requires restart):'
|
||||
end
|
||||
object lblCustomSnippetsDirectory: TLabel
|
||||
Left = 8
|
||||
Top = 246
|
||||
Width = 129
|
||||
Height = 13
|
||||
Caption = 'Custom snippets directory:'
|
||||
end
|
||||
object chkAutoReconnect: TCheckBox
|
||||
Left = 8
|
||||
Top = 31
|
||||
@@ -175,21 +182,35 @@ object optionsform: Toptionsform
|
||||
RightButton.Visible = True
|
||||
TabOrder = 10
|
||||
Text = 'editMySQLBinaries'
|
||||
TextHint = 'Required to launch mysql.exe shell'
|
||||
TextHint = 'Find mysql.exe directory'
|
||||
OnChange = Modified
|
||||
OnDblClick = editMySQLBinariesRightButtonClick
|
||||
OnRightButtonClick = editMySQLBinariesRightButtonClick
|
||||
end
|
||||
object comboAppLanguage: TComboBox
|
||||
Left = 272
|
||||
Top = 243
|
||||
Top = 270
|
||||
Width = 319
|
||||
Height = 21
|
||||
Style = csDropDownList
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 11
|
||||
TabOrder = 12
|
||||
OnClick = Modified
|
||||
end
|
||||
object editCustomSnippetsDirectory: TButtonedEdit
|
||||
Left = 272
|
||||
Top = 243
|
||||
Width = 319
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
Images = MainForm.ImageListMain
|
||||
RightButton.ImageIndex = 51
|
||||
RightButton.Visible = True
|
||||
TabOrder = 11
|
||||
Text = 'editCustomSnippetsDirectory'
|
||||
TextHint = 'Set custom directory for SQL snippet files'
|
||||
OnRightButtonClick = editCustomSnippetsDirectoryRightButtonClick
|
||||
end
|
||||
end
|
||||
object tabLogging: TTabSheet
|
||||
Caption = 'Logging'
|
||||
@@ -341,6 +362,7 @@ object optionsform: Toptionsform
|
||||
RightButton.Visible = True
|
||||
TabOrder = 5
|
||||
Text = 'editLogDir'
|
||||
TextHint = 'Select output directory'
|
||||
OnChange = Modified
|
||||
OnDblClick = editLogDirRightButtonClick
|
||||
OnRightButtonClick = editLogDirRightButtonClick
|
||||
|
||||
@@ -125,6 +125,8 @@ type
|
||||
cboxSQLColForeground: TColorBox;
|
||||
cboxSQLColBackground: TColorBox;
|
||||
SynMemoSQLSample: TSynMemo;
|
||||
editCustomSnippetsDirectory: TButtonedEdit;
|
||||
lblCustomSnippetsDirectory: TLabel;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure Modified(Sender: TObject);
|
||||
procedure Apply(Sender: TObject);
|
||||
@@ -162,6 +164,7 @@ type
|
||||
procedure colorBoxGridTextColorsSelect(Sender: TObject);
|
||||
procedure editMySQLBinariesRightButtonClick(Sender: TObject);
|
||||
procedure editGridRowCountExit(Sender: TObject);
|
||||
procedure editCustomSnippetsDirectoryRightButtonClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
FWasModified: Boolean;
|
||||
@@ -169,6 +172,7 @@ type
|
||||
FGridTextColors: Array[dtcInteger..dtcOther] of TColor;
|
||||
FLanguages: TStringList;
|
||||
procedure InitLanguages;
|
||||
procedure SelectDirectory(Sender: TObject; NewFolderButton: Boolean);
|
||||
public
|
||||
{ Public declarations }
|
||||
end;
|
||||
@@ -256,6 +260,7 @@ begin
|
||||
AppSettings.WriteBool(asDisplayBars, chkColorBars.Checked);
|
||||
AppSettings.WriteInt(asBarColor, cboxColorBars.Selected);
|
||||
AppSettings.WriteString(asMySQLBinaries, editMySQLBinaries.Text);
|
||||
AppSettings.WriteString(asCustomSnippetsDirectory, editCustomSnippetsDirectory.Text);
|
||||
if comboAppLanguage.ItemIndex > 0 then begin
|
||||
// There is no TStringList.Names[Value] getter, so we find the language code via loop
|
||||
LangCode := '';
|
||||
@@ -438,6 +443,7 @@ begin
|
||||
chkColorBars.Checked := AppSettings.ReadBool(asDisplayBars);
|
||||
cboxColorBars.Selected := AppSettings.ReadInt(asBarColor);
|
||||
editMySQLBinaries.Text := AppSettings.ReadString(asMySQLBinaries);
|
||||
editCustomSnippetsDirectory.Text := AppSettings.ReadString(asCustomSnippetsDirectory);
|
||||
LangCode := AppSettings.ReadString(asAppLanguage);
|
||||
comboAppLanguage.ItemIndex := comboAppLanguage.Items.IndexOf(FLanguages.Values[LangCode]);
|
||||
chkAskFileSave.Checked := AppSettings.ReadBool(asPromptSaveFileOnTabClose);
|
||||
@@ -559,38 +565,45 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure Toptionsform.editLogDirRightButtonClick(Sender: TObject);
|
||||
procedure Toptionsform.SelectDirectory(Sender: TObject; NewFolderButton: Boolean);
|
||||
var
|
||||
Browse: TBrowseForFolder;
|
||||
Edit: TButtonedEdit;
|
||||
begin
|
||||
// Select folder for session logs
|
||||
// Select folder for any option
|
||||
Edit := Sender as TButtonedEdit;
|
||||
Browse := TBrowseForFolder.Create(Self);
|
||||
Browse.Folder := (Sender as TButtonedEdit).Text;
|
||||
Browse.DialogCaption := _('Select output directory');
|
||||
// Enable "Create new folder" button
|
||||
Browse.BrowseOptions := Browse.BrowseOptions - [bifNoNewFolderButton] + [bifNewDialogStyle];
|
||||
Browse.Folder := Edit.Text;
|
||||
Browse.DialogCaption := _(Edit.TextHint);
|
||||
Browse.BrowseOptions := Browse.BrowseOptions + [bifNewDialogStyle];
|
||||
if not NewFolderButton then
|
||||
Browse.BrowseOptions := Browse.BrowseOptions + [bifNoNewFolderButton];
|
||||
if Browse.Execute then begin
|
||||
(Sender as TButtonedEdit).Text := Browse.Folder;
|
||||
Edit.Text := Browse.Folder;
|
||||
Modified(Sender);
|
||||
end;
|
||||
Browse.Free;
|
||||
end;
|
||||
|
||||
|
||||
procedure Toptionsform.editLogDirRightButtonClick(Sender: TObject);
|
||||
begin
|
||||
// Select folder for session logs
|
||||
SelectDirectory(Sender, True);
|
||||
end;
|
||||
|
||||
|
||||
procedure Toptionsform.editMySQLBinariesRightButtonClick(Sender: TObject);
|
||||
var
|
||||
Browse: TBrowseForFolder;
|
||||
begin
|
||||
// Select folder where MySQL binaries reside
|
||||
Browse := TBrowseForFolder.Create(Self);
|
||||
Browse.Folder := (Sender as TButtonedEdit).Text;
|
||||
Browse.DialogCaption := _('Find mysql.exe directory');
|
||||
Browse.BrowseOptions := Browse.BrowseOptions + [bifNewDialogStyle];
|
||||
if Browse.Execute then begin
|
||||
(Sender as TButtonedEdit).Text := Browse.Folder;
|
||||
Modified(Sender);
|
||||
end;
|
||||
Browse.Free;
|
||||
SelectDirectory(Sender, False);
|
||||
end;
|
||||
|
||||
|
||||
procedure Toptionsform.editCustomSnippetsDirectoryRightButtonClick(Sender: TObject);
|
||||
begin
|
||||
// Set custom snippets directory
|
||||
SelectDirectory(Sender, True);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user