Fix checkboxes in toolbar menu items

This commit is contained in:
dP
2020-05-19 20:08:42 +03:00
parent 9fc36d5db0
commit f9699294a9
5 changed files with 9 additions and 43 deletions

View File

@@ -74,14 +74,17 @@ This is usable for any OpenTTD servers
== CHANGELOG ==
*** next
*** 1.10.2 ( 2020) ***
- Add new minimap mode showing industries, height and farms at the same time.
- Rename "CB town border" zone to "CB cargo acceptance", switch it to a new colored highlight and fix for new CB mode.
- Rename "New CB borders" zone to "CB town limit" and switch it to a new colored highlight. Remove old "CB borders" zone.
- In CB modes added CB town limit to outer town zones highlight (red border).
- Show engine id in build window in newgrf developer mode.
- Fixed automatic funding and advertisement wasting money.
- Fixed crash on selecting tram station build tool.
- Fixed zoning hotkeys.
- Fixed tooltip width on empty stations.
- Fixed checkboxes in toolbar menu items.
*** 1.10.1 (15 Apr 2020) ***
- Add a setting to autoopen vehicle window when cloning vehicles while sharing orders.

View File

@@ -2,12 +2,12 @@
#include "stdafx.h"
#include <sstream>
#include "widgets/dropdown_type.h" //fillrect
#include "core/geometry_func.hpp" //maxdim
#include "settings_type.h"
#include "settings_func.h" //saveconfig
#include "3rdparty/md5/md5.h" //pass crypt
#include "network/network_func.h" //network chat
#include "strings_func.h"
#include "textbuf_gui.h" //show query
#include "network/network.h" //networking
#include "network/core/tcp_http.h" //http connector
@@ -15,6 +15,9 @@
#include "fileio_func.h" //personal dir
#include "error.h" //error message
#include "debug.h"
#include "window_func.h"
#include "window_gui.h"
#include "citymania/base64.h"

View File

@@ -83,4 +83,4 @@ const byte _openttd_revision_tagged = 1;
const uint32 _openttd_newgrf_version = 1 << 28 | 10 << 24 | 0 << 20 | 1 << 19 | 28004;
const char _citymania_version[] = "20200519-master-m7b15d2a938 19.05.20";
const char _citymania_version[] = "20200519-master-m9fc36d5db0 19.05.20";

View File

@@ -89,7 +89,6 @@ enum CallBackFunction {
static CallBackFunction _last_started_action = CBF_NONE; ///< Last started user action.
#if 0 // CM
/**
* Drop down list entry for showing a checked/unchecked toggle item.
*/
@@ -117,7 +116,6 @@ public:
DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : this->checkmark_width), right - WD_FRAMERECT_RIGHT - (rtl ? this->checkmark_width : 0), top, this->String(), sel ? TC_WHITE : TC_BLACK);
}
};
#endif
/**
* Drop down list entry for showing a company entry, with companies 'blob'.

View File

@@ -14,11 +14,6 @@
#include "../gfx_func.h"
#include "../core/smallvec_type.hpp"
#include "table/strings.h"
#include "../stdafx.h"
#include "../window_gui.h"
#include "../string_func.h"
#include "../strings_func.h"
#include "../window_func.h"
/**
* Base list item class from which others are derived. If placed in a list it
@@ -55,39 +50,6 @@ public:
static bool NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second);
};
/**
* Drop down list entry for showing a checked/unchecked toggle item. Use
* DropDownListCheckedItem or DropDownListCharStringCheckedItem depending of
* type of string used (either StringID or const char*).
*/
template <class T, typename S>
class DropDownListCheckedItemT : public T {
uint checkmark_width;
public:
bool checked;
DropDownListCheckedItemT<T,S>(S string, int result, bool masked, bool checked) : T(string, result, masked), checked(checked)
{
this->checkmark_width = GetStringBoundingBox(STR_JUST_CHECKMARK).width + 3;
}
virtual ~DropDownListCheckedItemT<T,S>() {}
virtual uint Width() const
{
return T::Width() + this->checkmark_width;
}
virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
{
bool rtl = _current_text_dir == TD_RTL;
if (this->checked) {
DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, STR_JUST_CHECKMARK, sel ? TC_WHITE : TC_BLACK);
}
DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : this->checkmark_width), right - WD_FRAMERECT_RIGHT - (rtl ? this->checkmark_width : 0), top, this->String(), sel ? TC_WHITE : TC_BLACK);
}
};
#define DropDownListCheckedItem DropDownListCheckedItemT<DropDownListStringItem,StringID>
#define DropDownListCharStringCheckedItem DropDownListCheckedItemT<DropDownListCharStringItem,const char*>
/**
* String list item with parameters.
*/