diff --git a/editor/studio/AMXX_Studio.dof b/editor/studio/AMXX_Studio.dof index 8ec12b1a..5ad33626 100755 --- a/editor/studio/AMXX_Studio.dof +++ b/editor/studio/AMXX_Studio.dof @@ -115,7 +115,7 @@ AutoIncBuild=1 MajorVer=1 MinorVer=4 Release=3 -Build=0 +Build=1 Debug=0 PreRelease=0 Special=0 @@ -126,11 +126,11 @@ CodePage=1252 [Version Info Keys] CompanyName=AMX Mod X Dev Team FileDescription= -FileVersion=1.4.3.0 +FileVersion=1.4.3.1 InternalName= LegalCopyright=AMX Mod X Dev Team LegalTrademarks= OriginalFilename= ProductName=AMXX-Studio -ProductVersion=1.4.3.0 +ProductVersion=1.4.3 final Comments= diff --git a/editor/studio/AMXX_Studio.exe b/editor/studio/AMXX_Studio.exe index 3eb7d592..e183ace5 100755 Binary files a/editor/studio/AMXX_Studio.exe and b/editor/studio/AMXX_Studio.exe differ diff --git a/editor/studio/AMXX_Studio.res b/editor/studio/AMXX_Studio.res index 73b9d20a..6d220e38 100755 Binary files a/editor/studio/AMXX_Studio.res and b/editor/studio/AMXX_Studio.res differ diff --git a/editor/studio/UnitCodeInspector.pas b/editor/studio/UnitCodeInspector.pas index 6aa0be3b..665c6955 100755 --- a/editor/studio/UnitCodeInspector.pas +++ b/editor/studio/UnitCodeInspector.pas @@ -800,6 +800,8 @@ begin eCurrLine := Between(eCurrLine, '(', ')', True); HideBracesAndStrings(eCurrLine, True); eStr2.Text := StringReplace(eCurrLine, ',', #13, [rfReplaceAll]); + if (Trim(eStr2.Text) = ')') then + eStr2.Clear; CreateCategory('Function Call'); AddField('Function', 'Function Call', eVarName); diff --git a/editor/studio/UnitMainTools.pas b/editor/studio/UnitMainTools.pas index e20dfdde..5f46df55 100755 --- a/editor/studio/UnitMainTools.pas +++ b/editor/studio/UnitMainTools.pas @@ -751,6 +751,8 @@ begin else eCPUSpeed := 1; // otherwise the program would hang up frmSettings.txtLangDir.Text := IncludeTrailingPathDelimiter(eConfig.ReadString('Misc', 'LangDir', '')); + if (frmSettings.txtLangDir.Text = '\') then + frmSettings.txtLangDir.Text := ''; frmSettings.chkShowStatusbar.Checked := eConfig.ReadBool('Misc', 'ShowStatusbar', True); frmMain.sbStatus.Visible := frmSettings.chkShowStatusbar.Checked; end; diff --git a/editor/studio/UnitTextAnalyze.pas b/editor/studio/UnitTextAnalyze.pas index a73aebf2..011f4ef9 100755 --- a/editor/studio/UnitTextAnalyze.pas +++ b/editor/studio/UnitTextAnalyze.pas @@ -116,6 +116,11 @@ begin if (Trim(eStr[k]) <> '') and (eStr[k] <> '}') then begin eTemp := Trim(RemoveSemicolon(eStr[k])); + if (IsAtStart('const', eTemp, False)) then begin + Delete(eTemp, 1, 5); + eTemp := Trim(eTemp); + end; + if Pos(':', eTemp) <> 0 then eTemp := Copy(eTemp, Pos(':', eTemp) + 1, Length(eTemp)); @@ -229,7 +234,7 @@ begin eStartLine := eStartLine - 1; eTemp := Trim(RemoveSemicolon(Trim(eCode[eStartLine]))); - // Analyze type + // Analyze type k := 0; if IsAtStart('public', eTemp) then k := 1 @@ -243,7 +248,7 @@ begin k := 5; - // Remove type + // Remove type if Pos('@', eTemp) = 1 then begin eTemp := Copy(eTemp, 2, Length(eTemp)); k := 1; @@ -258,7 +263,7 @@ begin if eTemp[Length(eTemp)] = '{' then eTemp := Trim(Copy(eTemp, 1, Length(eTemp) - 1)); - // Remove return-type + // Remove return-type if (Pos(':', eTemp) <> 0) and (Pos(':', eTemp) < Pos('(', eTemp)) then Delete(eTemp, 1, Pos(':', eTemp)); @@ -275,7 +280,7 @@ begin 4: Result.CallTips.Add(eTemp + '-> ' + FileName + ', forward'); end; end; - // Copy function-name + // Copy function-name if Pos('(', eTemp) <> 0 then eTemp := Copy(eTemp, 1, Pos('(', eTemp) - 1); eTemp := Trim(eTemp); diff --git a/editor/studio/UnitfrmInfo.dfm b/editor/studio/UnitfrmInfo.dfm index f82faf39..e7fcf2c1 100755 Binary files a/editor/studio/UnitfrmInfo.dfm and b/editor/studio/UnitfrmInfo.dfm differ diff --git a/editor/studio/UnitfrmMain.dfm b/editor/studio/UnitfrmMain.dfm index f473507e..f9d18c28 100755 --- a/editor/studio/UnitfrmMain.dfm +++ b/editor/studio/UnitfrmMain.dfm @@ -1,7 +1,7 @@ object frmMain: TfrmMain - Left = 189 - Top = 114 - Width = 888 + Left = 184 + Top = 77 + Width = 893 Height = 648 Caption = 'AMXX-Studio' Color = clBtnFace @@ -45,13 +45,13 @@ object frmMain: TfrmMain PixelsPerInch = 96 TextHeight = 13 object splRight: TSplitter - Left = 669 + Left = 674 Top = 95 Height = 501 Align = alRight end object spcRight1: TImage - Left = 877 + Left = 882 Top = 95 Width = 3 Height = 501 @@ -67,7 +67,7 @@ object frmMain: TfrmMain object tbxTopDock: TSpTBXDock Left = 0 Top = 0 - Width = 880 + Width = 885 Height = 72 object tbxMenu: TSpTBXToolbar Left = 0 @@ -680,11 +680,11 @@ object frmMain: TfrmMain object sbStatus: TSpTBXStatusBar Left = 0 Top = 596 - Width = 880 + Width = 885 Height = 25 object mnuFilename: TSpTBXRightAlignSpacerItem Caption = 'Untitled.sma' - CustomWidth = 542 + CustomWidth = 547 end object sepStatus0: TSpTBXSeparatorItem end @@ -728,7 +728,7 @@ object frmMain: TfrmMain object tbDocs: TJvTabBar Left = 0 Top = 72 - Width = 880 + Width = 885 RightClickSelect = False Tabs = < item @@ -740,7 +740,7 @@ object frmMain: TfrmMain OnMouseDown = tbDocsMouseDown end object tcTools: TSpTBXTabControl - Left = 672 + Left = 677 Top = 95 Width = 205 Height = 501 @@ -950,7 +950,7 @@ object frmMain: TfrmMain object pnlParent: TPanel Left = 3 Top = 95 - Width = 666 + Width = 671 Height = 501 Align = alClient BevelOuter = bvNone @@ -958,7 +958,7 @@ object frmMain: TfrmMain object splOutput: TSplitter Left = 0 Top = 416 - Width = 666 + Width = 671 Height = 3 Cursor = crVSplit Align = alBottom @@ -967,7 +967,7 @@ object frmMain: TfrmMain object sciEditor: TScintilla Left = 0 Top = 0 - Width = 666 + Width = 671 Height = 416 Color = clWhite Font.Charset = DEFAULT_CHARSET @@ -4493,7 +4493,7 @@ object frmMain: TfrmMain object lstOutput: TListBox Left = 0 Top = 419 - Width = 666 + Width = 671 Height = 82 Align = alBottom ItemHeight = 13 diff --git a/editor/studio/UnitfrmMain.pas b/editor/studio/UnitfrmMain.pas index f1bbe3d5..fd4554a9 100755 --- a/editor/studio/UnitfrmMain.pas +++ b/editor/studio/UnitfrmMain.pas @@ -1071,9 +1071,30 @@ begin end; procedure TfrmMain.OnCodeSnippetClick(Sender: TObject); +var Snippet, Indentation: String; + Line: Integer; begin - if Plugin_CodeSnippetClick(TSpTBXItem(Sender).Caption, GetCat, GetSnippet(GetCat, (Sender as TSpTBXItem).Caption)) then - sciEditor.SelText := GetSnippet(GetCat, (Sender as TSpTBXItem).Caption); + if Plugin_CodeSnippetClick(TSpTBXItem(Sender).Caption, GetCat, GetSnippet(GetCat, (Sender as TSpTBXItem).Caption)) then begin + Snippet := GetSnippet(GetCat, (Sender as TSpTBXItem).Caption); + if (Pos('!APPEND!' + #13, Snippet) = 1) then begin + Snippet := Copy(Snippet, Pos(#10, Snippet)+1, Length(Snippet)); + Line := sciEditor.Lines.Add(Snippet); + end + else if (Pos('!INSERT!' + #13, Snippet) = 1) then begin + Indentation := sciEditor.Lines[sciEditor.GetCurrentLineNumber]; + if (Trim(Indentation) <> '') then + Indentation := Copy(Indentation, 1, Pos(Copy(TrimLeft(Indentation), 1, 1), Indentation)-1); + Snippet := StringReplace(Snippet, #10, #10 + Indentation, [rfReplaceAll]); + Line := sciEditor.GetCurrentLineNumber; + sciEditor.Lines.Insert(Line, Copy(Snippet, Pos(#10, Snippet)+1, Length(Snippet))); + end + else begin + sciEditor.SelText := Snippet; + Line := sciEditor.GetCurrentLineNumber; + end; + + sciEditor.GoToLine(Line); + end; end; procedure TfrmMain.mnuCopyMessageClick(Sender: TObject); diff --git a/editor/studio/UnitfrmSettings.dfm b/editor/studio/UnitfrmSettings.dfm index be7abc30..82fb52fc 100755 --- a/editor/studio/UnitfrmSettings.dfm +++ b/editor/studio/UnitfrmSettings.dfm @@ -64,7 +64,7 @@ object frmSettings: TfrmSettings Top = 0 Width = 351 Height = 260 - ActivePage = jspCTSettings + ActivePage = jspCodeSnippets PropagateEnable = False Align = alClient OnChange = jplSettingsChange @@ -760,6 +760,9 @@ object frmSettings: TfrmSettings ScrollBars = ssBoth TabOrder = 1 WantTabs = True + OnChange = txtCodeSnippetChange + OnEnter = txtCodeSnippetEnter + OnExit = txtCodeSnippetExit OnKeyUp = txtCodeSnippetKeyUp end object cmdCSAdd: TFlatButton diff --git a/editor/studio/UnitfrmSettings.pas b/editor/studio/UnitfrmSettings.pas index 49c8ab3e..9394c80c 100755 --- a/editor/studio/UnitfrmSettings.pas +++ b/editor/studio/UnitfrmSettings.pas @@ -277,6 +277,9 @@ type procedure lvParamsDblClick(Sender: TObject); procedure cmdAddFunctionClick(Sender: TObject); procedure lstFunctionsClick(Sender: TObject); + procedure txtCodeSnippetEnter(Sender: TObject); + procedure txtCodeSnippetExit(Sender: TObject); + procedure txtCodeSnippetChange(Sender: TObject); public Foreground, Background: TColor; CaretFore, CaretBack: TColor; @@ -339,9 +342,14 @@ begin eReg.OpenKey('SOFTWARE\Microsoft\Windows\CurrentVersion', False); { AMXX } AMXXDir := eReg.ReadString('ProgramFilesDir') + '\AMX Mod X\'; - if not DirectoryExists(AMXXDir) then + if DirectoryExists(AMXXDir) then + AMXXDir := IncludeTrailingPathDelimiter(AMXXDir) + else AMXXDir := ''; eReg.CloseKey; + { Language Files } + if (DirectoryExists(AMXXDir + 'files\base\data\lang')) then + txtLangDir.Text := AMXXDir + 'files\base\data\lang'; { Steam } if eReg.KeyExists('SOFTWARE\Valve\Steam') then begin eReg.OpenKey('SOFTWARE\Valve\Steam', False); @@ -421,7 +429,7 @@ begin eConfig.WriteString('Misc', 'DefaultPluginAuthor', GetUser); eConfig.WriteInteger('Misc', 'SaveNotesTo', 0); eConfig.WriteInteger('Misc', 'CPUSpeed', 5); - eConfig.WriteString('Misc', 'LangDir', ''); + eConfig.WriteString('Misc', 'LangDir', txtLangDir.Text); eConfig.WriteInteger('Misc', 'ShowStatusbar', 1); eConfig.WriteInteger('Misc', 'WindowState', 0); end; @@ -434,6 +442,8 @@ begin 2: frmMain.WindowState := wsMinimized; end; + txtCodeSnippetExit(Sender); + PaintForeground(clBlack); PaintBackground(clBlack); PaintCaretFore(clBlack); @@ -778,6 +788,7 @@ begin lstCodeSnippets.ItemIndex := lstCodeSnippets.Items.Add(eStr); AddSnippet(ftcCodeSnippets.Tabs[ftcCodeSnippets.ActiveTab], eStr, ''); txtCodeSnippet.Enabled := True; + lstCodeSnippets.SetFocus; lstCodeSnippetsClick(Sender); end else @@ -805,7 +816,9 @@ procedure TfrmSettings.lstCodeSnippetsClick(Sender: TObject); begin cmdCSRemove.Enabled := lstCodeSnippets.ItemIndex <> -1; if cmdCSRemove.Enabled then - txtCodeSnippet.Lines.Text := GetSnippet(ftcCodeSnippets.Tabs[ftcCodeSnippets.ActiveTab], lstCodeSnippets.Items[lstCodeSnippets.ItemIndex]); + txtCodeSnippet.Lines.Text := GetSnippet(ftcCodeSnippets.Tabs[ftcCodeSnippets.ActiveTab], lstCodeSnippets.Items[lstCodeSnippets.ItemIndex]) + else + txtCodeSnippetExit(Sender); end; procedure TfrmSettings.ftcCodeSnippetsTabChanged(Sender: TObject); @@ -815,8 +828,8 @@ begin lstCodeSnippets.ItemIndex := 0 else txtCodeSnippet.Clear; - lstCodeSnippetsClick(Sender); txtCodeSnippet.Enabled := lstCodeSnippets.Items.Count > 0; + lstCodeSnippetsClick(Sender); cmdCSRemove.Enabled := lstCodeSnippets.ItemIndex <> -1; end; @@ -1250,4 +1263,28 @@ begin end; end; +procedure TfrmSettings.txtCodeSnippetEnter(Sender: TObject); +begin + if (txtCodeSnippet.Font.Color = $008396A0) and ((ActiveControl = txtCodeSnippet) or (txtCodeSnippet.Enabled)) then begin + txtCodeSnippet.Font.Color := clWindowText; + txtCodeSnippet.Text := ''; + end; +end; + +procedure TfrmSettings.txtCodeSnippetExit(Sender: TObject); +begin + if (txtCodeSnippet.Text = '') then begin + txtCodeSnippet.Lines.Text := 'Use "!APPEND!" to append or'#13'"!INSERT!" to insert the code'#13'snippet into a new line on click...'; + txtCodeSnippet.Font.Color := $008396A0; + end; +end; + +procedure TfrmSettings.txtCodeSnippetChange(Sender: TObject); +begin + if (txtCodeSnippet.Font.Color = $008396A0) then + txtCodeSnippet.Font.Color := clWindowText + else if (txtCodeSnippet.Text = '') and (ActiveControl <> txtCodeSnippet) then + txtCodeSnippetExit(Sender); +end; + end.