Browse Source

Merge branch source:main into main

Margers 11 months ago
parent
commit
16da5280b2

+ 2 - 2
packages/ide/fpcompil.pas

@@ -839,7 +839,7 @@ begin
           FileName:=P^.Editor^.FileName;
           FileName:=P^.Editor^.FileName;
           if FileName='' then
           if FileName='' then
             begin
             begin
-              P^.Editor^.SaveAsk(true);
+              P^.Editor^.SaveAsk(cmValid,true);
               FileName:=P^.Editor^.FileName;
               FileName:=P^.Editor^.FileName;
             end;
             end;
         end
         end
@@ -988,7 +988,7 @@ begin
 
 
   { Retrieve created exefile }
   { Retrieve created exefile }
   If GetEXEPath<>'' then
   If GetEXEPath<>'' then
-    EXEFile:=FixFileName(GetEXEPath+NameOf(MainFile)+GetTargetExeExt)
+    EXEFile:=FixFileName(GetEXEPath)+NameOf(MainFile)+GetTargetExeExt
   else
   else
     EXEFile:=DirOf(MainFile)+NameOf(MainFile)+GetTargetExeExt;
     EXEFile:=DirOf(MainFile)+NameOf(MainFile)+GetTargetExeExt;
   DefaultReplacements(ExeFile);
   DefaultReplacements(ExeFile);

+ 1 - 1
packages/ide/fptools.pas

@@ -1305,7 +1305,7 @@ begin
               begin
               begin
                 I:=I+ReplacePart(LastWordStart,I-1,'')-1;
                 I:=I+ReplacePart(LastWordStart,I-1,'')-1;
                 if W<>nil then
                 if W<>nil then
-                  if W^.Editor^.SaveAsk(true)=false then
+                  if W^.Editor^.SaveAsk(cmValid,true)=false then
                     Err:=-1;
                     Err:=-1;
               end;
               end;
           end else
           end else

+ 1 - 2
packages/ide/fputils.pas

@@ -155,8 +155,7 @@ begin
               NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
               NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
             end;
             end;
  'A'..'Z' : if NoPath then
  'A'..'Z' : if NoPath then
-             {FixFileName[i]:=char(byte(s[i])+ord('a')-ord('A'))}
-             FixFileName[i]:=s[i] {leave case as is, not sure why lowercasing to begin with}
+             FixFileName[i]:=char(byte(s[i])+ord('a')-ord('A'))
             else
             else
              FixFileName[i]:=s[i];
              FixFileName[i]:=s[i];
  {$else}
  {$else}

+ 30 - 24
packages/ide/fpviews.pas

@@ -541,6 +541,10 @@ const menu_key_edit_cut:string[63]=menu_key_edit_cut_borland;
       menu_key_edit_paste:string[63]=menu_key_edit_paste_borland;
       menu_key_edit_paste:string[63]=menu_key_edit_paste_borland;
       menu_key_edit_all:string[63]=menu_key_edit_all_borland;
       menu_key_edit_all:string[63]=menu_key_edit_all_borland;
       menu_key_hlplocal_copy:string[63]=menu_key_hlplocal_copy_borland;
       menu_key_hlplocal_copy:string[63]=menu_key_hlplocal_copy_borland;
+      cut_key:word=kbShiftDel;
+      copy_key:word=kbCtrlIns;
+      paste_key:word=kbShiftIns;
+      all_key:word=kbNoKey;
 
 
 procedure RegisterFPViews;
 procedure RegisterFPViews;
 
 
@@ -1892,7 +1896,7 @@ begin
   if OK and ({(Command=cmClose) or already handled in TFileEditor.Valid PM }
   if OK and ({(Command=cmClose) or already handled in TFileEditor.Valid PM }
      (Command=cmAskSaveAll)) then
      (Command=cmAskSaveAll)) then
     if IsClipboard=false then
     if IsClipboard=false then
-      OK:=SaveAsk(false);
+      OK:=SaveAsk(Command,false);
   Valid:=OK;
   Valid:=OK;
 end;
 end;
 
 
@@ -2217,7 +2221,9 @@ begin
     AFileName:='';
     AFileName:='';
   New(Editor, Init(R, HSB, VSB, Indicator,AFileName));
   New(Editor, Init(R, HSB, VSB, Indicator,AFileName));
   Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
   Editor^.GrowMode:=gfGrowHiX+gfGrowHiY;
-  if LoadFile then
+  {load from file if there is no other window with the same file }
+  if Editor^.Core^.GetBindingCount = 1 then
+    if LoadFile then
     begin
     begin
       if Editor^.LoadFile=false then
       if Editor^.LoadFile=false then
         ErrorBox(FormatStrStr(msg_errorreadingfile,AFileName),nil)
         ErrorBox(FormatStrStr(msg_errorreadingfile,AFileName),nil)
@@ -3656,7 +3662,7 @@ begin
   if HeaderLen>Size.X-2 then HeaderLen:=Size.X-2;
   if HeaderLen>Size.X-2 then HeaderLen:=Size.X-2;
 
 
   { --- 1. sor --- }
   { --- 1. sor --- }
-  ClearBuf; MoveChar(B[0],'�',C1,1); MoveChar(B[HeaderLen+1],'�',C1,1);
+  ClearBuf; MoveChar(B[0],'³',C1,1); MoveChar(B[HeaderLen+1],'³',C1,1);
   X:=1;
   X:=1;
   for i:=0 to DefCount-1 do
   for i:=0 to DefCount-1 do
       begin
       begin
@@ -3669,47 +3675,47 @@ begin
                 end
                 end
            else C:=C2;
            else C:=C2;
         MoveCStr(B[X],' '+Name^+' ',C); X:=X+X2+3;
         MoveCStr(B[X],' '+Name^+' ',C); X:=X+X2+3;
-        MoveChar(B[X-1],'�',C1,1);
+        MoveChar(B[X-1],'³',C1,1);
       end;
       end;
   SWriteBuf(0,1,Size.X,1,B);
   SWriteBuf(0,1,Size.X,1,B);
 
 
   { --- 0. sor --- }
   { --- 0. sor --- }
-  ClearBuf; MoveChar(B[0],'�',C1,1);
+  ClearBuf; MoveChar(B[0],'Ú',C1,1);
   X:=1;
   X:=1;
   for i:=0 to DefCount-1 do
   for i:=0 to DefCount-1 do
       begin
       begin
-        if I<ActiveDef then FC:='�'
-                       else FC:='�';
+        if I<ActiveDef then FC:='Ú'
+                       else FC:='¿';
         X2:=CStrLen(AtTab(i)^.Name^)+2;
         X2:=CStrLen(AtTab(i)^.Name^)+2;
-        MoveChar(B[X+X2],{'�'}FC,C1,1);
+        MoveChar(B[X+X2],{'Â'}FC,C1,1);
         if i=DefCount-1 then X2:=X2+1;
         if i=DefCount-1 then X2:=X2+1;
         if X2>0 then
         if X2>0 then
-        MoveChar(B[X],'�',C1,X2);
+        MoveChar(B[X],'Ä',C1,X2);
         X:=X+X2+1;
         X:=X+X2+1;
       end;
       end;
-  MoveChar(B[HeaderLen+1],'�',C1,1);
-  MoveChar(B[ActiveKPos],'�',C1,1); MoveChar(B[ActiveVPos],'�',C1,1);
+  MoveChar(B[HeaderLen+1],'¿',C1,1);
+  MoveChar(B[ActiveKPos],'Ú',C1,1); MoveChar(B[ActiveVPos],'¿',C1,1);
   SWriteBuf(0,0,Size.X,1,B);
   SWriteBuf(0,0,Size.X,1,B);
 
 
   { --- 2. sor --- }
   { --- 2. sor --- }
-  MoveChar(B[1],'�',C1,Max(HeaderLen,0)); MoveChar(B[HeaderLen+2],'�',C1,Max(Size.X-HeaderLen-3,0));
-  MoveChar(B[Size.X-1],'�',C1,1);
-  MoveChar(B[ActiveKPos],'�',C1,1);
-  if ActiveDef=0 then MoveChar(B[0],'�',C1,1)
-                 else MoveChar(B[0],{'�'}'�',C1,1);
-  MoveChar(B[HeaderLen+1],'�'{'�'},C1,1); MoveChar(B[ActiveVPos],'�',C1,1);
+  MoveChar(B[1],'Ä',C1,Max(HeaderLen,0)); MoveChar(B[HeaderLen+2],'Ä',C1,Max(Size.X-HeaderLen-3,0));
+  MoveChar(B[Size.X-1],'¿',C1,1);
+  MoveChar(B[ActiveKPos],'Ù',C1,1);
+  if ActiveDef=0 then MoveChar(B[0],'³',C1,1)
+                 else MoveChar(B[0],{'Ã'}'Ú',C1,1);
+  MoveChar(B[HeaderLen+1],'Ä'{'Á'},C1,1); MoveChar(B[ActiveVPos],'À',C1,1);
   MoveChar(B[ActiveKPos+1],' ',C1,Max(ActiveVPos-ActiveKPos-1,0));
   MoveChar(B[ActiveKPos+1],' ',C1,Max(ActiveVPos-ActiveKPos-1,0));
   SWriteBuf(0,2,Size.X,1,B);
   SWriteBuf(0,2,Size.X,1,B);
 
 
-  { --- marad�k sor --- }
-  ClearBuf; MoveChar(B[0],'�',C1,1); MoveChar(B[Size.X-1],'�',C1,1);
+  { --- maradk sor --- }
+  ClearBuf; MoveChar(B[0],'³',C1,1); MoveChar(B[Size.X-1],'³',C1,1);
   for i:=3 to Size.Y-1 do
   for i:=3 to Size.Y-1 do
     SWriteBuf(0,i,Size.X,1,B);
     SWriteBuf(0,i,Size.X,1,B);
   { SWriteBuf(0,3,Size.X,Size.Y-4,B); this was wrong
   { SWriteBuf(0,3,Size.X,Size.Y-4,B); this was wrong
     because WriteBuf then expect a buffer of size size.x*(size.y-4)*2 PM }
     because WriteBuf then expect a buffer of size size.x*(size.y-4)*2 PM }
 
 
   { --- Size.X . sor --- }
   { --- Size.X . sor --- }
-  MoveChar(B[0],'�',C1,1); MoveChar(B[1],'�',C1,Max(Size.X-2,0)); MoveChar(B[Size.X-1],'�',C1,1);
+  MoveChar(B[0],'À',C1,1); MoveChar(B[1],'Ä',C1,Max(Size.X-2,0)); MoveChar(B[Size.X-1],'Ù',C1,1);
   SWriteBuf(0,Size.Y-1,Size.X,1,B);
   SWriteBuf(0,Size.Y-1,Size.X,1,B);
 
 
   { - End of TGroup.Draw - }
   { - End of TGroup.Draw - }
@@ -4295,7 +4301,7 @@ begin
     R2.Move(0,2);
     R2.Move(0,2);
   Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-2020 by')));
   Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-2020 by')));
   R2.Move(0,2);
   R2.Move(0,2);
-  Insert(New(PStaticText, Init(R2, ^C'B�rczi G�bor')));
+  Insert(New(PStaticText, Init(R2, ^C'B‚rczi G bor')));
   R2.Move(0,1);
   R2.Move(0,1);
   Insert(New(PStaticText, Init(R2, ^C'Pierre Muller')));
   Insert(New(PStaticText, Init(R2, ^C'Pierre Muller')));
   R2.Move(0,1);
   R2.Move(0,1);
@@ -4311,14 +4317,14 @@ begin
   AddLine(^C'< Compiler development >');
   AddLine(^C'< Compiler development >');
   AddLine(^C'Carl-Eric Codere');
   AddLine(^C'Carl-Eric Codere');
   AddLine(^C'Daniel Mantione');
   AddLine(^C'Daniel Mantione');
-  AddLine(^C'Florian Kl�mpfl');
+  AddLine(^C'Florian Klmpfl');
   AddLine(^C'Jonas Maebe');
   AddLine(^C'Jonas Maebe');
-  AddLine(^C'Mich�el Van Canneyt');
+  AddLine(^C'Michel Van Canneyt');
   AddLine(^C'Peter Vreman');
   AddLine(^C'Peter Vreman');
   AddLine(^C'Pierre Muller');
   AddLine(^C'Pierre Muller');
   AddLine('');
   AddLine('');
   AddLine(^C'< IDE development >');
   AddLine(^C'< IDE development >');
-  AddLine(^C'B�rczi G�bor');
+  AddLine(^C'B‚rczi G bor');
   AddLine(^C'Peter Vreman');
   AddLine(^C'Peter Vreman');
   AddLine(^C'Pierre Muller');
   AddLine(^C'Pierre Muller');
   AddLine('');
   AddLine('');

+ 6 - 5
packages/ide/wcedit.pas

@@ -234,7 +234,7 @@ type
           PScrollBar; AIndicator: PIndicator; ACore: PCodeEditorCore; const AFileName: string);
           PScrollBar; AIndicator: PIndicator; ACore: PCodeEditorCore; const AFileName: string);
       function    Save: Boolean; virtual;
       function    Save: Boolean; virtual;
       function    SaveAs: Boolean; virtual;
       function    SaveAs: Boolean; virtual;
-      function    SaveAsk(Force: boolean): Boolean; virtual;
+      function    SaveAsk(Command: Word; Force: boolean): boolean; virtual;
       function    LoadFile: boolean; virtual;
       function    LoadFile: boolean; virtual;
       function    ReloadFile: boolean; virtual;
       function    ReloadFile: boolean; virtual;
       function    SaveFile: boolean; virtual;
       function    SaveFile: boolean; virtual;
@@ -265,7 +265,7 @@ implementation
 
 
 uses Dos,
 uses Dos,
      WConsts,
      WConsts,
-     FVConsts,
+     FVConsts,FPConst,
      App,WViews;
      App,WViews;
 
 
 {$ifndef NOOBJREG}
 {$ifndef NOOBJREG}
@@ -1931,7 +1931,7 @@ begin
   end;
   end;
 end;
 end;
 
 
-function TFileEditor.SaveAsk(Force: boolean): boolean;
+function TFileEditor.SaveAsk(Command: Word; Force: boolean): boolean;
 var OK: boolean;
 var OK: boolean;
     D: Sw_integer;
     D: Sw_integer;
 begin
 begin
@@ -1946,7 +1946,8 @@ begin
    begin
    begin
      OK:=(GetModified=false);
      OK:=(GetModified=false);
      if (OK=false) and (Core^.GetBindingCount>1) then
      if (OK=false) and (Core^.GetBindingCount>1) then
-      OK:=true;
+       if (command<>cmAskSaveAll) or (Core^.GetBindingIndex(PCustomCodeEditor(@self))<>0) then
+         OK:=true;
      if OK=false then
      if OK=false then
       begin
       begin
         if FileName = '' then D := edSaveUntitled else D := edSaveModify;
         if FileName = '' then D := edSaveUntitled else D := edSaveModify;
@@ -2002,7 +2003,7 @@ begin
   OK:=inherited Valid(Command);
   OK:=inherited Valid(Command);
   if OK and (Command=cmClose) then
   if OK and (Command=cmClose) then
     if IsClipboard=false then
     if IsClipboard=false then
-      OK:=SaveAsk(false);
+      OK:=SaveAsk(Command,false);
   Valid:=OK;
   Valid:=OK;
 end;
 end;
 
 

+ 3 - 8
packages/ide/weditor.pas

@@ -737,11 +737,6 @@ const
        selection (PM) }
        selection (PM) }
      DontConsiderShiftState: boolean  = false;
      DontConsiderShiftState: boolean  = false;
 
 
-     cut_key:word=kbShiftDel;
-     copy_key:word=kbCtrlIns;
-     paste_key:word=kbShiftIns;
-     all_key:word=kbNoKey;
-
      CodeCompleteMinLen : byte = 4; { minimum length of text to try to complete }
      CodeCompleteMinLen : byte = 4; { minimum length of text to try to complete }
 
 
      ToClipCmds         : TCommandSet = ([cmCut,cmCopy,cmCopyWin,
      ToClipCmds         : TCommandSet = ([cmCut,cmCopy,cmCopyWin,
@@ -7011,7 +7006,7 @@ begin
                end;
                end;
              ClearEvent(Event);
              ClearEvent(Event);
            End
            End
-         else if ((Event.KeyCode=kbShiftIns) or (Event.KeyCode=paste_key))  and
+         else if (Event.KeyCode=kbShiftIns)  and
                  Assigned(Clipboard) and (Clipboard^.ValidBlock) then
                  Assigned(Clipboard) and (Clipboard^.ValidBlock) then
            { paste from clipboard }
            { paste from clipboard }
            begin
            begin
@@ -7039,7 +7034,7 @@ begin
                end;
                end;
              ClearEvent(Event);
              ClearEvent(Event);
            end
            end
-         else if ((Event.KeyCode=kbCtrlIns) or (Event.KeyCode=copy_key))  and
+         else if (Event.KeyCode=kbCtrlIns)  and
                  Assigned(Clipboard) then
                  Assigned(Clipboard) then
            { Copy to clipboard }
            { Copy to clipboard }
            begin
            begin
@@ -7050,7 +7045,7 @@ begin
              Clipboard^.SelEnd:=Clipboard^.CurPos;
              Clipboard^.SelEnd:=Clipboard^.CurPos;
              ClearEvent(Event);
              ClearEvent(Event);
            end
            end
-         else if ((Event.KeyCode=kbShiftDel) or (Event.KeyCode=cut_key))  and
+         else if (Event.KeyCode=kbShiftDel)  and
                  Assigned(Clipboard) then
                  Assigned(Clipboard) then
            { Cut to clipboard }
            { Cut to clipboard }
            begin
            begin