45
45
if( msg_type==-1 ) {
46
46
// case : no message filtering
47
47
message_list = &(msg->get_list());
48
set_groesse( koord(600, min(2000, last_count) * BUTTON_HEIGHT + 1) );
51
51
// case : filter messages belonging to the specified type
73
73
message_selected = -1;
74
74
if( ev->button_state>0 && ev->cx>=2 && ev->cx<=12 ) {
75
message_selected = ev->cy/BUTTON_HEIGHT;
75
message_selected = ev->cy/(LINESPACE+1);
78
78
if( IS_LEFTRELEASE(ev) ) {
79
sint32 line = ev->cy/BUTTON_HEIGHT;
79
sint32 line = ev->cy/(LINESPACE+1);
80
80
if( (uint32)line<message_list->get_count() ) {
81
81
message_t::node &n = *(message_list->at(line));
82
82
if( ev->cx>=2 && ev->cx<=12 && welt->ist_in_kartengrenzen(n.pos) ) {
98
98
else if( IS_RIGHTRELEASE(ev) ) {
100
sint32 line = ev->cy/BUTTON_HEIGHT;
100
sint32 line = ev->cy/(LINESPACE+1);
101
101
if( (uint32)line<message_list->get_count() ) {
102
102
message_t::node &n = *(message_list->at(line));
103
103
if( welt->ist_in_kartengrenzen(n.pos) ) {
112
void message_stats_t::recalc_size()
117
// loop copied from ::zeichnen(), trimmed to minimum for x_size calculation
119
for( slist_tpl<message_t::node *>::const_iterator iter=message_list->begin(), end=message_list->end(); iter!=end; ++iter, y_size+=(LINESPACE+1) ) {
120
const message_t::node &n = *(*iter);
124
switch (umgebung_t::show_month) {
125
case umgebung_t::DATE_FMT_GERMAN:
126
case umgebung_t::DATE_FMT_GERMAN_NO_SEASON:
127
sprintf(time, "(%d.%d)", (n.time%12)+1, n.time/12 );
130
case umgebung_t::DATE_FMT_MONTH:
131
case umgebung_t::DATE_FMT_US:
132
case umgebung_t::DATE_FMT_US_NO_SEASON:
133
sprintf(time, "(%d/%d)", (n.time%12)+1, n.time/12 );
136
case umgebung_t::DATE_FMT_JAPANESE:
137
case umgebung_t::DATE_FMT_JAPANESE_NO_SEASON:
138
sprintf(time, "(%d/%d)", n.time/12, (n.time%12)+1 );
146
left += proportional_string_width(time)+8;
150
for( int j=0; j<256; ++j ) {
151
buf[j] = (n.msg[j]=='\n')?' ':n.msg[j];
157
left += proportional_string_width(buf);
163
set_groesse(koord(x_size+4,y_size));
113
168
* Now draw the list
121
176
if( message_type==-1 ) {
122
177
// no message filtering -> only update last count and component size
123
178
last_count = new_count;
124
set_groesse( koord(600, min(2000, last_count) * BUTTON_HEIGHT + 1) );
127
182
// incrementally add new entries to filtered message list before recalculating component size, and update last count
136
191
// insert new messages to old messages
137
while( temp_list.get_count()>0 ) {
192
while (!temp_list.empty()) {
138
193
filtered_messages.insert( temp_list.remove_first() );
140
195
last_count = new_count;
141
set_groesse( koord(600, min(2000, filtered_messages.get_count()) * BUTTON_HEIGHT + 1) );
145
200
struct clip_dimension cd = display_get_clip_wh();
146
sint16 y = offset.y+1;
201
sint16 y = offset.y+2;
148
for( slist_tpl<message_t::node *>::const_iterator iter=message_list->begin(), end=message_list->end(); iter!=end; ++iter, y+=BUTTON_HEIGHT ) {
203
// changes to loop affecting x_size must be copied to ::recalc_size()
204
for( slist_tpl<message_t::node *>::const_iterator iter=message_list->begin(), end=message_list->end(); iter!=end; ++iter, y+=(LINESPACE+1) ) {
159
215
// goto information
160
216
if( n.pos!=koord::invalid ) {
162
display_color_img( message_selected!=((y-offset.y)/BUTTON_HEIGHT) ? button_t::arrow_right_normal : button_t::arrow_right_pushed, offset.x + 4, y, 0, false, true);
218
display_color_img( message_selected!=((y-offset.y)/(LINESPACE+1)) ? button_t::arrow_right_normal : button_t::arrow_right_pushed, offset.x + 2, y, 0, false, true);
165
221
// correct for player color