Browse Source

option to show full background

Laserlicht 6 months ago
parent
commit
e4e77b9cc5

+ 7 - 0
mapeditor/campaigneditor/campaigneditor.cpp

@@ -34,6 +34,10 @@ CampaignEditor::CampaignEditor():
 	ui->actionNew->setIcon(QIcon{":/icons/document-new.png"});
 	ui->actionScenarioProperties->setIcon(QIcon{":/icons/menu-settings.png"});
 	ui->actionCampaignProperties->setIcon(QIcon{":/icons/menu-mods.png"});
+	ui->actionShowFullBackground->setIcon(QIcon{":/icons/tool-area.png"});
+
+	ui->actionShowFullBackground->setCheckable(true);
+	connect(ui->actionShowFullBackground, &QAction::triggered, [this](){ redraw(); });
 
 	campaignScene.reset(new CampaignScene());
 	ui->campaignView->setScene(campaignScene.get());
@@ -65,6 +69,8 @@ void CampaignEditor::redraw()
 	campaignScene->clear();
 
 	auto background = BitmapHandler::loadBitmap(campaignState->getRegions().getBackgroundName().getName());
+	if(!ui->actionShowFullBackground->isChecked())
+		background = background.copy(0, 0, 456, 600); 
 	campaignScene->addItem(new QGraphicsPixmapItem(QPixmap::fromImage(background)));
 	for (auto & s : campaignState->scenarios)
 	{
@@ -105,6 +111,7 @@ void CampaignEditor::redraw()
 		campaignScene->addItem(pixmap);
 	}
 
+	campaignScene->setSceneRect(background.rect());
 	ui->campaignView->show();
 }
 

+ 20 - 0
mapeditor/campaigneditor/campaigneditor.ui

@@ -47,8 +47,15 @@
       <addaction name="actionCampaignProperties"/>
       <addaction name="actionScenarioProperties"/>
      </widget>
+     <widget class="QMenu" name="menuView">
+      <property name="title">
+       <string>View</string>
+      </property>
+      <addaction name="actionShowFullBackground"/>
+     </widget>
      <addaction name="menuFile"/>
      <addaction name="menuEdit"/>
+     <addaction name="menuView"/>
     </widget>
    </item>
    <item>
@@ -68,6 +75,8 @@
      <addaction name="separator"/>
      <addaction name="actionCampaignProperties"/>
      <addaction name="actionScenarioProperties"/>
+     <addaction name="separator"/>
+     <addaction name="actionShowFullBackground"/>
     </widget>
    </item>
    <item>
@@ -144,6 +153,17 @@
     <string notr="true">Enter</string>
    </property>
   </action>
+  <action name="actionShowFullBackground">
+   <property name="text">
+    <string>Show full background</string>
+   </property>
+   <property name="toolTip">
+    <string>Show full background</string>
+   </property>
+   <property name="shortcut">
+    <string notr="true">F</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>