Fixed shortcut bugs

Fixed include bug
Changed a few small things in the core
This commit is contained in:
Christian Hammacher 2005-09-09 16:49:41 +00:00
parent f8aac5e88d
commit e2a521583a
14 changed files with 203 additions and 343 deletions

View File

@ -115,7 +115,7 @@ AutoIncBuild=1
MajorVer=1
MinorVer=1
Release=0
Build=10
Build=12
Debug=0
PreRelease=0
Special=0
@ -126,7 +126,7 @@ CodePage=1252
[Version Info Keys]
CompanyName=AMX Mod X Dev Team
FileDescription=
FileVersion=1.1.0.10
FileVersion=1.1.0.12
InternalName=
LegalCopyright=
LegalTrademarks=

View File

@ -1,5 +1,7 @@
program AMXX_Studio;
{%ToDo 'AMXX_Studio.todo'}
uses
Forms,
Windows,
@ -48,7 +50,7 @@ uses
var i: integer;
begin
if FindWindow('TfrmMain', 'AMXX-Studio') <> 0 then begin
if (FindWindow('TfrmMain', 'AMXX-Studio') <> 0) and (FindWindow(nil, 'Delphi 7') = 0) then begin
if ParamCount > 0 then begin
for i := 1 to ParamCount do
SendStudioMsg(SCM_LOADFILE, ParamStr(i), 0);

Binary file not shown.

Binary file not shown.

View File

@ -122,7 +122,7 @@ begin
eIdent := 0;
eTempIdent := 0;
ShowProgress;
ShowProgress(False);
frmMain.pbLoading.Max := frmMain.sciEditor.Lines.Count *2 -2;
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
if Cancel then begin
@ -211,6 +211,7 @@ begin
frmMain.pbLoading.Position := frmMain.sciEditor.Lines.Count + i -1;
SetProgressStatus('Indenting Code...');
frmMain.pnlLoading.Repaint;
end;
ActiveDoc.Modified := True;
@ -226,8 +227,9 @@ var i: integer;
begin
Screen.Cursor := crHourGlass;
frmMain.sciEditor.Enabled := False;
ShowProgress;
ShowProgress(False);
frmMain.pbLoading.Max := frmMain.sciEditor.Lines.Count -1;
for i := 0 to frmMain.sciEditor.Lines.Count -1 do begin
if Cancel then begin
Cancel := False;
@ -237,8 +239,10 @@ begin
frmMain.sciEditor.Lines[i] := TrimLeft(frmMain.sciEditor.Lines[i]);
frmMain.pbLoading.Position := i;
SetProgressStatus('Unintending Code...');
frmMain.pnlLoading.Repaint;
end;
HideProgress;
frmMain.sciEditor.Enabled := True;
Screen.Cursor := crDefault;
end;

View File

@ -12,7 +12,7 @@ type TDocument = class(TCollectionItem)
FSelLength: Integer;
FSelStart: Integer;
FFileName: String;
FCode: TStringList;
FCode: String;
FReadOnly: Boolean;
FTopLine: Integer;
FHighlighter: String;
@ -23,7 +23,7 @@ type TDocument = class(TCollectionItem)
published
property FileName: String read FFileName write SetFileName;
property Title: String read FTitle write FTitle;
property Code: TStringList read FCode write FCode;
property Code: String read FCode write FCode;
property SelStart: Integer read FSelStart write FSelStart;
property SelLength: Integer read FSelLength write FSelLength;
property Highlighter: String read FHighlighter write FHighlighter;
@ -83,7 +83,7 @@ procedure ActivateProjects(Index: Integer; JumpToLastDoc: Boolean);
procedure ReloadIni;
procedure SelectLanguage(Lang: String);
procedure ShowProgress;
procedure ShowProgress(ReadOnly: Boolean);
procedure HideProgress;
procedure mIRCDDE(Service, Topic, Cmd: string);
@ -335,7 +335,7 @@ begin
else
eExt := LowerCase(ExtractFileExt(FileName));
if (eExt = '.sma') or (eExt = '.inc') then
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then
eLang := 'Pawn'
else if (eExt = '.cpp') or (eExt = '.h') then
eLang := 'C++'
@ -723,7 +723,7 @@ begin
frmMain.mnuHNone.Checked := Lang = 'null';
end;
procedure ShowProgress;
procedure ShowProgress(ReadOnly: Boolean);
var i: integer;
begin
if not Started then exit;
@ -744,7 +744,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;
frmMain.sciEditor.ReadOnly := ReadOnly;
end;
procedure HideProgress;
@ -784,13 +784,11 @@ constructor TDocument.Create(ACollection: TCollection;
begin
inherited Create(ACollection);
FHighlighter := TDocCollection(ACollection).Highlighter;
FCode := TStringList.Create;
FModified := False;
end;
destructor TDocument.Destroy;
begin
FCode.Destroy;
inherited Destroy;
end;
@ -808,7 +806,7 @@ begin
Result := True;
ShowProgress;
ShowProgress(True);
try
AssignFile(F, FFilename);
Rewrite(F);
@ -817,7 +815,8 @@ begin
sNotes := GetRTFText(frmMain.rtfNotes);
end
else begin
sLines := Code;
sLines := TStringList.Create;
sLines.Text := Code;
sNotes := NotesText;
end;
@ -914,7 +913,7 @@ begin
Screen.Cursor := crHourGlass;
{ Save old }
if SaveLastDoc then begin
ActiveDoc.Code.Text := frmMain.sciEditor.Lines.Text; // saving is fast, but loading is usually slow because of code-folding...
ActiveDoc.Code := frmMain.sciEditor.Lines.Text; // saving is fast, but loading is usually slow because of code-folding...
ActiveDoc.Highlighter := frmMain.sciEditor.LanguageManager.SelectedLanguage;
ActiveDoc.ReadOnly := frmMain.sciEditor.ReadOnly;
ActiveDoc.SelStart := frmMain.sciEditor.SelStart;
@ -940,7 +939,7 @@ begin
Started := True;
end;
frmMain.sciEditor.SetText(Document.Code.GetText);
frmMain.sciEditor.SetText(PChar(Document.Code));
SetRTFText(frmMain.rtfNotes, Document.NotesText);
frmMain.sciEditor.ReadOnly := Document.ReadOnly;
@ -951,7 +950,7 @@ begin
frmMain.sciEditor.Modified := Document.Modified;
if RestoreCaret then begin
if (eConfig.ReadBool('Editor', 'CheckRestoreCaret', True)) and (eConfig.ReadInteger('Editor', 'CheckRestoreLines', 600) < Document.Code.Count) then begin
if (eConfig.ReadBool('Editor', 'CheckRestoreCaret', True)) and (eConfig.ReadInteger('Editor', 'CheckRestoreLines', 600) < CountChars(Document.Code, #13)) then begin
Screen.Cursor := crDefault;
exit;
end;
@ -1072,7 +1071,7 @@ begin
end;
if Assigned(ActiveDoc) then begin
ActiveDoc.Code.Text := frmMain.sciEditor.Lines.Text; // saving is fast, but loading is usually slow because of code-folding...
ActiveDoc.Code := frmMain.sciEditor.Lines.Text; // saving is fast, but loading is usually slow because of code-folding...
ActiveDoc.Highlighter := frmMain.sciEditor.LanguageManager.SelectedLanguage;
ActiveDoc.ReadOnly := frmMain.sciEditor.ReadOnly;
ActiveDoc.SelStart := frmMain.sciEditor.SelStart;
@ -1083,7 +1082,7 @@ begin
end;
Screen.Cursor := crHourGlass;
ShowProgress;
ShowProgress(True);
AssignFile(F, AFilename);
{ ... count lines ... }
@ -1097,7 +1096,7 @@ begin
{ ... read lines ... }
Reset(F);
with Add(AFilename, AHighlighter) do begin
ShowProgress;
ShowProgress(True);
frmMain.pbLoading.Max := i;
i := 0;
while not EOF(F) do begin
@ -1118,11 +1117,20 @@ begin
MessageBox(frmMain.Handle, PChar(lFailedLoadNotes), PChar(Application.Title), MB_ICONERROR);
end;
end
else begin
if i = 0 then
Code := eString
else
Code.Add(eString);
Code := Code + #13#10 + eString;
end;
end
else begin
if i = 0 then
Code := eString
else
Code.Add(eString);
Code := Code + #13#10 + eString;
end;
frmMain.pbLoading.Position := i;
SetProgressStatus('Loading file...');
Inc(i, 1);

View File

@ -39,6 +39,7 @@ var eLookedUpIncluded: TStringList;
function UpdateIncPath(eInput: String): String;
begin
eInput := StringReplace(Trim(eInput), '/', '\', [rfReplaceAll]);
if FileExists(ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + eInput + '.inc') then
Result := ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + eInput + '.inc'
else if FileExists(ExtractFilePath(frmSettings.txtPAWNCompilerPath.Text) + 'include\' + eInput + '.inc') then
@ -51,7 +52,7 @@ end;
function ParseCodePAWN(eCode: TStringList; FileName: String; IsRecursive: Boolean = False): TPAWNParseResult;
var i, k: integer;
eString, eTemp: string;
eString, eTemp, eBackup: string;
eStr, ePreEvents: TStringList;
eStartLine, eBracesOpen: Integer;
eTimeToSleep: Integer;
@ -74,6 +75,8 @@ begin
if (Application.Terminated) or (not Started) or (frmMain.pnlLoading.Visible) or (not frmMain.trvExplorer.Visible) then exit;
eString := RemoveStringsAndComments(Trim(eCode[i]), True);
eBackup := Trim(eCode[i]);
eProcedureAdded := False;
Inc(eTimeToSleep, 1);
@ -82,6 +85,8 @@ begin
eTimeToSleep := 0;
end;
if Pos('smbans/constants.inl"', eString) <> 0 then
eString := eString;
{ Constants and Variables }
if (IsAtStart('new', eString)) and (eBracesOpen = 0) and (not IsRecursive) then begin // const or variable
Delete(eString, 1, 4);
@ -113,7 +118,8 @@ begin
eString := RemoveStringsAndComments(Trim(eCode[i]), True);
end
{ Included }
else if (IsAtStart('#include', eString)) then begin
else if (IsAtStart('#include', eBackup)) then begin
eString := StringReplace(eBackup, '/', '\', [rfReplaceAll]);
if Between(eString, '<', '>') <> '' then begin
eString := Between(eString, '<', '>');
if ExtractFileExt(eString) <> '' then
@ -125,7 +131,7 @@ begin
ChangeFileExt(eString, '');
end
else begin
eString := Copy(eString, 9, Length(eString));
eString := Trim(eString);
if ExtractFileExt(eString) <> '' then
ChangeFileExt(eString, '');
end;
@ -162,7 +168,7 @@ begin
{ CVars }
else if (IsAtStart('register_cvar', eString)) and (not IsRecursive) then begin
if Between(eString, '"', '"') <> '' then
Result.CVars.AddObject(Between(eString, '"', '"'), TObject(i));
Result.CVars.AddObject(Between(eBackup, '"', '"'), TObject(i));
end
{ Defined }
else if (IsAtStart('#define', eString)) then begin
@ -178,9 +184,9 @@ begin
end
{ Events (Part 1) }
else if (IsAtStart('register_event(', eString)) and (not IsRecursive) then begin
if CountChars(eString, '"') >= 4 then begin
eTemp := StringReplace(eString, '"' + Between(eString, '"', '"') + '"', '', []);
ePreEvents.Add(Between(eString, '"', '"'));
if CountChars(eBackup, '"') >= 4 then begin
eTemp := StringReplace(eBackup, '"' + Between(eBackup, '"', '"') + '"', '', []);
ePreEvents.Add(Between(eBackup, '"', '"'));
end;
end;

View File

@ -1,6 +1,6 @@
object frmMain: TfrmMain
Left = 224
Top = 293
Left = 260
Top = 195
Width = 888
Height = 640
Caption = 'AMXX-Studio'
@ -40,8 +40,6 @@ object frmMain: TfrmMain
Position = poDesktopCenter
OnClose = FormClose
OnConstrainedResize = FormConstrainedResize
OnCreate = FormCreate
OnKeyDown = FormKeyDown
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
@ -533,7 +531,7 @@ object frmMain: TfrmMain
object mnuTNew: TSpTBXItem
ImageIndex = 0
Images = ilImages
ShortCut = 16467
ShortCut = 16462
OnClick = mnuTNewClick
CaptionW = 'New'
end
@ -6202,10 +6200,10 @@ object frmMain: TfrmMain
object odOpen: TOpenDialog
Filter =
'All supported files|*.sma;*.inc;*.cpp;*.h;*.htm;*.html;*.sql;*.x' +
'ml;*.txt|SMALL scripts (*.sma;*.inc)|*.sma;*.inc|C++ files (*.cp' +
'p;*.h)|*.cpp;*.h|HTML files (*.htm;*.html)|*.htm;*.html|SQL data' +
'bases (*.sql)|*.sql|XML files (*.xml)|*.xml|Textfiles (*.txt)|*.' +
'txt|All Files (*.*)|*.*'
'ml;*.txt;*.inl|SMALL scripts (*.sma;*.inc;*.inl)|*.sma;*.inc;*.i' +
'nl|C++ files (*.cpp;*.h)|*.cpp;*.h|HTML files (*.htm;*.html)|*.h' +
'tm;*.html|SQL databases (*.sql)|*.sql|XML files (*.xml)|*.xml|Te' +
'xtfiles (*.txt)|*.txt|All Files (*.*)|*.*'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing]
Title = 'Open...'
Left = 752
@ -6214,10 +6212,10 @@ object frmMain: TfrmMain
object sdSave: TSaveDialog
Filter =
'All supported files|*.sma;*.inc;*.cpp;*.h;*.htm;*.html;*.sql;*.x' +
'ml;*.txt|SMALL scripts (*.sma;*.inc)|*.sma;*.inc|C++ files (*.cp' +
'p;*.h)|*.cpp;*.h|HTML files (*.htm;*.html)|*.htm;*.html|SQL data' +
'bases (*.sql)|*.sql|XML files (*.xml)|*.xml|Textfiles (*.txt)|*.' +
'txt|All Files (*.*)|*.*'
'ml;*.txt;*.inl|SMALL scripts (*.sma;*.inc;*.inl)|*.sma;*.inc;*.i' +
'nl|C++ files (*.cpp;*.h)|*.cpp;*.h|HTML files (*.htm;*.html)|*.h' +
'tm;*.html|SQL databases (*.sql)|*.sql|XML files (*.xml)|*.xml|Te' +
'xtfiles (*.txt)|*.txt|All Files (*.*)|*.*'
Title = 'Save...'
Left = 752
Top = 36
@ -6241,175 +6239,6 @@ object frmMain: TfrmMain
Left = 692
Top = 6
end
object alControlChars: TActionList
Left = 662
Top = 36
object acControlChar1: TAction
ShortCut = 24641
OnExecute = acControlCharHandler
end
object acControlChar2: TAction
ShortCut = 24641
OnExecute = acControlCharHandler
end
object acControlChar3: TAction
ShortCut = 16453
OnExecute = acControlCharHandler
end
object acControlChar4: TAction
ShortCut = 16454
OnExecute = acControlCharHandler
end
object acControlChar5: TAction
ShortCut = 16455
OnExecute = acControlCharHandler
end
object acControlChar6: TAction
ShortCut = 16456
OnExecute = acControlCharHandler
end
object acControlChar7: TAction
ShortCut = 16459
OnExecute = acControlCharHandler
end
object acControlChar8: TAction
ShortCut = 16462
OnExecute = acControlCharHandler
end
object acControlChar9: TAction
ShortCut = 16463
OnExecute = acControlCharHandler
end
object acControlChar10: TAction
ShortCut = 16465
OnExecute = acControlCharHandler
end
object acControlChar11: TAction
ShortCut = 16466
OnExecute = acControlCharHandler
end
object acControlChar12: TAction
ShortCut = 16467
OnExecute = acControlCharHandler
end
object acControlChar13: TAction
ShortCut = 16468
OnExecute = acControlCharHandler
end
object acControlChar14: TAction
ShortCut = 16473
OnExecute = acControlCharHandler
end
object acControlChar15: TAction
ShortCut = 24642
OnExecute = acControlCharHandler
end
object acControlChar16: TAction
ShortCut = 24643
OnExecute = acControlCharHandler
end
object acControlChar17: TAction
ShortCut = 24644
OnExecute = acControlCharHandler
end
object acControlChar18: TAction
ShortCut = 24645
OnExecute = acControlCharHandler
end
object acControlChar19: TAction
ShortCut = 24646
OnExecute = acControlCharHandler
end
object acControlChar20: TAction
ShortCut = 24647
OnExecute = acControlCharHandler
end
object acControlChar21: TAction
ShortCut = 24648
OnExecute = acControlCharHandler
end
object acControlChar22: TAction
ShortCut = 24651
OnExecute = acControlCharHandler
end
object acControlChar23: TAction
ShortCut = 24654
OnExecute = acControlCharHandler
end
object acControlChar24: TAction
ShortCut = 24655
OnExecute = acControlCharHandler
end
object acControlChar25: TAction
ShortCut = 24656
OnExecute = acControlCharHandler
end
object acControlChar26: TAction
ShortCut = 24657
OnExecute = acControlCharHandler
end
object acControlChar27: TAction
ShortCut = 24658
OnExecute = acControlCharHandler
end
object acControlChar28: TAction
ShortCut = 24659
OnExecute = acControlCharHandler
end
object acControlChar29: TAction
ShortCut = 24662
OnExecute = acControlCharHandler
end
object acControlChar30: TAction
ShortCut = 24663
OnExecute = acControlCharHandler
end
object acControlChar31: TAction
ShortCut = 24664
OnExecute = acControlCharHandler
end
object acControlChar32: TAction
ShortCut = 24665
OnExecute = acControlCharHandler
end
object acControlChar33: TAction
ShortCut = 24666
OnExecute = acControlCharHandler
end
object acControlChar34: TAction
Caption = 'acControlChar34'
ShortCut = 114
OnExecute = acControlCharHandler
end
object acControlChar35: TAction
ShortCut = 16463
OnExecute = acControlCharHandler
end
object acControlChar36: TAction
ShortCut = 16467
OnExecute = acControlCharHandler
end
object acControlChar37: TAction
ShortCut = 24659
OnExecute = acControlCharHandler
end
object acControlChar38: TAction
ShortCut = 27
OnExecute = acControlCharHandler
end
object acControlChar39: TAction
ShortCut = 16457
OnExecute = acControlCharHandler
end
object acControlChar40: TAction
ShortCut = 24649
OnExecute = acControlCharHandler
end
object acControlChar41: TAction
ShortCut = 112
OnExecute = acControlCharHandler
end
end
object ppmEditor: TSpTBXPopupMenu
Images = ilImages
Left = 782
@ -7736,7 +7565,7 @@ object frmMain: TfrmMain
end
object JvInspectorDotNETPainter: TJvInspectorDotNETPainter
DrawNameEndEllipsis = False
Left = 632
Top = 6
Left = 662
Top = 36
end
end

View File

@ -192,40 +192,6 @@ type
mnuCopyAll: TSpTBXItem;
mnuSaveToFile: TSpTBXItem;
sepOutput: TSpTBXSeparatorItem;
alControlChars: TActionList;
acControlChar1: TAction;
acControlChar2: TAction;
acControlChar3: TAction;
acControlChar4: TAction;
acControlChar5: TAction;
acControlChar6: TAction;
acControlChar7: TAction;
acControlChar8: TAction;
acControlChar9: TAction;
acControlChar10: TAction;
acControlChar11: TAction;
acControlChar12: TAction;
acControlChar13: TAction;
acControlChar14: TAction;
acControlChar15: TAction;
acControlChar16: TAction;
acControlChar17: TAction;
acControlChar18: TAction;
acControlChar19: TAction;
acControlChar20: TAction;
acControlChar22: TAction;
acControlChar23: TAction;
acControlChar24: TAction;
acControlChar25: TAction;
acControlChar21: TAction;
acControlChar26: TAction;
acControlChar27: TAction;
acControlChar28: TAction;
acControlChar29: TAction;
acControlChar30: TAction;
acControlChar31: TAction;
acControlChar32: TAction;
acControlChar33: TAction;
ppmEditor: TSpTBXPopupMenu;
mnuEditorCopy: TSpTBXItem;
mnuEditorPaste: TSpTBXItem;
@ -240,17 +206,10 @@ type
sepEditorMenu1: TSpTBXSeparatorItem;
mnuEditorSelectAll: TSpTBXItem;
sciSearchReplace: TSciSearchReplace;
acControlChar34: TAction;
acControlChar35: TAction;
acControlChar36: TAction;
acControlChar37: TAction;
IdFTP: TIdFTP;
acControlChar38: TAction;
pnlLoading: TSpTBXPanel;
pbLoading: TSpTBXProgressBar;
cmdCancel: TSpTBXButton;
acControlChar39: TAction;
acControlChar40: TAction;
sciAutoComplete: TSciAutoComplete;
mnuHTML: TSpTBXItem;
ppmDocuments: TSpTBXPopupMenu;
@ -266,7 +225,6 @@ type
JvInspectorDotNETPainter: TJvInspectorDotNETPainter;
jviCode: TJvInspector;
mnuConnectionGen: TSpTBXItem;
acControlChar41: TAction;
sepView3: TSpTBXSeparatorItem;
mnuShowCodeExplorer: TSpTBXItem;
mnuShowCodeInspector: TSpTBXItem;
@ -289,7 +247,6 @@ type
procedure tsDocumentsActiveTabChange(Sender: TObject;
ItemIndex: Integer);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure mnuTOpenClick(Sender: TObject);
procedure mnuTSaveClick(Sender: TObject);
procedure mnuTSearchClick(Sender: TObject);
@ -339,9 +296,6 @@ type
procedure ppmOutputInitPopup(Sender: TObject; PopupView: TTBView);
procedure mnuSearchForumsClick(Sender: TObject);
procedure mnuOpenScriptingForumClick(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure acControlCharHandler(Sender: TObject);
procedure mnuEditorUndoClick(Sender: TObject);
procedure mnuEditorRedoClick(Sender: TObject);
procedure mnuEditorCopyClick(Sender: TObject);
@ -736,11 +690,6 @@ begin
end;
end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
end;
{ <- Settings | Toolbars -> }
procedure TfrmMain.mnuTOpenClick(Sender: TObject);
@ -851,7 +800,7 @@ begin
eExt := ExtractFileExt(odOpen.FileName);
eExt := LowerCase(eExt);
if (eExt = '.sma') or (eExt = '.inc') then begin // Pawn files
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then begin // Pawn files
if tsMain.ActiveTabIndex <> 0 then
ActivateProjects(0, False);
PAWNProjects.Open(odOpen.FileName);
@ -1158,49 +1107,6 @@ begin
ShellExecute(Handle, 'open', 'http://www.amxmodx.org/forums/viewforum.php?f=8', nil, nil, SW_SHOW);
end;
procedure TfrmMain.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Shift = [ssCtrl, ssShift]) then begin
if Key = 16 then
Key := 0;
end;
end;
procedure TfrmMain.acControlCharHandler(Sender: TObject);
function TriggerMenuShortcut(eShortcut: TShortcut; Item: TTBCustomItem): Boolean;
var i: integer;
begin
Result := False;
for i := 0 to Item.Count -1 do begin
if Item.Items[i].ShortCut = eShortcut then begin
Item.Items[i].OnClick(Self);
Result := True;
exit;
end
else
TriggerMenuShortcut(eShortcut, Item.Items[i]);
end;
end;
var i: integer;
begin
Application.ProcessMessages;
// stop IRC Paster if escape is pressed
if ShortCutToText((Sender As TAction).ShortCut) = 'Esc' then
IRCPasterStop := True;
if sciEditor.CallTipActive then
sciEditor.CallTipCancel;
if sciEditor.AutoCActive then
sciEditor.AutoCCancel;
// Some menu commands are suppressed by the controlchars thingy, so they will be triggered manually
for i := 0 to tbxMenu.Items.Count -1 do begin
if TriggerMenuShortcut((Sender As TAction).ShortCut, tbxMenu.Items[i]) then
exit;
end;
Application.ProcessMessages;
end;
procedure TfrmMain.mnuEditorUndoClick(Sender: TObject);
begin
mnuUndo.Click;
@ -1462,7 +1368,7 @@ begin
end;
pbLoading.Max := eTo - eFrom;
pbLoading.Position := 0;
ShowProgress;
ShowProgress(True);
for i := eFrom to eTo do begin
if (FindWindow('mirc', nil) = 0) or (Application.Terminated) or (IRCPasterStop) then
break;
@ -1544,7 +1450,7 @@ var i, k: integer;
eItem: TDocument;
eSavedFiles: TStringList;
begin
ActiveDoc.Code.Text := sciEditor.Lines.Text;
ActiveDoc.Code := sciEditor.Lines.Text;
frmClose.trvFiles.Items.Clear;
{ PAWN Projects }
eRoot := frmClose.trvFiles.Items.Add(nil, tsMain.Items[0].Caption);
@ -1786,7 +1692,7 @@ begin
if not Plugin_Compile(COMP_DEFAULT, GetCurrLang.Name, ActiveDoc.FileName, True) then
exit;
if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inc') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.h') then exit;
if (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inl') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.inc') or (LowerCase(ExtractFileExt(ActiveDoc.FileName)) = '.h') then exit;
if tsMain.ActiveTabIndex = 0 then
DoCompilePAWN(COMP_DEFAULT)
@ -2406,7 +2312,7 @@ begin
try
Msg.Result := 1;
case eMessage of
SCM_SHOWPROGRESS: ShowProgress;
SCM_SHOWPROGRESS: ShowProgress(eIntData = 1);
SCM_HIDEPROGRESS: HideProgress;
SCM_UPDATEPROGRESS: begin
pbLoading.Position := eIntData;
@ -2649,7 +2555,7 @@ 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);
Msg.Result := Integer(PChar(TDocument(PawnProjects.Items[eIntData]).Code));
end;
SCM_CPP_NEWFILE: begin
if eCPP then
@ -2725,7 +2631,7 @@ 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);
Msg.Result := Integer(PChar(TDocument(CPPProjects.Items[eIntData]).Code));
end;
SCM_OTHER_NEWFILE: OtherProjects.Add(eData);
SCM_OTHER_SAVEFILE: begin

View File

@ -59,7 +59,7 @@ object frmSettings: TfrmSettings
Top = 0
Width = 353
Height = 260
ActivePage = jspHighlighter
ActivePage = jspShortcuts
PropagateEnable = False
Align = alClient
OnChange = jplSettingsChange
@ -563,15 +563,15 @@ object frmSettings: TfrmSettings
Top = 46
Width = 331
Height = 17
Caption = 'Do not restore caret when document has more than xxxxxx lines'
Caption = 'Do not restore caret if the document has more than xxxxxx lines'
TabOrder = 4
TabStop = True
OnClick = chkRestoreCaretClick
end
object txtLines: TFlatEdit
Left = 272
Left = 270
Top = 47
Width = 35
Width = 37
Height = 14
ColorFlat = clWhite
Font.Charset = DEFAULT_CHARSET
@ -697,7 +697,6 @@ object frmSettings: TfrmSettings
ColorFlat = clWhite
TabOrder = 3
Text = 'None'
OnKeyDown = txtShortcutKeyDown
OnKeyPress = txtShortcutKeyPress
OnKeyUp = txtShortcutKeyUp
end

View File

@ -244,8 +244,6 @@ type
procedure cmdLoadClick(Sender: TObject);
procedure cmdRemoveClick(Sender: TObject);
procedure cmdBrowseAMXXDirClick(Sender: TObject);
procedure txtShortcutKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure txtShortcutKeyPress(Sender: TObject; var Key: Char);
procedure cmdResetShortcutsClick(Sender: TObject);
procedure txtShortcutKeyUp(Sender: TObject; var Key: Word;
@ -953,23 +951,6 @@ begin
txtAMXXDir.Text := eStr;
end;
procedure TfrmSettings.txtShortcutKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_SHIFT) or (Key = VK_CONTROL) or (Key = VK_MENU) then begin
txtShortcut.Clear;
if ssShift in Shift then
txtShortcut.Text := txtShortcut.Text + 'Shift+';
if ssCtrl in Shift then
txtShortcut.Text := txtShortcut.Text + 'Ctrl+';
if ssAlt in Shift then
txtShortcut.Text := txtShortcut.Text + 'Alt+';
Key := 0;
end
else
txtShortcut.Text := ShortcutToText(Shortcut(Key, Shift));
end;
procedure TfrmSettings.txtShortcutKeyPress(Sender: TObject; var Key: Char);
begin
Key := #0;

View File

@ -8,7 +8,7 @@ uses
UnitfrmMain, UnitfrmSettings, UnitfrmSelectColor, UnitfrmSearch,
UnitfrmReplace, UnitfrmAllFilesForm, UnitfrmGoToLine,
UnitfrmPluginsIniEditor, UnitfrmSocketsTerminal, UnitfrmInfo, TBX,
TB2Item, SpTBXItem, Dialogs;
TB2Item, SpTBXItem, Dialogs, menus, SciKeyBindings;
type
TfrmSplashscreen = class(TForm)
@ -19,6 +19,7 @@ type
procedure tmrHideTimer(Sender: TObject);
public
procedure OnMessage(var Msg: TMsg; var Handled: Boolean);
procedure OnShortCut(var Msg: TWMKey; var Handled: Boolean);
end;
var
@ -103,6 +104,7 @@ begin
frmMain.mnuMOTDGenerator.Enabled := False;
Application.OnMessage := OnMessage;
Application.OnShortCut := OnShortCut;
with frmMain do begin
sciPropertyLoader.FileName := ExtractFilePath(ParamStr(0)) + 'config\Editor.sci';
@ -129,7 +131,7 @@ begin
if FileExists(eCache[i]) then begin
eExt := ExtractFileExt(eCache[i]);
eExt := LowerCase(eExt);
if (eExt = '.sma') or (eExt = '.inc') then // PAWN files
if (eExt = '.sma') or (eExt = '.inc') or (eExt = '.inl') then // Pawn files
PAWNProjects.Open(eCache[i])
else if (eExt = '.cpp') or (eExt = '.h') then // C++ files
CPPProjects.Open(eCache[i])
@ -175,6 +177,129 @@ begin
Handled := not Plugin_AppMsg(Msg.hwnd, Msg.message, Msg.wParam, Msg.lParam, Msg.time, Msg.pt);
end;
procedure TfrmSplashscreen.OnShortCut(var Msg: TWMKey;
var Handled: Boolean);
function TriggerMenuShortcut(eShortcut: TShortcut; Item: TTBCustomItem): Boolean;
var i: integer;
begin
Result := False;
for i := 0 to Item.Count -1 do begin
if Item.Items[i].ShortCut = eShortcut then begin
Item.Items[i].OnClick(Self);
Result := True;
exit;
end
else
TriggerMenuShortcut(eShortcut, Item.Items[i]);
end;
end;
var i: integer;
eShortcut: TShortcut;
begin
if not Started then exit;
// Check frmSettings shortcut
if (frmSettings.Visible) and (frmSettings.txtShortcut.Focused) then begin
if (Msg.CharCode = VK_CONTROL) or (Msg.CharCode = VK_MENU) or (Msg.CharCode = VK_SHIFT) then begin
frmSettings.txtShortcut.Clear;
if ssShift in KeyDataToShiftState(Msg.KeyData) then
frmSettings.txtShortcut.Text := frmSettings.txtShortcut.Text + 'Shift+';
if ssCtrl in KeyDataToShiftState(Msg.KeyData) then
frmSettings.txtShortcut.Text := frmSettings.txtShortcut.Text + 'Ctrl+';
if ssAlt in KeyDataToShiftState(Msg.KeyData) then
frmSettings.txtShortcut.Text := frmSettings.txtShortcut.Text + 'Alt+';
end
else
frmSettings.txtShortcut.Text := ShortcutToText(Shortcut(Msg.CharCode, KeyDataToShiftState(Msg.KeyData)));
Handled := True;
end;
if not frmMain.Focused then exit;
// stop IRC Paster if escape is pressed
if (Msg.CharCode = VK_ESCAPE) then begin
frmMain.IRCPasterStop := True;
if frmMain.sciEditor.CallTipActive then
frmMain.sciEditor.CallTipCancel;
if frmMain.sciEditor.AutoCActive then
frmMain.sciEditor.AutoCCancel;
exit;
end;
eShortcut := Shortcut(Msg.CharCode, KeyDataToShiftState(Msg.KeyData));
// Some menu commands are suppressed by the controlchars thingy, so they will be triggered manually
for i := 0 to frmMain.tbxMenu.Items.Count -1 do begin
if TriggerMenuShortcut(eShortcut, frmMain.tbxMenu.Items[i]) then begin
Handled := True;
exit;
end;
end;
for i := 0 to frmMain.tbxToolbar.Items.Count -1 do begin
if frmMain.tbxToolbar.Items[i].ShortCut = eShortcut then begin
Handled := True;
frmMain.tbxToolbar.Items[i].OnClick(Self);
exit;
end;
end;
for i := 0 to frmMain.tbxEdit.Items.Count -1 do begin
if frmMain.tbxEdit.Items[i].ShortCut = eShortcut then begin
Handled := True;
frmMain.tbxEdit.Items[i].OnClick(Self);
exit;
end;
end;
Application.ProcessMessages;
// Control chars
if (eShortcut = Shortcut(Ord('E'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('H'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('K'), [ssCtrl])) then
Handled := True;
if (eShortcut = Shortcut(Ord('B'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('C'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('D'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('E'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('F'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('G'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('H'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('K'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('N'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('O'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('P'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('Q'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('R'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('V'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('W'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('X'), [ssCtrl, ssShift])) then
Handled := True;
if (eShortcut = Shortcut(Ord('Y'), [ssCtrl, ssShift])) then
Handled := True;
if Handled then begin
for i := 0 to frmMain.sciEditor.KeyCommands.Count -1 do begin
if TSciKeyCommand(frmMain.sciEditor.KeyCommands.Items[i]).ShortCut = eShortcut then
Handled := False;
end;
end;
end;
procedure TfrmSplashscreen.tmrHideTimer(Sender: TObject);
begin
Hide;

Binary file not shown.