diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas
index e0054350131bc2507ed9cfc4c8a963fce0ebe835..a810a63637c87848381a1c051228b1cfd91a1f7c 100644 (file)
--- a/src/editor/f_main.pas
+++ b/src/editor/f_main.pas
procedure RefreshRecentMenu();
procedure OpenMapFile(FileName: String);
function RenderMousePos(): TPoint;
+ procedure RecountSelectedObjects();
end;
const
str: String;
begin
MainForm.vleObjectProperty.Strings.Clear();
+ MainForm.RecountSelectedObjects();
// Отображаем свойства если выделен только один объект:
if SelectedObjectCount() <> 1 then
gAlphaTriggerArea := config.ReadInt('Editor', 'TriggerAlpha', ALPHA_AREA);
if gAlphaTriggerArea = 255 then
gAlphaTriggerArea := ALPHA_AREA;
+ gAlphaMonsterRect := config.ReadInt('Editor', 'MonsterRectAlpha', 0);
+ gAlphaAreaRect := config.ReadInt('Editor', 'AreaRectAlpha', 0);
if config.ReadInt('Editor', 'Scale', 0) = 1 then
Scale := 2
else
g_GetTexture('NOTEXTURE', ID);
g_GetTextureSizeByID(ID, Width, Height);
with DrawRect^ do
- e_DrawFill(ID, Min(Left, Right), Min(Top, Bottom), Abs(Right-Left) div Width,
- Abs(Bottom-Top) div Height, 0, True, False);
+ if (Abs(Right-Left) >= Width) and (Abs(Bottom-Top) >= Height) then
+ e_DrawFill(ID, Min(Left, Right), Min(Top, Bottom), Abs(Right-Left) div Width,
+ Abs(Bottom-Top) div Height, 64, True, False);
end;
// Прямоугольник выделения:
e_DrawQuad(Left, Top, Right-1, Bottom-1, 255, 255, 255);
// Чертим мышью панель/триггер или меняем мышью их размер:
- if (MouseAction in [MOUSEACTION_DRAWPANEL, MOUSEACTION_DRAWTRIGGER, MOUSEACTION_RESIZE]) and
+ if (((MouseAction in [MOUSEACTION_DRAWPANEL, MOUSEACTION_DRAWTRIGGER]) and
+ not(ssCtrl in GetKeyShiftState())) or (MouseAction = MOUSEACTION_RESIZE)) and
(DrawPanelSize) then
begin
e_DrawFillQuad(MousePos.X, MousePos.Y, MousePos.X+88, MousePos.Y+33, 192, 192, 192, 127);
begin // Чертим новый
PrintBlack(MousePos.X+2, MousePos.Y+2, Format(_glc[I_HINT_WIDTH],
[Abs(MousePos.X-MouseLDownPos.X)]), gEditorFont);
- PrintBlack(MousePos.X+2, MousePos.Y+14, Format(_glc[I_HINT_HEIGHT],
+ PrintBlack(MousePos.X+2, MousePos.Y+16, Format(_glc[I_HINT_HEIGHT],
[Abs(MousePos.Y-MouseLDownPos.Y)]), gEditorFont);
end
else // Растягиваем существующий
PrintBlack(MousePos.X+2, MousePos.Y+2, Format(_glc[I_HINT_WIDTH], [Width]),
gEditorFont);
- PrintBlack(MousePos.X+2, MousePos.Y+14, Format(_glc[I_HINT_HEIGHT], [Height]),
+ PrintBlack(MousePos.X+2, MousePos.Y+16, Format(_glc[I_HINT_HEIGHT], [Height]),
gEditorFont);
end;
end;
var
panel: TPanel;
trigger: TTrigger;
- i: Integer;
- IDArray: DWArray;
rRect: TRectWH;
rSelectRect: Boolean;
+ wWidth, wHeight: Word;
+ TextureID: DWORD;
+
+ procedure SelectObjects(ObjectType: Byte);
+ var
+ i: Integer;
+ IDArray: DWArray;
+ begin
+ IDArray := ObjectInRect(rRect.X, rRect.Y,
+ rRect.Width, rRect.Height,
+ ObjectType, rSelectRect);
+
+ if IDArray <> nil then
+ for i := 0 to High(IDArray) do
+ SelectObject(ObjectType, IDArray[i], (ssCtrl in Shift) or rSelectRect);
+ end;
begin
if Button = mbLeft then
MouseLDown := False;
DrawRect := nil;
ResizeType := RESIZETYPE_NONE;
+ TextureID := 0;
if Button = mbLeft then // Left Mouse Button
begin
if MouseAction <> MOUSEACTION_NONE then
begin // Было действие мышью
- // Мышь сдвинулась во время удержания клавиши:
- if (MousePos.X <> MouseLDownPos.X) and
- (MousePos.Y <> MouseLDownPos.Y) then
+ // Мышь сдвинулась во время удержания клавиши,
+ // либо активирован режим быстрого рисования:
+ if ((MousePos.X <> MouseLDownPos.X) and
+ (MousePos.Y <> MouseLDownPos.Y)) or
+ ((MouseAction in [MOUSEACTION_DRAWPANEL, MOUSEACTION_DRAWTRIGGER]) and
+ (ssCtrl in Shift)) then
case MouseAction of
// Рисовали панель:
MOUSEACTION_DRAWPANEL:
Panel.X := Min(MousePos.X-MapOffset.X, MouseLDownPos.X-MapOffset.X);
Panel.Y := Min(MousePos.Y-MapOffset.Y, MouseLDownPos.Y-MapOffset.Y);
- Panel.Width := Abs(MousePos.X-MouseLDownPos.X);
- Panel.Height := Abs(MousePos.Y-MouseLDownPos.Y);
+ if ssCtrl in Shift then
+ begin
+ wWidth := DotStep;
+ wHeight := DotStep;
+ if (lbTextureList.ItemIndex <> -1) and
+ (not IsSpecialTextureSel()) then
+ begin
+ if not g_GetTexture(SelectedTexture(), TextureID) then
+ g_GetTexture('NOTEXTURE', TextureID);
+ g_GetTextureSizeByID(TextureID, wWidth, wHeight);
+ end;
+ Panel.Width := wWidth;
+ Panel.Height := wHeight;
+ end
+ else
+ begin
+ Panel.Width := Abs(MousePos.X-MouseLDownPos.X);
+ Panel.Height := Abs(MousePos.Y-MouseLDownPos.Y);
+ end;
// Лифты, блокМон или отсутствие текстуры - пустая текстура:
if (lbPanelType.ItemIndex in [9, 10, 11, 12, 13]) or
begin
trigger.X := Min(MousePos.X-MapOffset.X, MouseLDownPos.X-MapOffset.X);
trigger.Y := Min(MousePos.Y-MapOffset.Y, MouseLDownPos.Y-MapOffset.Y);
- trigger.Width := Abs(MousePos.X-MouseLDownPos.X);
- trigger.Height := Abs(MousePos.Y-MouseLDownPos.Y);
+ if ssCtrl in Shift then
+ begin
+ wWidth := DotStep;
+ wHeight := DotStep;
+ trigger.Width := wWidth;
+ trigger.Height := wHeight;
+ end
+ else
+ begin
+ trigger.Width := Abs(MousePos.X-MouseLDownPos.X);
+ trigger.Height := Abs(MousePos.Y-MouseLDownPos.Y);
+ end;
trigger.Enabled := True;
trigger.TriggerType := lbTriggersList.ItemIndex+1;
RemoveSelectFromObjects();
// Выделяем всё в выбранном прямоугольнике:
- IDArray := ObjectInRect(rRect.X, rRect.Y,
- rRect.Width, rRect.Height,
- pcObjects.ActivePageIndex+1, rSelectRect);
-
- if IDArray <> nil then
- for i := 0 to High(IDArray) do
- SelectObject(pcObjects.ActivePageIndex+1, IDArray[i],
- (ssCtrl in Shift) or rSelectRect);
+ if (ssCtrl in Shift) and (ssAlt in Shift) then
+ begin
+ SelectObjects(OBJECT_PANEL);
+ SelectObjects(OBJECT_ITEM);
+ SelectObjects(OBJECT_MONSTER);
+ SelectObjects(OBJECT_AREA);
+ SelectObjects(OBJECT_TRIGGER);
+ end
+ else
+ SelectObjects(pcObjects.ActivePageIndex+1);
FillProperty();
end;
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
sX, sY: Integer;
dWidth, dHeight: Integer;
_id: Integer;
+ TextureID: DWORD;
+ wWidth, wHeight: Word;
begin
_id := GetFirstSelected();
+ TextureID := 0;
// Рисуем панель с текстурой, сетка - размеры текстуры:
if (MouseAction = MOUSEACTION_DRAWPANEL) and
begin
if DrawRect = nil then
New(DrawRect);
- DrawRect.Top := MouseLDownPos.y;
- DrawRect.Left := MouseLDownPos.x;
- DrawRect.Bottom := MousePos.y;
- DrawRect.Right := MousePos.x;
+ if ssCtrl in Shift then
+ begin
+ wWidth := DotStep;
+ wHeight := DotStep;
+ if (lbTextureList.ItemIndex <> -1) and (not IsSpecialTextureSel()) and
+ (MouseAction = MOUSEACTION_DRAWPANEL) then
+ begin
+ if not g_GetTexture(SelectedTexture(), TextureID) then
+ g_GetTexture('NOTEXTURE', TextureID);
+ g_GetTextureSizeByID(TextureID, wWidth, wHeight);
+ end;
+ DrawRect.Top := MouseLDownPos.y;
+ DrawRect.Left := MouseLDownPos.x;
+ DrawRect.Bottom := DrawRect.Top + wHeight;
+ DrawRect.Right := DrawRect.Left + wWidth;
+ end
+ else
+ begin
+ DrawRect.Top := MouseLDownPos.y;
+ DrawRect.Left := MouseLDownPos.x;
+ DrawRect.Bottom := MousePos.y;
+ DrawRect.Right := MousePos.x;
+ end;
end
else // Двигаем карту:
if MouseAction = MOUSEACTION_MOVEMAP then
config.WriteInt('Editor', 'EdgeAlpha', gAlphaEdge);
config.WriteInt('Editor', 'LineAlpha', gAlphaTriggerLine);
config.WriteInt('Editor', 'TriggerAlpha', gAlphaTriggerArea);
+ config.WriteInt('Editor', 'MonsterRectAlpha', gAlphaMonsterRect);
+ config.WriteInt('Editor', 'AreaRectAlpha', gAlphaAreaRect);
for i := 0 to RecentCount-1 do
if i < RecentFiles.Count then
if Key = Ord('V') then
aPasteObjectExecute(Sender);
end;
+ RenderPanelMouseMove(Sender, Shift, RenderMousePos().X, RenderMousePos().Y);
end;
end;
if gTriggers[a].TriggerType <> TRIGGER_NONE then
SelectObject(OBJECT_TRIGGER, a, True);
end;
+
+ RecountSelectedObjects();
end;
procedure TMainForm.tbGridOnClick(Sender: TObject);
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;
if PreviewMode = 2 then
PreviewMode := 0;
end;
+ RenderPanelMouseMove(Sender, Shift, RenderMousePos().X, RenderMousePos().Y);
end;
end.