Переглянути джерело

CH: Several bug fixes in many different places of the code. Also fixed some anoying things

Jean-Francois Goulet 20 роки тому
батько
коміт
9523eb1eba

+ 2 - 2
LuaEdit/AddBreakpoint.dfm

@@ -36,7 +36,7 @@ object frmAddBreakpoint: TfrmAddBreakpoint
       Cancel = True
       Caption = '&Cancel'
       ModalResult = 2
-      TabOrder = 0
+      TabOrder = 1
     end
     object Button2: TButton
       Left = 208
@@ -47,7 +47,7 @@ object frmAddBreakpoint: TfrmAddBreakpoint
       Caption = '&OK'
       Default = True
       ModalResult = 1
-      TabOrder = 1
+      TabOrder = 0
       OnClick = Button2Click
     end
   end

+ 4 - 4
LuaEdit/AddToPrj.dfm

@@ -37,7 +37,7 @@ object frmAddToPrj: TfrmAddToPrj
       Anchors = [akRight, akBottom]
       Caption = '&Cancel'
       ModalResult = 2
-      TabOrder = 0
+      TabOrder = 1
     end
     object btnOK: TButton
       Left = 239
@@ -47,7 +47,7 @@ object frmAddToPrj: TfrmAddToPrj
       Anchors = [akRight, akBottom]
       Caption = '&OK'
       ModalResult = 1
-      TabOrder = 1
+      TabOrder = 0
       OnClick = btnOKClick
     end
   end
@@ -86,7 +86,7 @@ object frmAddToPrj: TfrmAddToPrj
       Height = 17
       Anchors = [akTop, akRight]
       Caption = '...'
-      TabOrder = 0
+      TabOrder = 2
       OnClick = btnBrowseClick
     end
     object txtExistingFile: TEdit
@@ -103,7 +103,7 @@ object frmAddToPrj: TfrmAddToPrj
       Width = 305
       Height = 17
       Caption = 'Existing Unit(s)'
-      TabOrder = 2
+      TabOrder = 0
       OnClick = chkExistingClick
     end
     object chkNew: TRadioButton

+ 4 - 3
LuaEdit/Breakpoints.dfm

@@ -1,11 +1,11 @@
 object frmBreakpoints: TfrmBreakpoints
   Left = 329
   Top = 298
+  Width = 547
+  Height = 300
   BorderIcons = [biSystemMenu]
-  BorderStyle = bsSingle
+  BorderStyle = bsSizeToolWin
   Caption = 'Breakpoints'
-  ClientHeight = 266
-  ClientWidth = 539
   Color = clBtnFace
   DockSite = True
   DragKind = dkDock
@@ -688,6 +688,7 @@ object frmBreakpoints: TfrmBreakpoints
       000000000000}
   end
   object popmBreakpoints: TPopupMenu
+    OnPopup = popmBreakpointsPopup
     Left = 88
     Top = 80
     object RemoveBreakpoint1: TMenuItem

+ 8 - 0
LuaEdit/Breakpoints.pas

@@ -44,6 +44,7 @@ type
       Change: TItemChange; var AllowChange: Boolean);
     procedure FormCreate(Sender: TObject);
     procedure tbtnAddClick(Sender: TObject);
+    procedure popmBreakpointsPopup(Sender: TObject);
   private
     { Private declarations }
   public
@@ -310,4 +311,11 @@ begin
     RefreshBreakpointList;
 end;
 
+procedure TfrmBreakpoints.popmBreakpointsPopup(Sender: TObject);
+begin
+  RemoveBreakpoint1.Enabled := (lvwBreakpoints.Items.Count = 0);
+  Goto1.Enabled := (lvwBreakpoints.Items.Count = 0);
+  Condition1.Enabled := (lvwBreakpoints.Items.Count = 0);
+end;
+
 end.

+ 5 - 5
LuaEdit/EditorSettings.dfm

@@ -119,7 +119,7 @@ object frmEditorSettings: TfrmEditorSettings
       Top = 0
       Width = 492
       Height = 375
-      ActivePage = stabGeneral
+      ActivePage = stabColors
       Align = alClient
       TabOrder = 0
       object stabGeneral: TTabSheet
@@ -282,7 +282,7 @@ object frmEditorSettings: TfrmEditorSettings
             Width = 161
             Height = 17
             Caption = 'Save Projects Incrementally'
-            TabOrder = 1
+            TabOrder = 3
           end
           object chkSaveUnitsInc: TCheckBox
             Left = 272
@@ -290,7 +290,7 @@ object frmEditorSettings: TfrmEditorSettings
             Width = 161
             Height = 17
             Caption = 'Save Units Incrementally'
-            TabOrder = 2
+            TabOrder = 4
           end
           object chkSaveBreakpoints: TCheckBox
             Left = 16
@@ -298,7 +298,7 @@ object frmEditorSettings: TfrmEditorSettings
             Width = 217
             Height = 17
             Caption = 'Save Breakpoints'
-            TabOrder = 3
+            TabOrder = 1
           end
           object chkShowExSaveDlg: TCheckBox
             Left = 16
@@ -306,7 +306,7 @@ object frmEditorSettings: TfrmEditorSettings
             Width = 217
             Height = 17
             Caption = 'Show Extended Save Dialog on Exit'
-            TabOrder = 4
+            TabOrder = 2
           end
         end
       end

+ 5 - 5
LuaEdit/ExSaveExit.dfm

@@ -21,7 +21,7 @@ object frmExSaveExit: TfrmExSaveExit
     Height = 39
     Align = alBottom
     BevelOuter = bvNone
-    TabOrder = 0
+    TabOrder = 1
     DesignSize = (
       342
       39)
@@ -33,7 +33,7 @@ object frmExSaveExit: TfrmExSaveExit
       Anchors = [akRight, akBottom]
       Caption = '&Cancel'
       ModalResult = 2
-      TabOrder = 0
+      TabOrder = 2
     end
     object Button2: TButton
       Left = 180
@@ -53,7 +53,7 @@ object frmExSaveExit: TfrmExSaveExit
       Anchors = [akRight, akBottom]
       Caption = '&Yes'
       ModalResult = 6
-      TabOrder = 2
+      TabOrder = 0
     end
   end
   object Panel3: TPanel
@@ -63,7 +63,7 @@ object frmExSaveExit: TfrmExSaveExit
     Height = 41
     Align = alTop
     BevelOuter = bvNone
-    TabOrder = 1
+    TabOrder = 2
     object Label1: TLabel
       Left = 11
       Top = 16
@@ -82,6 +82,6 @@ object frmExSaveExit: TfrmExSaveExit
     Background.FillMode = bfmTile
     Background.Visible = False
     MultiSelect = True
-    TabOrder = 2
+    TabOrder = 0
   end
 end

+ 2 - 2
LuaEdit/LuaEdit.dof

@@ -115,7 +115,7 @@ AutoIncBuild=1
 MajorVer=2
 MinorVer=0
 Release=1
-Build=570
+Build=585
 Debug=0
 PreRelease=0
 Special=0
@@ -126,7 +126,7 @@ CodePage=1252
 [Version Info Keys]
 CompanyName=Open Source
 FileDescription=IDE for Lua 5.0.2
-FileVersion=2.0.1.570
+FileVersion=2.0.1.585
 InternalName=LuaEdit
 LegalCopyright=LuaEdit Copyright 2004-2005 ©
 LegalTrademarks=

BIN
LuaEdit/LuaEdit.res


+ 1 - 0
LuaEdit/LuaEditMessages.dfm

@@ -3,6 +3,7 @@ object frmLuaEditMessages: TfrmLuaEditMessages
   Top = 342
   Width = 468
   Height = 203
+  BorderStyle = bsSizeToolWin
   Caption = 'Messages'
   Color = clBtnFace
   DockSite = True

+ 1 - 0
LuaEdit/LuaOutput.dfm

@@ -31,6 +31,7 @@ object frmLuaOutput: TfrmLuaOutput
     Font.Name = 'Arial'
     Font.Style = []
     ParentFont = False
+    ReadOnly = True
     TabOrder = 0
   end
   object JvDockClient1: TJvDockClient

+ 0 - 1
LuaEdit/Main.dfm

@@ -3723,7 +3723,6 @@ object frmMain: TfrmMain
   object jvchnNotifier: TJvChangeNotify
     Notifications = <>
     CheckInterval = 1000
-    FreeOnTerminate = False
     OnChangeNotify = jvchnNotifierChangeNotify
     Left = 144
     Top = 342

+ 309 - 176
LuaEdit/Main.pas

@@ -933,6 +933,7 @@ var
   bResult: Boolean;
   pMsgBox: TfrmReadOnlyMsgBox;
 begin
+  frmMain.jvchnNotifier.Active := False;
   Result := True;
 
   // Popup a open dialog according to parameters and the state of the file
@@ -1033,7 +1034,7 @@ begin
   // Write data for [Debug] section
   pFile.WriteString('Debug', 'Initializer', sInitializer);
 
-  // Wrtie data for [Files] section  
+  // Wrtie data for [Files] section
   for x := 0 to lstUnits.Count - 1 do
   begin
     // Write the file with a relative path
@@ -1052,6 +1053,7 @@ begin
 
   // Now we wrote on the disk we may retrieve the time it has been writen
   LastTimeModified := GetFileLastTimeModified(PChar(sPath));
+  frmMain.jvchnNotifier.Active := True;
 end;
 
 function TLuaProject.SaveProject(sPath: String; bNoDialog: Boolean = False; bForceDialog: Boolean = False): Boolean;
@@ -1060,6 +1062,7 @@ var
   x, iAnswer: integer;
   pMsgBox: TfrmReadOnlyMsgBox;
 begin
+  frmMain.jvchnNotifier.Active := False;
   Result := True;
 
   // Popup a open dialog according to parameters and the state of the file
@@ -1158,6 +1161,7 @@ begin
 
   // Now we wrote on the disk we may retrieve the time it has been writen
   LastTimeModified := GetFileLastTimeModified(PChar(sPath));
+  frmMain.jvchnNotifier.Active := True;
 end;
 
 procedure TLuaProject.RealoadProject();
@@ -1239,6 +1243,7 @@ var
   bResult: Boolean;
   pMsgBox: TfrmReadOnlyMsgBox;
 begin
+  frmMain.jvchnNotifier.Active := False;
   Result := True;
   
   // save only if the file is opened in the tab...
@@ -1343,6 +1348,8 @@ begin
     frmMain.stbMain.Refresh;
     synUnit.Refresh;
   end;
+
+  frmMain.jvchnNotifier.Active := True;
 end;
 
 function TLuaUnit.SaveUnit(sPath: String; bNoDialog: Boolean = False; bForceDialog: Boolean = False): Boolean;
@@ -1350,6 +1357,7 @@ var
   iAnswer: Integer;
   pMsgBox: TfrmReadOnlyMsgBox;
 begin
+  frmMain.jvchnNotifier.Active := False;
   Result := True;
   
   // save only if the file is opened in the tab...
@@ -1433,6 +1441,8 @@ begin
     frmMain.stbMain.Refresh;
     synUnit.Refresh;
   end;
+
+  frmMain.jvchnNotifier.Active := True;
 end;
 
 procedure TLuaUnit.SaveBreakpoints();
@@ -1636,7 +1646,7 @@ var
   pLuaUnit: TLuaUnit;
 begin
   pReg := TRegistry.Create;
-                                
+
   if pReg.OpenKey('\Software\LuaEdit', False) then
     odlgOpenUnit.InitialDir := pReg.ReadString('RecentPath');
 
@@ -1774,6 +1784,7 @@ var
   pLuaPrj: TLuaProject;
   x: Integer;
   bNeedPrjTreeRebuild: Boolean;
+  test: Double;
 begin
   try
     // Try to find wich file(s) has changed
@@ -1817,6 +1828,7 @@ begin
 
             if sFileName = pLuaPrj.sPrjPath then
             begin
+              test := GetFileLastTimeModified(PChar(sFileName));
               if ((pLuaPrj.LastTimeModified < GetFileLastTimeModified(PChar(sFileName))) or (pLuaPrj.IsReadOnly <> GetFileReadOnlyAttr(PChar(sFileName)))) then
               begin
                 if Application.MessageBox(PChar('The file '+sFileName+' has been modified outside of the LuaEdit environnement. Do you want to reaload the file now?'), 'LuaEdit', MB_YESNO+MB_ICONQUESTION) = IDYES then
@@ -1836,7 +1848,7 @@ begin
   finally
     // Do it once and only if we need it
     if bNeedPrjTreeRebuild then
-      frmProjectTree.BuildProjectTree;
+      frmProjectTree.BuildProjectTree(False);
 
     FindClose(srSearchRec);
   end;
@@ -2584,7 +2596,11 @@ var
   pNewPrj: TLuaProject;
   pLuaUnit: TLuaUnit;
   mnuSender: TMenuItem;
+  pReg: TRegistry;
+  BuildTreeNeeded: Boolean;
+  x: Integer;
 begin
+  BuildTreeNeeded := False;
   mnuSender := TMenuItem(Sender);
   
   if FileExists(mnuSender.Caption) then
@@ -2597,7 +2613,10 @@ begin
         pLuaUnit.IsLoaded := True;
         AddFileInTab(pLuaUnit);
         MonitorFile(mnuSender.Caption);
-      end;
+        BuildTreeNeeded := True;
+      end
+      else
+        Application.MessageBox(PChar('The project "'+mnuSender.Caption+')" is already opened by LuaEdit.'), 'LuaEdit', MB_OK+MB_ICONERROR);
     end
     else if ExtractFileExt(mnuSender.Caption) = '.lpr' then
     begin
@@ -2605,17 +2624,68 @@ begin
       begin
         pNewPrj := TLuaProject.Create(mnuSender.Caption);
         pNewPrj.GetProjectFromDisk(mnuSender.Caption);
+        BuildTreeNeeded := True;
+      end
+      else
+        Application.MessageBox(PChar('The project "'+mnuSender.Caption+')" is already opened by LuaEdit.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+    end;
+  end
+  else
+  begin
+    Application.MessageBox(PChar('The file "'+mnuSender.Caption+'" is innexistant and will be removed from the list.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+
+    // Remove entry from registry
+    pReg := TRegistry.Create;
+    if pReg.OpenKey('\Software\LuaEdit\RecentFiles', False) then
+    begin
+      if pReg.ValueExists(mnuSender.Caption) then
+        pReg.DeleteValue(mnuSender.Caption);
+    end;
+
+    // Remove ring button from the list
+    for x := 0 to frmRings.jvRings.Pages[JVPAGE_RING_FILES].Buttons.Count - 1 do
+    begin
+      if frmRings.jvRings.Pages[JVPAGE_RING_FILES].Buttons[x].Caption = mnuSender.Caption then
+      begin
+        frmRings.jvRings.Pages[JVPAGE_RING_FILES].Buttons.Delete(x);
+        Break;
+      end;
+    end;
+
+    // Remove menu from the other reopen menu
+    if mnuSender.Owner.ClassType <> TPopupMenu then
+    begin
+      for x := 0 to mnuReopen.Items.Count - 1 do
+      begin
+        if mnuReopen.Items[x].Caption = mnuSender.Caption then
+        begin
+          mnuReopen.Items.Delete(x);
+          Break;
+        end;
       end;
     end
     else
-      Application.MessageBox(PChar('The project "'+mnuSender.Caption+')" is already opened by LuaEdit.'), 'LuaEdit', MB_OK+MB_ICONERROR);
-  end
-  else
-    Application.MessageBox(PChar('The file "'+mnuSender.Caption+'" is innexistant.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+    begin
+      for x := 0 to Reopen1.Count - 1 do
+      begin
+        if Reopen1.Items[x].Caption = mnuSender.Caption then
+        begin
+          Reopen1.Delete(x);
+          Break;
+        end;
+      end;
+    end;
+
+    // Remove itself from the list
+    mnuSender.Free;
+  end;
 
   // Rebuild tree view and initialize stuff
-  frmProjectTree.BuildProjectTree;
-  CheckButtons;
+  if BuildTreeNeeded then
+  begin
+    frmProjectTree.BuildProjectTree;
+    CheckButtons;
+  end;
 end;
 
 // Trigered when user clicks on a ring button of the "Files" slide bar
@@ -2624,7 +2694,11 @@ var
   pNewPrj: TLuaProject;
   pLuaUnit: TLuaUnit;
   btnSender: TJvOutlookBarButton;
+  pReg: TRegistry;
+  BuildTreeNeeded: Boolean;
+  x: Integer;
 begin
+  BuildTreeNeeded := False;
   btnSender := TJvOutlookBarButton(Sender);
 
   if FileExists(btnSender.Caption) then
@@ -2637,7 +2711,10 @@ begin
         pLuaUnit.IsLoaded := True;
         AddFileInTab(pLuaUnit);
         MonitorFile(btnSender.Caption);
-      end;
+        BuildTreeNeeded := True;
+      end
+      else
+        Application.MessageBox(PChar('The project "'+btnSender.Caption+')" is already opened by LuaEdit.'), 'LuaEdit', MB_OK+MB_ICONERROR);
     end
     else if ExtractFileExt(btnSender.Caption) = '.lpr' then
     begin
@@ -2645,17 +2722,53 @@ begin
       begin
         pNewPrj := TLuaProject.Create(btnSender.Caption);
         pNewPrj.GetProjectFromDisk(btnSender.Caption);
-      end;
-    end
-    else
-      Application.MessageBox(PChar('The project "'+btnSender.Caption+')" is already opened by LuaEdit.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+        BuildTreeNeeded := True;
+      end
+      else
+        Application.MessageBox(PChar('The project "'+btnSender.Caption+')" is already opened by LuaEdit.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+    end;
   end
   else
-    Application.MessageBox(PChar('The file "'+btnSender.Caption+'" is innexistant.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+  begin
+    Application.MessageBox(PChar('The file "'+btnSender.Caption+'" is innexistant and will be removed from the list.'), 'LuaEdit', MB_OK+MB_ICONERROR);
+
+    // Remove entry from registry
+    pReg := TRegistry.Create;
+    if pReg.OpenKey('\Software\LuaEdit\RecentFiles', False) then
+    begin
+      if pReg.ValueExists(btnSender.Caption) then
+        pReg.DeleteValue(btnSender.Caption);
+    end;
+
+    // Remove menu from the two reopen menus
+    for x := 0 to mnuReopen.Items.Count - 1 do
+    begin
+      if mnuReopen.Items[x].Caption = btnSender.Caption then
+      begin
+        mnuReopen.Items.Delete(x);
+        Break;
+      end;
+    end;
+
+    for x := 0 to Reopen1.Count - 1 do
+    begin
+      if Reopen1.Items[x].Caption = btnSender.Caption then
+      begin
+        Reopen1.Delete(x);
+        Break;
+      end;
+    end;
+
+    // Remove itself from the list
+    btnSender.Free;
+  end;
 
   // Rebuild tree view and initialize stuff
-  frmProjectTree.BuildProjectTree;
-  CheckButtons;
+  if BuildTreeNeeded then
+  begin
+    frmProjectTree.BuildProjectTree;
+    CheckButtons;
+  end;
 end;
 
 procedure TfrmMain.btnXClipboardClick(Sender: TObject);
@@ -3290,7 +3403,11 @@ var
     NextLine: Integer;
     pLuaUnit: TLuaUnit;
   begin
-    NextFile := ExpandUNCFileName(StringReplace(AR.source, '@', '',[]));
+    if FileExists(StringReplace(AR.source, '@', '',[])) then
+      NextFile := ExpandUNCFileName(StringReplace(AR.source, '@', '',[]))
+    else
+      NextFile := StringReplace(AR.source, '@', '',[]);
+
     NextLine := AR.currentline;
 
     if (PrevFile <> NextFile) then
@@ -3316,9 +3433,26 @@ var
   end;
 
   procedure WaitReStart;
-  begin
+  var
+    sUnitName: String;
+  begin 
+    // Get current call level
     CurrentICI := AR.i_ci;
-    Pause := Pause or IsBreak(ExpandUNCFileName(StringReplace(AR.source, '@', '',[])), AR.currentline) or IsICI(CurrentICI);
+
+    // NOTE: this condition has been added because when the unit is new,
+    //       ExpandUNCFileName must not be used
+    if FileExists(StringReplace(AR.source, '@', '',[])) then
+      sUnitName := ExpandUNCFileName(StringReplace(AR.source, '@', '',[]))
+    else
+      sUnitName := StringReplace(AR.source, '@', '',[]);
+
+    // Get line break status
+    Pause := Pause or IsBreak(sUnitName, AR.currentline) or IsICI(CurrentICI);
+
+    {if Assigned(pLuaUnit) then
+      if ((Pause) and (pLuaUnit.pDebugInfos.iCurrentLineDebug = -1)) then
+        frmLuaEditMessages.memMessages.Lines.Add('[HINT]:  Break in document '+StrPas(AR.source)+' ('+IntToStr(AR.currentline)+') - '+DateTimeToStr(Now));}
+
     ReStart := not Pause;
 
     if (Pause) then
@@ -3327,7 +3461,6 @@ var
       PauseICI := 0;
       PauseLine := -1;
       PauseFile := '';
-      frmLuaEditMessages.memMessages.Lines.Add('[HINT]:  Break in document '+StrPas(AR.source)+' ('+IntToStr(AR.currentline)+') - '+DateTimeToStr(Now));
     end;
 
     frmMain.CheckButtons;
@@ -3418,11 +3551,19 @@ begin
   end;
 end;
 
+// Open the unit in the IDE if not already opened
 function TfrmMain.PopUpUnitToScreen(sFileName: String; iLine: Integer = -1; bCleanPrevUnit: Boolean = False): TLuaUnit;
 var
   pLuaUnit: TLuaUnit;
   x: Integer;
 begin
+  // if the current file is already the one selected then we exit this function
+  if TLuaUnit(frmMain.jvUnitBar.SelectedTab.Data).sUnitPath = sFileName then
+  begin
+    Result := TLuaUnit(frmMain.jvUnitBar.SelectedTab.Data);
+    Exit;
+  end;
+
   if bCleanPrevUnit then
   begin
     if Assigned(frmMain.jvUnitBar.SelectedTab) then
@@ -3464,6 +3605,152 @@ begin
     pLuaUnit.synUnit.GotoLineAndCenter(iLine);
 end;
 
+// print the call stack
+procedure TfrmMain.PrintStack(L: Plua_State);
+begin
+  LuaStackToStrings(L, frmLuaStack.lstLuaStack.Items, PRINT_SIZE);
+end;
+
+// print local list and fill the list of locals
+procedure TfrmMain.PrintLocal(L: Plua_State; Level: Integer = 0);
+begin
+  LuaLocalToStrings(L, frmLuaLocals.lstLocals.Items, PRINT_SIZE, Level);
+  LuaLocalToStrings(L, lstLocals, PRINT_SIZE, Level);
+end;
+
+// print global list
+procedure TfrmMain.PrintGlobal(L: Plua_State; Foce: Boolean);
+begin
+  if (not Assigned(L)) then
+    Exit;
+  if not Foce then
+    Exit;
+
+  LuaTableToTreeView(L, LUA_GLOBALSINDEX, frmLuaGlobals.tvwLuaGlobals, PRINT_SIZE);
+  LuaGlobalsToStrings(L, lstGlobals, PRINT_SIZE);
+end;
+
+// print watches list
+procedure TfrmMain.PrintWatch(L: Plua_State);
+var
+  I: Integer;
+begin
+  for I := 1 to frmWatch.lvwWatch.RowCount - 1 do
+    if frmWatch.lvwWatch.Cells[0, I] <> '' then
+      frmWatch.lvwWatch.Cells[1, I] := GetValue(frmWatch.lvwWatch.Cells[0, I]);
+end;
+
+// check if current debug line is a break one
+function TfrmMain.IsBreak(sFileName: String; Line: Integer): Boolean;
+var
+  pLuaUnit: TLuaUnit;
+  pBreakpoint: TBreakpoint;
+  BreakCondition: String;
+begin
+  Result := False;
+  pLuaUnit := FindUnitInTabs(sFileName);
+
+  if Assigned(pLuaUnit) then
+  begin
+    if pLuaUnit.pDebugInfos.IsBreakPointLine(Line) then
+    begin
+      pBreakpoint := pLuaUnit.pDebugInfos.GetBreakpointAtLine(Line);
+
+      if pBreakpoint.iStatus = BKPT_ENABLED then
+      begin
+        BreakCondition := pBreakpoint.sCondition;
+        if BreakCondition <> '' then
+        begin
+          lua_dostring(LuaState, PChar('return ('+BreakCondition+')'));
+
+          if lua_toboolean(LuaState, -1) = 1 then
+          begin
+            // Breakpoint hit!!!
+            Result := True;
+          end;
+
+          lua_pop(LuaState, 1);
+        end
+        else
+        begin
+          // Breakpoint hit!!!
+          Result := True;
+        end;
+      end;
+
+      if Result then
+      begin
+        Inc(pBreakpoint.iHitCount);
+        frmBreakpoints.RefreshBreakpointList;
+      end;
+    end
+    else
+    begin
+      if Line = PauseLine then
+      begin
+        Result := True;
+      end;
+    end;
+  end;
+end;
+
+// check if it is the current call level
+function TfrmMain.IsICI(ICI: Integer): Boolean;
+begin
+  Result := (ICI <= PauseICI);
+end;
+
+// stdout function for lua_print override
+procedure DoLuaStdout(S: PChar; N: Integer);
+const
+  CR = #$0D;
+  LF = #$0A;
+  CRLF = CR + LF;
+begin
+  frmLuaOutput.Put(StringReplace(S, LF, CRLF, [rfReplaceAll]));
+end;
+
+// check if the given unit was modified
+function TfrmMain.IsEdited(pIgnoreUnit: TLuaUnit): Boolean;
+var
+  x: Integer;
+  pLuaUnit: TLuaUnit;
+begin
+  Result := False;
+
+  for x := 0 to jvUnitBar.Tabs.Count - 1 do
+  begin
+    pLuaUnit := TLuaUnit(jvUnitBar.Tabs[x].Data);
+    if (pLuaUnit <> pIgnoreUnit) then
+      Result := Result or pLuaUnit.HasChanged;
+  end;
+end;
+
+// add selected data to watch list
+procedure TfrmMain.actAddWatchExecute(Sender: TObject);
+var
+  sTemp: string;
+  I: Integer;
+begin
+  if Assigned(pCurrentSynEdit) then
+  begin
+    sTemp := pCurrentSynEdit.SelText;
+
+    with (frmWatch.lvwWatch) do
+    begin
+      I := 0;
+      while (Cells[0, I] <> '') do
+      begin
+        Inc(I);
+        if (I = RowCount) then
+          RowCount := RowCount + 1;
+      end;
+      Cells[0, I] := sTemp;
+      PrintWatch(LuaState);
+    end;
+  end;
+end;
+
 procedure TfrmMain.LuaHelp1Click(Sender: TObject);
 begin
   if FileExists(ExtractFilePath(Application.ExeName)+'Help\refman-5.0.pdf') then
@@ -3772,16 +4059,6 @@ end;
 
 procedure TfrmMain.actStepOverExecute(Sender: TObject);
 begin
-  {if TLuaUnit(jvUnitBar.SelectedTab.Data).pDebugInfos.iCurrentLineDebug = -1 then
-  begin
-    FirstLineStop := True;
-    actRunScriptExecute(nil);
-  end
-  else
-  begin
-    if not IsRunning then
-      StepOverPressed := True;
-  end;}
   if (Pause) then
     Exit;
   ExecuteCurrent(False, CurrentICI, '', -1);
@@ -6246,151 +6523,7 @@ begin
   end;
 end;
 
-// print the call stack
-procedure TfrmMain.PrintStack(L: Plua_State);
-begin
-  LuaStackToStrings(L, frmLuaStack.lstLuaStack.Items, PRINT_SIZE);
-end;
-
-// print local list and fill the list of locals
-procedure TfrmMain.PrintLocal(L: Plua_State; Level: Integer = 0);
-begin
-  LuaLocalToStrings(L, frmLuaLocals.lstLocals.Items, PRINT_SIZE, Level);
-  LuaLocalToStrings(L, lstLocals, PRINT_SIZE, Level);
-end;
-
-// print global list
-procedure TfrmMain.PrintGlobal(L: Plua_State; Foce: Boolean);
-begin
-  if (not Assigned(L)) then
-    Exit;
-  if not Foce then
-    Exit;
-
-  LuaTableToTreeView(L, LUA_GLOBALSINDEX, frmLuaGlobals.tvwLuaGlobals, PRINT_SIZE);
-  LuaGlobalsToStrings(L, lstGlobals, PRINT_SIZE);
-end;
 
-// print watches list
-procedure TfrmMain.PrintWatch(L: Plua_State);
-var
-  I: Integer;
-begin
-  for I := 1 to frmWatch.lvwWatch.RowCount - 1 do
-    if frmWatch.lvwWatch.Cells[0, I] <> '' then
-      frmWatch.lvwWatch.Cells[1, I] := GetValue(frmWatch.lvwWatch.Cells[0, I]);
-end;
-
-// check if current debug line is a break one
-function TfrmMain.IsBreak(sFileName: String; Line: Integer): Boolean;
-var
-  pLuaUnit: TLuaUnit;
-  pBreakpoint: TBreakpoint;
-  BreakCondition: String;
-begin
-  Result := False;
-  pLuaUnit := FindUnitInTabs(sFileName);
-
-  if Assigned(pLuaUnit) then
-  begin
-    if pLuaUnit.pDebugInfos.IsBreakPointLine(Line) then
-    begin
-      pBreakpoint := pLuaUnit.pDebugInfos.GetBreakpointAtLine(Line);
-
-      if pBreakpoint.iStatus = BKPT_ENABLED then
-      begin
-        BreakCondition := pBreakpoint.sCondition;
-        if BreakCondition <> '' then
-        begin
-          lua_dostring(LuaState, PChar('return ('+BreakCondition+')'));
-
-          if lua_toboolean(LuaState, -1) = 1 then
-          begin
-            // Breakpoint hit!!!
-            Result := True;
-          end;
-
-          lua_pop(LuaState, 1);
-        end
-        else
-        begin
-          // Breakpoint hit!!!
-          Result := True;
-        end;
-      end;
-
-      if Result then
-      begin
-        Inc(pBreakpoint.iHitCount);
-        frmBreakpoints.RefreshBreakpointList;
-      end;
-    end
-    else
-    begin
-      if Line = PauseLine then
-      begin
-        Result := True;
-      end;
-    end;
-  end;
-end;
-
-// check if it is the current call level
-function TfrmMain.IsICI(ICI: Integer): Boolean;
-begin
-  Result := (ICI <= PauseICI);
-end;
-
-// stdout function for lua_print override
-procedure DoLuaStdout(S: PChar; N: Integer);
-const
-  CR = #$0D;
-  LF = #$0A;
-  CRLF = CR + LF;
-begin
-  frmLuaOutput.Put(StringReplace(S, LF, CRLF, [rfReplaceAll]));
-end;
-
-// check if the given unit was modified
-function TfrmMain.IsEdited(pIgnoreUnit: TLuaUnit): Boolean;
-var
-  x: Integer;
-  pLuaUnit: TLuaUnit;
-begin
-  Result := False;
-
-  for x := 0 to jvUnitBar.Tabs.Count - 1 do
-  begin
-    pLuaUnit := TLuaUnit(jvUnitBar.Tabs[x].Data);
-    if (pLuaUnit <> pIgnoreUnit) then
-      Result := Result or pLuaUnit.HasChanged;
-  end;
-end;
-
-// add selected data to watch list
-procedure TfrmMain.actAddWatchExecute(Sender: TObject);
-var
-  sTemp: string;
-  I: Integer;
-begin
-  if Assigned(pCurrentSynEdit) then
-  begin
-    sTemp := pCurrentSynEdit.SelText;
-
-    with (frmWatch.lvwWatch) do
-    begin
-      I := 0;
-      while (Cells[0, I] <> '') do
-      begin
-        Inc(I);
-        if (I = RowCount) then
-          RowCount := RowCount + 1;
-      end;
-      Cells[0, I] := sTemp;
-      PrintWatch(LuaState);
-    end;
-  end;
-end;
 
 // check the syntax of the currently opened unit
 procedure TfrmMain.actCheckSyntaxExecute(Sender: TObject);

+ 7 - 7
LuaEdit/PrintSetup.dfm

@@ -23,7 +23,7 @@ object frmPrintSetup: TfrmPrintSetup
     Height = 41
     Align = alBottom
     BevelOuter = bvNone
-    TabOrder = 0
+    TabOrder = 5
     DesignSize = (
       329
       41)
@@ -36,7 +36,7 @@ object frmPrintSetup: TfrmPrintSetup
       Cancel = True
       Caption = '&Cancel'
       ModalResult = 2
-      TabOrder = 0
+      TabOrder = 2
     end
     object btnOk: TButton
       Left = 169
@@ -56,7 +56,7 @@ object frmPrintSetup: TfrmPrintSetup
       Width = 75
       Height = 25
       Caption = 'Advanced...'
-      TabOrder = 2
+      TabOrder = 0
       OnClick = Button1Click
     end
   end
@@ -66,7 +66,7 @@ object frmPrintSetup: TfrmPrintSetup
     Width = 97
     Height = 17
     Caption = 'Use Colors'
-    TabOrder = 1
+    TabOrder = 0
   end
   object chkUseHighLight: TCheckBox
     Left = 16
@@ -74,7 +74,7 @@ object frmPrintSetup: TfrmPrintSetup
     Width = 121
     Height = 17
     Caption = 'Use Syntax Highlight'
-    TabOrder = 2
+    TabOrder = 1
   end
   object chkShowLineNumbers: TCheckBox
     Left = 160
@@ -90,7 +90,7 @@ object frmPrintSetup: TfrmPrintSetup
     Width = 97
     Height = 17
     Caption = 'Wrap Lines'
-    TabOrder = 4
+    TabOrder = 2
   end
   object chkLineNumbersInMargin: TCheckBox
     Left = 160
@@ -98,7 +98,7 @@ object frmPrintSetup: TfrmPrintSetup
     Width = 161
     Height = 17
     Caption = 'Print Line Numbers in Margin'
-    TabOrder = 5
+    TabOrder = 4
   end
   object psdlgPrinterSetup: TPrinterSetupDialog
     Left = 160

+ 2 - 2
LuaEdit/PrjSettings.dfm

@@ -45,7 +45,7 @@ object frmPrjOptions: TfrmPrjOptions
       Cancel = True
       Caption = '&Cancel'
       ModalResult = 2
-      TabOrder = 0
+      TabOrder = 1
     end
     object btnOk: TButton
       Left = 275
@@ -56,7 +56,7 @@ object frmPrjOptions: TfrmPrjOptions
       Caption = '&OK'
       Default = True
       ModalResult = 1
-      TabOrder = 1
+      TabOrder = 0
       OnClick = btnOkClick
     end
   end

+ 14 - 11
LuaEdit/ProjectTree.pas

@@ -22,18 +22,16 @@ type
     RemoveUnitFromProject1: TMenuItem;
     Options1: TMenuItem;
     procedure trvProjectTreeDblClick(Sender: TObject);
-    procedure trvProjectTreeMouseDown(Sender: TObject;
-      Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
+    procedure trvProjectTreeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     procedure trvProjectTreeAdvancedCustomDrawItem(Sender: TCustomTreeView;
-      Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage;
-      var PaintImages, DefaultDraw: Boolean);
+      Node: TTreeNode; State: TCustomDrawState; Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
     procedure UnloadFileProject1Click(Sender: TObject);
     procedure ppmProjectTreePopup(Sender: TObject);
   private
     { Private declarations }
   public
     { Public declarations }
-    procedure BuildProjectTree;
+    procedure BuildProjectTree(HandleNotifier: Boolean = True);
   end;
 
 var
@@ -76,7 +74,7 @@ begin
   frmMain.CheckButtons;
 end;
 
-procedure TfrmProjectTree.BuildProjectTree;
+procedure TfrmProjectTree.BuildProjectTree(HandleNotifier: Boolean);
 var
   pTempPrj: TLuaProject;
   pNewPrjNode, pNewNode: TTreeNode;
@@ -84,8 +82,13 @@ var
 begin
   pNewPrjNode := nil;
   pNewNode := nil;
-  frmMain.jvchnNotifier.Active := False;
-  frmMain.jvchnNotifier.Notifications.Clear;
+
+  if HandleNotifier then
+  begin
+    frmMain.jvchnNotifier.Active := False;
+    frmMain.jvchnNotifier.Notifications.Clear;
+  end;
+
   frmProjectTree.trvProjectTree.Items.BeginUpdate;
   frmProjectTree.trvProjectTree.Items.Clear;
 
@@ -102,7 +105,7 @@ begin
       pNewPrjNode.SelectedIndex := 0;
 
       // Adding project root to change notifier...
-      if not pTempPrj.IsNew then
+      if ((not pTempPrj.IsNew) and HandleNotifier) then
         frmMain.AddToNotifier(ExtractFileDir(pTempPrj.sPrjPath));
     end;
 
@@ -123,7 +126,7 @@ begin
       pNewNode.Data := TLuaUnit(pTempPrj.lstUnits.Items[y]);
 
       // Adding unit root to change notifier...
-      if not TLuaUnit(pTempPrj.lstUnits.Items[y]).IsNew then
+      if ((not TLuaUnit(pTempPrj.lstUnits.Items[y]).IsNew) and HandleNotifier) then
         frmMain.AddToNotifier(ExtractFileDir(TLuaUnit(pTempPrj.lstUnits.Items[y]).sUnitPath));
     end;
 
@@ -132,7 +135,7 @@ begin
   end;
 
   frmProjectTree.trvProjectTree.Items.EndUpdate;
-  if frmMain.jvchnNotifier.Notifications.Count > 0 then
+  if ((frmMain.jvchnNotifier.Notifications.Count > 0) and HandleNotifier) then
     frmMain.jvchnNotifier.Active := True;
 end;
 

+ 2 - 2
LuaEdit/ReadOnlyMsgBox.dfm

@@ -52,7 +52,7 @@ object frmReadOnlyMsgBox: TfrmReadOnlyMsgBox
       Height = 25
       Caption = 'Save &As...'
       ModalResult = 6
-      TabOrder = 0
+      TabOrder = 1
     end
     object Button2: TButton
       Left = 13
@@ -62,7 +62,7 @@ object frmReadOnlyMsgBox: TfrmReadOnlyMsgBox
       Caption = '&Overwrite'
       Default = True
       ModalResult = 1
-      TabOrder = 1
+      TabOrder = 0
     end
     object Button1: TButton
       Left = 197

+ 5 - 5
LuaEdit/RemFromPrj.dfm

@@ -4,7 +4,7 @@ object frmRemoveFile: TfrmRemoveFile
   BorderIcons = [biSystemMenu]
   BorderStyle = bsSingle
   Caption = 'Remove Unit'
-  ClientHeight = 120
+  ClientHeight = 98
   ClientWidth = 361
   Color = clBtnFace
   Font.Charset = DEFAULT_CHARSET
@@ -18,14 +18,14 @@ object frmRemoveFile: TfrmRemoveFile
   TextHeight = 13
   object Label1: TLabel
     Left = 24
-    Top = 24
+    Top = 16
     Width = 77
     Height = 13
     Caption = 'Unit to Remove:'
   end
   object btnCancel: TButton
     Left = 278
-    Top = 88
+    Top = 64
     Width = 75
     Height = 25
     Cancel = True
@@ -35,7 +35,7 @@ object frmRemoveFile: TfrmRemoveFile
   end
   object btnOk: TButton
     Left = 198
-    Top = 88
+    Top = 64
     Width = 75
     Height = 25
     Caption = '&OK'
@@ -45,7 +45,7 @@ object frmRemoveFile: TfrmRemoveFile
   end
   object cboUnit: TComboBox
     Left = 24
-    Top = 40
+    Top = 32
     Width = 313
     Height = 21
     Style = csDropDownList

+ 1 - 0
LuaEdit/Rings.dfm

@@ -3,6 +3,7 @@ object frmRings: TfrmRings
   Top = 294
   Width = 343
   Height = 271
+  BorderStyle = bsSizeToolWin
   Caption = 'Rings'
   Color = clBtnFace
   DockSite = True