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
-LE"c:\programme\borland\delphi7\Projects\Bpl"
-LN"c:\programme\borland\delphi7\Projects\Bpl"
-DmadExcept
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

View File

@ -96,7 +96,7 @@ PackageDLLOutputDir=
PackageDCPOutputDir=
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
Conditionals=
Conditionals=madExcept
DebugSourceDirs=
UsePackages=0
[Parameters]
@ -113,9 +113,9 @@ RootDir=C:\Programme\Borland\Delphi7\Bin\
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=1
MinorVer=2
Release=0
Build=13
Build=1
Debug=0
PreRelease=0
Special=0
@ -126,13 +126,13 @@ CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.1.0.13
FileVersion=1.2.0.1
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=AMXX-Studio
ProductVersion=1.1.0.0
ProductVersion=1.2.0.0
Comments=
[HistoryLists\hlConditionals]
Count=1

View File

@ -1,11 +1,16 @@
program AMXX_Studio;
{%ToDo 'AMXX_Studio.todo'}
uses
madExcept,
madLinkDisAsm,
Forms,
Windows,
Classes,
Messages,
SysUtils,
SciLexerMemo,
JvInspector,
UnitfrmMain in 'UnitfrmMain.pas' {frmMain},
UnitMainTools in 'UnitMainTools.pas',
UnitfrmSettings in 'UnitfrmSettings.pas' {frmSettings},
@ -14,7 +19,6 @@ uses
UnitfrmInfo in 'UnitfrmInfo.pas' {frmInfo},
UnitCodeSnippets in 'UnitCodeSnippets.pas',
UnitCodeUtils in 'UnitCodeUtils.pas',
UnitfrmSplashscreen in 'UnitfrmSplashscreen.pas' {frmSplashscreen},
UnitfrmSearch in 'UnitfrmSearch.pas' {frmSearch},
UnitfrmReplace in 'UnitfrmReplace.pas' {frmReplace},
UnitfrmAllFilesForm in 'UnitfrmAllFilesForm.pas' {frmAllFilesForm},
@ -48,7 +52,9 @@ uses
{$R *.res}
var i: integer;
var eCache: TStringList;
i: integer;
eExt: String;
begin
if (FindWindow('TfrmMain', 'AMXX-Studio') <> 0) and (FindWindow(nil, 'Delphi 7') = 0) then begin
if ParamCount > 0 then begin
@ -59,6 +65,90 @@ begin
end;
Application.Initialize;
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;
end.

Binary file not shown.

Binary file not shown.

View File

@ -24,7 +24,7 @@ type
protected
procedure Execute; override;
procedure GetCode;
procedure SetValuesPAWN;
procedure SetValuesPawn;
end;
implementation
@ -62,7 +62,7 @@ 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
// analyze code
with ParseCodePAWN(eCode, ExtractFileName(ActiveDoc.FileName)) do begin
with ParseCodePawn(eCode, ExtractFileName(ActiveDoc.FileName)) do begin
eConstants.Assign(Constants);
eDefined.Assign(Defined);
eCVars.Assign(CVars);
@ -81,7 +81,7 @@ begin
DestroyResult;
end;
// apply changes
Synchronize(SetValuesPAWN);
Synchronize(SetValuesPawn);
end;
end;
except
@ -113,7 +113,7 @@ begin
eCode.Assign(frmMain.sciEditor.Lines);
end;
procedure TCodeExplorerUpdater.SetValuesPAWN;
procedure TCodeExplorerUpdater.SetValuesPawn;
function GetNode(eText: String): TTreeNode;
var i: integer;
begin
@ -223,6 +223,15 @@ begin
SelectedIndex := 35;
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
with frmMain.trvExplorer.Items.AddChildObject(GetNode('Included'), eIncluded[i], Pointer(eIncluded.Objects[i])) do begin
ImageIndex := 34;

View File

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

View File

@ -10,7 +10,7 @@ var lInvalidFile: String;
lModified: String;
lLnCh: String;
lCloseModify: String;
lSelectOutputPAWN: String;
lSelectOutputPawn: String;
lSelectOutputCPP: String;
lDynamic: String;
lOutputHint: String;
@ -41,7 +41,7 @@ var lInvalidFile: String;
lPastingCodeEscStop: String;
lInvalidDirectory: String;
lFailedLoadNotes: String;
lPAWNCompilerNotFound: String;
lPawnCompilerNotFound: String;
lError: String;
lWarning: String;
lOnLine: String;
@ -94,7 +94,7 @@ begin
lModified := 'Modified';
lLnCh := 'Ln %u Ch %u';
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:';
lDynamic := 'Dynamic';
lOutputHint := 'The output will be copied to the source''s directory.';
@ -125,7 +125,7 @@ begin
lPastingCodeEscStop := 'Pasting Code, press Esc to stop...';
lInvalidDirectory := 'Could not change FTP directory. Update it and try again.';
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';
lWarning := 'Warning: %s on line %u';
lOther := '%s on line %u';
@ -142,7 +142,7 @@ begin
lSuccessfulRegistered := 'The plugin has been registered successfully!';
lFailedUpdatePluginsIni := 'Failed to update plugins.ini!';
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';
lType := 'Type';
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;
TUpdateCodeTools = function (pLang, pFilename, pCurrProjects: PChar): Integer; cdecl;
TOutputEvent = function (pItemIndex: Integer): Integer; cdecl;
TShortcutEvent = function (pCharCode, pKeyData: Integer): Integer; cdecl;
type TIntegerArray = array of Integer;
@ -56,7 +57,6 @@ type TLoadInfo = record
hSelectColor: HWND;
hSettings: HWND;
hSocketsTerminal: HWND;
hSplashscreen: HWND;
{ Important Control Handles }
hOutput: 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_OutputDblClick(ItemIndex: Integer): Boolean;
function Plugin_OutputPopup(ItemIndex: Integer): Boolean;
function Plugin_Shortcut(CharCode, KeyData: Integer): Boolean;
const { Return values for dlls }
PLUGIN_CONTINUE = 0; // continue...
@ -241,10 +242,9 @@ uses UnitfrmSettings, UnitMainTools, UnitfrmAllFilesForm,
UnitfrmHTMLPreview, UnitfrmHudMsgGenerator, UnitfrmInfo, UnitfrmMain,
UnitfrmMenuGenerator, UnitfrmMOTDGen, UnitfrmPluginsIniEditor,
UnitfrmReplace, UnitfrmSearch, UnitfrmSelectColor,
UnitfrmSocketsTerminal, UnitfrmSplashscreen, UnitLanguages,
UnitCodeExplorerUpdater, UnitCodeInspector, UnitCodeSnippets,
UnitCodeUtils, UnitCompile, UnitfrmIRCPaster, UnitMenuGenerators,
UnitReadThread, UnitTextAnalyze;
UnitfrmSocketsTerminal, UnitLanguages,UnitCodeExplorerUpdater,
UnitCodeInspector, UnitCodeSnippets, UnitCodeUtils, UnitCompile,
UnitfrmIRCPaster, UnitMenuGenerators, UnitReadThread, UnitTextAnalyze;
function LoadPlugin(ListItem: TListItem): Boolean;
var eLoadInfo: TLoadInfo;
@ -276,7 +276,6 @@ begin
hSelectColor := frmSelectColor.Handle;
hSettings := frmSettings.Handle;
hSocketsTerminal := frmSocketsTerminal.Handle;
hSplashscreen := frmSplashscreen.Handle;
{ Important Control Handles }
hOutput := frmMain.lstOutput.Handle;
hCodeExplorer := frmMain.trvExplorer.Handle;
@ -1043,4 +1042,29 @@ begin
Handles := nil;
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.

View File

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

Binary file not shown.

View File

@ -38,6 +38,8 @@ begin
MessageBox(Handle, 'Hampster!', 'Your computer! wtf', MB_ICONERROR);
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, 'hampsters eat gaben.', 'oh noes', MB_ICONWARNING);
MessageBox(Handle, 'or gaben eats hampsters.', 'gabenbla', MB_ICONERROR);
end;
procedure TfrmInfo.imgDoom4Click(Sender: TObject);
@ -45,6 +47,7 @@ begin
MessageBox(Handle, 'gaben', 'doom', MB_ICONWARNING);
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, 'oh noes gaben eats hampsters!', 'dooo oo oo o om!', MB_ICONWARNING);
end;
procedure TfrmInfo.imgYamsClick(Sender: TObject);
@ -52,6 +55,7 @@ begin
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, '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.

View File

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

View File

@ -9,7 +9,9 @@ uses
TBXMonaiTheme, TBXNexos2Theme, TBXNexos3Theme, TBXNexos4Theme, TBXNexos5Theme,
TBXOffice11AdaptiveTheme, TBXOfficeCTheme, TBXOfficeKTheme, TBXOfficeXPTheme,
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,
StdCtrls, mbTBXRichEdit, TBXDkPanels, TBXToolPals, SciPropertyMgr,
mbTBXHint, mbTBXHotKeyEdit, SciAutoComplete, sciKeyBindings,
@ -30,7 +32,7 @@ type
mnuNew: TSpTBXSubmenuItem;
mnuEmptyPlugin: TSpTBXItem;
mnuNewPlugin: TSpTBXItem;
mnuHeaderPAWN: TSpTBXItem;
mnuHeaderPawn: TSpTBXItem;
mnuNewModule: TSpTBXItem;
mnuNewUnit: TSpTBXItem;
mnuNewHeaderCPP: TSpTBXItem;
@ -67,7 +69,7 @@ type
mnuChangeTheme: TSpTBXSubmenuItem;
mnuThemes: TSpTBXThemeGroupItem;
mnuSelectHighlighter: TSpTBXSubmenuItem;
mnuHPAWN: TSpTBXItem;
mnuHPawn: TSpTBXItem;
mnuHCPP: TSpTBXItem;
mnuHHTML: TSpTBXItem;
mnuHSQL: TSpTBXItem;
@ -127,7 +129,7 @@ type
sepTEdit2: TSpTBXSeparatorItem;
mnuTSelectAll: TSpTBXItem;
tsMain: TSpTBXTabSet;
tiPAWN: TSpTBXTabItem;
tiPawn: TSpTBXTabItem;
tiCPP: TSpTBXTabItem;
tsDocuments: TSpTBXTabSet;
tiDocument1: TSpTBXTabItem;
@ -321,7 +323,7 @@ type
procedure mnuSocketTerminalClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure trvExplorerDblClick(Sender: TObject);
procedure tiPAWNClick(Sender: TObject);
procedure tiPawnClick(Sender: TObject);
procedure tiCPPClick(Sender: TObject);
procedure tiOtherClick(Sender: TObject);
procedure mnuOpenHelpClick(Sender: TObject);
@ -343,7 +345,7 @@ type
const Position: Integer; ListToDisplay: TStrings;
var CancelDisplay: Boolean);
procedure mnuMOTDGeneratorClick(Sender: TObject);
procedure mnuHeaderPAWNClick(Sender: TObject);
procedure mnuHeaderPawnClick(Sender: TObject);
procedure OnTabSelect(Sender: TTBCustomItem; Viewer: TTBItemViewer;
Selecting: Boolean);
procedure mnuPCloseClick(Sender: TObject);
@ -383,6 +385,9 @@ type
procedure OnCustomClick(Sender: TObject);
procedure SetErrorLine(eLine: Integer);
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;
var
@ -394,8 +399,8 @@ implementation
uses UnitfrmSettings, UnitMainTools, UnitLanguages, UnitfrmInfo,
UnitCodeSnippets, UnitfrmSearch, UnitfrmReplace, UnitfrmGoToLine,
UnitfrmAllFilesForm, UnitCodeUtils, UnitfrmPluginsIniEditor,
UnitfrmSocketsTerminal, UnitfrmSplashscreen, UnitCodeExplorerUpdater,
UnitTextAnalyze, UnitfrmHudMsgGenerator, UnitCompile, UnitfrmAutoIndent,
UnitfrmSocketsTerminal, UnitCodeExplorerUpdater, UnitTextAnalyze,
UnitfrmHudMsgGenerator, UnitCompile, UnitfrmAutoIndent,
UnitfrmHTMLPreview, UnitCodeInspector, UnitfrmMOTDGen,
UnitfrmMenuGenerator, UnitfrmClose, UnitPlugins, UnitfrmConnGen,
UnitMenuGenerators, UnitfrmIRCPaster;
@ -423,7 +428,7 @@ end;
procedure TfrmMain.OnCodeSnippetSelect(Sender: TObject);
begin
mnuPAWN.Checked := Sender = mnuPAWN;
mnuPawn.Checked := Sender = mnuPawn;
mnuCPP.Checked := Sender = mnuCPP;
mnuHTML.Checked := Sender = mnuHTML;
mnuOther.Checked := Sender = mnuOther;
@ -499,7 +504,7 @@ procedure TfrmMain.mnuSettingsClick(Sender: TObject);
var i: integer;
eModified: Boolean;
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\Other.csl'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.bak'), False);
eModified := ActiveDoc.Modified;
@ -545,9 +550,9 @@ begin
if FileExists(sciPropertyLoader.FileName) then
sciPropertyLoader.Save;
{ Compiler }
eConfig.WriteString('Pawn-Compiler', 'Path', frmSettings.txtPAWNCompilerPath.Text);
eConfig.WriteString('Pawn-Compiler', 'Args', frmSettings.txtPAWNArgs.Text);
eConfig.WriteString('Pawn-Compiler', 'DefaultOutput', frmSettings.txtPAWNOutput.Text);
eConfig.WriteString('Pawn-Compiler', 'Path', frmSettings.txtPawnCompilerPath.Text);
eConfig.WriteString('Pawn-Compiler', 'Args', frmSettings.txtPawnArgs.Text);
eConfig.WriteString('Pawn-Compiler', 'DefaultOutput', frmSettings.txtPawnOutput.Text);
eConfig.WriteString('CPP-Compiler', 'Path', frmSettings.txtCPPCompilerPath.Text);
eConfig.WriteString('CPP-Compiler', 'Args', frmSettings.txtCPPCompilerArguments.Text);
eConfig.WriteString('CPP-Compiler', 'DefaultOutput', frmSettings.txtCPPOutput.Text);
@ -583,10 +588,10 @@ begin
end
else begin
{ 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\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\Other.bak'), PChar(ExtractFilePath(ParamStr(0)) + 'config\Other.csl'), False);
end;
@ -600,7 +605,7 @@ begin
else
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\Other.bak');
@ -670,7 +675,7 @@ begin
end;
case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; // PAWN
0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other
end;
@ -742,23 +747,23 @@ end;
procedure TfrmMain.mnuEmptyPluginClick(Sender: TObject);
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
ActivateProjects(0, False);
PAWNProjects.Activate(PAWNProjects.Add(''), True);
Plugin_CreateNewFile(NEW_PAWN_EMPTYPLUGIN, False);
PawnProjects.Activate(PawnProjects.Add(''), True);
Plugin_CreateNewFile(NEW_Pawn_EMPTYPLUGIN, False);
end;
procedure TfrmMain.mnuNewPluginClick(Sender: TObject);
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
ActivateProjects(0, False);
PAWNProjects.Activate(PAWNProjects.Add(''), False);
PawnProjects.Activate(PawnProjects.Add(''), False);
sciEditor.Lines.Add('/* Plugin generated by AMXX-Studio */');
sciEditor.Lines.Add('');
sciEditor.Lines.Add('#include <amxmodx>');
@ -775,7 +780,7 @@ begin
sciEditor.Lines.Add(' // Add your code here...');
sciEditor.Lines.Add('}');
Plugin_CreateNewFile(NEW_PAWN_PLUGIN, False);
Plugin_CreateNewFile(NEW_Pawn_PLUGIN, False);
end;
procedure TfrmMain.mnuHXMLClick(Sender: TObject);
@ -801,7 +806,7 @@ begin
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then begin // Pawn files
if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False);
PAWNProjects.Open(odOpen.FileName);
PawnProjects.Open(odOpen.FileName);
end
else if (eExt = '.cpp') or (eExt = '.h') then begin // C++ files
if not eCPP then
@ -1239,7 +1244,7 @@ var a,b: integer;
Collection: TDocCollection;
begin
case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects;
0: Collection := PawnProjects;
1: Collection := CPPProjects;
else Collection := OtherProjects;
end;
@ -1307,7 +1312,7 @@ var i: integer;
Collection: TDocCollection;
begin
case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects;
0: Collection := PawnProjects;
1: Collection := CPPProjects;
else Collection := OtherProjects;
end;
@ -1450,11 +1455,11 @@ var i, k: integer;
begin
ActiveDoc.Code := sciEditor.Lines.Text;
frmClose.trvFiles.Items.Clear;
{ PAWN Projects }
{ Pawn Projects }
eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[0].Caption);
for i := 0 to PAWNProjects.Count -1 do begin
if TDocument(PAWNProjects.Items[i]).Modified then
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(PAWNProjects.Items[i]).FileName));
for i := 0 to PawnProjects.Count -1 do begin
if TDocument(PawnProjects.Items[i]).Modified then
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i +1) + '. ' + ExtractFileName(TDocument(PawnProjects.Items[i]).FileName));
end;
if eRoot.Count = 0 then
eRoot.Destroy
@ -1497,12 +1502,12 @@ begin
if (frmClose.ShowModal = mrOk) then begin
if frmClose.cmdSave.Caption = lSaveCaption then 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
with frmClose.trvFiles.Items[i] do begin
for k := 0 to Count -1 do 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
if not eItem.Untitled then
eItem.Save
@ -1588,9 +1593,9 @@ begin
end;
if eSavedFiles.Count = 0 then begin
for i := 0 to PAWNProjects.Count -1 do begin
if (not TDocument(PAWNProjects.Items[i]).Untitled) then
eSavedFiles.Add(TDocument(PAWNProjects.Items[i]).FileName);
for i := 0 to PawnProjects.Count -1 do begin
if (not TDocument(PawnProjects.Items[i]).Untitled) then
eSavedFiles.Add(TDocument(PawnProjects.Items[i]).FileName);
end;
for i := 0 to CPPProjects.Count -1 do begin
if (not TDocument(CPPProjects.Items[i]).Untitled) then
@ -1616,7 +1621,7 @@ begin
end;
end;
procedure TfrmMain.tiPAWNClick(Sender: TObject);
procedure TfrmMain.tiPawnClick(Sender: TObject);
begin
trvExplorer.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 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
if IEInstalled then
frmHTMLPreview.Show
@ -1796,7 +1801,7 @@ begin
exit;
if tsMain.ActiveTabIndex = 0 then
DoCompilePAWN(COMP_STARTHL);
DoCompilePawn(COMP_STARTHL);
end;
procedure TfrmMain.mnuCompileAndUploadClick(Sender: TObject);
@ -1805,7 +1810,7 @@ begin
exit;
if tsMain.ActiveTabIndex = 0 then
DoCompilePAWN(COMP_UPLOAD);
DoCompilePawn(COMP_UPLOAD);
end;
procedure TfrmMain.mnuRegisterPluginsIniLocalClick(Sender: TObject);
@ -1983,17 +1988,17 @@ begin
end;
end;
procedure TfrmMain.mnuHeaderPAWNClick(Sender: TObject);
procedure TfrmMain.mnuHeaderPawnClick(Sender: TObject);
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
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('');
Plugin_CreateNewFile(NEW_PAWN_HEADER, False);
Plugin_CreateNewFile(NEW_Pawn_HEADER, False);
end;
procedure TfrmMain.OnTabSelect(Sender: TTBCustomItem;
@ -2010,7 +2015,7 @@ var Collection: TDocCollection;
begin
try
case tsMain.ActiveTabIndex of
0: Collection := PAWNProjects; // PAWN
0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other
end;
@ -2511,15 +2516,15 @@ begin
else
Msg.Result := 0;
end;
SCM_PAWN_NEWFILE: PawnProjects.Add(eData, '');
SCM_PAWN_SAVEFILE: begin
SCM_Pawn_NEWFILE: PawnProjects.Add(eData, '');
SCM_Pawn_SAVEFILE: begin
if (eData = '') and (TDocument(PawnProjects.Items[eIntData]).Untitled) then
Msg.Result := 0
else
PawnProjects.Save(eIntData, eData);
end;
SCM_PAWN_CLOSEFILE: PawnProjects.Close(eIntData);
SCM_PAWN_ISUNTITLED: begin
SCM_Pawn_CLOSEFILE: PawnProjects.Close(eIntData);
SCM_Pawn_ISUNTITLED: begin
try
if TDocument(PawnProjects.Items[eIntData]).Untitled then
Msg.Result := 1
@ -2529,27 +2534,27 @@ begin
Msg.Result := -1;
end;
end;
SCM_PAWN_ACTIVATE: begin
SCM_Pawn_ACTIVATE: begin
if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, eIntData = 1)
else
Msg.Result := 0;
end;
SCM_PAWN_ACTIVATEDOC: PawnProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0);
SCM_PAWN_GETNOTES: begin
SCM_Pawn_ACTIVATEDOC: PawnProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0);
SCM_Pawn_GETNOTES: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(PChar(GetRTFText(rtfNotes)))
else
Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).NotesText));
end;
SCM_PAWN_SETNOTES: begin
SCM_Pawn_SETNOTES: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
SetRTFText(rtfNotes, eData)
else
TDocument(PawnProjects.Items[eIntData]).NotesText := eData;
end;
SCM_PAWN_GETFILENAME: Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).FileName));
SCM_PAWN_GETTEXT: begin
SCM_Pawn_GETFILENAME: Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).FileName));
SCM_Pawn_GETTEXT: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText)
else
@ -2720,4 +2725,136 @@ begin
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.