Changeset - r23324:11315ee6c365
[Not reviewed]
master
0 5 0
Joan Josep - 6 years ago 2019-02-16 23:15:58
juanjo.ng.83@gmail.com
Add: News menu entry and shortcut for deleting all messages. (#7240)
5 files changed with 19 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -463,12 +463,13 @@ STR_LANDSCAPING_MENU_PLACE_SIGN         
 
STR_TOOLBAR_SOUND_MUSIC                                         :Sound/music
 
############ range ends here
 

	
 
############ range for message menu starts
 
STR_NEWS_MENU_LAST_MESSAGE_NEWS_REPORT                          :Last message/news report
 
STR_NEWS_MENU_MESSAGE_HISTORY_MENU                              :Message history
 
STR_NEWS_MENU_DELETE_ALL_MESSAGES                               :Delete all messages
 
############ range ends here
 

	
 
############ range for about menu starts
 
STR_ABOUT_MENU_LAND_BLOCK_INFO                                  :Land area information
 
STR_ABOUT_MENU_SEPARATOR                                        :
 
STR_ABOUT_MENU_TOGGLE_CONSOLE                                   :Toggle console
src/main_gui.cpp
Show inline comments
 
@@ -217,12 +217,13 @@ enum {
 
	GHK_DIRTY_BLOCKS,
 
	GHK_CENTER,
 
	GHK_CENTER_ZOOM,
 
	GHK_RESET_OBJECT_TO_PLACE,
 
	GHK_DELETE_WINDOWS,
 
	GHK_DELETE_NONVITAL_WINDOWS,
 
	GHK_DELETE_ALL_MESSAGES,
 
	GHK_REFRESH_SCREEN,
 
	GHK_CRASH,
 
	GHK_MONEY,
 
	GHK_UPDATE_COORDS,
 
	GHK_TOGGLE_TRANSPARENCY,
 
	GHK_TOGGLE_INVISIBILITY = GHK_TOGGLE_TRANSPARENCY + 9,
 
@@ -342,12 +343,13 @@ struct MainWindow : Window
 
				break;
 
			}
 

	
 
			case GHK_RESET_OBJECT_TO_PLACE: ResetObjectToPlace(); break;
 
			case GHK_DELETE_WINDOWS: DeleteNonVitalWindows(); break;
 
			case GHK_DELETE_NONVITAL_WINDOWS: DeleteAllNonVitalWindows(); break;
 
			case GHK_DELETE_ALL_MESSAGES: DeleteAllMessages(); break;
 
			case GHK_REFRESH_SCREEN: MarkWholeScreenDirty(); break;
 

	
 
			case GHK_CRASH: // Crash the game
 
				*(volatile byte *)0 = 0;
 
				break;
 

	
 
@@ -485,12 +487,13 @@ static Hotkey global_hotkeys[] = {
 
	Hotkey('I' | WKC_CTRL, "dirty_blocks", GHK_DIRTY_BLOCKS),
 
	Hotkey('C', "center", GHK_CENTER),
 
	Hotkey('Z', "center_zoom", GHK_CENTER_ZOOM),
 
	Hotkey(WKC_ESC, "reset_object_to_place", GHK_RESET_OBJECT_TO_PLACE),
 
	Hotkey(WKC_DELETE, "delete_windows", GHK_DELETE_WINDOWS),
 
	Hotkey(WKC_DELETE | WKC_SHIFT, "delete_all_windows", GHK_DELETE_NONVITAL_WINDOWS),
 
	Hotkey(WKC_DELETE | WKC_CTRL, "delete_all_messages", GHK_DELETE_ALL_MESSAGES),
 
	Hotkey('R' | WKC_CTRL, "refresh_screen", GHK_REFRESH_SCREEN),
 
#if defined(_DEBUG)
 
	Hotkey('0' | WKC_ALT, "crash_game", GHK_CRASH),
 
	Hotkey('1' | WKC_ALT, "money", GHK_MONEY),
 
	Hotkey('2' | WKC_ALT, "update_coordinates", GHK_UPDATE_COORDS),
 
#endif
src/toolbar_gui.cpp
Show inline comments
 
@@ -1020,13 +1020,13 @@ static CallBackFunction MenuClickMusicWi
 
}
 

	
 
/* --- Newspaper button menu --- */
 

	
 
static CallBackFunction ToolbarNewspaperClick(Window *w)
 
{
 
	PopupMainToolbMenu(w, WID_TN_MESSAGES, STR_NEWS_MENU_LAST_MESSAGE_NEWS_REPORT, 2);
 
	PopupMainToolbMenu(w, WID_TN_MESSAGES, STR_NEWS_MENU_LAST_MESSAGE_NEWS_REPORT, 3);
 
	return CBF_NONE;
 
}
 

	
 
/**
 
 * Handle click on the entry in the Newspaper menu.
 
 *
 
@@ -1035,12 +1035,13 @@ static CallBackFunction ToolbarNewspaper
 
 */
 
static CallBackFunction MenuClickNewspaper(int index)
 
{
 
	switch (index) {
 
		case 0: ShowLastNewsMessage(); break;
 
		case 1: ShowMessageHistory();  break;
 
		case 2: DeleteAllMessages();   break;
 
	}
 
	return CBF_NONE;
 
}
 

	
 
/* --- Help button menu --- */
 

	
src/window.cpp
Show inline comments
 
@@ -36,12 +36,13 @@
 
#include "error.h"
 
#include "game/game.hpp"
 
#include "video/video_driver.hpp"
 
#include "framerate_type.h"
 
#include "network/network_func.h"
 
#include "guitimer_func.h"
 
#include "news_func.h"
 

	
 
#include "safeguards.h"
 

	
 
/** Values for _settings_client.gui.auto_scrolling */
 
enum ViewportAutoscrolling {
 
	VA_DISABLED,                  //!< Do not autoscroll when mouse is at edge of viewport.
 
@@ -3368,12 +3369,23 @@ restart_search:
 
			goto restart_search;
 
		}
 
	}
 
}
 

	
 
/**
 
 * Delete all messages and their corresponding window (if any).
 
 */
 
void DeleteAllMessages()
 
{
 
	InitNewsItemStructs();
 
	InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED); // invalidate the statusbar
 
	InvalidateWindowData(WC_MESSAGE_HISTORY, 0); // invalidate the message history
 
	DeleteWindowById(WC_NEWS_WINDOW, 0); // close newspaper or general message window if shown
 
}
 

	
 
/**
 
 * Delete all windows that are used for construction of vehicle etc.
 
 * Once done with that invalidate the others to ensure they get refreshed too.
 
 */
 
void DeleteConstructionWindows()
 
{
 
	Window *w;
src/window_func.h
Show inline comments
 
@@ -37,12 +37,13 @@ void InputLoop();
 

	
 
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data = 0, bool gui_scope = false);
 
void InvalidateWindowClassesData(WindowClass cls, int data = 0, bool gui_scope = false);
 

	
 
void DeleteNonVitalWindows();
 
void DeleteAllNonVitalWindows();
 
void DeleteAllMessages();
 
void DeleteConstructionWindows();
 
void HideVitalWindows();
 
void ShowVitalWindows();
 

	
 
void ReInitAllWindows();
 

	
0 comments (0 inline, 0 general)