435 first = false; |
436 first = false; |
436 } |
437 } |
437 lines++; |
438 lines++; |
438 } |
439 } |
439 |
440 |
440 if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) lines += 2; |
441 if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) { |
441 |
442 lines += 2; |
442 for (byte j = 5; j <= 7; j++) { |
443 } else { |
443 if (j != 5) w->widget[j].top += lines * 10; |
444 /* Remove the resizing option from the widgets. Do it before the Hiding since it will be overwritten */ |
444 w->widget[j].bottom += lines * 10; |
445 for (byte j = IVW_INFO; j <= IVW_RESIZE_WIDGET; j++) { |
445 } |
446 w->widget[j].display_flags = RESIZE_NONE; |
446 w->height += lines * 10; |
447 } |
|
448 /* Hide the resize button and enlarge the spacer so it will take its place */ |
|
449 w->HideWidget(IVW_RESIZE_WIDGET); |
|
450 w->widget[IVW_SPACER].right = w->widget[IVW_RESIZE_WIDGET].right; |
|
451 } |
|
452 |
|
453 lines *= 10; |
|
454 |
|
455 /* Resize the widgets for the new size, given by the addition of cargos */ |
|
456 for (byte j = IVW_INFO; j <= IVW_RESIZE_WIDGET; j++) { |
|
457 if (j != IVW_INFO) w->widget[j].top += lines; |
|
458 w->widget[j].bottom += lines; |
|
459 } |
|
460 w->height += lines; |
|
461 w->resize.height += lines; |
447 } break; |
462 } break; |
448 |
463 |
449 case WE_PAINT: { |
464 case WE_PAINT: { |
450 Industry *i = GetIndustry(w->window_number); |
465 Industry *i = GetIndustry(w->window_number); |
451 const IndustrySpec *ind = GetIndustrySpec(i->type); |
466 const IndustrySpec *ind = GetIndustrySpec(i->type); |
513 if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) { |
528 if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) { |
514 uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->xy); |
529 uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->xy); |
515 if (callback_res != CALLBACK_FAILED) { |
530 if (callback_res != CALLBACK_FAILED) { |
516 StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res); |
531 StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res); |
517 if (message != STR_NULL && message != STR_UNDEFINED) { |
532 if (message != STR_NULL && message != STR_UNDEFINED) { |
|
533 const Widget *wi = &w->widget[IVW_INFO]; |
518 y += 10; |
534 y += 10; |
519 |
535 |
520 PrepareTextRefStackUsage(6); |
536 PrepareTextRefStackUsage(6); |
521 DrawString(2, y, message, TC_FROMSTRING); |
537 /* Use all the available space left from where we stand up to the end of the window */ |
|
538 DrawStringMultiLine(2, y, message, wi->right - wi->left - 4, wi->bottom - y); |
522 StopTextRefStackUsage(); |
539 StopTextRefStackUsage(); |
523 } |
540 } |
524 } |
541 } |
525 } |
542 } |
526 |
543 |
605 { WWT_CLOSEBOX, RESIZE_NONE, 9, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // IVW_CLOSEBOX |
622 { WWT_CLOSEBOX, RESIZE_NONE, 9, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // IVW_CLOSEBOX |
606 { WWT_CAPTION, RESIZE_NONE, 9, 11, 247, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS}, // IVW_CAPTION |
623 { WWT_CAPTION, RESIZE_NONE, 9, 11, 247, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS}, // IVW_CAPTION |
607 { WWT_STICKYBOX, RESIZE_NONE, 9, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, // IVW_STICKY |
624 { WWT_STICKYBOX, RESIZE_NONE, 9, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, // IVW_STICKY |
608 { WWT_PANEL, RESIZE_NONE, 9, 0, 259, 14, 105, 0x0, STR_NULL}, // IVW_BACKGROUND |
625 { WWT_PANEL, RESIZE_NONE, 9, 0, 259, 14, 105, 0x0, STR_NULL}, // IVW_BACKGROUND |
609 { WWT_INSET, RESIZE_NONE, 9, 2, 257, 16, 103, 0x0, STR_NULL}, // IVW_VIEWPORT |
626 { WWT_INSET, RESIZE_NONE, 9, 2, 257, 16, 103, 0x0, STR_NULL}, // IVW_VIEWPORT |
610 { WWT_PANEL, RESIZE_NONE, 9, 0, 259, 106, 147, 0x0, STR_NULL}, // IVW_INFO |
627 { WWT_PANEL, RESIZE_BOTTOM, 9, 0, 259, 106, 147, 0x0, STR_NULL}, // IVW_INFO |
611 { WWT_PUSHTXTBTN, RESIZE_NONE, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON}, // IVW_GOTO |
628 { WWT_PUSHTXTBTN, RESIZE_TB, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON}, // IVW_GOTO |
612 { WWT_PANEL, RESIZE_NONE, 9, 130, 259, 148, 159, 0x0, STR_NULL}, // IVW_SPACER |
629 { WWT_PANEL, RESIZE_TB, 9, 130, 247, 148, 159, 0x0, STR_NULL}, // IVW_SPACER |
|
630 { WWT_RESIZEBOX, RESIZE_TB, 9, 248, 259, 148, 159, 0x0, STR_RESIZE_BUTTON}, // IVW_RESIZE_WIDGET |
613 { WIDGETS_END}, |
631 { WIDGETS_END}, |
614 }; |
632 }; |
615 |
633 |
616 /** Window definition of the view industy gui */ |
634 /** Window definition of the view industy gui */ |
617 static const WindowDesc _industry_view_desc = { |
635 static const WindowDesc _industry_view_desc = { |
618 WDP_AUTO, WDP_AUTO, 260, 160, 260, 160, |
636 WDP_AUTO, WDP_AUTO, 260, 160, 260, 160, |
619 WC_INDUSTRY_VIEW, WC_NONE, |
637 WC_INDUSTRY_VIEW, WC_NONE, |
620 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
638 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
621 _industry_view_widgets, |
639 _industry_view_widgets, |
622 IndustryViewWndProc |
640 IndustryViewWndProc |
623 }; |
641 }; |
624 |
642 |
625 void ShowIndustryViewWindow(int industry) |
643 void ShowIndustryViewWindow(int industry) |