Upgraded plugin-system (other command call and now 93 commands)

Customizable IRC Paster
Updated version number from 1.01 to 1.1
This commit is contained in:
Christian Hammacher 2005-09-03 20:00:46 +00:00
parent e239801671
commit fdbe0e2064
15 changed files with 805 additions and 443 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,20 +113,20 @@ RootDir=C:\Programme\Borland\Delphi7\Bin\
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=0
MinorVer=1
Release=0
Build=10
Build=1
Debug=0
PreRelease=1
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1031
Locale=1033
CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.0.0.10
FileVersion=1.1.0.1
InternalName=
LegalCopyright=
LegalTrademarks=

View File

@ -1,6 +1,8 @@
program AMXX_Studio;
uses
madExcept,
madLinkDisAsm,
Forms,
Windows,
Messages,
@ -32,7 +34,8 @@ uses
UnitMenuGenerators in 'UnitMenuGenerators.pas',
UnitfrmClose in 'UnitfrmClose.pas' {frmClose},
UnitfrmConnGen in 'UnitfrmConnGen.pas' {frmConnGen},
UnitPlugins in 'UnitPlugins.pas';
UnitPlugins in 'UnitPlugins.pas',
UnitfrmIRCPaster in 'UnitfrmIRCPaster.pas' {frmIRCPaster};
{ Used components:
- JVCL 3.0
@ -50,9 +53,9 @@ begin
if FindWindow(nil, 'AMXX-Studio') <> 0 then begin
if ParamCount > 0 then begin
for i := 1 to ParamCount do
SendToMainApp('LoadFile' + ParamStr(i));
SendStudioMsg(SCM_LOADFILE, ParamStr(i), 0);
end;
//exit;
exit;
end;
Application.Initialize;
Application.Title := 'AMXX-Studio';

Binary file not shown.

Binary file not shown.

View File

@ -24,7 +24,7 @@ procedure SetRTFText(ARichEdit: TRichedit; ARTFText: String);
implementation
uses UnitfrmMain, UnitMainTools, UnitLanguages;
uses UnitfrmMain, UnitMainTools, UnitLanguages, UnitfrmIRCPaster;
function IsAtStart(eSubStr, eStr: String; AllowFunctions: Boolean = True): Boolean;
begin
@ -90,7 +90,7 @@ begin
eLength := 0;
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
eLength := eLength + Length(frmMain.sciEditor.Lines[i]);
eLength := eLength + Length(frmMain.sciEditor.Lines[i]) + 2;
if eLength >= ePos then begin
Result := i;
break;
@ -335,9 +335,14 @@ begin
end;
eCurrStyle := '';
Result := IntToStr(eLine +1) + '] ';
if Length(frmMain.sciEditor.Lines[eLine]) = 0 then exit;
if frmIRCPaster.chkLineNumbers.Checked then
Result := IntToStr(eLine +1) + '] '
else
Result := '';
if Trim(frmMain.sciEditor.Lines[eLine]) = '' then
exit;
for i := 0 to Length(frmMain.sciEditor.Lines[eLine]) -1 do begin
if eCurrStyle <> GetStyleAt(eChars + i).Name then begin
eCurrStyle := GetStyleAt(eChars + i).Name;

View File

@ -78,6 +78,7 @@ var lInvalidFile: String;
lSaveCaption: String;
lCloseCaption: String;
lNoCPP: String;
lInvalidChannel: String;
procedure ResetToEnglish;
@ -110,7 +111,7 @@ begin
lNoMIRCWindowOpen := 'You have to open mIRC first to use IRC Paster!';
lSelectChannel := 'Select channel';
lSelectChannelPrompt := 'Please enter the channel the code shall be sent to:';
lWarnBigPluginPaste := 'Warning: The plugin is quite large, if you post it to a channel it MAY result in a ban. Are you sure to paste it?';
lWarnBigPluginPaste := 'Warning: This plugin is quite large for pasting it to the IRC network, maybe you should paste it on pastebin.com instead. Otherwise it MAY result in a ban, are you sure to continue?';
lConnect := 'Connect';
lConnecting := 'Connecting...';
lDisconnect := 'Disconnect';
@ -140,7 +141,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 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';
@ -159,6 +160,7 @@ begin
lSaveCaption := 'Save';
lCloseCaption := 'Close';
lNoCPP := 'Sorry, the C++ IDE is not enabled.';
lInvalidChannel := 'Invalid channel.';
end;
end.

View File

@ -5,7 +5,7 @@ interface
uses SysUtils, Classes, Windows, Forms, Controls, SpTBXTabs, TBX, SciLexer,
SciLexerMemo, ExtCtrls, Graphics, sciKeyBindings, ComCtrls, TB2Item,
sciLexerMod, ScintillaLanguageManager, Menus, SpTBXItem, Registry,
ShellApi, DDEMan, IdFTP, IdFTPList, IdException, JvInspector;
ShellApi, DDEMan, IdFTP, IdFTPList, IdException, JvInspector, JvComCtrls;
type TDocument = class(TCollectionItem)
private
@ -59,6 +59,10 @@ type TStringArray = array of string;
function GetMenuItem(Caption: String; eParent: TTBCustomItem = nil): TTBCustomItem;
function GetCat: String;
function GetCIItem(eName: String; eParent: TJvCustomInspectorItem = nil): TJvCustomInspectorItem;
function FindSettingsNode(eText: String; eParent: TTreeNode = nil): TTreeNode;
procedure LoadPlugins;
function GetAllIncludeFiles: TStringArray;
function GetCurrLang(FileName: String = ''): TSciLangItem;
@ -106,6 +110,79 @@ uses UnitfrmMain, UnitfrmSettings, UnitLanguages, UnitfrmSelectColor,
UnitCodeSnippets, UnitTextAnalyze, UnitCodeUtils, UnitfrmAutoIndent,
UnitPlugins;
function GetCat: String;
begin
if frmMain.mnuPAWN.Checked then
Result := 'Pawn'
else if frmMain.mnuCPP.Checked then
Result := 'C++'
else if frmMain.mnuHTML.Checked then
Result := 'HTML'
else
Result := 'Other';
end;
function GetCIItem(eName: String; eParent: TJvCustomInspectorItem = nil): TJvCustomInspectorItem;
var i: integer;
begin
eName := LowerCase(eName);
Result := nil;
if eParent = nil then begin
for i := 0 to frmMain.jviCode.Root.Count -1 do begin
if LowerCase(frmMain.jviCode.Root.Items[i].DisplayName) = eName then
Result := frmMain.jviCode.Root.Items[i]
else if frmMain.jviCode.Root.Items[i].Count <> 0 then
Result := GETCIItem(eName, frmMain.jviCode.Root.Items[i]);
if Assigned(Result) then
exit;
end;
end
else begin
for i := 0 to eParent.Count -1 do begin
if LowerCase(eParent.Items[i].DisplayName) = eName then
Result := eParent.Items[i]
else if eParent.Items[i].Count <> 0 then
Result := GETCIItem(eName, eParent.Items[i]);
if Assigned(Result) then
exit;
end;
end;
end;
function FindSettingsNode(eText: String; eParent: TTreeNode = nil): TTreeNode;
var i: integer;
begin
Result := nil;
if eText = '' then exit;
eText := LowerCase(eText);
if eParent = nil then begin
for i := 0 to frmSettings.trvSettings.Items.Count -1 do begin
if LowerCase(frmSettings.trvSettings.Items[i].Text) = eText then
Result := frmSettings.trvSettings.Items[i]
else if frmSettings.trvSettings.Items[i].Count <> 0 then
Result := FindSettingsNode(eText, frmSettings.trvSettings.Items[i]);
if Assigned(Result) then
exit;
end;
end
else begin
for i := 0 to eParent.Count -1 do begin
if LowerCase(eParent[i].Text) = eText then
Result := eParent[i]
else if eParent[i].Count <> 0 then
Result := FindSettingsNode(eText, eParent[i]);
if Assigned(Result) then
exit;
end;
end;
end;
function GetMenuItem(Caption: String; eParent: TTBCustomItem = nil): TTBCustomItem;
var i: integer;
begin
@ -636,6 +713,7 @@ begin
for i := 0 to frmMain.tcTools.Items.Count -1 do
frmMain.tcTools.Items[i].Enabled := False;
frmMain.ppmDocuments.Items.Enabled := False;
frmMain.sciEditor.ReadOnly := True;
end;
procedure HideProgress;
@ -665,6 +743,7 @@ begin
frmMain.mnuNewUnit.Enabled := eCPP;
frmMain.ppmDocuments.Items.Enabled := True;
frmMain.sciEditor.ReadOnly := False;
end;
{ TDocument }
@ -914,7 +993,10 @@ begin
Title := '< ' + IntToStr(Count) + #32 + ExtractFileName(AFilename) + ' >';
if not Started then exit;
if (Self = PawnProjects) and (frmMain.tsMain.ActiveTabIndex <> 0) then exit;
if (Self = CPPProjects) and (frmMain.tsMain.ActiveTabIndex <> 1) then exit;
if (Self = OtherProjects) and (frmMain.tsMain.ActiveTabIndex <> 2) then exit;
TabItem := TSpTBXTabItem.Create(frmMain.tsDocuments);
TabItem.Caption := Title;
TabItem.OnSelect := frmMain.OnTabSelect;

View File

@ -10,7 +10,7 @@ type TCodeSnippetClick = function (pTitle, pCategory: PChar; pCode: PChar): Inte
TProjectsChange = function (pOldIndex, pNewIndex: DWord): Integer; cdecl;
TCreateNewFile = function (Item: PByte): Integer; cdecl;
TDisplaySearch = function (pSearchList: PChar; pSelected: PChar): Integer; cdecl;
TSearch = function (pExpression: PChar; pCaseSensivity, pWholeWords, pSearchFromCaret, pSelectedOnly, pRegEx, pForward: Boolean): Integer; cdecl;
TSearch = function (pExpression, pSearchList: PChar; pCaseSensivity, pWholeWords, pSearchFromCaret, pSelectedOnly, pRegEx, pForward: Boolean): Integer; cdecl;
TSearchReplace = function (pExpression, pReplace, pExpList, pRepList: PChar; pCaseSensivity, pWholeWords, pSearchFromCaret, pSelectedOnly, pRegEx, pForward: Boolean): Integer; cdecl;
TVisibleControlChange = function (pControl: DWord; pShow: Boolean): Integer; cdecl;
TCompile = function (pCompileType: DWord; Lang, Filename: PChar): Integer; cdecl;
@ -19,7 +19,7 @@ type TCodeSnippetClick = function (pTitle, pCategory: PChar; pCode: PChar): Inte
TThemeChanged = function (pTheme: PChar): Integer; cdecl;
TModified = function (pText: PChar): Integer; cdecl;
TKeyPress = function (var pKey: Char): Integer; cdecl;
TKeyPress = function (pKey: PChar): Integer; cdecl;
TEditorClick = function (pDoubleClick: Boolean): Integer; cdecl;
TUpdateSel = function (pSelStart, pSelLength, pFirstVisibleLine: DWord): Integer; cdecl;
TCallTipShow = function (pList: PChar): Integer; cdecl;
@ -46,6 +46,7 @@ type TLoadInfo = record
hHTMLPreview: HWND;
hHudMsgGenerator: HWND;
hInfo: HWND;
hIRCPaster: HWND;
hMainForm: HWND;
hMenuGenerator: HWND;
hMOTDGen: HWND;
@ -69,7 +70,7 @@ type PLoadInfo = ^TLoadInfo;
TLoadPlugin = procedure (LoadInfo: PLoadInfo); cdecl;
TUnloadPlugin = procedure; cdecl;
procedure SendToMainApp(eData: String);
function SendStudioMsg(eMessage: Integer; eData: String; eIntData: Integer): Integer;
function LoadPlugin(ListItem: TListItem): Boolean;
procedure UnloadPlugin(ListItem: TListItem);
@ -80,7 +81,7 @@ function Plugin_FileSave(Filename: String; Saving: Boolean): Boolean;
function Plugin_DocChange(Index: Integer; Filename, Highlighter: String; RestoreCaret, Changing: Boolean): Boolean;
function Plugin_ProjectsChange(OldIndex, NewIndex: Integer; Changing: Boolean): Boolean;
function Plugin_CreateNewFile(Item: Byte; Creating: Boolean): Boolean;
function Plugin_Search(SearchList, Selected: String; Displaying, SearchAgain: Boolean): Boolean;
function Plugin_Search(SearchList, Selected: String; Displaying, SearchAgain: Boolean; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean;
function Plugin_SearchReplace(Expression, Replace, ExpList, RepList: String; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean;
function Plugin_VisibleControlChange(Control: Integer; Show: Boolean): Boolean;
function Plugin_Compile(CompileType: Integer; Lang, Filename: String; Compiling: Boolean): Boolean;
@ -89,7 +90,7 @@ function Plugin_CustomItemClick(Caption: String): Boolean;
function Plugin_ThemeChange(Theme: String): Boolean;
function Plugin_Modified(Code: PChar): Boolean;
function Plugin_KeyPress(var Key: Char): Boolean;
function Plugin_KeyPress(Key: Char): Boolean;
function Plugin_EditorClick(DoubleClick: Boolean): Boolean;
function Plugin_UpdateSel(SelStart, SelLength, FirstVisibleLine: Integer): Boolean;
function Plugin_CallTipShow(List: PChar): Boolean;
@ -133,6 +134,106 @@ const { Return values for dlls }
NEW_OTHER_SQL = 8;
NEW_OTHER_XML = 9;
const SCM_SHOWPROGRESS = WM_USER + $100;
SCM_HIDEPROGRESS = WM_USER + $101;
SCM_UPDATEPROGRESS = WM_USER + $102;
SCM_LOADCODESNIPPETS = WM_USER + $103;
SCM_CODESNIPPETCLICK = WM_USER + $104;
SCM_MIRC_CMD = WM_USER + $105;
SCM_RELOADINI = WM_USER + $106;
SCM_SELECTLANGUAGE = WM_USER + $107;
SCM_LOADFILE = WM_USER + $108;
SCM_CURRPROJECTS = WM_USER + $109;
SCM_COMPILE = WM_USER + $110;
SCM_COMPILE_UPLOAD = WM_USER + $111;
SCM_COMPILE_STARTHL = WM_USER + $112;
SCM_MENU_LOADIMAGE = WM_USER + $113;
SCM_MENU_ADDITEM = WM_USER + $114;
SCM_MENU_ADDSUBITEM = WM_USER + $115;
SCM_MENU_FAKECLICK = WM_USER + $116;
SCM_MENU_SHOWITEM = WM_USER + $117;
SCM_MENU_HIDEITEM = WM_USER + $118;
SCM_PLUGIN_LOAD = WM_USER + $119;
SCM_PLUGIN_UNLOAD = WM_USER + $120;
SCM_SETTINGS_CREATEPAGE = WM_USER + $121;
SCM_CODEINSPECTOR_CLEAR = WM_USER + $122;
SCM_CODEINSPECTOR_ADD = WM_USER + $123;
SCM_CODEINSPECTOR_ADDCOMBO = WM_USER + $124;
SCM_CODEINSPECTOR_SETVALUE = WM_USER + $125;
SCM_CODEINSPECTOR_SETNAME = WM_USER + $126;
SCM_CODEINSPECTOR_GETVALUE = WM_USER + $127;
SCM_CODEINSPECTOR_GETNAME = WM_USER + $128;
SCM_CODEINSPECTOR_COUNT = WM_USER + $129;
SCM_CODEINSPECTOR_BEGINUPDATE = WM_USER + $130;
SCM_CODEINSPECTOR_ENDUPDATE = WM_USER + $131;
SCM_CODEINSPECTOR_DELETE = WM_USER + $132;
SCM_PAWN_NEWFILE = WM_USER + $133;
SCM_PAWN_SAVEFILE = WM_USER + $134;
SCM_PAWN_CLOSEFILE = WM_USER + $135;
SCM_PAWN_ISUNTITLED = WM_USER + $136;
SCM_PAWN_ACTIVATE = WM_USER + $137;
SCM_PAWN_ACTIVATEDOC = WM_USER + $138;
SCM_PAWN_GETNOTES = WM_USER + $139;
SCM_PAWN_SETNOTES = WM_USER + $140;
SCM_PAWN_GETFILENAME = WM_USER + $141;
SCM_PAWN_SETFILENAME = WM_USER + $142;
SCM_PAWN_GETTEXT = WM_USER + $143;
SCM_PAWN_SETTEXT = WM_USER + $144;
SCM_CPP_NEWFILE = WM_USER + $145;
SCM_CPP_SAVEFILE = WM_USER + $146;
SCM_CPP_CLOSEFILE = WM_USER + $147;
SCM_CPP_ISUNTITLED = WM_USER + $148;
SCM_CPP_ACTIVATE = WM_USER + $149;
SCM_CPP_ACTIVATEDOC = WM_USER + $150;
SCM_CPP_ACTIVATEIDE = WM_USER + $151;
SCM_CPP_GETNOTES = WM_USER + $152;
SCM_CPP_SETNOTES = WM_USER + $153;
SCM_CPP_GETFILENAME = WM_USER + $154;
SCM_CPP_SETFILENAME = WM_USER + $155;
SCM_CPP_GETTEXT = WM_USER + $156;
SCM_CPP_SETTEXT = WM_USER + $157;
SCM_OTHER_NEWFILE = WM_USER + $158;
SCM_OTHER_SAVEFILE = WM_USER + $159;
SCM_OTHER_CLOSEFILE = WM_USER + $160;
SCM_OTHER_ISUNTITLED = WM_USER + $161;
SCM_OTHER_ACTIVATE = WM_USER + $162;
SCM_OTHER_ACTIVATEDOC = WM_USER + $163;
SCM_OTHER_GETNOTES = WM_USER + $164;
SCM_OTHER_SETNOTES = WM_USER + $165;
SCM_OTHER_GETFILENAME = WM_USER + $166;
SCM_OTHER_SETFILENAME = WM_USER + $167;
SCM_OTHER_GETTEXT = WM_USER + $168;
SCM_OTHER_SETTEXT = WM_USER + $169;
SCM_OUTPUT_SHOW = WM_USER + $170;
SCM_OUTPUT_HIDE = WM_USER + $171;
SCM_OUTPUT_ADD = WM_USER + $172;
SCM_OUTPUT_CLEAR = WM_USER + $173;
SCM_OUTPUT_DELETE = WM_USER + $174;
SCM_OUTPUT_GETTEXT = WM_USER + $175;
SCM_OUTPUT_GETITEM = WM_USER + $176;
SCM_OUTPUT_INDEXOF = WM_USER + $177;
SCM_ACTIVE_DOCUMENT = WM_USER + $178;
SCM_ACTIVE_PROJECTS = WM_USER + $179;
SCM_EDITOR_SETTEXT = WM_USER + $180;
SCM_EDITOR_GETTEXT = WM_USER + $181;
SCM_EDTIOR_SETCALLTIPS = WM_USER + $182;
SCM_EDITOR_SHOWCALLTIP = WM_USER + $183;
SCM_EDITOR_SETAUTOCOMPLETE = WM_USER + $184;
SCM_EDITOR_SHOWAUTOCOMPLETE = WM_USER + $185;
SCM_EDITOR_GETSELSTART = WM_USER + $186;
SCM_EDTIOR_GETSELLENGTH = WM_USER + $187;
SCM_EDITOR_SETSELSTART = WM_USER + $188;
SCM_EDITOR_SETSELLENGH = WM_USER + $189;
SCM_REMOVE_MENUITEM = WM_USER + $190;
SCM_REMOVE_IMAGE = WM_USER + $191;
SCM_SETTHEME = WM_USER + $192;
SCM_GETTHEME = WM_USER + $193;
implementation
uses UnitfrmSettings, UnitMainTools, UnitfrmAllFilesForm,
@ -140,7 +241,10 @@ uses UnitfrmSettings, UnitMainTools, UnitfrmAllFilesForm,
UnitfrmHTMLPreview, UnitfrmHudMsgGenerator, UnitfrmInfo, UnitfrmMain,
UnitfrmMenuGenerator, UnitfrmMOTDGen, UnitfrmPluginsIniEditor,
UnitfrmReplace, UnitfrmSearch, UnitfrmSelectColor,
UnitfrmSocketsTerminal, UnitfrmSplashscreen, UnitLanguages;
UnitfrmSocketsTerminal, UnitfrmSplashscreen, UnitLanguages,
UnitCodeExplorerUpdater, UnitCodeInspector, UnitCodeSnippets,
UnitCodeUtils, UnitCompile, UnitfrmIRCPaster, UnitMenuGenerators,
UnitReadThread, UnitTextAnalyze;
function LoadPlugin(ListItem: TListItem): Boolean;
var eLoadInfo: TLoadInfo;
@ -162,6 +266,7 @@ begin
hHTMLPreview := frmHTMLPreview.Handle;
hHudMsgGenerator := frmHudMsgGenerator.Handle;
hInfo := frmInfo.Handle;
hIRCPaster := frmIRCPaster.Handle;
hMainForm := frmMain.Handle;
hMenuGenerator := frmMenuGenerator.Handle;
hMOTDGen := frmMOTDGen.Handle;
@ -183,8 +288,8 @@ begin
eHandle := LoadLibrary(PChar(ExtractFilePath(ParamStr(0)) + 'plugins\' + ListItem.SubItems[0]));
if eHandle = 0 then exit;
@eFunc := GetProcAddress(eHandle, 'pftPluginLoad');
@eFunc2 := GetProcAddress(eHandle, 'pftPluginUnload');
@eFunc := GetProcAddress(eHandle, 'PluginLoad');
@eFunc2 := GetProcAddress(eHandle, 'PluginUnload');
if @eFunc2 <> nil then begin
if @eFunc <> nil then begin
@ -201,16 +306,16 @@ begin
end;
end
else
MessageBox(Application.Handle, PChar('Error loading plugin:' + #13 + 'pftPluginLoad function not found.'), PChar(ExtractFileName(ExtractFilePath(ParamStr(0)) + 'plugins\' + ListItem.SubItems[0])), MB_ICONERROR);
MessageBox(Application.Handle, PChar('Error loading plugin:' + #13 + 'PluginLoad function not found.'), PChar(ExtractFileName(ExtractFilePath(ParamStr(0)) + 'plugins\' + ListItem.SubItems[0])), MB_ICONERROR);
end
else
MessageBox(Application.Handle, PChar('Error loading plugin:' + #13 + 'pftPluginUnload function not found.'), PChar(ExtractFileName(ExtractFilePath(ParamStr(0)) + 'plugins\' + ListItem.SubItems[0])), MB_ICONERROR);
MessageBox(Application.Handle, PChar('Error loading plugin:' + #13 + 'PluginUnload function not found.'), PChar(ExtractFileName(ExtractFilePath(ParamStr(0)) + 'plugins\' + ListItem.SubItems[0])), MB_ICONERROR);
end;
procedure UnloadPlugin(ListItem: TListItem);
var eFunc: TUnloadPlugin;
begin
@eFunc := GetProcAddress(Cardinal(ListItem.Data), 'pftPluginUnload');
@eFunc := GetProcAddress(Cardinal(ListItem.Data), 'PluginUnload');
if @eFunc <> nil then
eFunc;
FreeLibrary(Cardinal(ListItem.Data));
@ -221,20 +326,21 @@ begin
ListItem.SubItems[2] := 'Unloaded';
end;
procedure SendToMainApp(eData: String);
var HTargetWnd: HWND;
ACopyDataStruct: TCopyDataStruct;
function SendStudioMsg(eMessage: Integer; eData: String; eIntData: Integer): Integer;
var eStudioHandle: HWND;
eCopyDataStruct: TCopyDataStruct;
begin
with ACopyDataStruct do
begin
dwData := 0;
with eCopyDataStruct do begin
dwData := eIntData;
cbData := Length(eData) + 1;
lpData := PChar(eData);
end;
HTargetWnd := FindWindow('TfrmMain', 'AMXX-Studio');
if HTargetWnd <> 0 then
SendMessage(HTargetWnd, WM_COPYDATA, 0, LongInt(@ACopyDataStruct));
eStudioHandle := FindWindow('TfrmMain', 'AMXX-Studio');
if eStudioHandle <> 0 then
Result := SendMessage(eStudioHandle, WM_COPYDATA, eMessage, LongInt(@eCopyDataStruct))
else
Result := 0;
end;
@ -264,7 +370,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftCodeSnippetClick');
@Func := GetProcAddress(Handles[i], 'CodeSnippetClick');
if @Func <> nil then begin
case Func(PChar(Title), PChar(Category), PChar(Code)) of
@ -288,9 +394,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Loading then
@Func := GetProcAddress(Handles[i], 'pftLoading')
@Func := GetProcAddress(Handles[i], 'Loading')
else
@Func := GetProcAddress(Handles[i], 'pftLoaded');
@Func := GetProcAddress(Handles[i], 'Loaded');
if @Func <> nil then begin
case Func(PChar(Filename)) of
@ -314,9 +420,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Saving then
@Func := GetProcAddress(Handles[i], 'pftSaving')
@Func := GetProcAddress(Handles[i], 'Saving')
else
@Func := GetProcAddress(Handles[i], 'pftSaved');
@Func := GetProcAddress(Handles[i], 'Saved');
if @Func <> nil then begin
case Func(PChar(Filename)) of
@ -340,9 +446,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Changing then
@Func := GetProcAddress(Handles[i], 'pftDocChanging')
@Func := GetProcAddress(Handles[i], 'DocChanging')
else
@Func := GetProcAddress(Handles[i], 'pftDocChanged');
@Func := GetProcAddress(Handles[i], 'DocChanged');
if @Func <> nil then begin
case Func(Index, PChar(Filename), PChar(Highlighter), RestoreCaret) of
@ -366,9 +472,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Changing then
@Func := GetProcAddress(Handles[i], 'pftProjectsChanging')
@Func := GetProcAddress(Handles[i], 'ProjectsChanging')
else
@Func := GetProcAddress(Handles[i], 'pftProjectsChanged');
@Func := GetProcAddress(Handles[i], 'ProjectsChanged');
if @Func <> nil then begin
case Func(OldIndex, NewIndex) of
@ -392,9 +498,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Creating then
@Func := GetProcAddress(Handles[i], 'pftCreatingNewFile')
@Func := GetProcAddress(Handles[i], 'CreatingNewFile')
else
@Func := GetProcAddress(Handles[i], 'pftCreatedNewFile');
@Func := GetProcAddress(Handles[i], 'CreatedNewFile');
if @Func <> nil then begin
case Func(PByte(Item)) of
@ -408,8 +514,8 @@ begin
end;
end;
function Plugin_Search(SearchList, Selected: String; Displaying, SearchAgain: Boolean): Boolean;
var Func: TDisplaySearch;
function Plugin_Search(SearchList, Selected: String; Displaying, SearchAgain: Boolean; CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward: Boolean): Boolean;
var Func: TSearch;
i: integer;
Handles: TIntegerArray;
begin
@ -418,14 +524,14 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Displaying then
@Func := GetProcAddress(Handles[i], 'pftDisplayingSearch')
@Func := GetProcAddress(Handles[i], 'DisplayingSearch')
else if SearchAgain then
@Func := GetProcAddress(Handles[i], 'pftSearchAgain')
@Func := GetProcAddress(Handles[i], 'SearchAgain')
else
@Func := GetProcAddress(Handles[i], 'pftSearch');
@Func := GetProcAddress(Handles[i], 'Search');
if @Func <> nil then begin
case Func(PChar(SearchList), PChar(Selected)) of
case Func(PChar(Selected), PChar(SearchList), CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward) of
PLUGIN_HANDLED: Result := False;
PLUGIN_STOP: begin
Result := False;
@ -445,7 +551,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftSearchReplace');
@Func := GetProcAddress(Handles[i], 'SearchReplace');
if @Func <> nil then begin
case Func(PChar(Expression), PChar(Replace), PChar(ExpList), PChar(RepList), CaseSensivity, WholeWords, SearchFromCaret, SelectedOnly, RegEx, Forward) of
@ -468,7 +574,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftVisibleControlChange');
@Func := GetProcAddress(Handles[i], 'VisibleControlChange');
if @Func <> nil then begin
case Func(Control, Show) of
@ -492,9 +598,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Compiling then
@Func := GetProcAddress(Handles[i], 'pftCompiling')
@Func := GetProcAddress(Handles[i], 'Compiling')
else
@Func := GetProcAddress(Handles[i], 'pftCompile');
@Func := GetProcAddress(Handles[i], 'Compile');
if @Func <> nil then begin
case Func(CompileType, PChar(Lang), PChar(Filename)) of
@ -517,7 +623,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftShowHelp');
@Func := GetProcAddress(Handles[i], 'ShowHelp');
if @Func <> nil then begin
case Func(HelpType) of
@ -540,7 +646,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftCustomItemClick');
@Func := GetProcAddress(Handles[i], 'CustomItemClick');
if @Func <> nil then begin
case Func(PChar(Caption)) of
@ -563,7 +669,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftThemeChanged');
@Func := GetProcAddress(Handles[i], 'ThemeChanged');
if @Func <> nil then begin
case Func(PChar(Theme)) of
@ -586,7 +692,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftModified');
@Func := GetProcAddress(Handles[i], 'Modified');
if @Func <> nil then begin
case Func(Code) of
@ -600,7 +706,7 @@ begin
end;
end;
function Plugin_KeyPress(var Key: Char): Boolean;
function Plugin_KeyPress(Key: Char): Boolean;
var Func: TKeyPress;
i: integer;
Handles: TIntegerArray;
@ -609,10 +715,10 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftKeyPress');
@Func := GetProcAddress(Handles[i], 'KeyPress');
if @Func <> nil then begin
case Func(Key) of
case Func(PChar(String(Key))) of
PLUGIN_HANDLED: Result := False;
PLUGIN_STOP: begin
Result := False;
@ -633,9 +739,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if DoubleClick then
@Func := GetProcAddress(Handles[i], 'pftDoubleClick')
@Func := GetProcAddress(Handles[i], 'DoubleClick')
else
@Func := GetProcAddress(Handles[i], 'pftClick');
@Func := GetProcAddress(Handles[i], 'Click');
if @Func <> nil then begin
case Func(DoubleClick) of
@ -658,7 +764,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftUpdateSel');
@Func := GetProcAddress(Handles[i], 'UpdateSel');
if @Func <> nil then begin
case Func(SelStart, SelLength, FirstVisibleLine) of
@ -681,7 +787,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftCallTipShow');
@Func := GetProcAddress(Handles[i], 'CallTipShow');
if @Func <> nil then begin
case Func(List) of
@ -704,7 +810,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftCallTipClick');
@Func := GetProcAddress(Handles[i], 'CallTipClick');
if @Func <> nil then begin
case Func(Position) of
@ -727,7 +833,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftAutoCompleteShow');
@Func := GetProcAddress(Handles[i], 'AutoCompleteShow');
if @Func <> nil then begin
case Func(List) of
@ -750,7 +856,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftAutoCompleteSelect');
@Func := GetProcAddress(Handles[i], 'AutoCompleteSelect');
if @Func <> nil then begin
case Func(Text) of
@ -773,7 +879,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftMessage');
@Func := GetProcAddress(Handles[i], 'Message');
if @Func <> nil then begin
case Func(hwnd, Message, wParam, lParam, time, pt) of
@ -797,9 +903,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Updating then
@Func := GetProcAddress(Handles[i], 'pftUpdatingCodeExplorer')
@Func := GetProcAddress(Handles[i], 'UpdatingCodeExplorer')
else
@Func := GetProcAddress(Handles[i], 'pftUpdatedCodeExplorer');
@Func := GetProcAddress(Handles[i], 'UpdatedCodeExplorer');
if @Func <> nil then begin
case Func(PChar(Lang), PChar(Filename), PChar(CurrProjects)) of
@ -823,9 +929,9 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
if Updating then
@Func := GetProcAddress(Handles[i], 'pftUpdatingCodeInspector')
@Func := GetProcAddress(Handles[i], 'UpdatingCodeInspector')
else
@Func := GetProcAddress(Handles[i], 'pftUpdatedCodeInspector');
@Func := GetProcAddress(Handles[i], 'UpdatedCodeInspector');
if @Func <> nil then begin
case Func(PChar(Lang), PChar(Filename), PChar(CurrProjects)) of
@ -848,7 +954,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftOutputDoubleClick');
@Func := GetProcAddress(Handles[i], 'OutputDoubleClick');
if @Func <> nil then begin
case Func(ItemIndex) of
@ -871,7 +977,7 @@ begin
Handles := GetDLLHandles;
for i := 0 to High(Handles) do begin
@Func := GetProcAddress(Handles[i], 'pftOutputPopup');
@Func := GetProcAddress(Handles[i], 'OutputPopup');
if @Func <> nil then begin
case Func(ItemIndex) of

Binary file not shown.

Binary file not shown.

View File

@ -7738,4 +7738,9 @@ object frmMain: TfrmMain
Left = 632
Top = 6
end
object JvWindowHook: TJvWindowHook
Left = 632
Top = 36
IsForm = True
end
end

View File

@ -17,7 +17,7 @@ uses
IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP,
ShellAPI, IdFTPCommon, IdAntiFreezeBase, IdAntiFreeze, JvComponent,
JvInspector, JvExControls, JvPluginManager, JvgLanguageLoader,
JvWndProcHook, CommCtrl;
JvWndProcHook, CommCtrl, JvPageList, JvPageListTreeView;
type
TfrmMain = class(TForm)
@ -270,6 +270,7 @@ type
sepView3: TSpTBXSeparatorItem;
mnuShowCodeExplorer: TSpTBXItem;
mnuShowCodeInspector: TSpTBXItem;
JvWindowHook: TJvWindowHook;
procedure FormConstrainedResize(Sender: TObject; var MinWidth,
MinHeight, MaxWidth, MaxHeight: Integer);
procedure mnuExitClick(Sender: TObject);
@ -414,7 +415,6 @@ type
procedure sciEditorCallTipClick(Sender: TObject;
const position: Integer);
procedure sciEditorAutoCSelection(Sender: TObject; text: PAnsiChar);
procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
procedure pnlCodeInspectorVisibleChanged(Sender: TObject);
procedure pnlCodeExplorerVisibleChanged(Sender: TObject);
procedure mnuShowCodeExplorerClick(Sender: TObject);
@ -429,6 +429,7 @@ type
procedure OnCodeSnippetClick(Sender: TObject);
procedure OnCustomClick(Sender: TObject);
procedure SetErrorLine(eLine: Integer);
procedure OnCopyData(var Msg: TWMCopyData); message WM_COPYDATA;
end;
var
@ -444,7 +445,7 @@ uses UnitfrmSettings, UnitMainTools, UnitLanguages, UnitfrmInfo,
UnitTextAnalyze, UnitfrmHudMsgGenerator, UnitCompile, UnitfrmAutoIndent,
UnitfrmHTMLPreview, UnitCodeInspector, UnitfrmMOTDGen,
UnitfrmMenuGenerator, UnitfrmClose, UnitPlugins, UnitfrmConnGen,
UnitMenuGenerators;
UnitMenuGenerators, UnitfrmIRCPaster;
{$R *.dfm}
@ -834,43 +835,46 @@ end;
procedure TfrmMain.mnuOpenClick(Sender: TObject);
var eExt: String;
begin
if odOpen.Execute then begin
eExt := ExtractFileExt(odOpen.FileName);
eExt := LowerCase(eExt);
if (eExt = '.sma') or (eExt = '.inc') then begin // Pawn files
if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False);
PAWNProjects.Open(odOpen.FileName);
end
else if (eExt = '.cpp') or (eExt = '.h') then begin // C++ files
if not eCPP then
MessageBox(Handle, PChar(lNoCPP), PChar(Application.Title), MB_ICONWARNING)
else begin
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(1, False);
CPPProjects.Open(odOpen.FileName);
end;
end
else if (eExt = '.htm') or (eExt = '.html') then begin // HTML files
if Assigned(Sender) then begin
if not odOpen.Execute then
exit;
end;
eExt := ExtractFileExt(odOpen.FileName);
eExt := LowerCase(eExt);
if (eExt = '.sma') or (eExt = '.inc') then begin // Pawn files
if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False);
PAWNProjects.Open(odOpen.FileName);
end
else if (eExt = '.cpp') or (eExt = '.h') then begin // C++ files
if not eCPP then
MessageBox(Handle, PChar(lNoCPP), PChar(Application.Title), MB_ICONWARNING)
else begin
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'HTML');
end
else if (eExt = '.sql') then begin // SQL databases
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'SQL');
end
else if (eExt = '.xml') then begin // XML files
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'XML');
end
else begin // Other files and/or Textfiles
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'null');
ActivateProjects(1, False);
CPPProjects.Open(odOpen.FileName);
end;
end
else if (eExt = '.htm') or (eExt = '.html') then begin // HTML files
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'HTML');
end
else if (eExt = '.sql') then begin // SQL databases
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'SQL');
end
else if (eExt = '.xml') then begin // XML files
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'XML');
end
else begin // Other files and/or Textfiles
if tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'null');
end;
end;
@ -950,7 +954,7 @@ begin
if sdSave.Execute then begin
ActiveDoc.FileName := AddExtension(sdSave.FileName, ActiveDoc.Highlighter);
ActiveDoc.Save;
// Don't know why tsDocuments.Items[0].Caption := '???'; not works, but this works:
// Don't know why tsDocuments.Items[0].Caption := '???'; not works, but this does:
TSpTBXTabItem(tsDocuments.Items[ActiveDoc.Index]).Caption := ActiveDoc.Title;
end;
end;
@ -1105,21 +1109,9 @@ begin
end;
procedure TfrmMain.OnCodeSnippetClick(Sender: TObject);
function GetCat: String;
begin
if mnuPAWN.Checked then
Result := 'Pawn'
else if mnuCPP.Checked then
Result := 'C++'
else if mnuHTML.Checked then
Result := 'HTML'
else
Result := 'Other';
end;
begin
if Plugin_CodeSnippetClick(TSpTBXItem(Sender).Caption, GetCat, GetSnippet(GetCat, (Sender As TSpTBXItem).Caption)) then
sciEditor.SelText := GetSnippet('Pawn', (Sender As TSpTBXItem).Caption);
sciEditor.SelText := GetSnippet(GetCat, (Sender As TSpTBXItem).Caption);
end;
procedure TfrmMain.mnuCopyMessageClick(Sender: TObject);
@ -1247,9 +1239,9 @@ end;
procedure TfrmMain.mnuSearchDialogClick(Sender: TObject);
begin
Plugin_Search(frmSearch.cboSearchFor.Items.Text, frmSearch.cboSearchFor.Text, True, False);
Plugin_Search(frmSearch.cboSearchFor.Items.Text, frmSearch.cboSearchFor.Text, True, False, frmSearch.chkCaseSensivity.Checked, frmSearch.chkWholeWordsOnly.Checked, frmSearch.chkSearchFromCaret.Checked, frmSearch.chkSelectedTextOnly.Checked, frmSearch.chkRegularExpression.Checked, frmSearch.chkForward.Checked);
if frmSearch.ShowModal = mrOk then begin
if not Plugin_Search(frmSearch.cboSearchFor.Items.Text, frmSearch.cboSearchFor.Text, False, False) then
if not Plugin_Search(frmSearch.cboSearchFor.Items.Text, frmSearch.cboSearchFor.Text, False, False, frmSearch.chkCaseSensivity.Checked, frmSearch.chkWholeWordsOnly.Checked, frmSearch.chkSearchFromCaret.Checked, frmSearch.chkSelectedTextOnly.Checked, frmSearch.chkRegularExpression.Checked, frmSearch.chkForward.Checked) then
exit;
with sciSearchReplace do begin
@ -1298,7 +1290,7 @@ end;
procedure TfrmMain.mnuSearchAgainClick(Sender: TObject);
begin
if not Plugin_Search(frmSearch.cboSearchFor.Items.Text, frmSearch.cboSearchFor.Text, False, True) then
if not Plugin_Search(frmSearch.cboSearchFor.Items.Text, frmSearch.cboSearchFor.Text, False, True, frmSearch.chkCaseSensivity.Checked, frmSearch.chkWholeWordsOnly.Checked, frmSearch.chkSearchFromCaret.Checked, frmSearch.chkSelectedTextOnly.Checked, frmSearch.chkRegularExpression.Checked, frmSearch.chkForward.Checked) then
exit;
sciSearchReplace.SearchText := frmSearch.cboSearchFor.Text;
@ -1378,8 +1370,10 @@ end;
procedure TfrmMain.sciEditorKeyPress(Sender: TObject; var Key: Char);
begin
if Started then begin
if not Plugin_KeyPress(Key) then
if not Plugin_KeyPress(Key) then begin
Key := #0;
exit;
end;
mnuModified.Caption := lModified;
ActiveDoc.Modified := True;
@ -1432,42 +1426,53 @@ end;
procedure TfrmMain.mnuPasterClick(Sender: TObject);
var i: integer;
eChannel: String;
eIsGamesurge: Boolean;
eTo, eFrom: Integer;
eLine: String;
begin
if FindWindow('mirc', nil) = 0 then begin
MessageBox(Handle, PChar(lNoMIRCWindowOpen), PChar(Application.Title), MB_ICONERROR);
exit;
end;
if sciEditor.Lines.Count > 35 then begin
if MessageBox(Handle, PChar(lWarnBigPluginPaste), PChar(Application.Title), MB_ICONWARNING + MB_YESNO) = mrNo then
exit;
end;
if InputQuery(lSelectChannel, lSelectChannelPrompt, eChannel) then begin
if eChannel = '' then exit;
IRCPasterStop := False;
Caption := 'AMXX-Studio - ' + lPastingCodeEscStop;
eISGamesurge := Pos('gamesurge', LowerCase(mIRCGet('mIRC', 'SERVER', 'SERVER'))) = 0;
for i := 0 to sciEditor.Lines.Count -1 do begin
if (FindWindow('mirc', nil) = 0) or (Application.Terminated) or (IRCPasterStop) then begin
Caption := 'AMXX-Studio';
exit;
end;
if (sciEditor.LanguageManager.SelectedLanguage = 'Pawn') or (sciEditor.LanguageManager.SelectedLanguage = 'C++') then
mIRCDDE('mIRC', 'COMMAND', '/msg ' + eChannel + #32 + StringReplace(GetColoredLine(i), '|', '$chr(124)', [rfReplaceAll]))
else
mIRCDDE('mIRC', 'COMMAND', '/msg ' + eChannel + #32 + StringReplace(sciEditor.Lines[i], ' | ', ' $chr(124) ', [rfReplaceAll]));
if not eIsGamesurge then
Delay(2500)
else
Application.ProcessMessages;
frmIRCPaster.chkDelay.Checked := Pos('gamesurge', LowerCase(mIRCGet('mIRC', 'SERVER', 'SERVER'))) = 0;
if frmIRCPaster.ShowModal = mrOk then begin
{ All }
if frmIRCPaster.optAll.Checked then begin
eFrom := 0;
eTo := sciEditor.Lines.Count -1;
end
{ Special Lines }
else if frmIRCPaster.optLines.Checked then begin
eFrom := StrToInt(frmIRCPaster.txtFrom.Text) -1;
eTo := StrToInt(frmIRCPaster.txtTo.Text) -1;
end
{ Selected }
else begin
eFrom := LineFromPos(sciEditor.SelStart);
eTo := LineFromPos(sciEditor.SelStart + sciEditor.SelLength);
end;
Caption := 'AMXX-Studio';
pbLoading.Max := eTo - eFrom;
pbLoading.Position := 0;
ShowProgress;
for i := eFrom to eTo do begin
if (FindWindow('mirc', nil) = 0) or (Application.Terminated) or (IRCPasterStop) then
break;
pbLoading.Position := i;
SetProgressStatus('Pasting code...');
eLine := sciEditor.Lines[i];
eLine := Trim(eLine);
eLine := StringReplace(eLine, #9, #32, [rfReplaceAll]);
if frmIRCPaster.chkColors.Checked then
mIRCDDE('mIRC', 'COMMAND', '/msg ' + frmIRCPaster.txtChannel.Text + #32 + GetColoredLine(i))
else
mIRCDDE('mIRC', 'COMMAND', '/msg ' + frmIRCPaster.txtChannel.Text + #32 + eLine);
if frmIRCPaster.chkDelay.Checked then
Delay(eConfig.ReadInteger('Misc', 'IRCPasteDelay', 2500));
end;
HideProgress;
end;
end;
@ -2265,282 +2270,6 @@ begin
Plugin_AutoCompleteSelect(text);
end;
procedure TfrmMain.WMCopyData(var Msg: TWMCopyData);
var eCommand, eExt: String;
eItem: TSpTBXItem;
eItem2: TTBCustomItem;
begin
if Msg.Msg = WM_COPYDATA then begin
SetLength(eCommand, Msg.CopyDataStruct.cbData);
StrLCopy(PChar(eCommand), Msg.CopyDataStruct.lpData, Msg.CopyDataStruct.cbData);
{ AddMenuItem }
if Pos('ADDMENUITEM', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 11);
eCommand := Trim(eCommand);
if (CountChars(eCommand, '"') = 4) then begin
eItem2 := GetMenuItem(Between(eCommand, '"', '"'));
while CountChars(eCommand, '"') > 2 do
Delete(eCommand, 1, 1);
eItem := TSpTBXItem.Create(frmMain.tbxMenu.Items);
eItem.OnClick := OnCustomClick;
eItem.Caption := Between(eCommand, '"', '"');
eItem2.Add(eItem);
Msg.Result := 1;
exit;
end
else
Msg.Result := 0;
end
{ AddMenuSubItem }
else if Pos('ADDMENUSUBITEM', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 12);
eCommand := Trim(eCommand);
if (CountChars(eCommand, '"') = 4) and (Assigned(GetMenuItem(Between(eCommand, '"', '"')))) then begin
while CountChars(eCommand, '"') > 2 do
Delete(eCommand, 1, 1);
eItem := TSpTBXSubmenuItem.Create(frmMain.tbxMenu.Items);
eItem.OnClick := OnCustomClick;
eItem.Caption := Between(eCommand, '"', '"');
frmMain.tbxMenu.Items.Add(GetMenuItem(Between(eCommand, '"', '"')));
Msg.Result := 1;
exit;
end
else
Msg.Result := 0;
end
else if Pos('REMOVEMENUITEM', UpperCase(eCommand)) = 1 then begin
eCommand := Between(eCommand, '"', '"');
if Assigned(GetMenuItem(eCommand)) then begin
TSpTBXItem(GetMenuItem(eCommand)).Free;
Msg.Result := 1;
end
else
Msg.Result := 0;
end
{ SetEditorText }
else if Pos('SETEDITORTEXT', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 14);
frmMain.sciEditor.Lines.Text := eCommand;
Msg.Result := 1;
end
{ GetEditorText }
else if Pos('GETEDITORTEXT', UpperCase(eCommand)) = 1 then
Msg.Result := LongInt(sciEditor.Lines.GetText)
{ ExecMenuItem }
else if Pos('EXECMENUITEM', UpperCase(eCommand)) = 1 then begin
eCommand := TrimLeft(Copy(eCommand, Pos(#32, eCommand) +1, Length(eCommand)));
if Assigned(GetMenuItem(eCommand)) then begin
GetMenuItem(eCommand).Click;
Msg.Result := 1;
end
else
Msg.Result := 0;
end
{ LoadFile }
else if Pos('LOADFILE PAWN', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 13);
if frmMain.tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False);
if PAWNProjects.Open(Trim(eCommand)) <> -1 then
Msg.Result := 1
else
Msg.Result := 0;
end
else if Pos('LOADFILE CPP', UpperCase(eCommand)) = 1 then begin
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(1, False);
Delete(eCommand, 1, 12);
if CPPProjects.Open(Trim(eCommand)) <> -1 then
Msg.Result := 1
else
Msg.Result := 0;
end
else if Pos('LOADFILE OTHER', UpperCase(eCommand)) = 1 then begin
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
Delete(eCommand, 1, 12);
if CPPProjects.Open(Trim(eCommand)) <> -1 then
Msg.Result := 1
else
Msg.Result := 0;
end
else if Pos('LOADFILE', UpperCase(eCommand)) = 1 then begin
eExt := ExtractFileExt(eCommand);
eExt := LowerCase(eExt);
Msg.Result := 0;
if (eExt = '.sma') or (eExt = '.inc') then begin // Pawn files
if frmMain.tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False);
if PAWNProjects.Open(eCommand) <> -1 then
Msg.Result := 1;
end
else if (eExt = '.cpp') or (eExt = '.h') then begin // C++ files
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(1, False);
if CPPProjects.Open(eCommand) <> -1 then
Msg.Result := 1;
end
else if (eExt = '.htm') or (eExt = '.html') then begin // HTML files
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
if OtherProjects.Open(eCommand, 'HTML') <> -1 then
Msg.Result := 1;
end
else if (eExt = '.sql') then begin // SQL databases
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
if OtherProjects.Open(eCommand, 'SQL') <> -1 then
Msg.Result := 1;
end
else if (eExt = '.xml') then begin // XML files
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
if OtherProjects.Open(eCommand, 'XML') <> -1 then
Msg.Result := 1;
end
else begin // Other files and/or Textfiles
if frmMain.tsMain.ActiveTabIndex <> 1 then
ActivateProjects(2, False);
if OtherProjects.Open(eCommand, 'null') <> -1 then
Msg.Result := 1;
end;
end
{ SaveFile }
else if Pos('SAVEFILE', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 8);
Msg.Result := 0;
eCommand := Trim(eCommand);
if eCommand <> '' then
ActiveDoc.FileName := eCommand;
if ActiveDoc.Save then
Msg.Result := 1;
end
{ ActivateFile }
else if Pos('ACTIVATEFILE', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 12);
eCommand := Trim(eCommand);
Msg.Result := 0;
if IsNumeric(eCommand) then begin
if StrToInt(eCommand) < frmMain.tsDocuments.Items.Count then begin
frmMain.tsDocuments.ActiveTabIndex := StrToInt(eCommand);
Msg.Result := 1;
end;
end;
end
{ ActivateProjects }
else if Pos('ACTIVATEPROJECTS', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 12);
eCommand := Trim(eCommand);
Msg.Result := 0;
if IsNumeric(eCommand) then begin
if StrToInt(eCommand) < frmMain.tsMain.Items.Count then begin
ActivateProjects(StrToInt(eCommand), True);
Msg.Result := 1;
end;
end;
end
{ DeleteMenuItem }
else if Pos('DELETEMENUITEM', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 14);
eCommand := Trim(eCommand);
if Assigned(GetMenuItem(eCommand)) then begin
GetMenuItem(eCommand).Free;
Msg.Result := 1;
end
else
Msg.Result := 0;
end
{ C++ IDE }
else if Pos('CPPIDE', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 7);
eCommand := Trim(UpperCase(eCommand));
Msg.Result := 0;
if eCommand = 'ON' then begin
tiCPP.Enabled := True;
mnuNewHeaderCPP.Enabled := True;
mnuNewModule.Enabled := True;
mnuNewUnit.Enabled := True;
eCPP := True;
Msg.Result := 1;
end
else if eCommand = 'OFF' then begin
frmMain.tiCPP.Enabled := False;
frmMain.mnuNewHeaderCPP.Enabled := False;
frmMain.mnuNewModule.Enabled := False;
frmMain.mnuNewUnit.Enabled := False;
eCPP := False;
Msg.Result := 1;
end;
end
{ Output }
else if Pos('OUTPUT', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 6);
eCommand := Trim(eCommand);
Msg.Result := 0;
if Pos('ADD', eCommand) = 1 then begin
Delete(eCommand, 1, 4); // +1 for space
frmMain.lstOutput.Items.Add(eCommand);
Msg.Result := 1;
end
else if Pos('DELETE', eCommand) = 1 then begin
Delete(eCommand, 1, 7);
if IsNumeric(eCommand) then begin
if StrToInt(eCommand) < frmMain.lstOutput.Items.Count then
frmMain.lstOutput.Items.Delete(StrToInt(eCommand));
end;
end
else if Pos('SETTEXT', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 8); // +1 for space
frmMain.lstOutput.Items.Text := eCommand;
Msg.Result := 1;
end
else if Pos('GETTEXT', UpperCase(eCommand)) = 1 then begin
eCommand := frmMain.lstOutput.Items.Text;
Msg.Result := LongInt(PChar(eCommand));
end
else if Pos('CLEAR', UpperCase(eCommand)) = 1 then begin
frmMain.lstOutput.Items.Clear;
Msg.Result := 1;
end
else if Pos('SHOW', UpperCase(eCommand)) = 1 then begin
frmMain.splOutput.Show;
frmMain.lstOutput.Show;
Msg.Result := 1;
end
else if Pos('HIDE', UpperCase(eCommand)) = 1 then begin
frmMain.splOutput.Hide;
frmMain.lstOutput.Hide;
Msg.Result := 1;
end
end
{ New }
else if Pos('NEW', UpperCase(eCommand)) = 1 then begin
Delete(eCommand, 1, 4);
Msg.Result := 1;
if UpperCase(eCommand) = 'EMPTY_PLUGIN' then
frmMain.mnuEmptyPlugin.Click
else if UpperCase(eCommand) = 'PLUGIN' then
frmMain.mnuNewPlugin.Click
else if UpperCase(eCommand) = 'HEADER_PAWN' then
frmMain.mnuHeaderPAWN.Click
else if UpperCase(eCommand) = 'MODULE' then
frmMain.mnuNewModule.Click
else if UpperCase(eCommand) = 'HEADER_CPP' then
frmMain.mnuNewHeaderCPP.Click
else if UpperCase(eCommand) = 'TEXTFILE' then
frmMain.mnuNewTextfile.Click
else if UpperCase(eCommand) = 'HTML' then
frmMain.mnuNewHTML.Click
else if UpperCase(eCommand) = 'SQL' then
frmMain.mnuNewSQL.Click
else if UpperCase(eCommand) = 'XML' then
frmMain.mnuNewXML.Click
else
Msg.Result := 0;
end;
end
end;
procedure TfrmMain.OnCustomClick(Sender: TObject);
begin
Plugin_CustomItemClick((Sender As TTBXCustomItem).Caption);
@ -2649,4 +2378,429 @@ begin
end;
end;
procedure TfrmMain.OnCopyData(var Msg: TWMCopyData);
var eData: String;
eIntData: Integer;
eMessage: Integer;
eBMP: TBitmap;
eTemp: String;
eItem: TSpTBXItem;
ePage: TJvStandardPage;
eStr: TStringList;
eValues: array of string;
i: integer;
begin
eData := String(PChar(Msg.CopyDataStruct.lpData));
eIntData := Msg.CopyDataStruct.dwData;
eMessage := Msg.From;
try
Msg.Result := 1;
case eMessage of
SCM_SHOWPROGRESS: ShowProgress;
SCM_HIDEPROGRESS: HideProgress;
SCM_UPDATEPROGRESS: begin
pbLoading.Position := eIntData;
SetProgressStatus(eData);
end;
SCM_LOADCODESNIPPETS: LoadCodeSnippets(eData);
SCM_CODESNIPPETCLICK: begin
if Plugin_CodeSnippetClick(eData, GetCat, GetSnippet(GetCat, eData)) then
sciEditor.SelText := GetSnippet(GetCat, eData);
end;
SCM_MIRC_CMD: mIRCDDE('mIRC', 'COMMAND', eData);
SCM_RELOADINI: ReloadIni;
SCM_SELECTLANGUAGE: SelectLanguage(eData);
SCM_LOADFILE: begin
odOpen.FileName := eData;
mnuOpenClick(nil);
end;
SCM_CURRPROJECTS: Msg.Result := tsMain.ActiveTabIndex;
SCM_COMPILE: mnuDoCompile.Click;
SCM_COMPILE_UPLOAD: mnuCompileAndUpload.Click;
SCM_COMPILE_STARTHL: mnuCompileAndStartHL.Click;
SCM_MENU_LOADIMAGE: begin
eBMP := TBitmap.Create;
eBMP.LoadFromFile(eData);
if eIntData = -1 then
Msg.Result := ilImages.Add(eBMP, nil)
else
Msg.Result := ilImages.AddMasked(eBMP, eIntData);
eBMP.Free;
end;
SCM_MENU_ADDITEM: begin
if Pos('->', eData) <> 0 then begin
eTemp := Copy(eData, 1, Pos('->', eData) -1);
eData := Copy(eData, Pos('->', eData) +2, Length(eData));
end
else
eTemp := '';
eItem := TSpTBXItem.Create(tbxMenu.Items);
with eItem do begin
Caption := eData;
ImageIndex := eIntData;
OnClick := OnCustomClick;
end;
if Assigned(GetMenuItem(eTemp)) then
GetMenuItem(eTemp).Add(eItem)
else
tbxMenu.Items.Add(eItem);
end;
SCM_MENU_ADDSUBITEM: begin
if Pos('->', eData) <> 0 then begin
eTemp := Copy(eData, 1, Pos('->', eData) -1);
eData := Copy(eData, Pos('->', eData) +2, Length(eData));
end
else
eTemp := '';
eItem := TSpTBXSubMenuItem.Create(tbxMenu.Items);
with eItem do begin
Caption := eData;
ImageIndex := eIntData;
OnClick := OnCustomClick;
end;
if Assigned(GetMenuItem(eTemp)) then
GetMenuItem(eTemp).Add(eItem)
else
tbxMenu.Items.Add(eItem);
end;
SCM_MENU_FAKECLICK: begin
if Assigned(GetMenuItem(eData)) then
GetMenuItem(eData).Click
else
Msg.Result := 0;
end;
SCM_MENU_SHOWITEM: begin
if Assigned(GetMenuItem(eData)) then
GetMenuItem(eData).Visible := True
else
Msg.Result := 0;
end;
SCM_MENU_HIDEITEM: begin
if Assigned(GetMenuItem(eData)) then
GetMenuItem(eData).Visible := False
else
Msg.Result := 0;
end;
SCM_PLUGIN_LOAD: begin
if eData <> '' then begin
Msg.Result := 0;
for i := 0 to frmSettings.lvPlugins.Items.Count -1 do begin
if LowerCase(frmSettings.lvPlugins.Items[i].SubItems[0]) = LowerCase(eData) then begin
LoadPlugin(frmSettings.lvPlugins.Items[i]);
Msg.Result := 1;
break;
end;
end;
end
else
LoadPlugin(frmSettings.lvPlugins.Items[eIntData]);
end;
SCM_PLUGIN_UNLOAD: begin
if eData <> '' then begin
Msg.Result := 0;
for i := 0 to frmSettings.lvPlugins.Items.Count -1 do begin
if LowerCase(frmSettings.lvPlugins.Items[i].SubItems[0]) = LowerCase(eData) then begin
UnloadPlugin(frmSettings.lvPlugins.Items[i]);
Msg.Result := 1;
break;
end;
end;
end
else
UnloadPlugin(frmSettings.lvPlugins.Items[eIntData]);
end;
SCM_SETTINGS_CREATEPAGE: begin
if Pos('->', eData) <> 0 then begin
eTemp := Copy(eData, 1, Pos('->', eData) -1);
eData := Copy(eData, Pos('->', eData) +2, Length(eData));
end
else
eTemp := '';
ePage := TJvStandardPage.Create(frmSettings.jplSettings);
ePage.Caption := eData;
TJvPageIndexNode(frmSettings.trvSettings.Items.AddChild(FindSettingsNode(eTemp), eData)).PageIndex := ePage.PageIndex;
Msg.Result := ePage.Handle;
end;
SCM_CODEINSPECTOR_CLEAR: jviCode.Root.Clear;
SCM_CODEINSPECTOR_ADD: begin
eStr := TStringList.Create;
eStr.Text := eData;
if eStr.Count = 3 then
AddField(eStr[0], eStr[1], eStr[2])
else
Msg.Result := 0;
eStr.Free;
end;
SCM_CODEINSPECTOR_ADDCOMBO: begin
eStr := TStringList.Create;
eStr.Text := eData;
if eStr.Count > 3 then begin
SetLength(eValues, eStr.Count -2);
for i := 0 to eStr.Count -4 do
eValues[i] := eStr[i +3];
AddCombo(eStr[0], eStr[1], eStr[2], eValues);
end
else
Msg.Result := 0;
eStr.Free;
end;
SCM_CODEINSPECTOR_SETVALUE: begin
eStr := TStringList.Create;
eStr.Text := eData;
if eStr.Count = 2 then begin
if Assigned(GetCIItem(eStr[0])) then
GetCIItem(eStr[0]).DisplayValue := eStr[1]
else
Msg.Result := 0;
end
else
Msg.Result := 0;
end;
SCM_CODEINSPECTOR_SETNAME: begin
eStr := TStringList.Create;
eStr.Text := eData;
if eStr.Count = 2 then begin
if Assigned(GetCIItem(eStr[0])) then
GetCIItem(eStr[0]).DisplayName := eStr[1]
else
Msg.Result := 0;
end
else
Msg.Result := 0;
end;
SCM_CODEINSPECTOR_GETVALUE: begin
if Assigned(GetCIItem(eData)) then
Msg.Result := Integer(PChar(GetCIItem(eData).DisplayValue))
else
Msg.Result := Integer(PChar(''));
end;
SCM_CODEINSPECTOR_GETNAME: begin
if Assigned(GetCIItem(eData)) then
Msg.Result := Integer(PChar(GetCIItem(eData).DisplayName))
else
Msg.Result := Integer(PChar(''));
end;
SCM_CODEINSPECTOR_COUNT: Msg.Result := jviCode.Root.Count;
SCM_CODEINSPECTOR_BEGINUPDATE: jviCode.BeginUpdate;
SCM_CODEINSPECTOR_ENDUPDATE: jviCode.EndUpdate;
SCM_CODEINSPECTOR_DELETE: begin
if Assigned(GETCIItem(eData)) then
jviCode.Root.Delete(GETCIItem(eData))
else
Msg.Result := 0;
end;
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
try
if TDocument(PawnProjects.Items[eIntData]).Untitled then
Msg.Result := 1
else
Msg.Result := 0;
except
Msg.Result := -1;
end;
end;
SCM_PAWN_ACTIVATE: begin
if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, eIntData = 1);
end;
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
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
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText)
else
Msg.Result := Integer(TDocument(PawnProjects.Items[eIntData]).Code.GetText);
end;
SCM_CPP_NEWFILE: begin
if eCPP then
CPPProjects.Add(eData)
else
Msg.Result := 0;
end;
SCM_CPP_SAVEFILE: begin
if eCPP then begin
if (eData = '') and (TDocument(CPPProjects.Items[eIntData]).Untitled) then
Msg.Result := 0
else
CPPProjects.Save(eIntData, eData);
end;
end;
SCM_CPP_CLOSEFILE: begin
if eCPP then
CPPProjects.Close(eIntData)
else
Msg.Result := 0;
end;
SCM_CPP_ISUNTITLED: begin
try
if TDocument(CPPProjects.Items[eIntData]).Untitled then
Msg.Result := 1
else
Msg.Result := 0;
except
Msg.Result := -1;
end;
end;
SCM_CPP_ACTIVATE: begin
if (eCPP) and (tsMain.ActiveTabIndex <> 1) then
ActivateProjects(1, eIntData = 1)
else
Msg.Result := 0;
end;
SCM_CPP_ACTIVATEDOC: begin
if eCPP then
CPPProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0)
else
Msg.Result := 0;
end;
SCM_CPP_ACTIVATEIDE: begin
eCPP := eIntData = 1;
if eCPP then begin
tiCPP.Enabled := True;
mnuNewHeaderCPP.Enabled := True;
mnuNewModule.Enabled := True;
mnuNewUnit.Enabled := True;
end
else begin
tiCPP.Enabled := False;
mnuNewHeaderCPP.Enabled := False;
mnuNewModule.Enabled := False;
mnuNewUnit.Enabled := False;
end;
end;
SCM_CPP_GETNOTES: begin
if (tsMain.ActiveTabIndex = 1) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(PChar(GetRTFText(rtfNotes)))
else
Msg.Result := Integer(PChar(TDocument(CPPProjects.Items[eIntData]).NotesText));
end;
SCM_CPP_SETNOTES: begin
if (tsMain.ActiveTabIndex = 1) and (tsDocuments.ActiveTabIndex = eIntData) then
SetRTFText(rtfNotes, eData)
else
TDocument(CPPProjects.Items[eIntData]).NotesText := eData;
end;
SCM_CPP_GETFILENAME: Msg.Result := Integer(PChar(TDocument(CPPProjects.Items[eIntData]).FileName));
SCM_CPP_GETTEXT: begin
if (tsMain.ActiveTabIndex = 1) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText)
else
Msg.Result := Integer(TDocument(CPPProjects.Items[eIntData]).Code.GetText);
end;
SCM_OTHER_NEWFILE: OtherProjects.Add(eData);
SCM_OTHER_SAVEFILE: begin
if (eData = '') and (TDocument(CPPProjects.Items[eIntData]).Untitled) then
Msg.Result := 0
else
OtherProjects.Save(eIntData, eData);
end;
SCM_OTHER_CLOSEFILE: OtherProjects.Delete(eIntData);
SCM_OTHER_ISUNTITLED: begin
try
if TDocument(OtherProjects.Items[eIntData]).Untitled then
Msg.Result := 1
else
Msg.Result := 0;
except
Msg.Result := -1;
end;
end;
SCM_OTHER_ACTIVATE: begin
if tsMain.ActiveTabIndex <> 2 then
ActivateProjects(2, eIntData = 1)
else
Msg.Result := 0;
end;
SCM_OTHER_ACTIVATEDOC: OtherProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0);
SCM_OTHER_GETNOTES: begin
if (tsMain.ActiveTabIndex = 2) and (tsDocuments.ActiveTabIndex = eIntData) then
Msg.Result := Integer(PChar(GetRTFText(rtfNotes)))
else
Msg.Result := Integer(PChar(TDocument(OtherProjects.Items[eIntData]).NotesText));
end;
SCM_OTHER_SETNOTES: begin
if (tsMain.ActiveTabIndex = 2) and (tsDocuments.ActiveTabIndex = eIntData) then
SetRTFText(rtfNotes, eData)
else
TDocument(OtherProjects.Items[eIntData]).NotesText := eData;
end;
SCM_OUTPUT_SHOW: begin
splOutput.Show;
lstOutput.Show;
end;
SCM_OUTPUT_HIDE: begin
splOutput.Hide;
lstOutput.Hide;
end;
SCM_OUTPUT_ADD: Msg.Result := lstOutput.Items.Add(eData);
SCM_OUTPUT_CLEAR: lstOutput.Items.Clear;
SCM_OUTPUT_DELETE: lstOutput.Items.Delete(eIntData);
SCM_OUTPUT_GETTEXT: Msg.Result := Integer(lstOutput.Items.GetText);
SCM_OUTPUT_GETITEM: begin
try
Msg.Result := Integer(PChar(lstOutput.Items[eIntData]));
except
Msg.Result := Integer(PChar(''));
end;
end;
SCM_OUTPUT_INDEXOF: Msg.Result := lstOutput.Items.IndexOf(eData);
SCM_ACTIVE_DOCUMENT: Msg.Result := tsDocuments.ActiveTabIndex;
SCM_ACTIVE_PROJECTS: Msg.Result := tsMain.ActiveTabIndex;
SCM_EDITOR_SETTEXT: sciEditor.Lines.SetText(Msg.CopyDataStruct.lpData);
SCM_EDITOR_GETTEXT: Msg.Result := Integer(sciEditor.Lines.GetText);
SCM_EDTIOR_SETCALLTIPS: sciCallTips.ApiStrings.Text := eData;
SCM_EDITOR_SHOWCALLTIP: sciEditor.CallTipShow(eIntData, Msg.CopyDataStruct.lpData);
SCM_EDITOR_SETAUTOCOMPLETE: sciAutoComplete.AStrings.Text := eData;
SCM_EDITOR_SHOWAUTOCOMPLETE: sciEditor.AutoCShow(eIntData, Msg.CopyDataStruct.lpData);
SCM_EDITOR_GETSELSTART: Msg.Result := sciEditor.SelStart;
SCM_EDTIOR_GETSELLENGTH: Msg.Result := sciEditor.SelLength;
SCM_EDITOR_SETSELSTART: sciEditor.SelStart := eIntData;
SCM_EDITOR_SETSELLENGH: sciEditor.SelLength := eIntData;
SCM_REMOVE_MENUITEM: begin
if Assigned(GetMenuItem(eData)) then begin
if Assigned(GetMenuItem(eData).Parent) then
GetMenuItem(eData).Parent.Remove(GetMenuItem(eData))
else
tbxMenu.Items.Remove(GetMenuItem(eData));
Msg.Result := 1;
end
else
Msg.Result := 0;
end;
SCM_REMOVE_IMAGE: ilImages.Delete(eIntData);
SCM_SETTHEME: TBXSetTheme(eData);
SCM_GETTHEME: Msg.Result := Integer(PChar(TBXCurrentTheme));
end;
except
Msg.Result := 0;
end;
end;
end.

View File

@ -59,7 +59,7 @@ object frmSettings: TfrmSettings
Top = 0
Width = 353
Height = 260
ActivePage = jspShortcuts
ActivePage = jspPlugIns
PropagateEnable = False
Align = alClient
OnChange = jplSettingsChange

View File

@ -29,7 +29,8 @@ implementation
uses UnitCodeExplorerUpdater, UnitCodeSnippets, UnitCodeUtils,
UnitLanguages, UnitMainTools, UnitReadThread, UnitfrmHudMsgGenerator,
UnitfrmAutoIndent, UnitfrmHTMLPreview, UnitCodeInspector, UnitPlugins,
UnitfrmMenuGenerator, UnitfrmMOTDGen, UnitfrmClose, UnitfrmConnGen;
UnitfrmMenuGenerator, UnitfrmMOTDGen, UnitfrmClose, UnitfrmConnGen,
UnitfrmIRCPaster;
{$R *.DFM}
@ -89,7 +90,10 @@ begin
Application.CreateForm(TfrmConnGen, frmConnGen);
Application.ProcessMessages;
Repaint;
Application.CreateForm(TfrmIRCPaster, frmIRCPaster);
Application.ProcessMessages;
Repaint;
if IEInstalled then begin
Application.CreateForm(TfrmHTMLPreview, frmHTMLPreview);
Application.ProcessMessages;