Skip to content

Commit

Permalink
CHANGE: No rezooming in viewport; FIX: Text overflow in message box a…
Browse files Browse the repository at this point in the history
…nd some other UI issues

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@3069 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Knightly committed Feb 2, 2010
1 parent 424c7d8 commit 20d71bf
Show file tree
Hide file tree
Showing 40 changed files with 676 additions and 308 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ SOURCES += gui/components/gui_scrollpane.cc
SOURCES += gui/components/gui_speedbar.cc
SOURCES += gui/components/gui_tab_panel.cc
SOURCES += gui/components/gui_textarea.cc
SOURCES += gui/components/gui_fixedwidth_textarea.cc
SOURCES += gui/components/gui_textinput.cc
SOURCES += gui/components/gui_world_view_t.cc
SOURCES += gui/convoi_detail_t.cc
Expand Down
60 changes: 30 additions & 30 deletions boden/grund.cc
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ PLAYER_COLOR_VAL grund_t::text_farbe() const

void grund_t::display_boden(const sint16 xpos, const sint16 ypos) const
{
const bool dirty=get_flag(grund_t::dirty);
const sint16 rasterweite=get_tile_raster_width();
const bool dirty = get_flag(grund_t::dirty);
const sint16 raster_width = get_current_tile_raster_width();

// here: we are either ground(kartenboden) or visible
const bool visible = !ist_karten_boden() || is_karten_boden_visible();
Expand All @@ -804,14 +804,14 @@ void grund_t::display_boden(const sint16 xpos, const sint16 ypos) const
if(back_bild_nr!=0) {
if(abs(back_bild_nr)>121) {
// fence before a drop
const sint16 offset = visible && corner4(get_grund_hang()) ? -tile_raster_scale_y( TILE_HEIGHT_STEP/Z_TILE_STEP, get_tile_raster_width()) : 0;
const sint16 offset = visible && corner4(get_grund_hang()) ? -tile_raster_scale_y( TILE_HEIGHT_STEP/Z_TILE_STEP, raster_width) : 0;
if(back_bild_nr<0) {
// behind a building
display_img(grund_besch_t::fences->get_bild(-back_bild_nr-122+3), xpos, ypos+offset, dirty);
display_normal(grund_besch_t::fences->get_bild(-back_bild_nr-122+3), xpos, ypos+offset, 0, true, dirty);
}
else {
// on a normal tile
display_img(grund_besch_t::fences->get_bild(back_bild_nr-122), xpos, ypos+offset, dirty);
display_normal(grund_besch_t::fences->get_bild(back_bild_nr-122), xpos, ypos+offset, 0, true, dirty);
}
}
else {
Expand All @@ -820,13 +820,13 @@ void grund_t::display_boden(const sint16 xpos, const sint16 ypos) const
const sint8 back_bild1 = abs(back_bild_nr)%11;
if(back_bild_nr<0) {
// for a foundation
display_img(grund_besch_t::fundament->get_bild(back_bild1), xpos, ypos, dirty);
display_img(grund_besch_t::fundament->get_bild(back_bild2), xpos, ypos, dirty);
display_normal(grund_besch_t::fundament->get_bild(back_bild1), xpos, ypos, 0, true, dirty);
display_normal(grund_besch_t::fundament->get_bild(back_bild2), xpos, ypos, 0, true, dirty);
}
else {
// natural
display_img(grund_besch_t::slopes->get_bild(back_bild1), xpos, ypos, dirty);
display_img(grund_besch_t::slopes->get_bild(back_bild2), xpos, ypos, dirty);
display_normal(grund_besch_t::slopes->get_bild(back_bild1), xpos, ypos, 0, true, dirty);
display_normal(grund_besch_t::slopes->get_bild(back_bild2), xpos, ypos, 0, true, dirty);
}
}
}
Expand All @@ -836,49 +836,49 @@ void grund_t::display_boden(const sint16 xpos, const sint16 ypos) const
if(bild==IMG_LEER) {
// only check for forced redraw (of marked ... )
if(dirty) {
mark_rect_dirty_wc( xpos, ypos+rasterweite/2, xpos+rasterweite-1, ypos+rasterweite-1 );
mark_rect_dirty_wc( xpos, ypos+raster_width/2, xpos+raster_width-1, ypos+raster_width-1 );
}
}
else {
if(get_typ()!=wasser) {
// show image if tile is visible
if (visible) {
display_img(get_bild(), xpos, ypos, dirty);
display_normal(get_bild(), xpos, ypos, 0, true, dirty);
// we show additionally a grid
// for undergroundmode = ugm_all the grid is plotted in display_dinge
if(show_grid){
const uint8 hang = get_grund_hang();
const uint8 back_hang = (hang&1) + ((hang>>1)&6);
display_img(grund_besch_t::borders->get_bild(back_hang), xpos, ypos, dirty);
display_normal(grund_besch_t::borders->get_bild(back_hang), xpos, ypos, 0, true, dirty);
}
}
}
else {
// take animation into account
display_img(get_bild()+wasser_t::stage, xpos, ypos, dirty|wasser_t::change_stage);
display_normal(get_bild()+wasser_t::stage, xpos, ypos, 0, true, dirty|wasser_t::change_stage);
}
}

// display ways
if(visible){
if( flags&has_way1 ) {
sint16 ynpos = ypos-tile_raster_scale_y( get_weg_yoff(), rasterweite );
sint16 ynpos = ypos-tile_raster_scale_y( get_weg_yoff(), raster_width );
ding_t* d = obj_bei(0);
display_color_img( d->get_bild(), xpos, ynpos, d->get_player_nr(), true, dirty|d->get_flag(ding_t::dirty) );
display_color( d->get_bild(), xpos, ynpos, d->get_player_nr(), true, dirty|d->get_flag(ding_t::dirty) );
PLAYER_COLOR_VAL pc = d->get_outline_colour();
if(pc) {
display_img_blend( d->get_bild(), xpos, ynpos, pc, true, dirty|d->get_flag(ding_t::dirty) );
display_blend( d->get_bild(), xpos, ynpos, d->get_player_nr(), pc, true, dirty|d->get_flag(ding_t::dirty) );
}
d->clear_flag( ding_t::dirty );
}

if( flags&has_way2 ){
sint16 ynpos = ypos-tile_raster_scale_y( get_weg_yoff(), rasterweite );
sint16 ynpos = ypos-tile_raster_scale_y( get_weg_yoff(), raster_width );
ding_t* d = obj_bei(1);
display_color_img( d->get_bild(), xpos, ynpos, d->get_player_nr(), true, dirty|d->get_flag(ding_t::dirty) );
display_color( d->get_bild(), xpos, ynpos, d->get_player_nr(), true, dirty|d->get_flag(ding_t::dirty) );
PLAYER_COLOR_VAL pc = d->get_outline_colour();
if(pc) {
display_img_blend( d->get_bild(), xpos, ynpos, pc, true, dirty|d->get_flag(ding_t::dirty) );
display_blend( d->get_bild(), xpos, ynpos, d->get_player_nr(), pc, true, dirty|d->get_flag(ding_t::dirty) );
}
d->clear_flag( ding_t::dirty );
}
Expand All @@ -887,7 +887,7 @@ void grund_t::display_boden(const sint16 xpos, const sint16 ypos) const



void grund_t::display_dinge(const sint16 xpos, sint16 ypos, const bool is_global) const
void grund_t::display_dinge(const sint16 xpos, const sint16 ypos, const bool is_global) const
{
const bool dirty = get_flag(grund_t::dirty);
const uint8 start_offset=offsets[flags/has_way1];
Expand All @@ -899,31 +899,31 @@ void grund_t::display_dinge(const sint16 xpos, sint16 ypos, const bool is_global
if(is_global && get_flag(grund_t::marked)) {
const uint8 hang = get_grund_hang();
const uint8 back_hang = (hang&1) + ((hang>>1)&6)+8;
display_img(grund_besch_t::marker->get_bild(back_hang), xpos, ypos, dirty);
display_normal(grund_besch_t::marker->get_bild(back_hang), xpos, ypos, 0, true, dirty);
dinge.display_dinge( xpos, ypos, start_offset, is_global );
display_img(grund_besch_t::marker->get_bild(get_grund_hang()&7), xpos, ypos, dirty);
display_normal(grund_besch_t::marker->get_bild(get_grund_hang()&7), xpos, ypos, 0, true, dirty);
//display_img(grund_besch_t::marker->get_bild(get_weg_hang()&7), xpos, ypos, dirty);

if (!ist_karten_boden()) {
const grund_t *gr = welt->lookup_kartenboden(pos.get_2d());
const sint16 raster_tile_width = get_tile_raster_width();
const sint16 raster_tile_width = get_current_tile_raster_width();
if (pos.z > gr->get_hoehe()) {
//display front part of marker for grunds in between
for(sint8 z = pos.z-Z_TILE_STEP; z>gr->get_hoehe(); z-=Z_TILE_STEP) {
display_img(grund_besch_t::marker->get_bild(0), xpos, ypos - tile_raster_scale_y( (z-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), true);
display_normal(grund_besch_t::marker->get_bild(0), xpos, ypos - tile_raster_scale_y( (z-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), 0, true, true);
}
//display front part of marker for ground
display_img(grund_besch_t::marker->get_bild(gr->get_grund_hang()&7), xpos, ypos - tile_raster_scale_y( (gr->get_hoehe()-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), true);
display_normal(grund_besch_t::marker->get_bild(gr->get_grund_hang()&7), xpos, ypos - tile_raster_scale_y( (gr->get_hoehe()-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), 0, true, true);
}
else if (pos.z < gr->get_disp_height()) {
//display back part of marker for grunds in between
for(sint8 z = pos.z+Z_TILE_STEP; z<gr->get_disp_height(); z+=Z_TILE_STEP) {
display_img(grund_besch_t::borders->get_bild(0), xpos, ypos - tile_raster_scale_y( (z-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), true);
display_normal(grund_besch_t::borders->get_bild(0), xpos, ypos - tile_raster_scale_y( (z-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), 0, true, true);
}
//display back part of marker for ground
const uint8 hang = gr->get_grund_hang() | gr->get_weg_hang();
const uint8 back_hang = (hang&1) + ((hang>>1)&6);
display_img(grund_besch_t::borders->get_bild(back_hang), xpos, ypos - tile_raster_scale_y( (gr->get_hoehe()-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), true);
display_normal(grund_besch_t::borders->get_bild(back_hang), xpos, ypos - tile_raster_scale_y( (gr->get_hoehe()-pos.z)*TILE_HEIGHT_STEP/Z_TILE_STEP, raster_tile_width), 0, true, true);
}
}
}
Expand All @@ -935,11 +935,11 @@ void grund_t::display_dinge(const sint16 xpos, sint16 ypos, const bool is_global
// in undergroundmode: draw ground grid
const uint8 hang = underground_mode==ugm_all ? get_grund_hang() : (hang_t::typ)hang_t::flach;
const uint8 back_hang = (hang&1) + ((hang>>1)&6);
display_img(grund_besch_t::borders->get_bild(back_hang), xpos, ypos, dirty);
display_normal(grund_besch_t::borders->get_bild(back_hang), xpos, ypos, 0, true, dirty);
// show marker for marked but invisible tiles
if(is_global && get_flag(grund_t::marked)) {
display_img(grund_besch_t::marker->get_bild(back_hang+8), xpos, ypos, dirty);
display_img(grund_besch_t::marker->get_bild(hang&7), xpos, ypos, dirty);
display_normal(grund_besch_t::marker->get_bild(back_hang+8), xpos, ypos, 0, true, dirty);
display_normal(grund_besch_t::marker->get_bild(hang&7), xpos, ypos, 0, true, dirty);
}
}

Expand Down
4 changes: 2 additions & 2 deletions boden/grund.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,12 +447,12 @@ class grund_t
* Zeichnet Bodenbild des Grundes
* @author Hj. Malthaner
*/
void display_boden(const sint16 xpos, sint16 ypos) const;
void display_boden(const sint16 xpos, const sint16 ypos) const;

/* displays everything that is on a tile;
* @param is_global set to true, if this is called during the whole screen update
*/
void display_dinge(const sint16 xpos, sint16 ypos, const bool called_from_simview) const;
void display_dinge(const sint16 xpos, const sint16 ypos, const bool is_global) const;

/* overlayer with signs, good levels and station coverage
* resets the dirty flag
Expand Down
6 changes: 3 additions & 3 deletions dings/roadsign.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,15 @@ void roadsign_t::rotate90()
void roadsign_t::display_after(int xpos, int ypos, bool ) const
{
if(after_bild!=IMG_LEER) {
const int raster_width = get_tile_raster_width();
const int raster_width = get_current_tile_raster_width();
ypos += tile_raster_scale_x(get_yoff()+after_offset, raster_width);
xpos += tile_raster_scale_x(get_xoff(), raster_width);
// draw with owner
if(get_player_nr()!=-1) {
display_color_img(after_bild, xpos, ypos, get_player_nr(), true, get_flag(ding_t::dirty) );
display_color(after_bild, xpos, ypos, get_player_nr(), true, get_flag(ding_t::dirty) );
}
else {
display_img(after_bild, xpos, ypos, get_flag(ding_t::dirty) );
display_normal(after_bild, xpos, ypos, 0, true, get_flag(ding_t::dirty) );
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions gui/baum_edit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void baum_edit_frame_t::change_item_info(sint32 entry)
besch = baumlist[entry];

buf.append(translator::translate(besch->get_name()));
buf.append("\n");
buf.append("\n\n");

// climates
buf.append( translator::translate("allowed climates:\n") );
Expand All @@ -122,6 +122,7 @@ void baum_edit_frame_t::change_item_info(sint32 entry)
else {
for(uint16 i=0; i<=arctic_climate; i++ ) {
if(cl & (1<<i)) {
buf.append(" - ");
buf.append( translator::translate( grund_besch_t::get_climate_name_from_bit( (enum climate)i ) ) );
buf.append("\n");
}
Expand All @@ -138,7 +139,7 @@ void baum_edit_frame_t::change_item_info(sint32 entry)
}

info_text.recalc_size();
cont.set_groesse( info_text.get_groesse() );
cont.set_groesse( info_text.get_groesse() + koord(0, 20) );

img[3].set_image( besch->get_bild_nr( 0, 3 ) );

Expand Down
4 changes: 2 additions & 2 deletions gui/citybuilding_edit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void citybuilding_edit_frame_t::change_item_info(sint32 entry)
buf.append("\n\n");
buf.append( translator::translate( besch->get_name() ) );

buf.printf("\n%s: %i\n",translator::translate("Passagierrate"),besch->get_level());
buf.printf("\n\n%s: %i\n",translator::translate("Passagierrate"),besch->get_level());
buf.printf("%s: %i\n",translator::translate("Postrate"),besch->get_post_level());

buf.append(translator::translate("\nBauzeit von"));
Expand All @@ -255,7 +255,7 @@ void citybuilding_edit_frame_t::change_item_info(sint32 entry)
}

info_text.recalc_size();
cont.set_groesse( info_text.get_groesse() );
cont.set_groesse( info_text.get_groesse() + koord(0, 20) );

// orientation (255=random)
if(besch->get_all_layouts()>1) {
Expand Down
Loading

0 comments on commit 20d71bf

Please sign in to comment.