Updated about dialog

Updated a few plugin commands
Removed splashscreen
Added some themes
Updated some captions
This commit is contained in:
Christian Hammacher 2005-09-10 21:55:22 +00:00
parent 2d787f43de
commit 468d99ff70
14 changed files with 374 additions and 105 deletions

View File

@ -34,6 +34,7 @@
-K$00400000 -K$00400000
-LE"c:\programme\borland\delphi7\Projects\Bpl" -LE"c:\programme\borland\delphi7\Projects\Bpl"
-LN"c:\programme\borland\delphi7\Projects\Bpl" -LN"c:\programme\borland\delphi7\Projects\Bpl"
-DmadExcept
-w-UNSAFE_TYPE -w-UNSAFE_TYPE
-w-UNSAFE_CODE -w-UNSAFE_CODE
-w-UNSAFE_CAST -w-UNSAFE_CAST

View File

@ -96,7 +96,7 @@ PackageDLLOutputDir=
PackageDCPOutputDir= PackageDCPOutputDir=
SearchPath= SearchPath=
Packages=vcl;rtl;vclx;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;VclSmp;dbrtl;dbexpress;vcldb;dsnap;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;Rave50CLX;Rave50VCL;dclOffice2k;Indy70;DJcl;FlatStyle_D5;DelphiX_for7;mxFlatPack_D7;tbx_d7;tb2k_d7;mbTBXLibPack;TntUnicodeVcl_R70;SynEdit_R7 Packages=vcl;rtl;vclx;vclie;xmlrtl;inetdbbde;inet;inetdbxpress;VclSmp;dbrtl;dbexpress;vcldb;dsnap;dbxcds;inetdb;bdertl;vcldbx;adortl;teeui;teedb;tee;ibxpress;visualclx;visualdbclx;vclactnband;vclshlctrls;Rave50CLX;Rave50VCL;dclOffice2k;Indy70;DJcl;FlatStyle_D5;DelphiX_for7;mxFlatPack_D7;tbx_d7;tb2k_d7;mbTBXLibPack;TntUnicodeVcl_R70;SynEdit_R7
Conditionals= Conditionals=madExcept
DebugSourceDirs= DebugSourceDirs=
UsePackages=0 UsePackages=0
[Parameters] [Parameters]
@ -113,9 +113,9 @@ RootDir=C:\Programme\Borland\Delphi7\Bin\
IncludeVerInfo=1 IncludeVerInfo=1
AutoIncBuild=1 AutoIncBuild=1
MajorVer=1 MajorVer=1
MinorVer=1 MinorVer=2
Release=0 Release=0
Build=13 Build=1
Debug=0 Debug=0
PreRelease=0 PreRelease=0
Special=0 Special=0
@ -126,13 +126,13 @@ CodePage=1252
[Version Info Keys] [Version Info Keys]
CompanyName=AMX Mod X Dev Team CompanyName=AMX Mod X Dev Team
FileDescription= FileDescription=
FileVersion=1.1.0.13 FileVersion=1.2.0.1
InternalName= InternalName=
LegalCopyright= LegalCopyright=
LegalTrademarks= LegalTrademarks=
OriginalFilename= OriginalFilename=
ProductName=AMXX-Studio ProductName=AMXX-Studio
ProductVersion=1.1.0.0 ProductVersion=1.2.0.0
Comments= Comments=
[HistoryLists\hlConditionals] [HistoryLists\hlConditionals]
Count=1 Count=1

View File

@ -1,11 +1,16 @@
program AMXX_Studio; program AMXX_Studio;
{%ToDo 'AMXX_Studio.todo'}
uses uses
madExcept,
madLinkDisAsm,
Forms, Forms,
Windows, Windows,
Classes,
Messages, Messages,
SysUtils,
SciLexerMemo,
JvInspector,
UnitfrmMain in 'UnitfrmMain.pas' {frmMain}, UnitfrmMain in 'UnitfrmMain.pas' {frmMain},
UnitMainTools in 'UnitMainTools.pas', UnitMainTools in 'UnitMainTools.pas',
UnitfrmSettings in 'UnitfrmSettings.pas' {frmSettings}, UnitfrmSettings in 'UnitfrmSettings.pas' {frmSettings},
@ -14,7 +19,6 @@ uses
UnitfrmInfo in 'UnitfrmInfo.pas' {frmInfo}, UnitfrmInfo in 'UnitfrmInfo.pas' {frmInfo},
UnitCodeSnippets in 'UnitCodeSnippets.pas', UnitCodeSnippets in 'UnitCodeSnippets.pas',
UnitCodeUtils in 'UnitCodeUtils.pas', UnitCodeUtils in 'UnitCodeUtils.pas',
UnitfrmSplashscreen in 'UnitfrmSplashscreen.pas' {frmSplashscreen},
UnitfrmSearch in 'UnitfrmSearch.pas' {frmSearch}, UnitfrmSearch in 'UnitfrmSearch.pas' {frmSearch},
UnitfrmReplace in 'UnitfrmReplace.pas' {frmReplace}, UnitfrmReplace in 'UnitfrmReplace.pas' {frmReplace},
UnitfrmAllFilesForm in 'UnitfrmAllFilesForm.pas' {frmAllFilesForm}, UnitfrmAllFilesForm in 'UnitfrmAllFilesForm.pas' {frmAllFilesForm},
@ -48,7 +52,9 @@ uses
{$R *.res} {$R *.res}
var i: integer; var eCache: TStringList;
i: integer;
eExt: String;
begin begin
if (FindWindow('TfrmMain', 'AMXX-Studio') <> 0) and (FindWindow(nil, 'Delphi 7') = 0) then begin if (FindWindow('TfrmMain', 'AMXX-Studio') <> 0) and (FindWindow(nil, 'Delphi 7') = 0) then begin
if ParamCount > 0 then begin if ParamCount > 0 then begin
@ -59,6 +65,90 @@ begin
end; end;
Application.Initialize; Application.Initialize;
Application.Title := 'AMXX-Studio'; Application.Title := 'AMXX-Studio';
Application.CreateForm(TfrmSplashscreen, frmSplashscreen); Application.CreateForm(TfrmMain, frmMain);
Application.CreateForm(TfrmAutoIndent, frmAutoIndent);
Application.CreateForm(TfrmSettings, frmSettings);
Application.OnMessage := frmMain.OnMessage;
Application.OnShortCut := frmMain.OnShortCut;
frmMain.sciPropertyLoader.FileName := ExtractFilePath(ParamStr(0)) + 'config\Editor.sci';
if FileExists(frmMain.sciPropertyLoader.FileName) then
frmMain.sciPropertyLoader.Load
else
frmMain.sciPropertyLoader.Save; // create new if it doesnt exist...
frmMain.sciEditor.Gutter1.Width := 40;
frmMain.sciEditor.Gutter1.MarginType := gutLineNumber;
LoadCodeSnippets('Pawn');
ResetToEnglish;
TJvCustomInspectorData.ItemRegister.Add(TJvInspectorTypeInfoRegItem.Create(TJvInspectorSelectionTextListItem, TypeInfo(TSelectionTextList)));
eCache := TStringList.Create;
if FileExists(ExtractFilePath(ParamStr(0)) + 'config\Cache.cfg') then
eCache.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\Cache.cfg');
for i := 1 to ParamCount do begin
if eCache.IndexOf(ParamStr(i)) = -1 then
eCache.Add(ParamStr(i));
end;
for i := 0 to eCache.Count -1 do begin
if FileExists(eCache[i]) then begin
eExt := ExtractFileExt(eCache[i]);
eExt := LowerCase(eExt);
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then // Pawn files
PAWNProjects.Open(eCache[i])
else if (eExt = '.cpp') or (eExt = '.h') then // C++ files
CPPProjects.Open(eCache[i])
else if (eExt = '.htm') or (eExt = '.html') then // HTML files
OtherProjects.Open(eCache[i], 'HTML')
else if (eExt = '.sql') then // SQL databases
OtherProjects.Open(eCache[i], 'SQL')
else if (eExt = '.xml') then // XML files
OtherProjects.Open(eCache[i], 'XML')
else // Other files and/or Textfiles
OtherProjects.Open(eCache[i], 'null');
end;
end;
eCache.Free;
i := 0;
if PAWNProjects.Count > 1 then begin
PAWNProjects.Close(0);
i := 1;
end;
if CPPProjects.Count > 1 then begin
CPPProjects.Close(0);
i := 1;
end;
if OtherProjects.Count > 1 then begin
OtherProjects.Close(0);
i := 1;
end;
if i = 1 then begin
ActivateProjects(0, False); // Started := True is already set here
PAWNProjects.Activate(PAWNProjects.Count -1, False, False);
end;
UpdateCI;
Application.CreateForm(TfrmSelectColor, frmSelectColor);
Application.CreateForm(TfrmInfo, frmInfo);
Application.CreateForm(TfrmSearch, frmSearch);
Application.CreateForm(TfrmReplace, frmReplace);
Application.CreateForm(TfrmAllFilesForm, frmAllFilesForm);
Application.CreateForm(TfrmGoToLine, frmGoToLine);
Application.CreateForm(TfrmPluginsIniEditor, frmPluginsIniEditor);
Application.CreateForm(TfrmSocketsTerminal, frmSocketsTerminal);
Application.CreateForm(TfrmHudMsgGenerator, frmHudMsgGenerator);
Application.CreateForm(TfrmMenuGenerator, frmMenuGenerator);
Application.CreateForm(TfrmMOTDGen, frmMOTDGen);
Application.CreateForm(TfrmClose, frmClose);
Application.CreateForm(TfrmConnGen, frmConnGen);
Application.CreateForm(TfrmIRCPaster, frmIRCPaster);
if IEInstalled then
Application.CreateForm(TfrmHTMLPreview, frmHTMLPreview)
else
frmMain.mnuMOTDGenerator.Enabled := False;
LoadPlugins;
Application.Run; Application.Run;
end. end.

Binary file not shown.

Binary file not shown.

View File

@ -24,7 +24,7 @@ type
protected protected
procedure Execute; override; procedure Execute; override;
procedure GetCode; procedure GetCode;
procedure SetValuesPAWN; procedure SetValuesPawn;
end; end;
implementation implementation
@ -62,7 +62,7 @@ begin
if (frmMain.tsMain.ActiveTabIndex = 0) then begin if (frmMain.tsMain.ActiveTabIndex = 0) then begin
if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then begin if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then begin
// analyze code // analyze code
with ParseCodePAWN(eCode, ExtractFileName(ActiveDoc.FileName)) do begin with ParseCodePawn(eCode, ExtractFileName(ActiveDoc.FileName)) do begin
eConstants.Assign(Constants); eConstants.Assign(Constants);
eDefined.Assign(Defined); eDefined.Assign(Defined);
eCVars.Assign(CVars); eCVars.Assign(CVars);
@ -81,7 +81,7 @@ begin
DestroyResult; DestroyResult;
end; end;
// apply changes // apply changes
Synchronize(SetValuesPAWN); Synchronize(SetValuesPawn);
end; end;
end; end;
except except
@ -113,7 +113,7 @@ begin
eCode.Assign(frmMain.sciEditor.Lines); eCode.Assign(frmMain.sciEditor.Lines);
end; end;
procedure TCodeExplorerUpdater.SetValuesPAWN; procedure TCodeExplorerUpdater.SetValuesPawn;
function GetNode(eText: String): TTreeNode; function GetNode(eText: String): TTreeNode;
var i: integer; var i: integer;
begin begin
@ -223,6 +223,15 @@ begin
SelectedIndex := 35; SelectedIndex := 35;
end; end;
end; end;
// Sort items
eIncluded.Sort;
eMethodsDefault.Sort;
eMethodsEvents.Sort;
eStocks.Sort;
eNatives.Sort;
eForwards.Sort;
eVariables.Sort;
// Add items
for i := 0 to eIncluded.Count -1 do begin for i := 0 to eIncluded.Count -1 do begin
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Included'), eIncluded[i], Pointer(eIncluded.Objects[i])) do begin with frmMain.trvExplorer.Items.AddChildObject(GetNode('Included'), eIncluded[i], Pointer(eIncluded.Objects[i])) do begin
ImageIndex := 34; ImageIndex := 34;

View File

@ -29,6 +29,7 @@ type
public public
Value: string; Value: string;
constructor Create(const AValue: string); reintroduce; constructor Create(const AValue: string); reintroduce;
destructor Destroy; reintroduce;
end; end;
TSTLWrapper = class(TObject) TSTLWrapper = class(TObject)
@ -415,6 +416,12 @@ begin
inherited; inherited;
end; end;
destructor TStringWrapper.Destroy;
begin
Value := '';
inherited;
end;
initialization initialization
FItems := TObjectList.Create; FItems := TObjectList.Create;

View File

@ -10,7 +10,7 @@ var lInvalidFile: String;
lModified: String; lModified: String;
lLnCh: String; lLnCh: String;
lCloseModify: String; lCloseModify: String;
lSelectOutputPAWN: String; lSelectOutputPawn: String;
lSelectOutputCPP: String; lSelectOutputCPP: String;
lDynamic: String; lDynamic: String;
lOutputHint: String; lOutputHint: String;
@ -41,7 +41,7 @@ var lInvalidFile: String;
lPastingCodeEscStop: String; lPastingCodeEscStop: String;
lInvalidDirectory: String; lInvalidDirectory: String;
lFailedLoadNotes: String; lFailedLoadNotes: String;
lPAWNCompilerNotFound: String; lPawnCompilerNotFound: String;
lError: String; lError: String;
lWarning: String; lWarning: String;
lOnLine: String; lOnLine: String;
@ -94,7 +94,7 @@ begin
lModified := 'Modified'; lModified := 'Modified';
lLnCh := 'Ln %u Ch %u'; lLnCh := 'Ln %u Ch %u';
lCloseModify := 'The file "%s" has been modified. Save it before closing?'; lCloseModify := 'The file "%s" has been modified. Save it before closing?';
lSelectOutputPAWN := 'Please select the default output folder for compiled PAWN Plug-Ins:'; lSelectOutputPawn := 'Please select the default output folder for compiled Pawn Plug-Ins:';
lSelectOutputCPP := 'Please select the default output folder for compiled C++ libraries:'; lSelectOutputCPP := 'Please select the default output folder for compiled C++ libraries:';
lDynamic := 'Dynamic'; lDynamic := 'Dynamic';
lOutputHint := 'The output will be copied to the source''s directory.'; lOutputHint := 'The output will be copied to the source''s directory.';
@ -125,7 +125,7 @@ begin
lPastingCodeEscStop := 'Pasting Code, press Esc to stop...'; lPastingCodeEscStop := 'Pasting Code, press Esc to stop...';
lInvalidDirectory := 'Could not change FTP directory. Update it and try again.'; lInvalidDirectory := 'Could not change FTP directory. Update it and try again.';
lFailedLoadNotes := 'Failed to load the notes!'; lFailedLoadNotes := 'Failed to load the notes!';
lPAWNCompilerNotFound := 'PAWN compiler not found. Please check your settings and try again.'; lPawnCompilerNotFound := 'Pawn compiler not found. Please check your settings and try again.';
lError := 'Error: %s on line %u'; lError := 'Error: %s on line %u';
lWarning := 'Warning: %s on line %u'; lWarning := 'Warning: %s on line %u';
lOther := '%s on line %u'; lOther := '%s on line %u';
@ -142,7 +142,7 @@ begin
lSuccessfulRegistered := 'The plugin has been registered successfully!'; lSuccessfulRegistered := 'The plugin has been registered successfully!';
lFailedUpdatePluginsIni := 'Failed to update plugins.ini!'; lFailedUpdatePluginsIni := 'Failed to update plugins.ini!';
lInternetExplorerRequired := 'Microsoft Internet Explorer 6.0 is required to use this function.'; lInternetExplorerRequired := 'Microsoft Internet Explorer 6.0 is required to use this function.';
lUseMOTDAgain := 'When you''ve finished, use this function again to convert the HTML code to a PAWN string.'; lUseMOTDAgain := 'When you''ve finished, use this function again to convert the HTML code to a Pawn string.';
lName := 'Name'; lName := 'Name';
lType := 'Type'; lType := 'Type';
lValue := 'Value'; lValue := 'Value';

View File

@ -30,6 +30,7 @@ type TCodeSnippetClick = function (pTitle, pCategory: PChar; pCode: PChar): Inte
TAppMsg = function (pHwnd: HWND; pMessage: Integer; pWParam, pLParam: Integer; pTime: Integer; pPt: TPoint): Integer; cdecl; TAppMsg = function (pHwnd: HWND; pMessage: Integer; pWParam, pLParam: Integer; pTime: Integer; pPt: TPoint): Integer; cdecl;
TUpdateCodeTools = function (pLang, pFilename, pCurrProjects: PChar): Integer; cdecl; TUpdateCodeTools = function (pLang, pFilename, pCurrProjects: PChar): Integer; cdecl;
TOutputEvent = function (pItemIndex: Integer): Integer; cdecl; TOutputEvent = function (pItemIndex: Integer): Integer; cdecl;
TShortcutEvent = function (pCharCode, pKeyData: Integer): Integer; cdecl;
type TIntegerArray = array of Integer; type TIntegerArray = array of Integer;
@ -56,7 +57,6 @@ type TLoadInfo = record
hSelectColor: HWND; hSelectColor: HWND;
hSettings: HWND; hSettings: HWND;
hSocketsTerminal: HWND; hSocketsTerminal: HWND;
hSplashscreen: HWND;
{ Important Control Handles } { Important Control Handles }
hOutput: HWND; hOutput: HWND;
hCodeExplorer: HWND; hCodeExplorer: HWND;
@ -103,6 +103,7 @@ function Plugin_UpdateCodeExplorer(Lang, Filename, CurrProjects: String; Updatin
function Plugin_UpdateCodeInspector(Lang, Filename, CurrProjects: String; Updating: Boolean): Boolean; function Plugin_UpdateCodeInspector(Lang, Filename, CurrProjects: String; Updating: Boolean): Boolean;
function Plugin_OutputDblClick(ItemIndex: Integer): Boolean; function Plugin_OutputDblClick(ItemIndex: Integer): Boolean;
function Plugin_OutputPopup(ItemIndex: Integer): Boolean; function Plugin_OutputPopup(ItemIndex: Integer): Boolean;
function Plugin_Shortcut(CharCode, KeyData: Integer): Boolean;
const { Return values for dlls } const { Return values for dlls }
PLUGIN_CONTINUE = 0; // continue... PLUGIN_CONTINUE = 0; // continue...
@ -241,10 +242,9 @@ uses UnitfrmSettings, UnitMainTools, UnitfrmAllFilesForm,
UnitfrmHTMLPreview, UnitfrmHudMsgGenerator, UnitfrmInfo, UnitfrmMain, UnitfrmHTMLPreview, UnitfrmHudMsgGenerator, UnitfrmInfo, UnitfrmMain,
UnitfrmMenuGenerator, UnitfrmMOTDGen, UnitfrmPluginsIniEditor, UnitfrmMenuGenerator, UnitfrmMOTDGen, UnitfrmPluginsIniEditor,
UnitfrmReplace, UnitfrmSearch, UnitfrmSelectColor, UnitfrmReplace, UnitfrmSearch, UnitfrmSelectColor,
UnitfrmSocketsTerminal, UnitfrmSplashscreen, UnitLanguages, UnitfrmSocketsTerminal, UnitLanguages,UnitCodeExplorerUpdater,
UnitCodeExplorerUpdater, UnitCodeInspector, UnitCodeSnippets, UnitCodeInspector, UnitCodeSnippets, UnitCodeUtils, UnitCompile,
UnitCodeUtils, UnitCompile, UnitfrmIRCPaster, UnitMenuGenerators, UnitfrmIRCPaster, UnitMenuGenerators, UnitReadThread, UnitTextAnalyze;
UnitReadThread, UnitTextAnalyze;
function LoadPlugin(ListItem: TListItem): Boolean; function LoadPlugin(ListItem: TListItem): Boolean;
var eLoadInfo: TLoadInfo; var eLoadInfo: TLoadInfo;
@ -276,7 +276,6 @@ begin
hSelectColor := frmSelectColor.Handle; hSelectColor := frmSelectColor.Handle;
hSettings := frmSettings.Handle; hSettings := frmSettings.Handle;
hSocketsTerminal := frmSocketsTerminal.Handle; hSocketsTerminal := frmSocketsTerminal.Handle;
hSplashscreen := frmSplashscreen.Handle;
{ Important Control Handles } { Important Control Handles }
hOutput := frmMain.lstOutput.Handle; hOutput := frmMain.lstOutput.Handle;
hCodeExplorer := frmMain.trvExplorer.Handle; hCodeExplorer := frmMain.trvExplorer.Handle;
@ -1043,4 +1042,29 @@ begin
Handles := nil; Handles := nil;
end; end;
function Plugin_Shortcut(CharCode, KeyData: Integer): Boolean;
var Func: TShortcutEvent;
i: integer;
Handles: TIntegerArray;
begin
Result := True;
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'Shortcut');
if @Func <> nil then begin
case Func(CharCode, KeyData) of
PLUGIN_HANDLED: Result := False;
PLUGIN_STOP: begin
Result := False;
exit;
end;
end;
end;
end;
SetLength(Handles, 0);
Handles := nil;
end;
end. end.

View File

@ -4,7 +4,7 @@ interface
uses SysUtils, Classes, Windows, Forms; uses SysUtils, Classes, Windows, Forms;
type TPAWNParseResult = class type TPawnParseResult = class
public public
Constants: TStringList; Constants: TStringList;
Defined: TStringList; Defined: TStringList;
@ -25,7 +25,7 @@ type TPAWNParseResult = class
procedure DestroyResult; procedure DestroyResult;
end; end;
function ParseCodePAWN(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPAWNParseResult; function ParseCodePawn(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPawnParseResult;
function UpdateIncPath(eInput: String): String; function UpdateIncPath(eInput: String): String;
var eCPUSpeed: Integer = 1; var eCPUSpeed: Integer = 1;
@ -40,17 +40,17 @@ var eLookedUpIncluded: TStringList;
function UpdateIncPath(eInput: String): String; function UpdateIncPath(eInput: String): String;
begin begin
eInput := StringReplace(Trim(eInput), '/', '\', [rfReplaceAll]); eInput := StringReplace(Trim(eInput), '/', '\', [rfReplaceAll]);
if FileExists(ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + eInput + '.inc') then if FileExists(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + eInput + '.inc') then
Result := ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + eInput + '.inc' Result := ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + eInput + '.inc'
else if FileExists(ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + 'include\' + eInput + '.inc') then else if FileExists(ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + 'include\' + eInput + '.inc') then
Result := ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + 'include\' + eInput + '.inc' Result := ExtractFilePath(frmSettings.txtPawnCompilerPath.Text) + 'include\' + eInput + '.inc'
else if (FileExists(ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc')) and (not ActiveDoc.Modified) then else if (FileExists(ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc')) and (not ActiveDoc.Modified) then
Result := ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc' Result := ExtractFilePath(ActiveDoc.FileName) + eInput + '.inc'
else else
Result := ''; Result := '';
end; end;
function ParseCodePAWN(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPAWNParseResult; function ParseCodePawn(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPawnParseResult;
var i, k: integer; var i, k: integer;
eString, eTemp, eBackup: string; eString, eTemp, eBackup: string;
eStr, ePreEvents: TStringList; eStr, ePreEvents: TStringList;
@ -85,8 +85,6 @@ begin
eTimeToSleep := 0; eTimeToSleep := 0;
end; end;
if Pos('smbans/constants.inl"', eString) <> 0 then
eString := eString;
{ Constants and Variables } { Constants and Variables }
if (IsAtStart('new', eString)) and (eBracesOpen = 0) and (not IsRecursive) then begin // const or variable if (IsAtStart('new', eString)) and (eBracesOpen = 0) and (not IsRecursive) then begin // const or variable
Delete(eString, 1, 4); Delete(eString, 1, 4);
@ -149,7 +147,7 @@ begin
try try
eStr.LoadFromFile(eTemp); eStr.LoadFromFile(eTemp);
if Application.Terminated then exit; if Application.Terminated then exit;
eTempResult := ParseCodePAWN(eStr, ExtractFileName(eTemp), True); eTempResult := ParseCodePawn(eStr, ExtractFileName(eTemp), True);
// Assign parsed values // Assign parsed values
Result.AutoComplete.AddStrings(eTempResult.AutoComplete); Result.AutoComplete.AddStrings(eTempResult.AutoComplete);
Result.CallTips.AddStrings(eTempResult.CallTips); Result.CallTips.AddStrings(eTempResult.CallTips);
@ -356,9 +354,9 @@ begin
eStr.Free; eStr.Free;
end; end;
{ TPAWNParseResult } { TPawnParseResult }
constructor TPAWNParseResult.Create; constructor TPawnParseResult.Create;
begin begin
inherited Create; inherited Create;
@ -378,23 +376,22 @@ begin
HighlightKeywords := TStringList.Create; HighlightKeywords := TStringList.Create;
end; end;
procedure TPAWNParseResult.DestroyResult; procedure TPawnParseResult.DestroyResult;
begin begin
AutoComplete.Free;
CallTips.Free;
Constants.Free; Constants.Free;
Defined.Free;
CVars.Free; CVars.Free;
Defined.Free;
Events.Free;
Forwards.Free;
HighlightKeywords.Free;
Included.Free; Included.Free;
MethodsDefault.Free; MethodsDefault.Free;
Events.Free;
Stocks.Free;
Natives.Free; Natives.Free;
Forwards.Free; Stocks.Free;
Variables.Free; Variables.Free;
CallTips.Free;
AutoComplete.Free;
HighlightKeywords.Free;
Free; Free;
end; end;

Binary file not shown.

View File

@ -38,6 +38,8 @@ begin
MessageBox(Handle, 'Hampster!', 'Your computer! wtf', MB_ICONERROR); MessageBox(Handle, 'Hampster!', 'Your computer! wtf', MB_ICONERROR);
MessageBox(Handle, 'ZOMG YES it''s a hampster!', 'zomg', MB_ICONINFORMATION); MessageBox(Handle, 'ZOMG YES it''s a hampster!', 'zomg', MB_ICONINFORMATION);
MessageBox(Handle, 'hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster!', 'ham ham hampster', MB_ICONWARNING); MessageBox(Handle, 'hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster hampster!', 'ham ham hampster', MB_ICONWARNING);
MessageBox(Handle, 'hampsters eat gaben.', 'oh noes', MB_ICONWARNING);
MessageBox(Handle, 'or gaben eats hampsters.', 'gabenbla', MB_ICONERROR);
end; end;
procedure TfrmInfo.imgDoom4Click(Sender: TObject); procedure TfrmInfo.imgDoom4Click(Sender: TObject);
@ -45,6 +47,7 @@ begin
MessageBox(Handle, 'gaben', 'doom', MB_ICONWARNING); MessageBox(Handle, 'gaben', 'doom', MB_ICONWARNING);
MessageBox(Handle, 'gaben gaben gaben gaben gaben gaben!', 'doom', MB_ICONERROR); MessageBox(Handle, 'gaben gaben gaben gaben gaben gaben!', 'doom', MB_ICONERROR);
MessageBox(Handle, 'gab gab gab gab gab GABEN GABEN GABEN GAAGAGAGABEN! gabenygabgab gaben da gaben0r gabbagaben >_<', 'doom', MB_ICONINFORMATION); MessageBox(Handle, 'gab gab gab gab gab GABEN GABEN GABEN GAAGAGAGABEN! gabenygabgab gaben da gaben0r gabbagaben >_<', 'doom', MB_ICONINFORMATION);
MessageBox(Handle, 'oh noes gaben eats hampsters!', 'dooo oo oo o om!', MB_ICONWARNING);
end; end;
procedure TfrmInfo.imgYamsClick(Sender: TObject); procedure TfrmInfo.imgYamsClick(Sender: TObject);
@ -52,6 +55,7 @@ begin
MessageBox(Handle, 'mmm.. yams', 'personal farmer', MB_ICONINFORMATION); MessageBox(Handle, 'mmm.. yams', 'personal farmer', MB_ICONINFORMATION);
MessageBox(Handle, 'yam yam yam.. oh a yam! yaaaam yaaaam yayayammm yaaamamamamam and some yaaams', 'gran farmer', MB_ICONERROR); MessageBox(Handle, 'yam yam yam.. oh a yam! yaaaam yaaaam yayayammm yaaamamamamam and some yaaams', 'gran farmer', MB_ICONERROR);
MessageBox(Handle, 'yams? deadly yams? >:(', 'not a farmer', MB_ICONQUESTION); MessageBox(Handle, 'yams? deadly yams? >:(', 'not a farmer', MB_ICONQUESTION);
MessageBox(Handle, 'no, no DEADLY YAMS! but DEADLY GABEN eats NOT-DEADLY YAMS AND HAMPSTERS!', 'gaben', MB_ICONWARNING);
end; end;
end. end.

View File

@ -1,6 +1,6 @@
object frmMain: TfrmMain object frmMain: TfrmMain
Left = 260 Left = 284
Top = 305 Top = 290
Width = 888 Width = 888
Height = 640 Height = 640
Caption = 'AMXX-Studio' Caption = 'AMXX-Studio'
@ -306,7 +306,7 @@ object frmMain: TfrmMain
AutoCheck = True AutoCheck = True
Checked = True Checked = True
OnClick = mnuHXMLClick OnClick = mnuHXMLClick
CaptionW = 'PAWN' CaptionW = 'Pawn'
end end
object mnuHCPP: TSpTBXItem object mnuHCPP: TSpTBXItem
AutoCheck = True AutoCheck = True
@ -4222,7 +4222,7 @@ object frmMain: TfrmMain
Images = ilImages Images = ilImages
Indent = 19 Indent = 19
ReadOnly = True ReadOnly = True
SortType = stText SortType = stBoth
TabOrder = 1 TabOrder = 1
OnCollapsed = trvExplorerCollapsed OnCollapsed = trvExplorerCollapsed
OnDblClick = trvExplorerDblClick OnDblClick = trvExplorerDblClick

View File

@ -9,7 +9,9 @@ uses
TBXMonaiTheme, TBXNexos2Theme, TBXNexos3Theme, TBXNexos4Theme, TBXNexos5Theme, TBXMonaiTheme, TBXNexos2Theme, TBXNexos3Theme, TBXNexos4Theme, TBXNexos5Theme,
TBXOffice11AdaptiveTheme, TBXOfficeCTheme, TBXOfficeKTheme, TBXOfficeXPTheme, TBXOffice11AdaptiveTheme, TBXOfficeCTheme, TBXOfficeKTheme, TBXOfficeXPTheme,
TBXReliferTheme, TBXSentimoXTheme, TBXTristanTheme, TBXTristan2Theme, TBXReliferTheme, TBXSentimoXTheme, TBXTristanTheme, TBXTristan2Theme,
TBXXitoTheme, { <- Themes } SpTBXTabs, ExtCtrls, SpTBXDkPanels, TFlatSplitterUnit, TBXXitoTheme, TBXMonaiXPTheme, TBXZezioTheme, TBXWhidbeyTheme,
TBXRomaTheme, TBXMirandaTheme, { <- Themes }
SpTBXTabs, ExtCtrls, SpTBXDkPanels, TFlatSplitterUnit,
SciLexer, SciLexerMemo, SciLexerMod, SciCallTips, ComCtrls, mbTBXTreeView, SciLexer, SciLexerMemo, SciLexerMod, SciCallTips, ComCtrls, mbTBXTreeView,
StdCtrls, mbTBXRichEdit, TBXDkPanels, TBXToolPals, SciPropertyMgr, StdCtrls, mbTBXRichEdit, TBXDkPanels, TBXToolPals, SciPropertyMgr,
mbTBXHint, mbTBXHotKeyEdit, SciAutoComplete, sciKeyBindings, mbTBXHint, mbTBXHotKeyEdit, SciAutoComplete, sciKeyBindings,
@ -30,7 +32,7 @@ type
mnuNew: TSpTBXSubmenuItem; mnuNew: TSpTBXSubmenuItem;
mnuEmptyPlugin: TSpTBXItem; mnuEmptyPlugin: TSpTBXItem;
mnuNewPlugin: TSpTBXItem; mnuNewPlugin: TSpTBXItem;
mnuHeaderPAWN: TSpTBXItem; mnuHeaderPawn: TSpTBXItem;
mnuNewModule: TSpTBXItem; mnuNewModule: TSpTBXItem;
mnuNewUnit: TSpTBXItem; mnuNewUnit: TSpTBXItem;
mnuNewHeaderCPP: TSpTBXItem; mnuNewHeaderCPP: TSpTBXItem;
@ -67,7 +69,7 @@ type
mnuChangeTheme: TSpTBXSubmenuItem; mnuChangeTheme: TSpTBXSubmenuItem;
mnuThemes: TSpTBXThemeGroupItem; mnuThemes: TSpTBXThemeGroupItem;
mnuSelectHighlighter: TSpTBXSubmenuItem; mnuSelectHighlighter: TSpTBXSubmenuItem;
mnuHPAWN: TSpTBXItem; mnuHPawn: TSpTBXItem;
mnuHCPP: TSpTBXItem; mnuHCPP: TSpTBXItem;
mnuHHTML: TSpTBXItem; mnuHHTML: TSpTBXItem;
mnuHSQL: TSpTBXItem; mnuHSQL: TSpTBXItem;
@ -127,7 +129,7 @@ type
sepTEdit2: TSpTBXSeparatorItem; sepTEdit2: TSpTBXSeparatorItem;
mnuTSelectAll: TSpTBXItem; mnuTSelectAll: TSpTBXItem;
tsMain: TSpTBXTabSet; tsMain: TSpTBXTabSet;
tiPAWN: TSpTBXTabItem; tiPawn: TSpTBXTabItem;
tiCPP: TSpTBXTabItem; tiCPP: TSpTBXTabItem;
tsDocuments: TSpTBXTabSet; tsDocuments: TSpTBXTabSet;
tiDocument1: TSpTBXTabItem; tiDocument1: TSpTBXTabItem;
@ -321,7 +323,7 @@ type
procedure mnuSocketTerminalClick(Sender: TObject); procedure mnuSocketTerminalClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure trvExplorerDblClick(Sender: TObject); procedure trvExplorerDblClick(Sender: TObject);
procedure tiPAWNClick(Sender: TObject); procedure tiPawnClick(Sender: TObject);
procedure tiCPPClick(Sender: TObject); procedure tiCPPClick(Sender: TObject);
procedure tiOtherClick(Sender: TObject); procedure tiOtherClick(Sender: TObject);
procedure mnuOpenHelpClick(Sender: TObject); procedure mnuOpenHelpClick(Sender: TObject);
@ -343,7 +345,7 @@ type
const Position: Integer; ListToDisplay: TStrings; const Position: Integer; ListToDisplay: TStrings;
var CancelDisplay: Boolean); var CancelDisplay: Boolean);
procedure mnuMOTDGeneratorClick(Sender: TObject); procedure mnuMOTDGeneratorClick(Sender: TObject);
procedure mnuHeaderPAWNClick(Sender: TObject); procedure mnuHeaderPawnClick(Sender: TObject);
procedure OnTabSelect(Sender: TTBCustomItem; Viewer: TTBItemViewer; procedure OnTabSelect(Sender: TTBCustomItem; Viewer: TTBItemViewer;
Selecting: Boolean); Selecting: Boolean);
procedure mnuPCloseClick(Sender: TObject); procedure mnuPCloseClick(Sender: TObject);
@ -383,6 +385,9 @@ type
procedure OnCustomClick(Sender: TObject); procedure OnCustomClick(Sender: TObject);
procedure SetErrorLine(eLine: Integer); procedure SetErrorLine(eLine: Integer);
procedure OnCopyData(var Msg: TWMCopyData); message WM_COPYDATA; procedure OnCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
procedure OnMessage(var Msg: TMsg; var Handled: Boolean);
procedure OnShortCut(var Msg: TWMKey; var Handled: Boolean);
end; end;
var var
@ -394,8 +399,8 @@ implementation
uses UnitfrmSettings, UnitMainTools, UnitLanguages, UnitfrmInfo, uses UnitfrmSettings, UnitMainTools, UnitLanguages, UnitfrmInfo,
UnitCodeSnippets, UnitfrmSearch, UnitfrmReplace, UnitfrmGoToLine, UnitCodeSnippets, UnitfrmSearch, UnitfrmReplace, UnitfrmGoToLine,
UnitfrmAllFilesForm, UnitCodeUtils, UnitfrmPluginsIniEditor, UnitfrmAllFilesForm, UnitCodeUtils, UnitfrmPluginsIniEditor,
UnitfrmSocketsTerminal, UnitfrmSplashscreen, UnitCodeExplorerUpdater, UnitfrmSocketsTerminal, UnitCodeExplorerUpdater, UnitTextAnalyze,
UnitTextAnalyze, UnitfrmHudMsgGenerator, UnitCompile, UnitfrmAutoIndent, UnitfrmHudMsgGenerator, UnitCompile, UnitfrmAutoIndent,
UnitfrmHTMLPreview, UnitCodeInspector, UnitfrmMOTDGen, UnitfrmHTMLPreview, UnitCodeInspector, UnitfrmMOTDGen,
UnitfrmMenuGenerator, UnitfrmClose, UnitPlugins, UnitfrmConnGen, UnitfrmMenuGenerator, UnitfrmClose, UnitPlugins, UnitfrmConnGen,
UnitMenuGenerators, UnitfrmIRCPaster; UnitMenuGenerators, UnitfrmIRCPaster;
@ -423,7 +428,7 @@ end;
procedure TfrmMain.OnCodeSnippetSelect(Sender: TObject); procedure TfrmMain.OnCodeSnippetSelect(Sender: TObject);
begin begin
mnuPAWN.Checked := Sender = mnuPAWN; mnuPawn.Checked := Sender = mnuPawn;
mnuCPP.Checked := Sender = mnuCPP; mnuCPP.Checked := Sender = mnuCPP;
mnuHTML.Checked := Sender = mnuHTML; mnuHTML.Checked := Sender = mnuHTML;
mnuOther.Checked := Sender = mnuOther; mnuOther.Checked := Sender = mnuOther;
@ -499,7 +504,7 @@ procedure TfrmMain.mnuSettingsClick(Sender: TObject);
var i: integer; var i: integer;
eModified: Boolean; eModified: Boolean;
begin begin
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\PAWN.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\PAWN.bak'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Pawn.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Pawn.bak'), False);
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'), False);
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), False);
eModified := ActiveDoc.Modified; eModified := ActiveDoc.Modified;
@ -545,9 +550,9 @@ begin
if FileExists(sciPropertyLoader.FileName) then if FileExists(sciPropertyLoader.FileName) then
sciPropertyLoader.Save; sciPropertyLoader.Save;
{ Compiler } { Compiler }
eConfig.WriteString('Pawn-Compiler', 'Path', frmSettings.txtPAWNCompilerPath.Text); eConfig.WriteString('Pawn-Compiler', 'Path', frmSettings.txtPawnCompilerPath.Text);
eConfig.WriteString('Pawn-Compiler', 'Args', frmSettings.txtPAWNArgs.Text); eConfig.WriteString('Pawn-Compiler', 'Args', frmSettings.txtPawnArgs.Text);
eConfig.WriteString('Pawn-Compiler', 'DefaultOutput', frmSettings.txtPAWNOutput.Text); eConfig.WriteString('Pawn-Compiler', 'DefaultOutput', frmSettings.txtPawnOutput.Text);
eConfig.WriteString('CPP-Compiler', 'Path', frmSettings.txtCPPCompilerPath.Text); eConfig.WriteString('CPP-Compiler', 'Path', frmSettings.txtCPPCompilerPath.Text);
eConfig.WriteString('CPP-Compiler', 'Args', frmSettings.txtCPPCompilerArguments.Text); eConfig.WriteString('CPP-Compiler', 'Args', frmSettings.txtCPPCompilerArguments.Text);
eConfig.WriteString('CPP-Compiler', 'DefaultOutput', frmSettings.txtCPPOutput.Text); eConfig.WriteString('CPP-Compiler', 'DefaultOutput', frmSettings.txtCPPOutput.Text);
@ -583,10 +588,10 @@ begin
end end
else begin else begin
{ Restore Code-Snippets } { Restore Code-Snippets }
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\PAWN.csl'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Pawn.csl');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\C++.csl');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Other.csl');
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\PAWN.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\PAWN.csl'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Pawn.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Pawn.csl'), False);
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\C++.csl'), False);
CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), False); CopyFile(PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), False);
end; end;
@ -600,7 +605,7 @@ begin
else else
LoadCodeSnippets('Other'); LoadCodeSnippets('Other');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\PAWN.bak'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Pawn.bak');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\C++.bak'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\C++.bak');
DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'); DeleteFile(ExtractFilePath(ParamStr(0)) + 'config\Other.bak');
@ -670,7 +675,7 @@ begin
end; end;
case tsMain.ActiveTabIndex of case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; // PAWN 0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++ 1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other else Collection := OtherProjects; // Other
end; end;
@ -742,23 +747,23 @@ end;
procedure TfrmMain.mnuEmptyPluginClick(Sender: TObject); procedure TfrmMain.mnuEmptyPluginClick(Sender: TObject);
begin begin
if not Plugin_CreateNewFile(NEW_PAWN_EMPTYPLUGIN, True) then exit; if not Plugin_CreateNewFile(NEW_Pawn_EMPTYPLUGIN, True) then exit;
if tsMain.ActiveTabIndex <> 0 then if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False); ActivateProjects(0, False);
PAWNProjects.Activate(PAWNProjects.Add(''), True); PawnProjects.Activate(PawnProjects.Add(''), True);
Plugin_CreateNewFile(NEW_PAWN_EMPTYPLUGIN, False); Plugin_CreateNewFile(NEW_Pawn_EMPTYPLUGIN, False);
end; end;
procedure TfrmMain.mnuNewPluginClick(Sender: TObject); procedure TfrmMain.mnuNewPluginClick(Sender: TObject);
begin begin
if not Plugin_CreateNewFile(NEW_PAWN_PLUGIN, True) then exit; if not Plugin_CreateNewFile(NEW_Pawn_PLUGIN, True) then exit;
if tsMain.ActiveTabIndex <> 0 then if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False); ActivateProjects(0, False);
PAWNProjects.Activate(PAWNProjects.Add(''), False); PawnProjects.Activate(PawnProjects.Add(''), False);
sciEditor.Lines.Add('/* Plugin generated by AMXX-Studio */'); sciEditor.Lines.Add('/* Plugin generated by AMXX-Studio */');
sciEditor.Lines.Add(''); sciEditor.Lines.Add('');
sciEditor.Lines.Add('#include <amxmodx>'); sciEditor.Lines.Add('#include <amxmodx>');
@ -775,7 +780,7 @@ begin
sciEditor.Lines.Add(' // Add your code here...'); sciEditor.Lines.Add(' // Add your code here...');
sciEditor.Lines.Add('}'); sciEditor.Lines.Add('}');
Plugin_CreateNewFile(NEW_PAWN_PLUGIN, False); Plugin_CreateNewFile(NEW_Pawn_PLUGIN, False);
end; end;
procedure TfrmMain.mnuHXMLClick(Sender: TObject); procedure TfrmMain.mnuHXMLClick(Sender: TObject);
@ -801,7 +806,7 @@ begin
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then begin // Pawn files if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then begin // Pawn files
if tsMain.ActiveTabIndex <> 0 then if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False); ActivateProjects(0, False);
PAWNProjects.Open(odOpen.FileName); PawnProjects.Open(odOpen.FileName);
end end
else if (eExt = '.cpp') or (eExt = '.h') then begin // C++ files else if (eExt = '.cpp') or (eExt = '.h') then begin // C++ files
if not eCPP then if not eCPP then
@ -1239,7 +1244,7 @@ var a,b: integer;
Collection: TDocCollection; Collection: TDocCollection;
begin begin
case tsMain.ActiveTabIndex of case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; 0: Collection := PawnProjects;
1: Collection := CPPProjects; 1: Collection := CPPProjects;
else Collection := OtherProjects; else Collection := OtherProjects;
end; end;
@ -1307,7 +1312,7 @@ var i: integer;
Collection: TDocCollection; Collection: TDocCollection;
begin begin
case tsMain.ActiveTabIndex of case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; 0: Collection := PawnProjects;
1: Collection := CPPProjects; 1: Collection := CPPProjects;
else Collection := OtherProjects; else Collection := OtherProjects;
end; end;
@ -1450,11 +1455,11 @@ var i, k: integer;
begin begin
ActiveDoc.Code := sciEditor.Lines.Text; ActiveDoc.Code := sciEditor.Lines.Text;
frmClose.trvFiles.Items.Clear; frmClose.trvFiles.Items.Clear;
{ PAWN Projects } { Pawn Projects }
eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[0].Caption); eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[0].Caption);
for i := 0 to PAWNProjects.Count -1 do begin for i := 0 to PawnProjects.Count -1 do begin
if TDocument(PAWNProjects.Items[i]).Modified then if TDocument(PawnProjects.Items[i]).Modified then
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(PAWNProjects.Items[i]).FileName)); frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(PawnProjects.Items[i]).FileName));
end; end;
if eRoot.Count = 0 then if eRoot.Count = 0 then
eRoot.Destroy eRoot.Destroy
@ -1497,12 +1502,12 @@ begin
if (frmClose.ShowModal = mrOk) then begin if (frmClose.ShowModal = mrOk) then begin
if frmClose.cmdSave.Caption = lSaveCaption then begin if frmClose.cmdSave.Caption = lSaveCaption then begin
for i := 0 to frmClose.trvFiles.Items.Count -1 do begin for i := 0 to frmClose.trvFiles.Items.Count -1 do begin
{ PAWN Projects } { Pawn Projects }
if frmClose.trvFiles.Items[i].Text = tsMain.Items[0].Caption then begin if frmClose.trvFiles.Items[i].Text = tsMain.Items[0].Caption then begin
with frmClose.trvFiles.Items[i] do begin with frmClose.trvFiles.Items[i] do begin
for k := 0 to Count -1 do begin for k := 0 to Count -1 do begin
if frmClose.trvFiles.Checked[Item[k]] then begin if frmClose.trvFiles.Checked[Item[k]] then begin
eItem := TDocument(PAWNProjects.Items[StrToInt(Copy(Item[k].Text, 1, Pos('.', Item[k].Text) -1)) -1]); eItem := TDocument(PawnProjects.Items[StrToInt(Copy(Item[k].Text, 1, Pos('.', Item[k].Text) -1)) -1]);
// Process item here // Process item here
if not eItem.Untitled then if not eItem.Untitled then
eItem.Save eItem.Save
@ -1588,9 +1593,9 @@ begin
end; end;
if eSavedFiles.Count = 0 then begin if eSavedFiles.Count = 0 then begin
for i := 0 to PAWNProjects.Count -1 do begin for i := 0 to PawnProjects.Count -1 do begin
if (not TDocument(PAWNProjects.Items[i]).Untitled) then if (not TDocument(PawnProjects.Items[i]).Untitled) then
eSavedFiles.Add(TDocument(PAWNProjects.Items[i]).FileName); eSavedFiles.Add(TDocument(PawnProjects.Items[i]).FileName);
end; end;
for i := 0 to CPPProjects.Count -1 do begin for i := 0 to CPPProjects.Count -1 do begin
if (not TDocument(CPPProjects.Items[i]).Untitled) then if (not TDocument(CPPProjects.Items[i]).Untitled) then
@ -1616,7 +1621,7 @@ begin
end; end;
end; end;
procedure TfrmMain.tiPAWNClick(Sender: TObject); procedure TfrmMain.tiPawnClick(Sender: TObject);
begin begin
trvExplorer.Enabled := True; trvExplorer.Enabled := True;
jviCode.Enabled := True; jviCode.Enabled := True;
@ -1693,7 +1698,7 @@ begin
if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inl') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inc') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.h') then exit; if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inl') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inc') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.h') then exit;
if tsMain.ActiveTabIndex = 0 then if tsMain.ActiveTabIndex = 0 then
DoCompilePAWN(COMP_DEFAULT) DoCompilePawn(COMP_DEFAULT)
else if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.htm') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.html') then begin else if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.htm') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.html') then begin
if IEInstalled then if IEInstalled then
frmHTMLPreview.Show frmHTMLPreview.Show
@ -1796,7 +1801,7 @@ begin
exit; exit;
if tsMain.ActiveTabIndex = 0 then if tsMain.ActiveTabIndex = 0 then
DoCompilePAWN(COMP_STARTHL); DoCompilePawn(COMP_STARTHL);
end; end;
procedure TfrmMain.mnuCompileAndUploadClick(Sender: TObject); procedure TfrmMain.mnuCompileAndUploadClick(Sender: TObject);
@ -1805,7 +1810,7 @@ begin
exit; exit;
if tsMain.ActiveTabIndex = 0 then if tsMain.ActiveTabIndex = 0 then
DoCompilePAWN(COMP_UPLOAD); DoCompilePawn(COMP_UPLOAD);
end; end;
procedure TfrmMain.mnuRegisterPluginsIniLocalClick(Sender: TObject); procedure TfrmMain.mnuRegisterPluginsIniLocalClick(Sender: TObject);
@ -1983,17 +1988,17 @@ begin
end; end;
end; end;
procedure TfrmMain.mnuHeaderPAWNClick(Sender: TObject); procedure TfrmMain.mnuHeaderPawnClick(Sender: TObject);
begin begin
if not Plugin_CreateNewFile(NEW_PAWN_HEADER, True) then exit; if not Plugin_CreateNewFile(NEW_Pawn_HEADER, True) then exit;
if tsMain.ActiveTabIndex <> 0 then if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False); ActivateProjects(0, False);
PAWNProjects.Activate(PAWNProjects.Add('Untitled.inc'), False); PawnProjects.Activate(PawnProjects.Add('Untitled.inc'), False);
sciEditor.Lines.Add('/* Header generated by AMXX-Studio*/'); sciEditor.Lines.Add('/* Header generated by AMXX-Studio*/');
sciEditor.Lines.Add(''); sciEditor.Lines.Add('');
Plugin_CreateNewFile(NEW_PAWN_HEADER, False); Plugin_CreateNewFile(NEW_Pawn_HEADER, False);
end; end;
procedure TfrmMain.OnTabSelect(Sender: TTBCustomItem; procedure TfrmMain.OnTabSelect(Sender: TTBCustomItem;
@ -2010,7 +2015,7 @@ var Collection: TDocCollection;
begin begin
try try
case tsMain.ActiveTabIndex of case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; // PAWN 0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++ 1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other else Collection := OtherProjects; // Other
end; end;
@ -2511,15 +2516,15 @@ begin
else else
Msg.Result := 0; Msg.Result := 0;
end; end;
SCM_PAWN_NEWFILE: PawnProjects.Add(eData, ''); SCM_Pawn_NEWFILE: PawnProjects.Add(eData, '');
SCM_PAWN_SAVEFILE: begin SCM_Pawn_SAVEFILE: begin
if (eData = '') and (TDocument(PawnProjects.Items[eIntData]).Untitled) then if (eData = '') and (TDocument(PawnProjects.Items[eIntData]).Untitled) then
Msg.Result := 0 Msg.Result := 0
else else
PawnProjects.Save(eIntData, eData); PawnProjects.Save(eIntData, eData);
end; end;
SCM_PAWN_CLOSEFILE: PawnProjects.Close(eIntData); SCM_Pawn_CLOSEFILE: PawnProjects.Close(eIntData);
SCM_PAWN_ISUNTITLED: begin SCM_Pawn_ISUNTITLED: begin
try try
if TDocument(PawnProjects.Items[eIntData]).Untitled then if TDocument(PawnProjects.Items[eIntData]).Untitled then
Msg.Result := 1 Msg.Result := 1
@ -2529,27 +2534,27 @@ begin
Msg.Result := -1; Msg.Result := -1;
end; end;
end; end;
SCM_PAWN_ACTIVATE: begin SCM_Pawn_ACTIVATE: begin
if tsMain.ActiveTabIndex <> 0 then if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, eIntData = 1) ActivateProjects(0, eIntData = 1)
else else
Msg.Result := 0; Msg.Result := 0;
end; end;
SCM_PAWN_ACTIVATEDOC: PawnProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0); SCM_Pawn_ACTIVATEDOC: PawnProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0);
SCM_PAWN_GETNOTES: begin SCM_Pawn_GETNOTES: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(PChar(GetRTFText(rtfNotes))) Msg.Result := Integer(PChar(GetRTFText(rtfNotes)))
else else
Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).NotesText)); Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).NotesText));
end; end;
SCM_PAWN_SETNOTES: begin SCM_Pawn_SETNOTES: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
SetRTFText(rtfNotes, eData) SetRTFText(rtfNotes, eData)
else else
TDocument(PawnProjects.Items[eIntData]).NotesText := eData; TDocument(PawnProjects.Items[eIntData]).NotesText := eData;
end; end;
SCM_PAWN_GETFILENAME: Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).FileName)); SCM_Pawn_GETFILENAME: Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).FileName));
SCM_PAWN_GETTEXT: begin SCM_Pawn_GETTEXT: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText) Msg.Result := Integer(sciEditor.Lines.GetText)
else else
@ -2720,4 +2725,136 @@ begin
end; end;
end; end;
procedure TfrmMain.OnMessage(var Msg: TMsg; var Handled: Boolean);
begin
Handled := not Plugin_AppMsg(Msg.hwnd, Msg.message, Msg.wParam, Msg.lParam, Msg.time, Msg.pt);
end;
procedure TfrmMain.OnShortCut(var Msg: TWMKey;
var Handled: Boolean);
function TriggerMenuShortcut(eShortcut: TShortcut; Item: TTBCustomItem): Boolean;
var i: integer;
begin
Result := False;
for i := 0 to Item.Count -1 do begin
if Item.Items[i].ShortCut = eShortcut then begin
Item.Items[i].OnClick(Self);
Result := True;
exit;
end
else
TriggerMenuShortcut(eShortcut, Item.Items[i]);
end;
end;
var i: integer;
eShortcut: TShortcut;
begin
if not Started then
exit;
if not Plugin_Shortcut(Msg.CharCode, Msg.KeyData) then begin
Handled := True;
exit;
end;
// Check frmSettings shortcut
if (frmSettings.Visible) and (frmSettings.txtShortcut.Focused) then begin
if (Msg.CharCode = VK_CONTROL) or (Msg.CharCode = VK_MENU) or (Msg.CharCode = VK_SHIFT) then begin
frmSettings.txtShortcut.Clear;
if ssShift in KeyDataToShiftState(Msg.KeyData) then
frmSettings.txtShortcut.Text := frmSettings.txtShortcut.Text + 'Shift+';
if ssCtrl in KeyDataToShiftState(Msg.KeyData) then
frmSettings.txtShortcut.Text := frmSettings.txtShortcut.Text + 'Ctrl+';
if ssAlt in KeyDataToShiftState(Msg.KeyData) then
frmSettings.txtShortcut.Text := frmSettings.txtShortcut.Text + 'Alt+';
end
else
frmSettings.txtShortcut.Text := ShortcutToText(Shortcut(Msg.CharCode, KeyDataToShiftState(Msg.KeyData)));
Handled := True;
end;
if GetActiveWindow <> frmMain.Handle then exit;
// stop IRC Paster if escape is pressed
if (Msg.CharCode = VK_ESCAPE) then begin
frmMain.IRCPasterStop := True;
if frmMain.sciEditor.CallTipActive then
frmMain.sciEditor.CallTipCancel;
if frmMain.sciEditor.AutoCActive then
frmMain.sciEditor.AutoCCancel;
exit;
end;
eShortcut := Shortcut(Msg.CharCode, KeyDataToShiftState(Msg.KeyData));
// Some menu commands are suppressed by the controlchars thingy, so they will be triggered manually
for i := 0 to frmMain.tbxMenu.Items.Count -1 do begin
if TriggerMenuShortcut(eShortcut, frmMain.tbxMenu.Items[i]) then
Handled := True;
end;
for i := 0 to frmMain.tbxToolbar.Items.Count -1 do begin
if frmMain.tbxToolbar.Items[i].ShortCut = eShortcut then begin
Handled := True;
frmMain.tbxToolbar.Items[i].OnClick(Self);
end;
end;
for i := 0 to frmMain.tbxEdit.Items.Count -1 do begin
if frmMain.tbxEdit.Items[i].ShortCut = eShortcut then begin
Handled := True;
frmMain.tbxEdit.Items[i].OnClick(Self);
end;
end;
Application.ProcessMessages;
// Control chars
if (eShortcut = Shortcut(Ord('E'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('H'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('K'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('S'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('B'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('C'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('D'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('E'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('F'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('G'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('H'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('K'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('N'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('O'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('P'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('Q'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('R'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('V'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('W'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('X'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('Y'), [ssCtrl, ssShift])) then
Handled := True;
if Handled then begin
for i := 0 to frmMain.sciEditor.KeyCommands.Count -1 do begin
if TSciKeyCommand(frmMain.sciEditor.KeyCommands.Items[i]).ShortCut = eShortcut then
Handled := False;
end;
end;
end;
end. end.