DEADSOFTWARE

Main: Count selected objects in status bar
authorStas'M <x86corez@gmail.com>
Tue, 22 May 2018 12:06:08 +0000 (15:06 +0300)
committerStas'M <x86corez@gmail.com>
Tue, 22 May 2018 12:06:41 +0000 (15:06 +0300)
http://doom2d.org/forum/viewtopic.php?f=12&t=1568

src/editor/f_main.pas
src/editor/g_language.pas

index d217b30d0864c21869dcc3981be725bf741ed740..a810a63637c87848381a1c051228b1cfd91a1f7c 100644 (file)
@@ -267,6 +267,7 @@ type
     procedure RefreshRecentMenu();
     procedure OpenMapFile(FileName: String);
     function RenderMousePos(): TPoint;
+    procedure RecountSelectedObjects();
   end;
 
 const
@@ -739,6 +740,7 @@ var
   str: String;
 begin
   MainForm.vleObjectProperty.Strings.Clear();
+  MainForm.RecountSelectedObjects();
 
 // Отображаем свойства если выделен только один объект:
   if SelectedObjectCount() <> 1 then
@@ -4019,6 +4021,14 @@ begin
   Result := RenderPanel.ScreenToClient(Mouse.CursorPos);
 end;
 
+procedure TMainForm.RecountSelectedObjects();
+begin
+  if SelectedObjectCount() = 0 then
+    StatusBar.Panels[0].Text := ''
+  else
+    StatusBar.Panels[0].Text := Format(_lc[I_CAP_STAT_SELECTED], [SelectedObjectCount()]);
+end;
+
 procedure TMainForm.RenderPanelMouseMove(Sender: TObject;
   Shift: TShiftState; X, Y: Integer);
 var
@@ -6416,6 +6426,8 @@ begin
           if gTriggers[a].TriggerType <> TRIGGER_NONE then
             SelectObject(OBJECT_TRIGGER, a, True);
   end;
+
+  RecountSelectedObjects();
 end;
 
 procedure TMainForm.tbGridOnClick(Sender: TObject);
@@ -6737,6 +6749,8 @@ begin
     for a := 0 to High(gTriggers) do
       if gTriggers[a].TriggerType <> TRIGGER_NONE then
         SelectObject(OBJECT_TRIGGER, a, True);
+
+  RecountSelectedObjects();
 end;
 
 procedure TMainForm.Splitter1CanResize(Sender: TObject;
index b6a779d66be54d6d0f92060bbc4a7bfca8639e7d..cf9998fc8c0444dcf8d35ace2990668195f52ad1 100644 (file)
@@ -418,6 +418,7 @@ Type
     I_CAP_REMOVE,
     I_CAP_TEXTURE,
     I_CAP_ANIMATION,
+    I_CAP_STAT_SELECTED,
 
     I_CTRL_PROP_KEY,
     I_CTRL_PROP_VALUE,
@@ -1443,6 +1444,8 @@ Const
                                        'Текстура: %dx%d'),
     ('CAP ANIMATION',                  'Animation: %dx%d, %d frames',
                                        'Анимация: %dx%d, %d кадров'),
+    ('CAP STAT SELECTED',              'Selected objects: %d',
+                                       'Выделено объектов: %d'),
 
     ('CTRL PROP KEY',                  'Property',
                                        'Свойство'),