Replaced Documents tabbar (means two bugs are fixed now)

Removed Projects tabbar and added a new item to the statusbar
This commit is contained in:
Christian Hammacher 2006-04-10 18:05:08 +00:00
parent cd7f15f112
commit c9765e50c8
10 changed files with 4181 additions and 4133 deletions

View File

@ -114,8 +114,8 @@ IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=4
Release=0
Build=17
Release=1
Build=1
Debug=0
PreRelease=0
Special=0
@ -126,11 +126,17 @@ CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.4.0.17
FileVersion=1.4.1.1
InternalName=gaben
LegalCopyright=AMX Mod X Dev Team
LegalTrademarks=
OriginalFilename=
ProductName=AMXX-Studio
ProductVersion=1.4.0.0
ProductVersion=1.4.1.0
Comments=
[HistoryLists\hlConditionals]
Count=1
Item0=madExcept
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

View File

@ -122,22 +122,22 @@ begin
eCache.Free;
i := 0;
if PAWNProjects.Count > 1 then begin
PAWNProjects.Close(0);
if PawnProjects.Count > 1 then begin
PawnProjects.Close(0, True);
i := 1;
end;
if CPPProjects.Count > 1 then begin
CPPProjects.Close(0);
CPPProjects.Close(0, True);
i := 1;
end;
if OtherProjects.Count > 1 then begin
OtherProjects.Close(0);
OtherProjects.Close(0, True);
i := 1;
end;
if i = 1 then begin
ActivateProjects(0, False); // Started := True is already set here
PAWNProjects.Activate(PAWNProjects.Count -1, False, False);
PAWNProjects.Activate(PawnProjects.Count -1, False, False);
end;
UpdateCI(frmMain.sciEditor.GetCurrentLineNumber);

Binary file not shown.

Binary file not shown.

View File

@ -70,11 +70,11 @@ begin
eCallTips := '';
eKeywords := '';
if (not Application.Terminated) and (Started) and (not frmMain.pnlLoading.Visible) and (frmMain.trvExplorer.Visible) then begin
if (Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True)) and (frmMain.tsMain.ActiveTabIndex = 0) then begin
if (not Application.Terminated) and (Started) and (not frmMain.pnlLoading.Visible) and (frmMain.trvExplorer.Visible) and (Assigned(ActiveDoc)) then begin
if (Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tbDocs.SelectedTab.Caption, True)) and (frmMain.stlIDEs.ItemIndex = 0) then begin
try
if CheckAU then begin
if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then begin
if Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.stlIDEs.Strings[frmMain.stlIDEs.ItemIndex], True) then begin
// analyze code
with ParseCodePawn(eCode, ExtractFileName(ActiveDoc.FileName)) do begin
eConstants.Assign(Constants);
@ -358,7 +358,7 @@ begin
end;
end;
Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, False);
Plugin_UpdateCodeExplorer(GetCurrLang.Name, ActiveDoc.FileName, frmMain.stlIDEs.Strings[frmMain.stlIDEs.ItemIndex], False);
end;
end.

View File

@ -372,13 +372,13 @@ end;
procedure UpdateCI(eLine: Integer);
begin
if eUpdating then exit;
if (eUpdating) or (not Assigned(ActiveDoc)) then exit;
eUpdating := True;
if not Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, True) then exit;
if not Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tbDocs.SelectedTab.Caption, True) then exit;
if GetCurrLang.Name = 'Pawn' then begin
UpdateCI_Pawn(eLine);
Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tsMain.Items[frmMain.tsMain.ActiveTabIndex].Caption, False);
Plugin_UpdateCodeInspector(GetCurrLang.Name, ActiveDoc.FileName, frmMain.tbDocs.SelectedTab.Caption, False);
end;
eUpdating := False;
end;

View File

@ -5,7 +5,8 @@ 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, JvComCtrls;
ShellApi, DDEMan, IdFTP, IdFTPList, IdException, JvInspector, JvComCtrls,
JvTabBar;
type TDocument = class(TCollectionItem)
private
@ -53,7 +54,7 @@ type TDocCollection = class(TCollection)
function Add(AFilename: String; AHighlighter: String = ''): TDocument; reintroduce;
function Open(AFilename: String; AHighlighter: String = ''): Integer;
function Save(AIndex: Integer; AFilename: String = ''): Boolean;
procedure Close(AIndex: Integer);
procedure Close(AIndex: Integer; RemoveTab: Boolean);
procedure Activate(Document: Integer; RestoreCaret: Boolean; SaveLastDoc: Boolean = True); overload;
procedure Activate(Document: TDocument; RestoreCaret: Boolean; SaveLastDoc: Boolean = True); overload;
published
@ -77,7 +78,7 @@ procedure FillCodeExplorer(Lang: String);
function IEInstalled: Boolean;
function GetAMXXDir(ListenServer: Boolean): String;
function CloseDocument(eDocument: TDocument; SaveActiveDoc: Boolean = False): Boolean;
function CloseDocument(eDocument: TDocument; SaveActiveDoc, RemoveTab: Boolean): Boolean;
function AddExtension(eFilename, eHighlighter: String): String;
function ShowColorDialog(var Color: TColor; ePaintImage: TImage): Boolean;
@ -439,10 +440,10 @@ begin
Result := '';
end;
function CloseDocument(eDocument: TDocument; SaveActiveDoc: Boolean = False): Boolean;
function CloseDocument(eDocument: TDocument; SaveActiveDoc, RemoveTab: Boolean): Boolean;
var Collection: TDocCollection;
begin
case frmMain.tsMain.ActiveTabIndex of
case frmMain.stlIDEs.ItemIndex of
0: Collection := PawnProjects;
1: Collection := CPPProjects;
else Collection := OtherProjects;
@ -452,16 +453,18 @@ begin
if (eDocument.Modified) then begin
case MessageBox(frmMain.Handle, PChar(Format(lCloseModify, [ExtractFileName(eDocument.FileName)])), PChar(Application.Title), MB_ICONQUESTION + MB_YESNOCANCEL) of
mrYes: begin
Collection.Activate(eDocument, True);
frmMain.mnuSave.Click;
if not eDocument.Untitled then
Collection.Close(eDocument.Index);
Result := not eDocument.Untitled;
if Result then
Collection.Close(eDocument.Index, RemoveTab);
end;
mrNo: Collection.Close(eDocument.Index);
mrNo: Collection.Close(eDocument.Index, RemoveTab);
mrCancel: Result := False;
end;
end
else
Collection.Close(eDocument.Index);
Collection.Close(eDocument.Index, RemoveTab);
end;
function AddExtension(eFilename, eHighlighter: String): String;
@ -554,12 +557,11 @@ end;
procedure ActivateProjects(Index: Integer; JumpToLastDoc: Boolean);
var Collection: TDocCollection;
i: integer;
TabItem: TSpTBXTabItem;
OldIndex: Integer;
begin
if not Plugin_ProjectsChange(CurrProjects, Index, True) then begin
Started := False;
frmMain.tsMain.ActiveTabIndex := CurrProjects;
frmMain.stlIDEs.ItemIndex := CurrProjects;
Started := True;
exit;
end;
@ -577,21 +579,17 @@ begin
Started := False; // dont run this command twice
frmMain.tsMain.Items[Index].Checked := True; // select tab
frmMain.stlIDEs.ItemIndex := Index;
CurrProjects := Index;
tsDocuments.Items.Clear;
for i := 0 to Collection.Count -1 do begin
TabItem := TSpTBXTabItem.Create(tsDocuments);
TabItem.Caption := TDocument(Collection.Items[i]).Title;
TabItem.OnSelect := frmMain.OnTabSelect;
tsDocuments.Items.Add(TabItem);
end;
tbDocs.Tabs.Clear;
for i := 0 to Collection.Count -1 do
tbDocs.AddTab(TDocument(Collection.Items[i]).Title);
Started := True;
if JumpToLastDoc then begin
Started := False;
tsDocuments.Items[Collection.ActiveDocument.Index].Checked := True;
tbDocs.Tabs[Collection.ActiveDocument.Index].Selected := True;
Collection.Activate(Collection.ActiveDocument.Index, True);
Started := True;
end;
@ -765,10 +763,8 @@ begin
if not Started then exit;
frmMain.pnlLoading.Show;
for i := 0 to frmMain.tsDocuments.Items.Count -1 do
frmMain.tsDocuments.Items[i].Enabled := i = frmMain.tsDocuments.ActiveTabIndex;
for i := 0 to frmMain.tsMain.Items.Count -1 do
frmMain.tsMain.Items[i].Enabled := i = frmMain.tsMain.ActiveTabIndex;
for i := 0 to frmMain.tbDocs.Tabs.Count -1 do
frmMain.tbDocs.Tabs[i].Enabled := i = frmMain.tbDocs.SelectedTab.Index;
for i := 0 to frmMain.tbxMenu.Items.Count -1 do
frmMain.tbxMenu.Items[i].Enabled := False;
for i := 0 to frmMain.tbxToolbar.Items.Count -1 do
@ -779,6 +775,7 @@ begin
frmMain.tbxCodeSnippets.Items[i].Enabled := False;
for i := 0 to frmMain.tcTools.Items.Count -1 do
frmMain.tcTools.Items[i].Enabled := False;
frmMain.cboCurrentIDE.Enabled := False;
frmMain.ppmDocuments.Items.Enabled := False;
frmMain.sciEditor.ReadOnly := ReadOnly;
end;
@ -789,10 +786,8 @@ begin
if not Started then exit;
frmMain.pnlLoading.Hide;
for i := 0 to frmMain.tsDocuments.Items.Count -1 do
frmMain.tsDocuments.Items[i].Enabled := True;
for i := 0 to frmMain.tsMain.Items.Count -1 do
frmMain.tsMain.Items[i].Enabled := True;
for i := 0 to frmMain.tbDocs.Tabs.Count -1 do
frmMain.tbDocs.Tabs[i].Enabled := True;
for i := 0 to frmMain.tbxMenu.Items.Count -1 do
frmMain.tbxMenu.Items[i].Enabled := True;
for i := 0 to frmMain.tbxToolbar.Items.Count -1 do
@ -804,11 +799,11 @@ begin
for i := 0 to frmMain.tcTools.Items.Count -1 do
frmMain.tcTools.Items[i].Enabled := True;
frmMain.tiCPP.Enabled := eCPP;
frmMain.mnuNewHeaderCPP.Enabled := eCPP;
frmMain.mnuNewModule.Enabled := eCPP;
frmMain.mnuNewUnit.Enabled := eCPP;
frmMain.cboCurrentIDE.Enabled := True;
frmMain.ppmDocuments.Items.Enabled := True;
frmMain.sciEditor.ReadOnly := False;
end;
@ -947,14 +942,15 @@ end;
procedure TDocCollection.Activate(Document: Integer; RestoreCaret: Boolean; SaveLastDoc: Boolean = True);
begin
Activate(TDocument(Items[Document]), RestoreCaret, SaveLastDoc);
if Document < Count then
Activate(TDocument(Items[Document]), RestoreCaret, SaveLastDoc);
end;
procedure TDocCollection.Activate(Document: TDocument; RestoreCaret: Boolean; SaveLastDoc: Boolean = True);
begin
if not Plugin_DocChange(Document.Index, Document.FileName, Document.Highlighter, RestoreCaret, True) then begin
Started := False;
TSpTBXTabItem(frmMain.tsDocuments.Items[ActiveDoc.Index]).Checked := True;
TJvTabBarItem(frmMain.tbDocs.Tabs[ActiveDoc.Index]).Selected := True;
Started := True;
exit;
end;
@ -983,7 +979,7 @@ begin
frmMain.sciEditor.Lines.Clear;
if Started then begin
Started := False;
frmMain.tsDocuments.Items[Document.Index].Checked := True;
frmMain.tbDocs.Tabs[Document.Index].Selected := True;
if (frmMain.Canvas.TextWidth(Document.FileName) > frmMain.mnuFilename.CustomWidth) and (not Document.Untitled) then
frmMain.mnuFilename.Caption := ExtractFileName(Document.FileName)
else
@ -1024,7 +1020,6 @@ begin
end;
function TDocCollection.Add(AFilename: String; AHighlighter: String = ''): TDocument;
var TabItem: TSpTBXTabItem;
begin
if AHighlighter = '' then
AHighlighter := Highlighter;
@ -1064,43 +1059,63 @@ 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;
if (Self = PawnProjects) and (frmMain.stlIDEs.ItemIndex <> 0) then exit;
if (Self = CPPProjects) and (frmMain.stlIDEs.ItemIndex <> 1) then exit;
if (Self = OtherProjects) and (frmMain.stlIDEs.ItemIndex <> 2) then exit;
TabItem := TSpTBXTabItem.Create(frmMain.tsDocuments);
TabItem.Caption := Title;
TabItem.OnSelect := frmMain.OnTabSelect;
frmMain.tsDocuments.Items.Add(TabItem);
Started := False;
frmMain.tbDocs.AddTab(Title);
Started := True;
end;
end;
procedure TDocCollection.Close(AIndex: Integer);
procedure TDocCollection.Close(AIndex: Integer; RemoveTab: Boolean);
var Collection: TDocCollection;
i: integer;
begin
case frmMain.tsMain.ActiveTabIndex of
case frmMain.stlIDEs.ItemIndex of
0: Collection := PawnProjects;
1: Collection := CPPProjects;
else Collection := OtherProjects;
end;
if Collection = Self then begin
frmMain.tsDocuments.Items.Delete(AIndex);
frmMain.tsDocuments.Refresh;
if RemoveTab then
frmMain.tbDocs.Tabs.Delete(AIndex);
if ActiveDoc.Index = AIndex then
ActiveDoc := nil;
end;
Delete(AIndex);
for i := 0 to Count -1 do
TDocument(Items[i]).Title := '< ' + IntToStr(i +1) + #32 + ExtractFileName(TDocument(Items[i]).FileName) + ' >';
if Collection = Self then begin
for i := 0 to frmMain.tsDocuments.Items.Count -1 do
TSpTBXTabItem(frmMain.tsDocuments.Items[i]).Caption := TDocument(Items[i]).Title;
if (Collection = Self) then begin
try
for i := 0 to frmMain.tbDocs.Tabs.Count -1 do
TJvTabBarItem(frmMain.tbDocs.Tabs[i]).Caption := TDocument(Items[i]).Title;
except
// no idea how to fix this
end;
end;
if Count = 0 then
Add('', '');
if Count = 0 then begin
with Add('', '') do begin
if Self = PawnProjects then begin
Code := '/* Plugin generated by AMXX-Studio */' + #13#10 + #13#10;
Code := Code + '#include <amxmodx>' + #13#10;
Code := Code + '#include <amxmisc>' + #13#10 + #13#10;
Code := Code + '#define PLUGIN "' + eConfig.ReadString('Misc', 'DefaultPluginName', 'New Plugin') + '"' + #13#10;
Code := Code + '#define VERSION "' + eConfig.ReadString('Misc', 'DefaultPluginVersion', '1.0') + '"' + #13#10;
Code := Code + '#define AUTHOR "' + eConfig.ReadString('Misc', 'DefaultPluginAuthor', 'Your name') + '"' + #13#10 + #13#10 + #13#10;
Code := Code + 'public plugin_init() {' + #13#10;
Code := Code + ' register_plugin(PLUGIN, VERSION, AUTHOR)' + #13#10;
Code := Code + ' ' + #13#10;
Code := Code + ' // Add your code here...' + #13#10;
Code := Code + '}' + #13#10;
end;
end;
end;
if (AIndex -1 < Count) and (AIndex <> 0) then
Activate(AIndex -1, True, False)

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@ uses
ShellAPI, IdFTPCommon, IdAntiFreezeBase, IdAntiFreeze, JvComponent,
JvInspector, JvExControls, JvPluginManager, JvgLanguageLoader,
JvWndProcHook, CommCtrl, JvPageList, JvPageListTreeView,
SciSearchReplaceBase, SpTBXControls;
SciSearchReplaceBase, SpTBXControls, JvTabBar, TB2ExtItems, SpTBXEditors,
TBXLists, SpTBXLists;
type
TfrmMain = class(TForm)
@ -129,13 +130,6 @@ type
mnuTPaste: TSpTBXItem;
sepTEdit2: TSpTBXSeparatorItem;
mnuTSelectAll: TSpTBXItem;
tsMain: TSpTBXTabSet;
tiPawn: TSpTBXTabItem;
tiCPP: TSpTBXTabItem;
tsDocuments: TSpTBXTabSet;
tiDocument1: TSpTBXTabItem;
spcLeft1: TImage;
spcRight1: TImage;
sciCallTips: TSciCallTips;
sbStatus: TSpTBXStatusBar;
sepGenerators1: TSpTBXSeparatorItem;
@ -143,7 +137,6 @@ type
infoNewCPP: TSpTBXRightAlignSpacerItem;
sepNew1: TSpTBXSeparatorItem;
mnuPaster: TSpTBXItem;
tiOther: TSpTBXTabItem;
sciPropertyLoader: TSciPropertyLoader;
odOpen: TOpenDialog;
sdSave: TSaveDialog;
@ -166,9 +159,41 @@ type
mnuFoldAll: TSpTBXItem;
sepView1: TSpTBXSeparatorItem;
sciPrinter: TSciPrinter;
pnlParent: TPanel;
sciEditor: TScintilla;
splRight: TSplitter;
mnuCopyMessage: TSpTBXItem;
mnuCopyAll: TSpTBXItem;
mnuSaveToFile: TSpTBXItem;
sepOutput: TSpTBXSeparatorItem;
ppmEditor: TSpTBXPopupMenu;
mnuEditorCopy: TSpTBXItem;
mnuEditorPaste: TSpTBXItem;
mnuEditorCut: TSpTBXItem;
sepEditorMenu2: TSpTBXSeparatorItem;
mnuEditorUndo: TSpTBXItem;
mnuEditorRedo: TSpTBXItem;
sepEditorMenu3: TSpTBXSeparatorItem;
mnuToogleBookmark: TSpTBXItem;
mnuGoToBookmark: TSpTBXItem;
mnuEditorDelete: TSpTBXItem;
sepEditorMenu1: TSpTBXSeparatorItem;
mnuEditorSelectAll: TSpTBXItem;
sciSearchReplace: TSciSearchReplace;
IdFTP: TIdFTP;
sciAutoComplete: TSciAutoComplete;
mnuHTML: TSpTBXItem;
ppmDocuments: TSpTBXPopupMenu;
mnuPClose: TSpTBXItem;
mnuPSave: TSpTBXItem;
sepDocuments: TSpTBXSeparatorItem;
mnuPCloseAllFiles: TSpTBXItem;
mnuMenuGenerator: TSpTBXItem;
JvInspectorDotNETPainter: TJvInspectorDotNETPainter;
mnuConnectionGen: TSpTBXItem;
sepView3: TSpTBXSeparatorItem;
mnuShowCodeExplorer: TSpTBXItem;
mnuShowCodeInspector: TSpTBXItem;
mnuRestoreBackup: TSpTBXItem;
tbDocs: TJvTabBar;
mtpDocuments: TJvModernTabBarPainter;
tcTools: TSpTBXTabControl;
tiTools: TSpTBXTabItem;
tiNotes: TSpTBXTabItem;
@ -189,49 +214,24 @@ type
spcBottom2: TImage;
spcLeft2: TImage;
spcRight2: TImage;
lstOutput: TListBox;
splOutput: TSplitter;
mnuCopyMessage: TSpTBXItem;
mnuCopyAll: TSpTBXItem;
mnuSaveToFile: TSpTBXItem;
sepOutput: TSpTBXSeparatorItem;
ppmEditor: TSpTBXPopupMenu;
mnuEditorCopy: TSpTBXItem;
mnuEditorPaste: TSpTBXItem;
mnuEditorCut: TSpTBXItem;
sepEditorMenu2: TSpTBXSeparatorItem;
mnuEditorUndo: TSpTBXItem;
mnuEditorRedo: TSpTBXItem;
sepEditorMenu3: TSpTBXSeparatorItem;
mnuToogleBookmark: TSpTBXItem;
mnuGoToBookmark: TSpTBXItem;
mnuEditorDelete: TSpTBXItem;
sepEditorMenu1: TSpTBXSeparatorItem;
mnuEditorSelectAll: TSpTBXItem;
sciSearchReplace: TSciSearchReplace;
IdFTP: TIdFTP;
pnlLoading: TSpTBXPanel;
pbLoading: TSpTBXProgressBar;
cmdCancel: TSpTBXButton;
sciAutoComplete: TSciAutoComplete;
mnuHTML: TSpTBXItem;
ppmDocuments: TSpTBXPopupMenu;
mnuPClose: TSpTBXItem;
mnuPSave: TSpTBXItem;
sepDocuments: TSpTBXSeparatorItem;
mnuPCloseAllFiles: TSpTBXItem;
mnuMenuGenerator: TSpTBXItem;
pnlDock: TSpTBXMultiDock;
pnlCodeExplorer: TSpTBXDockablePanel;
trvExplorer: TTreeView;
pnlCodeInspector: TSpTBXDockablePanel;
JvInspectorDotNETPainter: TJvInspectorDotNETPainter;
jviCode: TJvInspector;
mnuConnectionGen: TSpTBXItem;
sepView3: TSpTBXSeparatorItem;
mnuShowCodeExplorer: TSpTBXItem;
mnuShowCodeInspector: TSpTBXItem;
mnuRestoreBackup: TSpTBXItem;
splRight: TSplitter;
spcRight1: TImage;
spcLeft1: TImage;
pnlParent: TPanel;
splOutput: TSplitter;
sciEditor: TScintilla;
lstOutput: TListBox;
pnlLoading: TSpTBXPanel;
pbLoading: TSpTBXProgressBar;
cmdCancel: TSpTBXButton;
sepStatus0: TSpTBXSeparatorItem;
cboCurrentIDE: TSpTBXDropDownItem;
stlIDEs: TSpTBXStringList;
procedure FormConstrainedResize(Sender: TObject; var MinWidth,
MinHeight, MaxWidth, MaxHeight: Integer);
procedure mnuExitClick(Sender: TObject);
@ -247,9 +247,6 @@ type
procedure trvExplorerCollapsed(Sender: TObject; Node: TTreeNode);
procedure trvExplorerExpanded(Sender: TObject; Node: TTreeNode);
procedure mnuSettingsClick(Sender: TObject);
procedure tsMainActiveTabChange(Sender: TObject; ItemIndex: Integer);
procedure tsDocumentsActiveTabChange(Sender: TObject;
ItemIndex: Integer);
procedure FormShow(Sender: TObject);
procedure mnuTOpenClick(Sender: TObject);
procedure mnuTSaveClick(Sender: TObject);
@ -348,8 +345,6 @@ type
var CancelDisplay: Boolean);
procedure mnuMOTDGeneratorClick(Sender: TObject);
procedure mnuHeaderPawnClick(Sender: TObject);
procedure OnTabSelect(Sender: TTBCustomItem; Viewer: TTBItemViewer;
Selecting: Boolean);
procedure mnuPCloseClick(Sender: TObject);
procedure mnuPCloseAllFilesClick(Sender: TObject);
procedure mnuTNewClick(Sender: TObject);
@ -380,12 +375,18 @@ type
Item: TJvCustomInspectorItem);
procedure mnuRestoreBackupClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure stlIDEsClick(Sender: TObject);
procedure tbDocsTabSelected(Sender: TObject; Item: TJvTabBarItem);
procedure tbDocsMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure tbDocsTabClosing(Sender: TObject; Item: TJvTabBarItem;
var AllowClose: Boolean);
private
procedure UpdateNotes;
public
IRCPasterStop: Boolean;
eErrorLine: Integer;
SelectedTab: TSpTBXTabItem;
SelectedTab: TJvTabBarItem;
procedure OnCodeSnippetClick(Sender: TObject);
procedure OnCustomClick(Sender: TObject);
procedure SetErrorLine(eLine: Integer);
@ -415,7 +416,7 @@ procedure TfrmMain.FormConstrainedResize(Sender: TObject; var MinWidth,
MinHeight, MaxWidth, MaxHeight: Integer);
begin
pnlLoading.Left := sciEditor.Left + 3 + (sciEditor.Width div 2) - (pnlLoading.Width div 2);
pnlLoading.Top := tsDocuments.Top + sciEditor.Top + ((sciEditor.Height * 5) div 6) - (pnlLoading.Height div 2);
pnlLoading.Top := tbDocs.Top + sciEditor.Top + ((sciEditor.Height * 5) div 6) - (pnlLoading.Height div 2);
if (Canvas.TextWidth(ActiveDoc.FileName) + 10 > mnuFilename.CustomWidth) then
mnuFilename.Caption := ExtractFileName(ActiveDoc.FileName)
@ -645,65 +646,7 @@ begin
sciEditor.Gutter1.Width := 40;
end;
{ Change Tab -> }
procedure TfrmMain.tsMainActiveTabChange(Sender: TObject;
ItemIndex: Integer);
begin
if (not Started) or (frmMain.pnlLoading.Visible) then exit;
if (lstOutput.Visible) then begin
if Plugin_VisibleControlChange(CTRL_OUTPUT, False) then begin
splOutput.Hide;
lstOutput.Hide;
Plugin_VisibleControlChange(CTRL_OUTPUT, False);
end;
end;
case tsMain.ActiveTabIndex of
0: begin
mnuTNew.Caption := 'New Plugin';
end;
1: begin
mnuTNew.Caption := 'New Unit';
sciCallTips.ApiStrings.Clear;
sciAutoComplete.AStrings.Clear;
end;
2: begin
mnuTNew.Caption := 'New Textfile';
sciCallTips.ApiStrings.Clear;
sciAutoComplete.AStrings.Clear;
end;
end;
ActivateProjects(ItemIndex, True);
trvExplorer.Items.Clear;
FillCodeExplorer(GetCurrLang.Name);
end;
procedure TfrmMain.tsDocumentsActiveTabChange(Sender: TObject;
ItemIndex: Integer);
var Collection: TDocCollection;
begin
if (not Started) or (pnlLoading.Visible) then exit;
if (lstOutput.Visible) then begin
if Plugin_VisibleControlChange(CTRL_OUTPUT, False) then begin
splOutput.Hide;
lstOutput.Hide;
Plugin_VisibleControlChange(CTRL_OUTPUT, False);
end;
end;
case tsMain.ActiveTabIndex of
0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other
end;
Collection.Activate(ItemIndex, True);
end;
{ <- Change Tab | Settings -> }
{ Settings -> }
procedure TfrmMain.FormShow(Sender: TObject);
begin
@ -770,7 +713,7 @@ procedure TfrmMain.mnuEmptyPluginClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_Pawn_EMPTYPLUGIN, True) then exit;
if tsMain.ActiveTabIndex <> 0 then
if stlIDEs.ItemIndex <> 0 then
ActivateProjects(0, False);
PawnProjects.Activate(PawnProjects.Add(''), True);
@ -781,7 +724,7 @@ procedure TfrmMain.mnuNewPluginClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_Pawn_PLUGIN, True) then exit;
if tsMain.ActiveTabIndex <> 0 then
if stlIDEs.ItemIndex <> 0 then
ActivateProjects(0, False);
PawnProjects.Activate(PawnProjects.Add(''), False);
@ -825,7 +768,7 @@ begin
eExt := ExtractFileExt(odOpen.FileName);
eExt := LowerCase(eExt);
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then begin // Pawn files
if tsMain.ActiveTabIndex <> 0 then
if stlIDEs.ItemIndex <> 0 then
ActivateProjects(0, False);
PawnProjects.Open(odOpen.FileName);
end
@ -833,28 +776,28 @@ begin
if not eCPP then
MessageBox(Handle, PChar(lNoCPP), PChar(Application.Title), MB_ICONWARNING)
else begin
if tsMain.ActiveTabIndex <> 1 then
if stlIDEs.ItemIndex <> 1 then
ActivateProjects(1, False);
CPPProjects.Open(odOpen.FileName);
end;
end
else if (eExt = '.htm') or (eExt = '.html') then begin // HTML files
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'HTML');
end
else if (eExt = '.sql') then begin // SQL databases
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'SQL');
end
else if (eExt = '.xml') then begin // XML files
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'XML');
end
else begin // Other files and/or Textfiles
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Open(odOpen.FileName, 'null');
end;
@ -864,7 +807,7 @@ procedure TfrmMain.mnuNewTextfileClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_OTHER_TEXTFILE, True) then exit;
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Activate(OtherProjects.Add(''), True);
@ -876,7 +819,7 @@ procedure TfrmMain.mnuNewHTMLClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_OTHER_HTML, True) then exit;
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, True);
OtherProjects.Activate(OtherProjects.Add('', 'HTML'), True);
@ -896,7 +839,7 @@ procedure TfrmMain.mnuNewSQLClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_OTHER_SQL, True) then exit;
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Activate(OtherProjects.Add('', 'SQL'), True);
@ -908,7 +851,7 @@ procedure TfrmMain.mnuNewXMLClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_OTHER_XML, True) then exit;
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 2 then
ActivateProjects(2, False);
OtherProjects.Activate(OtherProjects.Add('', 'XML'), True);
@ -939,8 +882,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 does:
TSpTBXTabItem(tsDocuments.Items[ActiveDoc.Index]).Caption := ActiveDoc.Title;
tbDocs.Tabs[ActiveDoc.Index].Caption := ActiveDoc.Title;
end;
end;
@ -999,7 +941,7 @@ end;
procedure TfrmMain.mnuCloseClick(Sender: TObject);
begin
CloseDocument(ActiveDoc);
CloseDocument(ActiveDoc, True, True);
end;
procedure TfrmMain.mnuShowCodeToolsClick(Sender: TObject);
@ -1287,10 +1229,10 @@ procedure TfrmMain.mnuSaveAllFilesClick(Sender: TObject);
var a, b: integer;
Collection: TDocCollection;
begin
case tsMain.ActiveTabIndex of
case stlIDEs.ItemIndex of
0: Collection := PawnProjects;
1: Collection := CPPProjects;
else Collection := OtherProjects;
else Collection := OtherProjects;
end;
frmAllFilesForm.Caption := lSaveAllCaption1;
@ -1315,7 +1257,7 @@ begin
if sdSave.Execute then begin
TDocument(Collection.Items[b]).FileName := AddExtension(sdSave.FileName, TDocument(Collection.Items[b]).Highlighter);
TDocument(Collection.Items[b]).Save;
TSpTBXTabItem(tsDocuments.Items[b]).Caption := TDocument(Collection.Items[b]).Title;
TJvTabBarItem(tbDocs.Tabs[b]).Caption := TDocument(Collection.Items[b]).Title;
end
else
exit;
@ -1355,7 +1297,7 @@ procedure TfrmMain.mnuCloseAllFilesClick(Sender: TObject);
var i: integer;
Collection: TDocCollection;
begin
case tsMain.ActiveTabIndex of
case stlIDEs.ItemIndex of
0: Collection := PawnProjects;
1: Collection := CPPProjects;
else Collection := OtherProjects;
@ -1370,7 +1312,7 @@ begin
if frmAllFilesForm.ShowModal = mrOk then begin
for i := Collection.Count - 1 downto 0 do begin
if not CloseDocument(TDocument(Collection.Items[i])) then
if not CloseDocument(TDocument(Collection.Items[i]), True, True) then
exit;
end;
end;
@ -1500,7 +1442,7 @@ begin
ActiveDoc.Code := sciEditor.Lines.Text;
frmClose.trvFiles.Items.Clear;
{ Pawn Projects }
eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[0].Caption);
eRoot := frmClose.trvFiles.Items.Add(nil, stlIDEs.Strings[0]);
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));
@ -1510,7 +1452,7 @@ begin
else
eRoot.Expand(False);
{ C++ Projects }
eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[1].Caption);
eRoot := frmClose.trvFiles.Items.Add(nil, stlIDEs.Strings[1]);
for i := 0 to CPPProjects.Count - 1 do begin
if TDocument(CPPProjects.Items[i]).Modified then
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i + 1) + '. ' + ExtractFileName(TDocument(CPPProjects.Items[i]).FileName));
@ -1520,7 +1462,7 @@ begin
else
eRoot.Expand(False);
{ Other Projects }
eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[2].Caption);
eRoot := frmClose.trvFiles.Items.Add(nil, stlIDEs.Strings[2]);
for i := 0 to OtherProjects.Count - 1 do begin
if TDocument(OtherProjects.Items[i]).Modified then
frmClose.trvFiles.Items.AddChild(eRoot, IntToStr(i + 1) + '. ' + ExtractFileName(TDocument(OtherProjects.Items[i]).FileName));
@ -1547,7 +1489,7 @@ begin
if frmClose.cmdSave.Caption = lSaveCaption then begin
for i := 0 to frmClose.trvFiles.Items.Count - 1 do begin
{ Pawn Projects }
if frmClose.trvFiles.Items[i].Text = tsMain.Items[0].Caption then begin
if frmClose.trvFiles.Items[i].Text = stlIDEs.Strings[0] 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
@ -1571,7 +1513,7 @@ begin
end;
end;
{ C++ Projects }
if frmClose.trvFiles.Items[i].Text = tsMain.Items[1].Caption then begin
if frmClose.trvFiles.Items[i].Text = stlIDEs.Items[1].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
@ -1595,7 +1537,7 @@ begin
end;
end;
{ Other Projects }
if frmClose.trvFiles.Items[i].Text = tsMain.Items[2].Caption then begin
if frmClose.trvFiles.Items[i].Text = stlIDEs.Strings[2] 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
@ -1747,7 +1689,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
if stlIDEs.ItemIndex = 0 then
DoCompilePawn(COMP_DEFAULT)
else if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.htm') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.html') then begin
if IEInstalled then
@ -1850,7 +1792,7 @@ begin
if not Plugin_Compile(COMP_STARTHL, GetCurrLang.Name, ActiveDoc.FileName, True) then
exit;
if tsMain.ActiveTabIndex = 0 then
if stlIDEs.ItemIndex = 0 then
DoCompilePawn(COMP_STARTHL);
end;
@ -1859,7 +1801,7 @@ begin
if not Plugin_Compile(COMP_UPLOAD, GetCurrLang.Name, ActiveDoc.FileName, True) then
exit;
if tsMain.ActiveTabIndex = 0 then
if stlIDEs.ItemIndex = 0 then
DoCompilePawn(COMP_UPLOAD);
end;
@ -2129,7 +2071,7 @@ procedure TfrmMain.mnuHeaderPawnClick(Sender: TObject);
begin
if not Plugin_CreateNewFile(NEW_Pawn_HEADER, True) then exit;
if tsMain.ActiveTabIndex <> 0 then
if stlIDEs.ItemIndex <> 0 then
ActivateProjects(0, False);
PawnProjects.Activate(PawnProjects.Add('Untitled.inc'), False);
@ -2138,27 +2080,18 @@ begin
Plugin_CreateNewFile(NEW_Pawn_HEADER, False);
end;
procedure TfrmMain.OnTabSelect(Sender: TTBCustomItem;
Viewer: TTBItemViewer; Selecting: Boolean);
begin
if (GetAsyncKeyState(VK_RBUTTON) <> 0) and (not pnlLoading.Visible) and (not Selecting) then begin
SelectedTab := TSpTBXTabItem(Sender);
ppmDocuments.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
end;
end;
procedure TfrmMain.mnuPCloseClick(Sender: TObject);
var Collection: TDocCollection;
begin
try
case tsMain.ActiveTabIndex of
case stlIDEs.ItemIndex of
0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other
else Collection := OtherProjects; // Other
end;
if tsDocuments.Items.IndexOf(SelectedTab) <> -1 then
CloseDocument(TDocument(Collection.Items[tsDocuments.Items.IndexOf(SelectedTab)]));
if tbDocs.Tabs.IndexOf(SelectedTab) <> -1 then
CloseDocument(TDocument(Collection.Items[tbDocs.Tabs.IndexOf(SelectedTab)]), True, True);
except
Application.ProcessMessages; // :o
end;
@ -2171,7 +2104,7 @@ end;
procedure TfrmMain.mnuTNewClick(Sender: TObject);
begin
case tsMain.ActiveTabIndex of
case stlIDEs.ItemIndex of
0: mnuNewPlugin.Click;
1: mnuNewUnit.Click;
2: mnuNewTextfile.Click;
@ -2453,7 +2386,7 @@ begin
mnuOpenClick(nil);
odOpen.FileName := eTemp;
end;
SCM_CURRPROJECTS: Msg.Result := tsMain.ActiveTabIndex;
SCM_CURRPROJECTS: Msg.Result := stlIDEs.ItemIndex;
SCM_COMPILE: mnuDoCompile.Click;
SCM_COMPILE_UPLOAD: mnuCompileAndUpload.Click;
SCM_COMPILE_STARTHL: mnuCompileAndStartHL.Click;
@ -2660,7 +2593,7 @@ begin
else
PawnProjects.Save(eIntData, eData);
end;
SCM_Pawn_CLOSEFILE: PawnProjects.Close(eIntData);
SCM_Pawn_CLOSEFILE: PawnProjects.Close(eIntData, True);
SCM_Pawn_ISUNTITLED: begin
try
if TDocument(PawnProjects.Items[eIntData]).Untitled then
@ -2672,28 +2605,28 @@ begin
end;
end;
SCM_Pawn_ACTIVATE: begin
if tsMain.ActiveTabIndex <> 0 then
if stlIDEs.ItemIndex <> 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
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
if (stlIDEs.ItemIndex = 0) and (tbDocs.SelectedTab.Index = 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
if (stlIDEs.ItemIndex = 0) and (tbDocs.SelectedTab.Index = eIntData) then
SetRTFText(rtfNotes, eData)
else
TDocument(PawnProjects.Items[eIntData]).NotesText := eData;
end;
end;
SCM_Pawn_GETFILENAME: Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).FileName));
SCM_Pawn_FILECOUNT: Msg.Result := PawnProjects.Count;
SCM_Pawn_GETTEXT: begin
if (tsMain.ActiveTabIndex = 0) and (tsDocuments.ActiveTabIndex = eIntData) then
if (stlIDEs.ItemIndex = 0) and (tbDocs.SelectedTab.Index = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText)
else
Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).Code));
@ -2714,7 +2647,7 @@ begin
end;
SCM_CPP_CLOSEFILE: begin
if eCPP then
CPPProjects.Close(eIntData)
CPPProjects.Close(eIntData, True)
else
Msg.Result := 0;
end;
@ -2729,11 +2662,11 @@ begin
end;
end;
SCM_CPP_ACTIVATE: begin
if (eCPP) and (tsMain.ActiveTabIndex <> 1) then
if (eCPP) and (stlIDEs.ItemIndex <> 1) then
ActivateProjects(1, eIntData = 1)
else
Msg.Result := 0;
end;
end;
SCM_CPP_ACTIVATEDOC: begin
if eCPP then
CPPProjects.Activate(eIntData, Pos('r', eData) <> 0, Pos('s', eData) <> 0)
@ -2743,26 +2676,24 @@ begin
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
if (stlIDEs.ItemIndex = 1) and (tbDocs.SelectedTab.Index = 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
if (stlIDEs.ItemIndex = 1) and (tbDocs.SelectedTab.Index = eIntData) then
SetRTFText(rtfNotes, eData)
else
TDocument(CPPProjects.Items[eIntData]).NotesText := eData;
@ -2770,7 +2701,7 @@ begin
SCM_CPP_GETFILENAME: Msg.Result := Integer(PChar(TDocument(CPPProjects.Items[eIntData]).FileName));
SCM_CPP_FILECOUNT: Msg.Result := CPPProjects.Count;
SCM_CPP_GETTEXT: begin
if (tsMain.ActiveTabIndex = 1) and (tsDocuments.ActiveTabIndex = eIntData) then
if (stlIDEs.ItemIndex = 1) and (tbDocs.SelectedTab.Index = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText)
else
Msg.Result := Integer(PChar(TDocument(CPPProjects.Items[eIntData]).Code));
@ -2794,20 +2725,20 @@ begin
end;
end;
SCM_OTHER_ACTIVATE: begin
if tsMain.ActiveTabIndex <> 2 then
if stlIDEs.ItemIndex <> 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
if (stlIDEs.ItemIndex = 2) and (tbDocs.SelectedTab.Index = 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
if (stlIDEs.ItemIndex = 2) and (tbDocs.SelectedTab.Index = eIntData) then
SetRTFText(rtfNotes, eData)
else
TDocument(OtherProjects.Items[eIntData]).NotesText := eData;
@ -2815,7 +2746,7 @@ begin
SCM_OTHER_GETFILENAME: Msg.Result := Integer(PChar(TDocument(OtherProjects.Items[eIntData]).FileName));
SCM_OTHER_FILECOUNT: Msg.Result := OtherProjects.Count;
SCM_OTHER_GETTEXT: begin
if (tsMain.ActiveTabIndex = 2) and (tsDocuments.ActiveTabIndex = eIntData) then
if (stlIDEs.ItemIndex = 2) and (tbDocs.SelectedTab.Index = eIntData) then
Msg.Result := Integer(sciEditor.Lines.GetText)
else
Msg.Result := Integer(PChar(TDocument(OtherProjects.Items[eIntData]).Code));
@ -2840,8 +2771,8 @@ begin
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_ACTIVE_DOCUMENT: Msg.Result := tbDocs.SelectedTab.Index;
SCM_ACTIVE_PROJECTS: Msg.Result := stlIDEs.ItemIndex;
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;
@ -3035,6 +2966,8 @@ end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
stlIDEs.ItemIndex := 0;
sciEditor.StreamClass := TSciMyStream;
sciEditor.OnCallTipClick := sciEditorCallTipClick; // god why doesn't delphi save this
eACList := TmxJsCollection.Create(TACFunction);
@ -3042,5 +2975,97 @@ begin
eACList.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'config\ACList.cfg');
end;
procedure TfrmMain.stlIDEsClick(Sender: TObject);
begin
if (stlIDEs.Strings[stlIDEs.ItemIndex] = 'C++') and (not eCPP) then begin
stlIDEs.ItemIndex := CurrProjects;
MessageBox(Handle, 'C++ IDE is currenty not implemented!', 'Error', MB_ICONERROR);
exit;
end;
cboCurrentIDE.Text := stlIDEs.Strings[stlIDEs.ItemIndex];
if (not Started) or (frmMain.pnlLoading.Visible) then exit;
if (lstOutput.Visible) then begin
if Plugin_VisibleControlChange(CTRL_OUTPUT, False) then begin
splOutput.Hide;
lstOutput.Hide;
Plugin_VisibleControlChange(CTRL_OUTPUT, False);
end;
end;
case stlIDEs.ItemIndex of
0: begin
mnuTNew.Caption := 'New Plugin';
end;
1: begin
mnuTNew.Caption := 'New Unit';
sciCallTips.ApiStrings.Clear;
sciAutoComplete.AStrings.Clear;
end;
2: begin
mnuTNew.Caption := 'New Textfile';
sciCallTips.ApiStrings.Clear;
sciAutoComplete.AStrings.Clear;
end;
end;
ActivateProjects(stlIDEs.ItemIndex, True);
trvExplorer.Items.Clear;
FillCodeExplorer(GetCurrLang.Name);
end;
procedure TfrmMain.tbDocsTabSelected(Sender: TObject; Item: TJvTabBarItem);
var Collection: TDocCollection;
begin
if (not Started) or (pnlLoading.Visible) or (not Assigned(Item)) or (Screen.Cursor <> crDefault) then exit;
if (lstOutput.Visible) then begin
if Plugin_VisibleControlChange(CTRL_OUTPUT, False) then begin
splOutput.Hide;
lstOutput.Hide;
Plugin_VisibleControlChange(CTRL_OUTPUT, False);
end;
end;
case stlIDEs.ItemIndex of
0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other
end;
Collection.Activate(Item.Index, True);
end;
procedure TfrmMain.tbDocsMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Button = mbRight then begin
SelectedTab := tbDocs.TabAt(X, Y);
if Assigned(SelectedTab) then
ppmDocuments.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
end;
end;
procedure TfrmMain.tbDocsTabClosing(Sender: TObject; Item: TJvTabBarItem;
var AllowClose: Boolean);
var Collection: TDocCollection;
begin
AllowClose := False;
if (Started) and (Screen.Cursor = crDefault) and (not pnlLoading.Visible) then begin
Screen.Cursor := crHourGlass;
case stlIDEs.ItemIndex of
0: Collection := PawnProjects; // Pawn
1: Collection := CPPProjects; // C++
else Collection := OtherProjects; // Other
end;
if tbDocs.Tabs.IndexOf(Item) <> -1 then begin
if CloseDocument(TDocument(Collection.Items[tbDocs.Tabs.IndexOf(Item)]), True, False) then
tbDocs.Tabs.Delete(tbDocs.Tabs.IndexOf(Item));
end;
Screen.Cursor := crDefault;
end;
end;
end.

View File

@ -64,7 +64,7 @@ object frmSettings: TfrmSettings
Top = 0
Width = 351
Height = 260
ActivePage = jspAutocompleteCheck
ActivePage = jspHighlighter
PropagateEnable = False
Align = alClient
OnChange = jplSettingsChange