← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/refactor_editor_start into lp:widelands

 

Tino has proposed merging lp:~widelands-dev/widelands/refactor_editor_start into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1390794 in widelands: "Remove the "New Map"/"Load map" menu when launching the editor"
  https://bugs.launchpad.net/widelands/+bug/1390794

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/refactor_editor_start/+merge/245412

The "Editor" button in the main menu now starts directly the editor, the new map/load map menu was removed.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/refactor_editor_start into lp:widelands.
=== modified file 'src/ui_fsmenu/CMakeLists.txt'
--- src/ui_fsmenu/CMakeLists.txt	2014-12-06 12:22:35 +0000
+++ src/ui_fsmenu/CMakeLists.txt	2014-12-28 15:16:30 +0000
@@ -4,8 +4,6 @@
     base.h
     campaign_select.cc
     campaign_select.h
-    editor.cc
-    editor.h
     fileview.cc
     fileview.h
     internet_lobby.cc

=== removed file 'src/ui_fsmenu/editor.cc'
--- src/ui_fsmenu/editor.cc	2014-12-06 12:22:35 +0000
+++ src/ui_fsmenu/editor.cc	1970-01-01 00:00:00 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2008 by the Widelands Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- */
-
-#include "ui_fsmenu/editor.h"
-
-#include "base/i18n.h"
-#include "graphic/graphic.h"
-#include "graphic/text_constants.h"
-
-FullscreenMenuEditor::FullscreenMenuEditor() :
-	FullscreenMenuMainMenu(),
-
-	// Title
-	title
-		(this, get_w() / 2, m_title_y, _("Editor"), UI::Align_HCenter),
-
-	// Buttons
-	vbox(this, m_box_x, m_box_y, UI::Box::Vertical,
-		  m_butw, get_h() - vbox.get_y(), m_padding),
-	new_map
-		(&vbox, "new_map", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
-		 _("New Map"), "", true, false),
-	load_map
-		(&vbox, "load_map", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
-		 _("Load Map"), "", true, false),
-	back
-		(&vbox, "back", 0, 0, m_butw, m_buth, g_gr->images().get(m_button_background),
-		 _("Back"), "", true, false)
-{
-	new_map.sigclicked.connect
-			(boost::bind(
-				 &FullscreenMenuEditor::end_modal,
-				 boost::ref(*this),
-				 static_cast<int32_t>(MenuTarget::kNewMap)));
-	load_map.sigclicked.connect
-			(boost::bind
-			 (&FullscreenMenuEditor::end_modal,
-			  boost::ref(*this),
-			  static_cast<int32_t>(MenuTarget::kLoadMap)));
-	back.sigclicked.connect
-			(boost::bind
-			 (&FullscreenMenuEditor::end_modal,
-			  boost::ref(*this),
-			  static_cast<int32_t>(MenuTarget::kBack)));
-
-	title.set_font(ui_fn(), fs_big(), UI_FONT_CLR_FG);
-
-	vbox.add(&new_map, UI::Box::AlignCenter);
-	vbox.add(&load_map, UI::Box::AlignCenter);
-
-	// Multiple add_space calls to get the same height for the back button as in the single player menu
-	vbox.add_space(m_buth);
-	vbox.add_space(m_buth);
-	vbox.add_space(6 * m_buth);
-
-	vbox.add(&back, UI::Box::AlignCenter);
-
-	vbox.set_size(m_butw, get_h() - vbox.get_y());
-}

=== removed file 'src/ui_fsmenu/editor.h'
--- src/ui_fsmenu/editor.h	2014-12-27 09:46:38 +0000
+++ src/ui_fsmenu/editor.h	1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008 by the Widelands Development Team
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- */
-
-#ifndef WL_UI_FSMENU_EDITOR_H
-#define WL_UI_FSMENU_EDITOR_H
-
-#include "ui_fsmenu/main_menu.h"
-#include "ui_basic/box.h"
-#include "ui_basic/button.h"
-#include "ui_basic/textarea.h"
-
-/**
- * Fullscreen Menu for Editor.
- * Here you select what game you want to play.
- */
-class FullscreenMenuEditor : public FullscreenMenuMainMenu {
-public:
-	FullscreenMenuEditor();
-
-	enum class MenuTarget {kBack = UI::Panel::dying_code, kNewMap, kLoadMap};
-
-private:
-	UI::Textarea title;
-	UI::Box     vbox;
-	UI::Button   new_map;
-	UI::Button   load_map;
-	UI::Button   back;
-};
-
-#endif  // end of include guard: WL_UI_FSMENU_EDITOR_H

=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc	2014-12-20 17:52:18 +0000
+++ src/wlapplication.cc	2014-12-28 15:16:30 +0000
@@ -78,7 +78,6 @@
 #include "ui_basic/messagebox.h"
 #include "ui_basic/progresswindow.h"
 #include "ui_fsmenu/campaign_select.h"
-#include "ui_fsmenu/editor.h"
 #include "ui_fsmenu/fileview.h"
 #include "ui_fsmenu/internet_lobby.h"
 #include "ui_fsmenu/intro.h"
@@ -1088,7 +1087,7 @@
 				break;
 			}
 			case FullscreenMenuMain::MenuTarget::kEditor:
-				mainmenu_editor();
+				EditorInteractive::run_editor(m_filename, m_script_to_run);
 				break;
 			default:
 			case FullscreenMenuMain::MenuTarget::kExit:
@@ -1268,42 +1267,6 @@
 	}
 }
 
-void WLApplication::mainmenu_editor()
-{
-	//  This is the code returned by UI::Panel::run() when the panel is dying.
-	//  Make sure that the program exits when the window manager says so.
-	static_assert
-		(static_cast<int32_t>(FullscreenMenuEditor::MenuTarget::kBack) == UI::Panel::dying_code,
-		 "Editor should be dying.");
-
-	for (;;) {
-		FullscreenMenuEditor editor_menu;
-		switch (static_cast<FullscreenMenuEditor::MenuTarget>(editor_menu.run())) {
-		case FullscreenMenuEditor::MenuTarget::kBack:
-			return;
-		case FullscreenMenuEditor::MenuTarget::kNewMap:
-			EditorInteractive::run_editor(m_filename, m_script_to_run);
-			return;
-		case FullscreenMenuEditor::MenuTarget::kLoadMap: {
-			std::string filename;
-			{
-				SinglePlayerGameSettingsProvider sp;
-				FullscreenMenuMapSelect emsm(&sp, nullptr, true);
-				if (emsm.run() <= 0)
-					break;
-
-				filename = emsm.get_map()->filename;
-			}
-			EditorInteractive::run_editor(filename.c_str(), "");
-			return;
-		}
-		default:
-			assert(false);
-			break;
-		}
-	}
-}
-
 /**
  * Handle the "New game" menu option: Configure a single player game and
  * run it.


Follow ups