DEADSOFTWARE

Map: Add fast preview feature
[d2df-editor.git] / src / editor / f_main.pas
index 2b9ddee5a2a3f6a26c8311f6984b84d4655e3836..8158c03344f380660a7de069841ce8357aedb984 100644 (file)
@@ -311,7 +311,7 @@ var
 
   LayerEnabled: Array [LAYER_BACK..LAYER_TRIGGERS] of Boolean =
     (True, True, True, True, True, True, True, True, True);
-  PreviewMode: Boolean = False;
+  PreviewMode: Byte = 0;
   gLanguage: String;
 
   FormCaption: String;
@@ -1996,6 +1996,7 @@ var
   MapName: String;
   idx: Integer;
 begin
+  SelectMapForm.Caption := _lc[I_CAP_OPEN];
   SelectMapForm.GetMaps(FileName);
 
   if (FileName = OpenedWAD) and
@@ -2772,7 +2773,7 @@ begin
   end;
 
 // Рисуем сетку:
-  if DotEnable and (not PreviewMode) then
+  if DotEnable and (PreviewMode = 0) then
   begin
     if DotSize = 2 then
       a := -1
@@ -2789,7 +2790,7 @@ begin
 
 // Превью текстуры:
   if (lbTextureList.ItemIndex <> -1) and (cbPreview.Checked) and
-     (not IsSpecialTextureSel()) and (not PreviewMode) then
+     (not IsSpecialTextureSel()) and (PreviewMode = 0) then
   begin
     if not g_GetTexture(SelectedTexture(), ID) then
       g_GetTexture('NOTEXTURE', ID);
@@ -4202,6 +4203,13 @@ begin
 
     if not (ssCtrl in Shift) then
     begin
+    // Быстрое превью карты:
+      if Key = Ord('E') then
+      begin
+        if PreviewMode = 0 then
+          PreviewMode := 2;
+      end;
+
     // Вертикальный скролл карты:
       with sbVertical do
       begin
@@ -4332,6 +4340,7 @@ begin
       if i > 0 then
       begin
         g_ProcessResourceStr(OpenedMap, @FileName, nil, nil);
+        SelectMapForm.Caption := _lc[I_CAP_SELECT];
         SelectMapForm.GetMaps(FileName);
 
         if SelectMapForm.ShowModal() = mrOK then
@@ -5520,6 +5529,7 @@ begin
   else if Key = _lc[I_PROP_TR_NEXT_MAP] then
     begin // Выбор следующей карты:
       g_ProcessResourceStr(OpenedMap, @FileName, nil, nil);
+      SelectMapForm.Caption := _lc[I_CAP_SELECT];
       SelectMapForm.GetMaps(FileName);
 
       if SelectMapForm.ShowModal() = mrOK then
@@ -5885,6 +5895,7 @@ begin
 
   MapList := WAD.GetResourcesList('');
 
+  SelectMapForm.Caption := _lc[I_CAP_REMOVE];
   SelectMapForm.lbMapList.Items.Clear();
 
   if MapList <> nil then
@@ -6166,7 +6177,10 @@ end;
 
 procedure TMainForm.miMapPreviewClick(Sender: TObject);
 begin
-  if not PreviewMode then
+  if PreviewMode = 2 then
+    Exit;
+
+  if PreviewMode = 0 then
     begin
       Splitter2.Visible := False;
       Splitter1.Visible := False;
@@ -6189,8 +6203,8 @@ begin
       sbVertical.Visible := True;
     end;
 
-  PreviewMode := not PreviewMode;
-  (Sender as TMenuItem).Checked := PreviewMode;
+  PreviewMode := PreviewMode xor 1;
+  (Sender as TMenuItem).Checked := PreviewMode > 0;
 
   FormResize(Self);
 end;
@@ -6493,6 +6507,12 @@ begin
        (Key = Ord('V')) then
       FillProperty();
   end;
+// Быстрое превью карты:
+  if Key = Ord('E') then
+  begin
+    if PreviewMode = 2 then
+      PreviewMode := 0;
+  end;
 end;
 
 end.