1
0
Fork 0

(svn r12952) -Cleanup: Indenting and codestyle

release/0.7
peter1138 2008-05-05 11:24:58 +00:00
parent cdd22af5a1
commit 57e104f97e
1 changed files with 45 additions and 36 deletions

View File

@ -131,7 +131,8 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
case WE_CREATE: { // If chatbar is open at creation time, we need to go above it case WE_CREATE: { // If chatbar is open at creation time, we need to go above it
const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0); const Window *w1 = FindWindowById(WC_SEND_NETWORK_MSG, 0);
w->message.msg = (w1 != NULL) ? w1->height : 0; w->message.msg = (w1 != NULL) ? w1->height : 0;
} break; break;
}
case WE_PAINT: { case WE_PAINT: {
const NewsItem *ni = WP(w, news_d).ni; const NewsItem *ni = WP(w, news_d).ni;
@ -186,28 +187,33 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
} }
break; break;
} }
} break; break;
}
case WE_CLICK: { case WE_CLICK:
switch (e->we.click.widget) { switch (e->we.click.widget) {
case 1: { case 1: {
NewsItem *ni = WP(w, news_d).ni; NewsItem *ni = WP(w, news_d).ni;
DeleteWindow(w); DeleteWindow(w);
ni->duration = 0; ni->duration = 0;
_forced_news = INVALID_NEWS; _forced_news = INVALID_NEWS;
} break; break;
}
case 0: { case 0: {
NewsItem *ni = WP(w, news_d).ni; NewsItem *ni = WP(w, news_d).ni;
if (ni->flags & NF_VEHICLE) { if (ni->flags & NF_VEHICLE) {
Vehicle *v = GetVehicle(ni->data_a); Vehicle *v = GetVehicle(ni->data_a);
ScrollMainWindowTo(v->x_pos, v->y_pos); ScrollMainWindowTo(v->x_pos, v->y_pos);
} else if (ni->flags & NF_TILE) { } else if (ni->flags & NF_TILE) {
if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0) if (!ScrollMainWindowToTile(ni->data_a) && ni->data_b != 0) {
ScrollMainWindowToTile(ni->data_b); ScrollMainWindowToTile(ni->data_b);
} }
} break;
} }
} break; break;
}
}
break;
case WE_KEYPRESS: case WE_KEYPRESS:
if (e->we.keypress.keycode == WKC_SPACE) { if (e->we.keypress.keycode == WKC_SPACE) {
@ -225,18 +231,19 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
break; break;
case WE_TICK: { // Scroll up newsmessages from the bottom in steps of 4 pixels case WE_TICK: { // Scroll up newsmessages from the bottom in steps of 4 pixels
int diff;
int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg); int y = max(w->top - 4, _screen.height - w->height - 12 - w->message.msg);
if (y == w->top) return; if (y == w->top) return;
if (w->viewport != NULL) if (w->viewport != NULL) {
w->viewport->top += y - w->top; w->viewport->top += y - w->top;
}
diff = Delta(w->top, y); int diff = Delta(w->top, y);
w->top = y; w->top = y;
SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height); SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
} break; break;
}
} }
} }
@ -698,7 +705,8 @@ void ShowMessageHistory()
DeleteWindowById(WC_MESSAGE_HISTORY, 0); DeleteWindowById(WC_MESSAGE_HISTORY, 0);
Window *w = AllocateWindowDesc(&_message_history_desc); Window *w = AllocateWindowDesc(&_message_history_desc);
if (w != NULL) { if (w == NULL) return;
w->vscroll.cap = 10; w->vscroll.cap = 10;
w->vscroll.count = _total_news; w->vscroll.count = _total_news;
w->resize.step_height = 12; w->resize.step_height = 12;
@ -707,7 +715,6 @@ void ShowMessageHistory()
w->resize.width = 200; // can't make window any smaller than 200 pixel w->resize.width = 200; // can't make window any smaller than 200 pixel
SetWindowDirty(w); SetWindowDirty(w);
} }
}
/** News settings window widget offset constants */ /** News settings window widget offset constants */
@ -757,9 +764,10 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
} }
/* If all values are the same value, the ALL-button will take over this value */ /* If all values are the same value, the ALL-button will take over this value */
WP(w, def_d).data_1 = all_val; WP(w, def_d).data_1 = all_val;
} break; break;
}
case WE_PAINT: { case WE_PAINT:
if (_news_ticker_sound) w->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER); if (_news_ticker_sound) w->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER);
w->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = message_opt[WP(w, def_d).data_1]; w->widget[WIDGET_NEWSOPT_DROP_SUMMARY].data = message_opt[WP(w, def_d).data_1];
@ -771,7 +779,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
* which will give centered position */ * which will give centered position */
DrawStringCentered(51, y + 1, message_opt[_news_type_data[i].display], TC_BLACK); DrawStringCentered(51, y + 1, message_opt[_news_type_data[i].display], TC_BLACK);
} }
} break; break;
case WE_CLICK: case WE_CLICK:
switch (e->we.click.widget) { switch (e->we.click.widget) {
@ -795,7 +803,8 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
_news_type_data[element].display = (NewsDisplay)val; _news_type_data[element].display = (NewsDisplay)val;
SetWindowDirty(w); SetWindowDirty(w);
} }
} break; break;
}
} }
break; break;